From d69600fde3fa3fbfcbbb3a516362c0158eba882a Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Sat, 28 Oct 2023 16:49:34 -0700 Subject: [PATCH 1/2] deps: node-gyp@10.0.0 --- DEPENDENCIES.md | 10 + node_modules/.gitignore | 61 +- node_modules/@gar/promisify/LICENSE.md | 10 + node_modules/@gar/promisify/index.js | 36 + node_modules/@gar/promisify/package.json | 32 + node_modules/@npmcli/move-file/LICENSE.md | 22 + node_modules/@npmcli/move-file/lib/index.js | 185 + node_modules/@npmcli/move-file/package.json | 47 + .../node_modules/@npmcli/fs}/LICENSE.md | 0 .../@npmcli/fs/lib/common/get-options.js | 20 + .../@npmcli/fs/lib/common/node.js | 9 + .../@npmcli/fs/lib/common/owner-sync.js | 96 + .../@npmcli/fs/lib/common/owner.js | 96 + .../node_modules/@npmcli/fs/lib/copy-file.js | 16 + .../node_modules/@npmcli/fs/lib/cp/LICENSE | 15 + .../node_modules/@npmcli/fs/lib/cp/index.js | 22 + .../@npmcli/fs/lib/cp/polyfill.js | 428 + .../node_modules/@npmcli/fs/lib/errors.js | 129 + .../node_modules/@npmcli/fs/lib/fs.js | 14 + .../node_modules/@npmcli/fs/lib/index.js | 12 + .../node_modules/@npmcli/fs/lib/mkdir.js | 19 + .../node_modules/@npmcli/fs/lib/mkdtemp.js | 23 + .../node_modules/@npmcli/fs/lib/rm/index.js | 22 + .../@npmcli/fs/lib/rm/polyfill.js | 239 + .../@npmcli/fs/lib/with-owner-sync.js | 21 + .../node_modules/@npmcli/fs/lib/with-owner.js | 21 + .../@npmcli/fs/lib/with-temp-dir.js | 41 + .../node_modules/@npmcli/fs/lib/write-file.js | 14 + .../node_modules/@npmcli/fs/package.json | 50 + .../run-script}/node_modules/abbrev/LICENSE | 0 .../run-script}/node_modules/abbrev/abbrev.js | 0 .../node_modules/abbrev/package.json | 0 .../node_modules/are-we-there-yet/LICENSE.md | 0 .../are-we-there-yet/lib/index.js | 0 .../are-we-there-yet/lib/tracker-base.js | 0 .../are-we-there-yet/lib/tracker-group.js | 0 .../are-we-there-yet/lib/tracker-stream.js | 0 .../are-we-there-yet/lib/tracker.js | 0 .../are-we-there-yet/package.json | 0 .../node_modules/brace-expansion/LICENSE | 0 .../node_modules/brace-expansion/index.js | 0 .../node_modules/brace-expansion/package.json | 0 .../node_modules/cacache/LICENSE.md | 0 .../node_modules/cacache/lib/content/path.js | 0 .../node_modules/cacache/lib/content/read.js | 77 +- .../node_modules/cacache/lib/content/rm.js | 6 +- .../node_modules/cacache/lib/content/write.js | 64 +- .../node_modules/cacache/lib/entry-index.js | 124 +- .../node_modules/cacache/lib/get.js | 57 +- .../node_modules/cacache/lib/index.js | 3 + .../node_modules/cacache/lib/memoization.js | 0 .../node_modules/cacache/lib/put.js | 0 .../node_modules/cacache/lib/rm.js | 10 +- .../cacache/lib/util/fix-owner.js | 145 + .../cacache/lib/util/hash-to-segments.js | 0 .../cacache/lib/util/move-file.js | 56 + .../node_modules/cacache/lib/util/tmp.js | 13 +- .../node_modules/cacache/lib/verify.js | 56 +- .../node_modules/brace-expansion/LICENSE | 0 .../node_modules/brace-expansion/index.js | 0 .../node_modules/brace-expansion/package.json | 0 .../cacache/node_modules/glob/LICENSE | 2 +- .../cacache/node_modules/glob/common.js | 244 + .../cacache/node_modules/glob/glob.js | 790 ++ .../cacache/node_modules/glob/package.json | 55 + .../cacache/node_modules/glob/sync.js | 486 + .../cacache/node_modules/minimatch/LICENSE | 0 .../node_modules/minimatch/lib/path.js | 4 + .../node_modules/minimatch/minimatch.js | 944 ++ .../node_modules/minimatch/package.json | 35 + .../node_modules/cacache/package.json | 40 +- .../node_modules/fs-minipass}/LICENSE | 0 .../node_modules/fs-minipass/index.js | 422 + .../node_modules/fs-minipass/package.json | 39 + .../run-script/node_modules/gauge}/LICENSE.md | 0 .../node_modules/gauge/lib/base-theme.js | 0 .../node_modules/gauge/lib/error.js | 0 .../node_modules/gauge/lib/has-color.js | 0 .../node_modules/gauge/lib/index.js | 0 .../node_modules/gauge/lib/plumbing.js | 0 .../node_modules/gauge/lib/process.js | 0 .../node_modules/gauge/lib/progress-bar.js | 0 .../node_modules/gauge/lib/render-template.js | 0 .../node_modules/gauge/lib/set-immediate.js | 0 .../node_modules/gauge/lib/set-interval.js | 0 .../node_modules/gauge/lib/spin.js | 0 .../node_modules/gauge/lib/template-item.js | 0 .../node_modules/gauge/lib/theme-set.js | 0 .../node_modules/gauge/lib/themes.js | 0 .../node_modules/gauge/lib/wide-truncate.js | 0 .../node_modules/gauge/package.json | 0 .../run-script}/node_modules/glob/LICENSE | 0 .../run-script}/node_modules/glob/common.js | 0 .../run-script}/node_modules/glob/glob.js | 0 .../node_modules/glob/package.json | 0 .../run-script}/node_modules/glob/sync.js | 0 .../node_modules/lru-cache/LICENSE | 0 .../node_modules/lru-cache/index.js | 0 .../node_modules/lru-cache/index.mjs | 0 .../node_modules/lru-cache/package.json | 0 .../node_modules/make-fetch-happen/LICENSE | 0 .../make-fetch-happen/lib/agent.js | 0 .../make-fetch-happen/lib/cache/entry.js | 27 +- .../make-fetch-happen/lib/cache/errors.js | 0 .../make-fetch-happen/lib/cache/index.js | 0 .../make-fetch-happen/lib/cache/key.js | 0 .../make-fetch-happen/lib/cache/policy.js | 0 .../node_modules/make-fetch-happen/lib/dns.js | 0 .../make-fetch-happen/lib/fetch.js | 0 .../make-fetch-happen/lib/index.js | 0 .../make-fetch-happen/lib/options.js | 2 - .../make-fetch-happen/lib/pipeline.js | 0 .../make-fetch-happen/lib/remote.js | 2 +- .../make-fetch-happen/package.json | 33 +- .../node_modules/minimatch}/LICENSE | 0 .../node_modules/minimatch/minimatch.js | 0 .../node_modules/minimatch/package.json | 0 .../node_modules/minipass-fetch/LICENSE | 28 + .../minipass-fetch/lib/abort-error.js | 17 + .../node_modules/minipass-fetch/lib/blob.js | 97 + .../node_modules/minipass-fetch/lib/body.js | 350 + .../minipass-fetch/lib/fetch-error.js | 32 + .../minipass-fetch/lib/headers.js | 267 + .../node_modules/minipass-fetch/lib/index.js | 365 + .../minipass-fetch/lib/request.js | 281 + .../minipass-fetch/lib/response.js | 90 + .../node_modules/minipass-fetch/package.json | 67 + .../run-script}/node_modules/minipass/LICENSE | 2 +- .../run-script/node_modules/minipass/index.js | 649 + .../node_modules/minipass/package.json | 34 +- .../node_modules/node-gyp/CONTRIBUTING.md | 34 + .../run-script/node_modules/node-gyp/LICENSE | 24 + .../node_modules/node-gyp/SECURITY.md | 2 + .../node_modules/node-gyp/addon.gypi | 204 + .../node_modules/node-gyp/bin/node-gyp.js | 140 + ...re-versions-of-node-cannot-be-installed.md | 0 .../docs/Force-npm-to-use-global-node-gyp.md | 0 .../node_modules}/node-gyp/docs/Home.md | 0 .../node-gyp/docs/Linking-to-OpenSSL.md | 0 .../docs/Updating-npm-bundled-node-gyp.md | 0 .../docs/binding.gyp-files-in-the-wild.md | 0 .../node_modules}/node-gyp/gyp/.flake8 | 0 .../node_modules}/node-gyp/gyp/AUTHORS | 0 .../node-gyp/gyp/CODE_OF_CONDUCT.md | 0 .../node-gyp/gyp/CONTRIBUTING.md | 0 .../node_modules/node-gyp/gyp/LICENSE | 28 + .../node-gyp/gyp/data/win/large-pdb-shim.cc | 12 + .../run-script/node_modules/node-gyp/gyp/gyp | 8 + .../node_modules/node-gyp/gyp/gyp.bat | 5 + .../node_modules/node-gyp/gyp/gyp_main.py | 45 + .../node-gyp/gyp/pylib/gyp/MSVSNew.py | 367 + .../node-gyp/gyp/pylib/gyp/MSVSProject.py | 206 + .../node-gyp/gyp/pylib/gyp/MSVSSettings.py | 1270 ++ .../gyp/pylib/gyp/MSVSSettings_test.py | 1547 +++ .../node-gyp/gyp/pylib/gyp/MSVSToolFile.py | 59 + .../node-gyp/gyp/pylib/gyp/MSVSUserFile.py | 153 + .../node-gyp/gyp/pylib/gyp/MSVSUtil.py | 271 + .../node-gyp/gyp/pylib/gyp/MSVSVersion.py | 574 + .../node-gyp/gyp/pylib/gyp/__init__.py | 690 + .../node-gyp/gyp/pylib/gyp/common.py | 661 + .../node-gyp/gyp/pylib/gyp/common_test.py | 78 + .../node-gyp/gyp/pylib/gyp/easy_xml.py | 165 + .../node-gyp/gyp/pylib/gyp/easy_xml_test.py | 109 + .../node-gyp/gyp/pylib/gyp/flock_tool.py | 55 + .../gyp/pylib/gyp/generator/__init__.py | 0 .../gyp/pylib/gyp/generator/analyzer.py | 808 ++ .../gyp/pylib/gyp/generator/android.py | 1173 ++ .../node-gyp/gyp/pylib/gyp/generator/cmake.py | 1321 ++ .../gyp/generator/compile_commands_json.py | 120 + .../gyp/generator/dump_dependency_json.py | 103 + .../gyp/pylib/gyp/generator/eclipse.py | 464 + .../node-gyp/gyp/pylib/gyp/generator/gypd.py | 89 + .../node-gyp/gyp/pylib/gyp/generator/gypsh.py | 58 + .../node-gyp/gyp/pylib/gyp/generator/make.py | 2714 ++++ .../node-gyp/gyp/pylib/gyp/generator/msvs.py | 3981 ++++++ .../gyp/pylib/gyp/generator/msvs_test.py | 44 + .../node-gyp/gyp/pylib/gyp/generator/ninja.py | 2936 +++++ .../gyp/pylib/gyp/generator/ninja_test.py | 55 + .../node-gyp/gyp/pylib/gyp/generator/xcode.py | 1394 +++ .../gyp/pylib/gyp/generator/xcode_test.py | 25 + .../node-gyp/gyp/pylib/gyp/input.py | 3130 +++++ .../node-gyp/gyp/pylib/gyp/input_test.py | 98 + .../node-gyp/gyp/pylib/gyp/mac_tool.py | 771 ++ .../node-gyp/gyp/pylib/gyp/msvs_emulation.py | 1271 ++ .../node-gyp/gyp/pylib/gyp/ninja_syntax.py | 174 + .../node-gyp/gyp/pylib/gyp/simple_copy.py | 61 + .../node-gyp/gyp/pylib/gyp/win_tool.py | 374 + .../node-gyp/gyp/pylib/gyp/xcode_emulation.py | 1939 +++ .../node-gyp/gyp/pylib/gyp/xcode_ninja.py | 302 + .../node-gyp/gyp/pylib/gyp/xcodeproj_file.py | 3197 +++++ .../node-gyp/gyp/pylib/gyp/xml_fix.py | 65 + .../node_modules/node-gyp/gyp/pyproject.toml | 41 + .../node_modules/node-gyp/gyp/test_gyp.py | 261 + .../tools/Xcode/Specifications/gyp.pbfilespec | 0 .../tools/Xcode/Specifications/gyp.xclangspec | 0 .../node-gyp/gyp/tools/emacs/gyp-tests.el | 0 .../node-gyp/gyp/tools/emacs/gyp.el | 0 .../gyp/tools/emacs/run-unit-tests.sh | 0 .../gyp/tools/emacs/testdata/media.gyp | 0 .../tools/emacs/testdata/media.gyp.fontified | 0 .../node-gyp/gyp/tools/graphviz.py | 0 .../node-gyp/gyp/tools/pretty_gyp.py | 0 .../node-gyp/gyp/tools/pretty_sln.py | 0 .../node-gyp/gyp/tools/pretty_vcproj.py | 0 .../node-gyp/lib/Find-VisualStudio.cs | 250 + .../node_modules/node-gyp/lib/build.js | 213 + .../node_modules/node-gyp/lib/clean.js | 15 + .../node_modules/node-gyp/lib/configure.js | 360 + .../node-gyp/lib/create-config-gypi.js | 147 + .../node-gyp/lib/find-node-directory.js | 63 + .../node_modules/node-gyp/lib/find-python.js | 344 + .../node-gyp/lib/find-visualstudio.js | 463 + .../node_modules/node-gyp/lib/install.js | 458 + .../node_modules/node-gyp/lib/list.js | 27 + .../node_modules/node-gyp/lib/node-gyp.js | 215 + .../node-gyp/lib/process-release.js | 147 + .../node_modules/node-gyp/lib/rebuild.js | 13 + .../node_modules/node-gyp/lib/remove.js | 46 + .../node_modules/node-gyp/lib/util.js | 64 + .../node_modules}/node-gyp/macOS_Catalina.md | 0 .../node-gyp/macOS_Catalina_acid_test.sh | 21 + .../node-gyp/node_modules/which/LICENSE | 0 .../node_modules/which/bin/node-which | 0 .../node-gyp/node_modules/which/package.json | 0 .../node-gyp/node_modules/which/which.js | 0 .../node_modules/node-gyp/package.json | 51 + .../node-gyp/src/win_delay_load_hook.cc | 39 + .../node_modules}/node-gyp/test/common.js | 0 .../fixtures/VS_2017_BuildTools_minimal.txt | 0 .../fixtures/VS_2017_Community_workload.txt | 0 .../test/fixtures/VS_2017_Express.txt | 0 .../test/fixtures/VS_2017_Unusable.txt | 0 .../fixtures/VS_2019_BuildTools_minimal.txt | 0 .../fixtures/VS_2019_Community_workload.txt | 0 .../test/fixtures/VS_2019_Preview.txt | 0 .../fixtures/VS_2022_Community_workload.txt | 0 .../node-gyp/test/fixtures/certs.js | 91 +- .../fixtures/nodedir/include/node/config.gypi | 0 .../node-gyp/test/fixtures/test-charmap.py | 0 .../node-gyp/test/process-exec-sync.js | 0 .../node_modules}/node-gyp/test/reporter.js | 0 .../node-gyp/test/simple-proxy.js | 0 .../node_modules}/node-gyp/test/test-addon.js | 0 .../node-gyp/test/test-configure-python.js | 0 .../node-gyp/test/test-create-config-gypi.js | 0 .../node-gyp/test/test-download.js | 0 .../test/test-find-accessible-sync.js | 0 .../node-gyp/test/test-find-node-directory.js | 0 .../node-gyp/test/test-find-python.js | 0 .../node-gyp/test/test-find-visualstudio.js | 0 .../node-gyp/test/test-install.js | 8 +- .../node-gyp/test/test-options.js | 0 .../node-gyp/test/test-process-release.js | 0 .../node_modules}/node-gyp/update-gyp.py | 0 .../run-script/node_modules/nopt}/LICENSE | 2 +- .../run-script}/node_modules/nopt/bin/nopt.js | 0 .../run-script}/node_modules/nopt/lib/nopt.js | 0 .../node_modules/nopt/package.json | 0 .../run-script/node_modules/npmlog/LICENSE.md | 20 + .../node_modules/npmlog/lib/log.js | 0 .../node_modules/npmlog/package.json | 0 .../readable-stream/CONTRIBUTING.md | 0 .../readable-stream/GOVERNANCE.md | 0 .../node_modules/readable-stream/LICENSE | 0 .../readable-stream/errors-browser.js | 0 .../node_modules/readable-stream/errors.js | 0 .../readable-stream/experimentalWarning.js | 0 .../readable-stream/lib/_stream_duplex.js | 0 .../lib/_stream_passthrough.js | 0 .../readable-stream/lib/_stream_readable.js | 0 .../readable-stream/lib/_stream_transform.js | 0 .../readable-stream/lib/_stream_writable.js | 0 .../lib/internal/streams/async_iterator.js | 0 .../lib/internal/streams/buffer_list.js | 0 .../lib/internal/streams/destroy.js | 0 .../lib/internal/streams/end-of-stream.js | 0 .../lib/internal/streams/from-browser.js | 0 .../lib/internal/streams/from.js | 0 .../lib/internal/streams/pipeline.js | 0 .../lib/internal/streams/state.js | 0 .../lib/internal/streams/stream-browser.js | 0 .../lib/internal/streams/stream.js | 0 .../node_modules/readable-stream/package.json | 0 .../readable-stream/readable-browser.js | 0 .../node_modules/readable-stream/readable.js | 0 .../node_modules/signal-exit/LICENSE.txt | 0 .../node_modules/signal-exit/index.js | 0 .../node_modules/signal-exit/package.json | 0 .../node_modules/signal-exit/signals.js | 0 .../run-script/node_modules/ssri/LICENSE.md | 16 + .../run-script/node_modules/ssri/lib/index.js | 524 + .../run-script/node_modules/ssri/package.json | 63 + .../node_modules/unique-filename/LICENSE | 5 + .../node_modules/unique-filename/lib/index.js | 7 + .../node_modules/unique-filename/package.json | 48 + .../node_modules/unique-slug/LICENSE | 15 + .../node_modules/unique-slug/lib/index.js | 11 + .../node_modules/unique-slug/package.json | 44 + node_modules/infer-owner/LICENSE | 15 + node_modules/infer-owner/index.js | 71 + node_modules/infer-owner/package.json | 26 + node_modules/node-gyp/CONTRIBUTING.md | 2 +- node_modules/node-gyp/bin/node-gyp.js | 56 +- .../node-gyp/gyp/pylib/gyp/MSVSNew.py | 26 +- .../node-gyp/gyp/pylib/gyp/MSVSProject.py | 2 +- .../node-gyp/gyp/pylib/gyp/MSVSSettings.py | 2 +- .../node-gyp/gyp/pylib/gyp/__init__.py | 6 +- node_modules/node-gyp/gyp/pylib/gyp/common.py | 21 +- .../node-gyp/gyp/pylib/gyp/easy_xml.py | 6 +- .../node-gyp/gyp/pylib/gyp/easy_xml_test.py | 4 + .../gyp/pylib/gyp/generator/analyzer.py | 26 +- .../gyp/pylib/gyp/generator/android.py | 2 +- .../node-gyp/gyp/pylib/gyp/generator/cmake.py | 9 +- .../gyp/generator/compile_commands_json.py | 9 +- .../gyp/pylib/gyp/generator/eclipse.py | 5 +- .../node-gyp/gyp/pylib/gyp/generator/make.py | 16 +- .../node-gyp/gyp/pylib/gyp/generator/msvs.py | 78 +- .../node-gyp/gyp/pylib/gyp/generator/ninja.py | 7 +- .../node-gyp/gyp/pylib/gyp/generator/xcode.py | 7 +- node_modules/node-gyp/gyp/pylib/gyp/input.py | 57 +- .../node-gyp/gyp/pylib/gyp/msvs_emulation.py | 25 +- .../node-gyp/gyp/pylib/gyp/win_tool.py | 9 +- .../node-gyp/gyp/pylib/gyp/xcode_emulation.py | 12 +- .../node-gyp/gyp/pylib/gyp/xcodeproj_file.py | 41 +- .../node-gyp/gyp/pylib/packaging/LICENSE | 3 + .../gyp/pylib/packaging/LICENSE.APACHE | 177 + .../node-gyp/gyp/pylib/packaging/LICENSE.BSD | 23 + .../node-gyp/gyp/pylib/packaging/__init__.py | 15 + .../node-gyp/gyp/pylib/packaging/_elffile.py | 108 + .../gyp/pylib/packaging/_manylinux.py | 252 + .../gyp/pylib/packaging/_musllinux.py | 83 + .../node-gyp/gyp/pylib/packaging/_parser.py | 359 + .../gyp/pylib/packaging/_structures.py | 61 + .../gyp/pylib/packaging/_tokenizer.py | 192 + .../node-gyp/gyp/pylib/packaging/markers.py | 252 + .../node-gyp/gyp/pylib/packaging/metadata.py | 825 ++ .../node-gyp/gyp/pylib/packaging/py.typed | 0 .../gyp/pylib/packaging/requirements.py | 90 + .../gyp/pylib/packaging/specifiers.py | 1030 ++ .../node-gyp/gyp/pylib/packaging/tags.py | 553 + .../node-gyp/gyp/pylib/packaging/utils.py | 172 + .../node-gyp/gyp/pylib/packaging/version.py | 563 + node_modules/node-gyp/gyp/pyproject.toml | 88 +- node_modules/node-gyp/lib/build.js | 189 +- node_modules/node-gyp/lib/clean.js | 10 +- node_modules/node-gyp/lib/configure.js | 333 +- .../node-gyp/lib/create-config-gypi.js | 25 +- node_modules/node-gyp/lib/download.js | 39 + .../node-gyp/lib/find-node-directory.js | 10 +- node_modules/node-gyp/lib/find-python.js | 290 +- .../node-gyp/lib/find-visualstudio.js | 222 +- node_modules/node-gyp/lib/install.js | 97 +- node_modules/node-gyp/lib/list.js | 29 +- node_modules/node-gyp/lib/log.js | 169 + node_modules/node-gyp/lib/node-gyp.js | 321 +- node_modules/node-gyp/lib/process-release.js | 45 +- node_modules/node-gyp/lib/rebuild.js | 3 +- node_modules/node-gyp/lib/remove.js | 39 +- node_modules/node-gyp/lib/util.js | 107 +- .../node_modules/cacache/lib/util/glob.js | 7 - .../node_modules/glob/dist/cjs/package.json | 4 - .../node_modules/glob/dist/cjs/src/bin.js | 270 - .../node_modules/glob/dist/cjs/src/glob.js | 238 - .../glob/dist/cjs/src/has-magic.js | 27 - .../node_modules/glob/dist/cjs/src/ignore.js | 103 - .../node_modules/glob/dist/cjs/src/index.js | 68 - .../node_modules/glob/dist/cjs/src/pattern.js | 219 - .../glob/dist/cjs/src/processor.js | 309 - .../node_modules/glob/dist/cjs/src/walker.js | 358 - .../node_modules/glob/dist/mjs/glob.js | 234 - .../node_modules/glob/dist/mjs/has-magic.js | 23 - .../node_modules/glob/dist/mjs/ignore.js | 99 - .../node_modules/glob/dist/mjs/index.js | 56 - .../node_modules/glob/dist/mjs/package.json | 4 - .../node_modules/glob/dist/mjs/pattern.js | 215 - .../node_modules/glob/dist/mjs/processor.js | 302 - .../node_modules/glob/dist/mjs/walker.js | 352 - .../cacache/node_modules/glob/package.json | 98 - .../dist/cjs/assert-valid-pattern.js | 14 - .../node_modules/minimatch/dist/cjs/ast.js | 589 - .../minimatch/dist/cjs/brace-expressions.js | 152 - .../node_modules/minimatch/dist/cjs/escape.js | 22 - .../node_modules/minimatch/dist/cjs/index.js | 1011 -- .../minimatch/dist/cjs/package.json | 3 - .../minimatch/dist/cjs/unescape.js | 24 - .../dist/mjs/assert-valid-pattern.js | 10 - .../node_modules/minimatch/dist/mjs/ast.js | 585 - .../minimatch/dist/mjs/brace-expressions.js | 148 - .../node_modules/minimatch/dist/mjs/escape.js | 18 - .../node_modules/minimatch/dist/mjs/index.js | 995 -- .../minimatch/dist/mjs/package.json | 3 - .../minimatch/dist/mjs/unescape.js | 20 - .../node_modules/minimatch/package.json | 86 - .../minipass/dist/commonjs/index.js | 1028 -- .../minipass/dist/commonjs/package.json | 1 - .../node_modules/minipass/dist/esm/index.js | 1018 -- .../minipass/dist/esm/package.json | 1 - .../node_modules/minipass/package.json | 82 - .../node-gyp/node_modules/minipass/index.js | 702 -- .../node-gyp/node_modules/minipass/index.mjs | 702 -- node_modules/node-gyp/package.json | 22 +- package-lock.json | 10441 +++++++++------- package.json | 2 +- 403 files changed, 56690 insertions(+), 16480 deletions(-) create mode 100644 node_modules/@gar/promisify/LICENSE.md create mode 100644 node_modules/@gar/promisify/index.js create mode 100644 node_modules/@gar/promisify/package.json create mode 100644 node_modules/@npmcli/move-file/LICENSE.md create mode 100644 node_modules/@npmcli/move-file/lib/index.js create mode 100644 node_modules/@npmcli/move-file/package.json rename node_modules/{node-gyp/node_modules/gauge => @npmcli/run-script/node_modules/@npmcli/fs}/LICENSE.md (100%) create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/get-options.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/node.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner-sync.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/copy-file.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/LICENSE create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/index.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/polyfill.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/errors.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/fs.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/index.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdir.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdtemp.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/index.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/polyfill.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner-sync.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-temp-dir.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/write-file.js create mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/package.json rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/abbrev/LICENSE (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/abbrev/abbrev.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/abbrev/package.json (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/are-we-there-yet/LICENSE.md (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/are-we-there-yet/lib/index.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/are-we-there-yet/lib/tracker-base.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/are-we-there-yet/lib/tracker-group.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/are-we-there-yet/lib/tracker-stream.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/are-we-there-yet/lib/tracker.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/are-we-there-yet/package.json (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/brace-expansion/LICENSE (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/brace-expansion/index.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/brace-expansion/package.json (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/LICENSE.md (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/content/path.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/content/read.js (70%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/content/rm.js (73%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/content/write.js (76%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/entry-index.js (74%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/get.js (77%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/index.js (89%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/memoization.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/put.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/rm.js (63%) create mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/util/fix-owner.js rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/util/hash-to-segments.js (100%) create mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/util/move-file.js rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/util/tmp.js (69%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/lib/verify.js (84%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/node_modules/brace-expansion/LICENSE (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/node_modules/brace-expansion/index.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/node_modules/brace-expansion/package.json (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/node_modules/glob/LICENSE (92%) create mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/common.js create mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/glob.js create mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/package.json create mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/sync.js rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/node_modules/minimatch/LICENSE (100%) create mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/lib/path.js create mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/minimatch.js create mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/package.json rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/cacache/package.json (70%) rename node_modules/{node-gyp/node_modules/minimatch => @npmcli/run-script/node_modules/fs-minipass}/LICENSE (100%) create mode 100644 node_modules/@npmcli/run-script/node_modules/fs-minipass/index.js create mode 100644 node_modules/@npmcli/run-script/node_modules/fs-minipass/package.json rename node_modules/{node-gyp/node_modules/npmlog => @npmcli/run-script/node_modules/gauge}/LICENSE.md (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/base-theme.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/error.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/has-color.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/index.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/plumbing.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/process.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/progress-bar.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/render-template.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/set-immediate.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/set-interval.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/spin.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/template-item.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/theme-set.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/themes.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/lib/wide-truncate.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/gauge/package.json (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/glob/LICENSE (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/glob/common.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/glob/glob.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/glob/package.json (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/glob/sync.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/lru-cache/LICENSE (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/lru-cache/index.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/lru-cache/index.mjs (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/lru-cache/package.json (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/LICENSE (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/agent.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/cache/entry.js (92%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/cache/errors.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/cache/index.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/cache/key.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/cache/policy.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/dns.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/fetch.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/index.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/options.js (95%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/pipeline.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/lib/remote.js (99%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/make-fetch-happen/package.json (73%) rename node_modules/{node-gyp/node_modules/nopt => @npmcli/run-script/node_modules/minimatch}/LICENSE (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/minimatch/minimatch.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/minimatch/package.json (100%) create mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/LICENSE create mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/abort-error.js create mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/blob.js create mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/body.js create mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/fetch-error.js create mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/headers.js create mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/index.js create mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/request.js create mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/response.js create mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/package.json rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/minipass/LICENSE (91%) create mode 100644 node_modules/@npmcli/run-script/node_modules/minipass/index.js rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/minipass/package.json (57%) create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/CONTRIBUTING.md create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/LICENSE create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/SECURITY.md create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/bin/node-gyp.js rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/docs/Error-pre-versions-of-node-cannot-be-installed.md (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/docs/Force-npm-to-use-global-node-gyp.md (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/docs/Home.md (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/docs/Linking-to-OpenSSL.md (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/docs/Updating-npm-bundled-node-gyp.md (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/docs/binding.gyp-files-in-the-wild.md (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/.flake8 (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/AUTHORS (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/CODE_OF_CONDUCT.md (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/CONTRIBUTING.md (100%) create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/LICENSE create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp.bat create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/__init__.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common.py create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common_test.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input.py create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input_test.py create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pyproject.toml create mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/test_gyp.py rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/tools/Xcode/Specifications/gyp.pbfilespec (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/tools/Xcode/Specifications/gyp.xclangspec (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/tools/emacs/gyp-tests.el (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/tools/emacs/gyp.el (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/tools/emacs/run-unit-tests.sh (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/tools/emacs/testdata/media.gyp (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/tools/emacs/testdata/media.gyp.fontified (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/tools/graphviz.py (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/tools/pretty_gyp.py (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/tools/pretty_sln.py (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/gyp/tools/pretty_vcproj.py (100%) create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/Find-VisualStudio.cs create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/clean.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/configure.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/create-config-gypi.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-node-directory.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-visualstudio.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/install.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/list.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/node-gyp.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/process-release.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/rebuild.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/remove.js create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/util.js rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/macOS_Catalina.md (100%) create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina_acid_test.sh rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/node_modules/which/LICENSE (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/node_modules/which/bin/node-which (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/node_modules/which/package.json (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/node_modules/which/which.js (100%) create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/package.json create mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/src/win_delay_load_hook.cc rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/common.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/fixtures/VS_2017_BuildTools_minimal.txt (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/fixtures/VS_2017_Community_workload.txt (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/fixtures/VS_2017_Express.txt (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/fixtures/VS_2017_Unusable.txt (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/fixtures/VS_2019_BuildTools_minimal.txt (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/fixtures/VS_2019_Community_workload.txt (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/fixtures/VS_2019_Preview.txt (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/fixtures/VS_2022_Community_workload.txt (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/fixtures/certs.js (66%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/fixtures/nodedir/include/node/config.gypi (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/fixtures/test-charmap.py (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/process-exec-sync.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/reporter.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/simple-proxy.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/test-addon.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/test-configure-python.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/test-create-config-gypi.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/test-download.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/test-find-accessible-sync.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/test-find-node-directory.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/test-find-python.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/test-find-visualstudio.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/test-install.js (97%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/test-options.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/test/test-process-release.js (100%) rename node_modules/{ => @npmcli/run-script/node_modules}/node-gyp/update-gyp.py (100%) rename node_modules/{node-gyp/node_modules/cacache/node_modules/minipass => @npmcli/run-script/node_modules/nopt}/LICENSE (90%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/nopt/bin/nopt.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/nopt/lib/nopt.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/nopt/package.json (100%) create mode 100644 node_modules/@npmcli/run-script/node_modules/npmlog/LICENSE.md rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/npmlog/lib/log.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/npmlog/package.json (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/CONTRIBUTING.md (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/GOVERNANCE.md (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/LICENSE (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/errors-browser.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/errors.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/experimentalWarning.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/_stream_duplex.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/_stream_passthrough.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/_stream_readable.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/_stream_transform.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/_stream_writable.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/internal/streams/async_iterator.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/internal/streams/buffer_list.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/internal/streams/destroy.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/internal/streams/end-of-stream.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/internal/streams/from-browser.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/internal/streams/from.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/internal/streams/pipeline.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/internal/streams/state.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/internal/streams/stream-browser.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/lib/internal/streams/stream.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/package.json (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/readable-browser.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/readable-stream/readable.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/signal-exit/LICENSE.txt (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/signal-exit/index.js (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/signal-exit/package.json (100%) rename node_modules/{node-gyp => @npmcli/run-script}/node_modules/signal-exit/signals.js (100%) create mode 100644 node_modules/@npmcli/run-script/node_modules/ssri/LICENSE.md create mode 100644 node_modules/@npmcli/run-script/node_modules/ssri/lib/index.js create mode 100644 node_modules/@npmcli/run-script/node_modules/ssri/package.json create mode 100644 node_modules/@npmcli/run-script/node_modules/unique-filename/LICENSE create mode 100644 node_modules/@npmcli/run-script/node_modules/unique-filename/lib/index.js create mode 100644 node_modules/@npmcli/run-script/node_modules/unique-filename/package.json create mode 100644 node_modules/@npmcli/run-script/node_modules/unique-slug/LICENSE create mode 100644 node_modules/@npmcli/run-script/node_modules/unique-slug/lib/index.js create mode 100644 node_modules/@npmcli/run-script/node_modules/unique-slug/package.json create mode 100644 node_modules/infer-owner/LICENSE create mode 100644 node_modules/infer-owner/index.js create mode 100644 node_modules/infer-owner/package.json create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/LICENSE create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/__init__.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/_elffile.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/_parser.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/_structures.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/markers.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/metadata.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/py.typed create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/requirements.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/specifiers.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/tags.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/utils.py create mode 100644 node_modules/node-gyp/gyp/pylib/packaging/version.py create mode 100644 node_modules/node-gyp/lib/download.js create mode 100644 node_modules/node-gyp/lib/log.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/lib/util/glob.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/package.json delete mode 100755 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/bin.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/glob.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/has-magic.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/ignore.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/index.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/pattern.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/processor.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/walker.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/glob.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/has-magic.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/ignore.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/index.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/package.json delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/pattern.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/processor.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/walker.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/glob/package.json delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/assert-valid-pattern.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/ast.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/brace-expressions.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/escape.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/index.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/package.json delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/unescape.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/assert-valid-pattern.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/ast.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/brace-expressions.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/escape.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/index.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/package.json delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/unescape.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/package.json delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/commonjs/index.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/commonjs/package.json delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/esm/index.js delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/esm/package.json delete mode 100644 node_modules/node-gyp/node_modules/cacache/node_modules/minipass/package.json delete mode 100644 node_modules/node-gyp/node_modules/minipass/index.js delete mode 100644 node_modules/node-gyp/node_modules/minipass/index.mjs diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index e9cf1ef283609..12cf0408f18b8 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -274,15 +274,21 @@ graph LR; bin-links-->write-file-atomic; brace-expansion-->balanced-match; builtins-->semver; + cacache-->chownr; cacache-->fs-minipass; cacache-->glob; + cacache-->infer-owner; cacache-->lru-cache; cacache-->minipass-collect; cacache-->minipass-flush; cacache-->minipass-pipeline; cacache-->minipass; + cacache-->mkdirp; cacache-->npmcli-fs["@npmcli/fs"]; + cacache-->npmcli-move-file["@npmcli/move-file"]; cacache-->p-map; + cacache-->promise-inflight; + cacache-->rimraf; cacache-->ssri; cacache-->tar; cacache-->unique-filename; @@ -456,6 +462,7 @@ graph LR; make-fetch-happen-->https-proxy-agent; make-fetch-happen-->is-lambda; make-fetch-happen-->lru-cache; + make-fetch-happen-->minipass-collect; make-fetch-happen-->minipass-fetch; make-fetch-happen-->minipass-flush; make-fetch-happen-->minipass-pipeline; @@ -486,6 +493,7 @@ graph LR; node-gyp-->make-fetch-happen; node-gyp-->nopt; node-gyp-->npmlog; + node-gyp-->proc-log; node-gyp-->rimraf; node-gyp-->semver; node-gyp-->tar; @@ -710,6 +718,8 @@ graph LR; npmcli-mock-registry-->npmcli-template-oss["@npmcli/template-oss"]; npmcli-mock-registry-->pacote; npmcli-mock-registry-->tap; + npmcli-move-file-->mkdirp; + npmcli-move-file-->rimraf; npmcli-package-json-->glob; npmcli-package-json-->hosted-git-info; npmcli-package-json-->json-parse-even-better-errors; diff --git a/node_modules/.gitignore b/node_modules/.gitignore index 59812d3aa24b6..0f4c4534aa2be 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -6,6 +6,9 @@ !/@colors/ /@colors/* !/@colors/colors +!/@gar/ +/@gar/* +!/@gar/promisify !/@isaacs/ /@isaacs/* !/@isaacs/cliui @@ -31,12 +34,46 @@ !/@npmcli/installed-package-contents !/@npmcli/map-workspaces !/@npmcli/metavuln-calculator +!/@npmcli/move-file !/@npmcli/name-from-folder !/@npmcli/node-gyp !/@npmcli/package-json !/@npmcli/promise-spawn !/@npmcli/query !/@npmcli/run-script +!/@npmcli/run-script/node_modules/ +/@npmcli/run-script/node_modules/* +!/@npmcli/run-script/node_modules/@npmcli/ +/@npmcli/run-script/node_modules/@npmcli/* +!/@npmcli/run-script/node_modules/@npmcli/fs +!/@npmcli/run-script/node_modules/abbrev +!/@npmcli/run-script/node_modules/are-we-there-yet +!/@npmcli/run-script/node_modules/brace-expansion +!/@npmcli/run-script/node_modules/cacache +!/@npmcli/run-script/node_modules/cacache/node_modules/ +/@npmcli/run-script/node_modules/cacache/node_modules/* +!/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion +!/@npmcli/run-script/node_modules/cacache/node_modules/glob +!/@npmcli/run-script/node_modules/cacache/node_modules/minimatch +!/@npmcli/run-script/node_modules/fs-minipass +!/@npmcli/run-script/node_modules/gauge +!/@npmcli/run-script/node_modules/glob +!/@npmcli/run-script/node_modules/lru-cache +!/@npmcli/run-script/node_modules/make-fetch-happen +!/@npmcli/run-script/node_modules/minimatch +!/@npmcli/run-script/node_modules/minipass-fetch +!/@npmcli/run-script/node_modules/minipass +!/@npmcli/run-script/node_modules/node-gyp +!/@npmcli/run-script/node_modules/node-gyp/node_modules/ +/@npmcli/run-script/node_modules/node-gyp/node_modules/* +!/@npmcli/run-script/node_modules/node-gyp/node_modules/which +!/@npmcli/run-script/node_modules/nopt +!/@npmcli/run-script/node_modules/npmlog +!/@npmcli/run-script/node_modules/readable-stream +!/@npmcli/run-script/node_modules/signal-exit +!/@npmcli/run-script/node_modules/ssri +!/@npmcli/run-script/node_modules/unique-filename +!/@npmcli/run-script/node_modules/unique-slug !/@pkgjs/ /@pkgjs/* !/@pkgjs/parseargs @@ -127,6 +164,7 @@ !/ignore-walk !/imurmurhash !/indent-string +!/infer-owner !/inflight !/inherits !/ini @@ -178,29 +216,6 @@ !/mute-stream !/negotiator !/node-gyp -!/node-gyp/node_modules/ -/node-gyp/node_modules/* -!/node-gyp/node_modules/abbrev -!/node-gyp/node_modules/are-we-there-yet -!/node-gyp/node_modules/brace-expansion -!/node-gyp/node_modules/cacache -!/node-gyp/node_modules/cacache/node_modules/ -/node-gyp/node_modules/cacache/node_modules/* -!/node-gyp/node_modules/cacache/node_modules/brace-expansion -!/node-gyp/node_modules/cacache/node_modules/glob -!/node-gyp/node_modules/cacache/node_modules/minimatch -!/node-gyp/node_modules/cacache/node_modules/minipass -!/node-gyp/node_modules/gauge -!/node-gyp/node_modules/glob -!/node-gyp/node_modules/lru-cache -!/node-gyp/node_modules/make-fetch-happen -!/node-gyp/node_modules/minimatch -!/node-gyp/node_modules/minipass -!/node-gyp/node_modules/nopt -!/node-gyp/node_modules/npmlog -!/node-gyp/node_modules/readable-stream -!/node-gyp/node_modules/signal-exit -!/node-gyp/node_modules/which !/nopt !/normalize-package-data !/npm-audit-report diff --git a/node_modules/@gar/promisify/LICENSE.md b/node_modules/@gar/promisify/LICENSE.md new file mode 100644 index 0000000000000..64f773240bed1 --- /dev/null +++ b/node_modules/@gar/promisify/LICENSE.md @@ -0,0 +1,10 @@ +The MIT License (MIT) + +Copyright © 2020-2022 Michael Garvin + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/@gar/promisify/index.js b/node_modules/@gar/promisify/index.js new file mode 100644 index 0000000000000..d0be95f6fec61 --- /dev/null +++ b/node_modules/@gar/promisify/index.js @@ -0,0 +1,36 @@ +'use strict' + +const { promisify } = require('util') + +const handler = { + get: function (target, prop, receiver) { + if (typeof target[prop] !== 'function') { + return target[prop] + } + if (target[prop][promisify.custom]) { + return function () { + return Reflect.get(target, prop, receiver)[promisify.custom].apply(target, arguments) + } + } + return function () { + return new Promise((resolve, reject) => { + Reflect.get(target, prop, receiver).apply(target, [...arguments, function (err, result) { + if (err) { + return reject(err) + } + resolve(result) + }]) + }) + } + } +} + +module.exports = function (thingToPromisify) { + if (typeof thingToPromisify === 'function') { + return promisify(thingToPromisify) + } + if (typeof thingToPromisify === 'object') { + return new Proxy(thingToPromisify, handler) + } + throw new TypeError('Can only promisify functions or objects') +} diff --git a/node_modules/@gar/promisify/package.json b/node_modules/@gar/promisify/package.json new file mode 100644 index 0000000000000..d0ce69b2f7c0e --- /dev/null +++ b/node_modules/@gar/promisify/package.json @@ -0,0 +1,32 @@ +{ + "name": "@gar/promisify", + "version": "1.1.3", + "description": "Promisify an entire class or object", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/wraithgar/gar-promisify.git" + }, + "scripts": { + "lint": "standard", + "lint:fix": "standard --fix", + "test": "lab -a @hapi/code -t 100", + "posttest": "npm run lint" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promisify", + "all", + "class", + "object" + ], + "author": "Gar ", + "license": "MIT", + "devDependencies": { + "@hapi/code": "^8.0.1", + "@hapi/lab": "^24.1.0", + "standard": "^16.0.3" + } +} diff --git a/node_modules/@npmcli/move-file/LICENSE.md b/node_modules/@npmcli/move-file/LICENSE.md new file mode 100644 index 0000000000000..072bf20840acd --- /dev/null +++ b/node_modules/@npmcli/move-file/LICENSE.md @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) +Copyright (c) npm, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@npmcli/move-file/lib/index.js b/node_modules/@npmcli/move-file/lib/index.js new file mode 100644 index 0000000000000..5789bb127e096 --- /dev/null +++ b/node_modules/@npmcli/move-file/lib/index.js @@ -0,0 +1,185 @@ +const { dirname, join, resolve, relative, isAbsolute } = require('path') +const rimraf_ = require('rimraf') +const { promisify } = require('util') +const { + access: access_, + accessSync, + copyFile: copyFile_, + copyFileSync, + readdir: readdir_, + readdirSync, + rename: rename_, + renameSync, + stat: stat_, + statSync, + lstat: lstat_, + lstatSync, + symlink: symlink_, + symlinkSync, + readlink: readlink_, + readlinkSync, +} = require('fs') + +const access = promisify(access_) +const copyFile = promisify(copyFile_) +const readdir = promisify(readdir_) +const rename = promisify(rename_) +const stat = promisify(stat_) +const lstat = promisify(lstat_) +const symlink = promisify(symlink_) +const readlink = promisify(readlink_) +const rimraf = promisify(rimraf_) +const rimrafSync = rimraf_.sync + +const mkdirp = require('mkdirp') + +const pathExists = async path => { + try { + await access(path) + return true + } catch (er) { + return er.code !== 'ENOENT' + } +} + +const pathExistsSync = path => { + try { + accessSync(path) + return true + } catch (er) { + return er.code !== 'ENOENT' + } +} + +const moveFile = async (source, destination, options = {}, root = true, symlinks = []) => { + if (!source || !destination) { + throw new TypeError('`source` and `destination` file required') + } + + options = { + overwrite: true, + ...options, + } + + if (!options.overwrite && await pathExists(destination)) { + throw new Error(`The destination file exists: ${destination}`) + } + + await mkdirp(dirname(destination)) + + try { + await rename(source, destination) + } catch (error) { + if (error.code === 'EXDEV' || error.code === 'EPERM') { + const sourceStat = await lstat(source) + if (sourceStat.isDirectory()) { + const files = await readdir(source) + await Promise.all(files.map((file) => + moveFile(join(source, file), join(destination, file), options, false, symlinks) + )) + } else if (sourceStat.isSymbolicLink()) { + symlinks.push({ source, destination }) + } else { + await copyFile(source, destination) + } + } else { + throw error + } + } + + if (root) { + await Promise.all(symlinks.map(async ({ source: symSource, destination: symDestination }) => { + let target = await readlink(symSource) + // junction symlinks in windows will be absolute paths, so we need to + // make sure they point to the symlink destination + if (isAbsolute(target)) { + target = resolve(symDestination, relative(symSource, target)) + } + // try to determine what the actual file is so we can create the correct + // type of symlink in windows + let targetStat = 'file' + try { + targetStat = await stat(resolve(dirname(symSource), target)) + if (targetStat.isDirectory()) { + targetStat = 'junction' + } + } catch { + // targetStat remains 'file' + } + await symlink( + target, + symDestination, + targetStat + ) + })) + await rimraf(source) + } +} + +const moveFileSync = (source, destination, options = {}, root = true, symlinks = []) => { + if (!source || !destination) { + throw new TypeError('`source` and `destination` file required') + } + + options = { + overwrite: true, + ...options, + } + + if (!options.overwrite && pathExistsSync(destination)) { + throw new Error(`The destination file exists: ${destination}`) + } + + mkdirp.sync(dirname(destination)) + + try { + renameSync(source, destination) + } catch (error) { + if (error.code === 'EXDEV' || error.code === 'EPERM') { + const sourceStat = lstatSync(source) + if (sourceStat.isDirectory()) { + const files = readdirSync(source) + for (const file of files) { + moveFileSync(join(source, file), join(destination, file), options, false, symlinks) + } + } else if (sourceStat.isSymbolicLink()) { + symlinks.push({ source, destination }) + } else { + copyFileSync(source, destination) + } + } else { + throw error + } + } + + if (root) { + for (const { source: symSource, destination: symDestination } of symlinks) { + let target = readlinkSync(symSource) + // junction symlinks in windows will be absolute paths, so we need to + // make sure they point to the symlink destination + if (isAbsolute(target)) { + target = resolve(symDestination, relative(symSource, target)) + } + // try to determine what the actual file is so we can create the correct + // type of symlink in windows + let targetStat = 'file' + try { + targetStat = statSync(resolve(dirname(symSource), target)) + if (targetStat.isDirectory()) { + targetStat = 'junction' + } + } catch { + // targetStat remains 'file' + } + symlinkSync( + target, + symDestination, + targetStat + ) + } + rimrafSync(source) + } +} + +module.exports = moveFile +module.exports.sync = moveFileSync diff --git a/node_modules/@npmcli/move-file/package.json b/node_modules/@npmcli/move-file/package.json new file mode 100644 index 0000000000000..58793b93a9ca0 --- /dev/null +++ b/node_modules/@npmcli/move-file/package.json @@ -0,0 +1,47 @@ +{ + "name": "@npmcli/move-file", + "version": "2.0.1", + "files": [ + "bin/", + "lib/" + ], + "main": "lib/index.js", + "description": "move a file (fork of move-file)", + "dependencies": { + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2" + }, + "devDependencies": { + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.5.0", + "tap": "^16.0.1" + }, + "scripts": { + "test": "tap", + "snap": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/move-file.git" + }, + "tap": { + "check-coverage": true + }, + "license": "MIT", + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.5.0" + } +} diff --git a/node_modules/node-gyp/node_modules/gauge/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/LICENSE.md similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/LICENSE.md rename to node_modules/@npmcli/run-script/node_modules/@npmcli/fs/LICENSE.md diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/get-options.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/get-options.js new file mode 100644 index 0000000000000..cb5982f79077a --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/get-options.js @@ -0,0 +1,20 @@ +// given an input that may or may not be an object, return an object that has +// a copy of every defined property listed in 'copy'. if the input is not an +// object, assign it to the property named by 'wrap' +const getOptions = (input, { copy, wrap }) => { + const result = {} + + if (input && typeof input === 'object') { + for (const prop of copy) { + if (input[prop] !== undefined) { + result[prop] = input[prop] + } + } + } else { + result[wrap] = input + } + + return result +} + +module.exports = getOptions diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/node.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/node.js new file mode 100644 index 0000000000000..4d13bc037359d --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/node.js @@ -0,0 +1,9 @@ +const semver = require('semver') + +const satisfies = (range) => { + return semver.satisfies(process.version, range, { includePrerelease: true }) +} + +module.exports = { + satisfies, +} diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner-sync.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner-sync.js new file mode 100644 index 0000000000000..3704aa6d18e1e --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner-sync.js @@ -0,0 +1,96 @@ +const { dirname, resolve } = require('path') +const url = require('url') + +const fs = require('../fs.js') + +// given a path, find the owner of the nearest parent +const find = (path) => { + // if we have no getuid, permissions are irrelevant on this platform + if (!process.getuid) { + return {} + } + + // fs methods accept URL objects with a scheme of file: so we need to unwrap + // those into an actual path string before we can resolve it + const resolved = path != null && path.href && path.origin + ? resolve(url.fileURLToPath(path)) + : resolve(path) + + let stat + + try { + stat = fs.lstatSync(resolved) + } finally { + // if we got a stat, return its contents + if (stat) { + return { uid: stat.uid, gid: stat.gid } + } + + // try the parent directory + if (resolved !== dirname(resolved)) { + return find(dirname(resolved)) + } + + // no more parents, never got a stat, just return an empty object + return {} + } +} + +// given a path, uid, and gid update the ownership of the path if necessary +const update = (path, uid, gid) => { + // nothing to update, just exit + if (uid === undefined && gid === undefined) { + return + } + + try { + // see if the permissions are already the same, if they are we don't + // need to do anything, so return early + const stat = fs.statSync(path) + if (uid === stat.uid && gid === stat.gid) { + return + } + } catch { + // ignore errors + } + + try { + fs.chownSync(path, uid, gid) + } catch { + // ignore errors + } +} + +// accepts a `path` and the `owner` property of an options object and normalizes +// it into an object with numerical `uid` and `gid` +const validate = (path, input) => { + let uid + let gid + + if (typeof input === 'string' || typeof input === 'number') { + uid = input + gid = input + } else if (input && typeof input === 'object') { + uid = input.uid + gid = input.gid + } + + if (uid === 'inherit' || gid === 'inherit') { + const owner = find(path) + if (uid === 'inherit') { + uid = owner.uid + } + + if (gid === 'inherit') { + gid = owner.gid + } + } + + return { uid, gid } +} + +module.exports = { + find, + update, + validate, +} diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner.js new file mode 100644 index 0000000000000..9f02d41a5e4b3 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner.js @@ -0,0 +1,96 @@ +const { dirname, resolve } = require('path') +const url = require('url') + +const fs = require('../fs.js') + +// given a path, find the owner of the nearest parent +const find = async (path) => { + // if we have no getuid, permissions are irrelevant on this platform + if (!process.getuid) { + return {} + } + + // fs methods accept URL objects with a scheme of file: so we need to unwrap + // those into an actual path string before we can resolve it + const resolved = path != null && path.href && path.origin + ? resolve(url.fileURLToPath(path)) + : resolve(path) + + let stat + + try { + stat = await fs.lstat(resolved) + } finally { + // if we got a stat, return its contents + if (stat) { + return { uid: stat.uid, gid: stat.gid } + } + + // try the parent directory + if (resolved !== dirname(resolved)) { + return find(dirname(resolved)) + } + + // no more parents, never got a stat, just return an empty object + return {} + } +} + +// given a path, uid, and gid update the ownership of the path if necessary +const update = async (path, uid, gid) => { + // nothing to update, just exit + if (uid === undefined && gid === undefined) { + return + } + + try { + // see if the permissions are already the same, if they are we don't + // need to do anything, so return early + const stat = await fs.stat(path) + if (uid === stat.uid && gid === stat.gid) { + return + } + } catch { + // ignore errors + } + + try { + await fs.chown(path, uid, gid) + } catch { + // ignore errors + } +} + +// accepts a `path` and the `owner` property of an options object and normalizes +// it into an object with numerical `uid` and `gid` +const validate = async (path, input) => { + let uid + let gid + + if (typeof input === 'string' || typeof input === 'number') { + uid = input + gid = input + } else if (input && typeof input === 'object') { + uid = input.uid + gid = input.gid + } + + if (uid === 'inherit' || gid === 'inherit') { + const owner = await find(path) + if (uid === 'inherit') { + uid = owner.uid + } + + if (gid === 'inherit') { + gid = owner.gid + } + } + + return { uid, gid } +} + +module.exports = { + find, + update, + validate, +} diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/copy-file.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/copy-file.js new file mode 100644 index 0000000000000..8888266d627f0 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/copy-file.js @@ -0,0 +1,16 @@ +const fs = require('./fs.js') +const getOptions = require('./common/get-options.js') +const withOwner = require('./with-owner.js') + +const copyFile = async (src, dest, opts) => { + const options = getOptions(opts, { + copy: ['mode'], + wrap: 'mode', + }) + + // the node core method as of 16.5.0 does not support the mode being in an + // object, so we have to pass the mode value directly + return withOwner(dest, () => fs.copyFile(src, dest, options.mode), opts) +} + +module.exports = copyFile diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/LICENSE b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/LICENSE new file mode 100644 index 0000000000000..93546dfb7655b --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/LICENSE @@ -0,0 +1,15 @@ +(The MIT License) + +Copyright (c) 2011-2017 JP Richardson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files +(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/index.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/index.js new file mode 100644 index 0000000000000..5da4739bdd528 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/index.js @@ -0,0 +1,22 @@ +const fs = require('../fs.js') +const getOptions = require('../common/get-options.js') +const node = require('../common/node.js') +const polyfill = require('./polyfill.js') + +// node 16.7.0 added fs.cp +const useNative = node.satisfies('>=16.7.0') + +const cp = async (src, dest, opts) => { + const options = getOptions(opts, { + copy: ['dereference', 'errorOnExist', 'filter', 'force', 'preserveTimestamps', 'recursive'], + }) + + // the polyfill is tested separately from this module, no need to hack + // process.version to try to trigger it just for coverage + // istanbul ignore next + return useNative + ? fs.cp(src, dest, options) + : polyfill(src, dest, options) +} + +module.exports = cp diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/polyfill.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/polyfill.js new file mode 100644 index 0000000000000..f83ccbf57ecc9 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/polyfill.js @@ -0,0 +1,428 @@ +// this file is a modified version of the code in node 17.2.0 +// which is, in turn, a modified version of the fs-extra module on npm +// node core changes: +// - Use of the assert module has been replaced with core's error system. +// - All code related to the glob dependency has been removed. +// - Bring your own custom fs module is not currently supported. +// - Some basic code cleanup. +// changes here: +// - remove all callback related code +// - drop sync support +// - change assertions back to non-internal methods (see options.js) +// - throws ENOTDIR when rmdir gets an ENOENT for a path that exists in Windows +'use strict' + +const { + ERR_FS_CP_DIR_TO_NON_DIR, + ERR_FS_CP_EEXIST, + ERR_FS_CP_EINVAL, + ERR_FS_CP_FIFO_PIPE, + ERR_FS_CP_NON_DIR_TO_DIR, + ERR_FS_CP_SOCKET, + ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY, + ERR_FS_CP_UNKNOWN, + ERR_FS_EISDIR, + ERR_INVALID_ARG_TYPE, +} = require('../errors.js') +const { + constants: { + errno: { + EEXIST, + EISDIR, + EINVAL, + ENOTDIR, + }, + }, +} = require('os') +const { + chmod, + copyFile, + lstat, + mkdir, + readdir, + readlink, + stat, + symlink, + unlink, + utimes, +} = require('../fs.js') +const { + dirname, + isAbsolute, + join, + parse, + resolve, + sep, + toNamespacedPath, +} = require('path') +const { fileURLToPath } = require('url') + +const defaultOptions = { + dereference: false, + errorOnExist: false, + filter: undefined, + force: true, + preserveTimestamps: false, + recursive: false, +} + +async function cp (src, dest, opts) { + if (opts != null && typeof opts !== 'object') { + throw new ERR_INVALID_ARG_TYPE('options', ['Object'], opts) + } + return cpFn( + toNamespacedPath(getValidatedPath(src)), + toNamespacedPath(getValidatedPath(dest)), + { ...defaultOptions, ...opts }) +} + +function getValidatedPath (fileURLOrPath) { + const path = fileURLOrPath != null && fileURLOrPath.href + && fileURLOrPath.origin + ? fileURLToPath(fileURLOrPath) + : fileURLOrPath + return path +} + +async function cpFn (src, dest, opts) { + // Warn about using preserveTimestamps on 32-bit node + // istanbul ignore next + if (opts.preserveTimestamps && process.arch === 'ia32') { + const warning = 'Using the preserveTimestamps option in 32-bit ' + + 'node is not recommended' + process.emitWarning(warning, 'TimestampPrecisionWarning') + } + const stats = await checkPaths(src, dest, opts) + const { srcStat, destStat } = stats + await checkParentPaths(src, srcStat, dest) + if (opts.filter) { + return handleFilter(checkParentDir, destStat, src, dest, opts) + } + return checkParentDir(destStat, src, dest, opts) +} + +async function checkPaths (src, dest, opts) { + const { 0: srcStat, 1: destStat } = await getStats(src, dest, opts) + if (destStat) { + if (areIdentical(srcStat, destStat)) { + throw new ERR_FS_CP_EINVAL({ + message: 'src and dest cannot be the same', + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new ERR_FS_CP_DIR_TO_NON_DIR({ + message: `cannot overwrite directory ${src} ` + + `with non-directory ${dest}`, + path: dest, + syscall: 'cp', + errno: EISDIR, + }) + } + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new ERR_FS_CP_NON_DIR_TO_DIR({ + message: `cannot overwrite non-directory ${src} ` + + `with directory ${dest}`, + path: dest, + syscall: 'cp', + errno: ENOTDIR, + }) + } + } + + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new ERR_FS_CP_EINVAL({ + message: `cannot copy ${src} to a subdirectory of self ${dest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + return { srcStat, destStat } +} + +function areIdentical (srcStat, destStat) { + return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && + destStat.dev === srcStat.dev +} + +function getStats (src, dest, opts) { + const statFunc = opts.dereference ? + (file) => stat(file, { bigint: true }) : + (file) => lstat(file, { bigint: true }) + return Promise.all([ + statFunc(src), + statFunc(dest).catch((err) => { + // istanbul ignore next: unsure how to cover. + if (err.code === 'ENOENT') { + return null + } + // istanbul ignore next: unsure how to cover. + throw err + }), + ]) +} + +async function checkParentDir (destStat, src, dest, opts) { + const destParent = dirname(dest) + const dirExists = await pathExists(destParent) + if (dirExists) { + return getStatsForCopy(destStat, src, dest, opts) + } + await mkdir(destParent, { recursive: true }) + return getStatsForCopy(destStat, src, dest, opts) +} + +function pathExists (dest) { + return stat(dest).then( + () => true, + // istanbul ignore next: not sure when this would occur + (err) => (err.code === 'ENOENT' ? false : Promise.reject(err))) +} + +// Recursively check if dest parent is a subdirectory of src. +// It works for all file types including symlinks since it +// checks the src and dest inodes. It starts from the deepest +// parent and stops once it reaches the src parent or the root path. +async function checkParentPaths (src, srcStat, dest) { + const srcParent = resolve(dirname(src)) + const destParent = resolve(dirname(dest)) + if (destParent === srcParent || destParent === parse(destParent).root) { + return + } + let destStat + try { + destStat = await stat(destParent, { bigint: true }) + } catch (err) { + // istanbul ignore else: not sure when this would occur + if (err.code === 'ENOENT') { + return + } + // istanbul ignore next: not sure when this would occur + throw err + } + if (areIdentical(srcStat, destStat)) { + throw new ERR_FS_CP_EINVAL({ + message: `cannot copy ${src} to a subdirectory of self ${dest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + return checkParentPaths(src, srcStat, destParent) +} + +const normalizePathToArray = (path) => + resolve(path).split(sep).filter(Boolean) + +// Return true if dest is a subdir of src, otherwise false. +// It only checks the path strings. +function isSrcSubdir (src, dest) { + const srcArr = normalizePathToArray(src) + const destArr = normalizePathToArray(dest) + return srcArr.every((cur, i) => destArr[i] === cur) +} + +async function handleFilter (onInclude, destStat, src, dest, opts, cb) { + const include = await opts.filter(src, dest) + if (include) { + return onInclude(destStat, src, dest, opts, cb) + } +} + +function startCopy (destStat, src, dest, opts) { + if (opts.filter) { + return handleFilter(getStatsForCopy, destStat, src, dest, opts) + } + return getStatsForCopy(destStat, src, dest, opts) +} + +async function getStatsForCopy (destStat, src, dest, opts) { + const statFn = opts.dereference ? stat : lstat + const srcStat = await statFn(src) + // istanbul ignore else: can't portably test FIFO + if (srcStat.isDirectory() && opts.recursive) { + return onDir(srcStat, destStat, src, dest, opts) + } else if (srcStat.isDirectory()) { + throw new ERR_FS_EISDIR({ + message: `${src} is a directory (not copied)`, + path: src, + syscall: 'cp', + errno: EINVAL, + }) + } else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) { + return onFile(srcStat, destStat, src, dest, opts) + } else if (srcStat.isSymbolicLink()) { + return onLink(destStat, src, dest) + } else if (srcStat.isSocket()) { + throw new ERR_FS_CP_SOCKET({ + message: `cannot copy a socket file: ${dest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } else if (srcStat.isFIFO()) { + throw new ERR_FS_CP_FIFO_PIPE({ + message: `cannot copy a FIFO pipe: ${dest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + // istanbul ignore next: should be unreachable + throw new ERR_FS_CP_UNKNOWN({ + message: `cannot copy an unknown file type: ${dest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) +} + +function onFile (srcStat, destStat, src, dest, opts) { + if (!destStat) { + return _copyFile(srcStat, src, dest, opts) + } + return mayCopyFile(srcStat, src, dest, opts) +} + +async function mayCopyFile (srcStat, src, dest, opts) { + if (opts.force) { + await unlink(dest) + return _copyFile(srcStat, src, dest, opts) + } else if (opts.errorOnExist) { + throw new ERR_FS_CP_EEXIST({ + message: `${dest} already exists`, + path: dest, + syscall: 'cp', + errno: EEXIST, + }) + } +} + +async function _copyFile (srcStat, src, dest, opts) { + await copyFile(src, dest) + if (opts.preserveTimestamps) { + return handleTimestampsAndMode(srcStat.mode, src, dest) + } + return setDestMode(dest, srcStat.mode) +} + +async function handleTimestampsAndMode (srcMode, src, dest) { + // Make sure the file is writable before setting the timestamp + // otherwise open fails with EPERM when invoked with 'r+' + // (through utimes call) + if (fileIsNotWritable(srcMode)) { + await makeFileWritable(dest, srcMode) + return setDestTimestampsAndMode(srcMode, src, dest) + } + return setDestTimestampsAndMode(srcMode, src, dest) +} + +function fileIsNotWritable (srcMode) { + return (srcMode & 0o200) === 0 +} + +function makeFileWritable (dest, srcMode) { + return setDestMode(dest, srcMode | 0o200) +} + +async function setDestTimestampsAndMode (srcMode, src, dest) { + await setDestTimestamps(src, dest) + return setDestMode(dest, srcMode) +} + +function setDestMode (dest, srcMode) { + return chmod(dest, srcMode) +} + +async function setDestTimestamps (src, dest) { + // The initial srcStat.atime cannot be trusted + // because it is modified by the read(2) system call + // (See https://nodejs.org/api/fs.html#fs_stat_time_values) + const updatedSrcStat = await stat(src) + return utimes(dest, updatedSrcStat.atime, updatedSrcStat.mtime) +} + +function onDir (srcStat, destStat, src, dest, opts) { + if (!destStat) { + return mkDirAndCopy(srcStat.mode, src, dest, opts) + } + return copyDir(src, dest, opts) +} + +async function mkDirAndCopy (srcMode, src, dest, opts) { + await mkdir(dest) + await copyDir(src, dest, opts) + return setDestMode(dest, srcMode) +} + +async function copyDir (src, dest, opts) { + const dir = await readdir(src) + for (let i = 0; i < dir.length; i++) { + const item = dir[i] + const srcItem = join(src, item) + const destItem = join(dest, item) + const { destStat } = await checkPaths(srcItem, destItem, opts) + await startCopy(destStat, srcItem, destItem, opts) + } +} + +async function onLink (destStat, src, dest) { + let resolvedSrc = await readlink(src) + if (!isAbsolute(resolvedSrc)) { + resolvedSrc = resolve(dirname(src), resolvedSrc) + } + if (!destStat) { + return symlink(resolvedSrc, dest) + } + let resolvedDest + try { + resolvedDest = await readlink(dest) + } catch (err) { + // Dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + // istanbul ignore next: can only test on windows + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') { + return symlink(resolvedSrc, dest) + } + // istanbul ignore next: should not be possible + throw err + } + if (!isAbsolute(resolvedDest)) { + resolvedDest = resolve(dirname(dest), resolvedDest) + } + if (isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new ERR_FS_CP_EINVAL({ + message: `cannot copy ${resolvedSrc} to a subdirectory of self ` + + `${resolvedDest}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + // Do not copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + const srcStat = await stat(src) + if (srcStat.isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY({ + message: `cannot overwrite ${resolvedDest} with ${resolvedSrc}`, + path: dest, + syscall: 'cp', + errno: EINVAL, + }) + } + return copyLink(resolvedSrc, dest) +} + +async function copyLink (resolvedSrc, dest) { + await unlink(dest) + return symlink(resolvedSrc, dest) +} + +module.exports = cp diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/errors.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/errors.js new file mode 100644 index 0000000000000..1cd1e05d0c533 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/errors.js @@ -0,0 +1,129 @@ +'use strict' +const { inspect } = require('util') + +// adapted from node's internal/errors +// https://github.com/nodejs/node/blob/c8a04049/lib/internal/errors.js + +// close copy of node's internal SystemError class. +class SystemError { + constructor (code, prefix, context) { + // XXX context.code is undefined in all constructors used in cp/polyfill + // that may be a bug copied from node, maybe the constructor should use + // `code` not `errno`? nodejs/node#41104 + let message = `${prefix}: ${context.syscall} returned ` + + `${context.code} (${context.message})` + + if (context.path !== undefined) { + message += ` ${context.path}` + } + if (context.dest !== undefined) { + message += ` => ${context.dest}` + } + + this.code = code + Object.defineProperties(this, { + name: { + value: 'SystemError', + enumerable: false, + writable: true, + configurable: true, + }, + message: { + value: message, + enumerable: false, + writable: true, + configurable: true, + }, + info: { + value: context, + enumerable: true, + configurable: true, + writable: false, + }, + errno: { + get () { + return context.errno + }, + set (value) { + context.errno = value + }, + enumerable: true, + configurable: true, + }, + syscall: { + get () { + return context.syscall + }, + set (value) { + context.syscall = value + }, + enumerable: true, + configurable: true, + }, + }) + + if (context.path !== undefined) { + Object.defineProperty(this, 'path', { + get () { + return context.path + }, + set (value) { + context.path = value + }, + enumerable: true, + configurable: true, + }) + } + + if (context.dest !== undefined) { + Object.defineProperty(this, 'dest', { + get () { + return context.dest + }, + set (value) { + context.dest = value + }, + enumerable: true, + configurable: true, + }) + } + } + + toString () { + return `${this.name} [${this.code}]: ${this.message}` + } + + [Symbol.for('nodejs.util.inspect.custom')] (_recurseTimes, ctx) { + return inspect(this, { + ...ctx, + getters: true, + customInspect: false, + }) + } +} + +function E (code, message) { + module.exports[code] = class NodeError extends SystemError { + constructor (ctx) { + super(code, message, ctx) + } + } +} + +E('ERR_FS_CP_DIR_TO_NON_DIR', 'Cannot overwrite directory with non-directory') +E('ERR_FS_CP_EEXIST', 'Target already exists') +E('ERR_FS_CP_EINVAL', 'Invalid src or dest') +E('ERR_FS_CP_FIFO_PIPE', 'Cannot copy a FIFO pipe') +E('ERR_FS_CP_NON_DIR_TO_DIR', 'Cannot overwrite non-directory with directory') +E('ERR_FS_CP_SOCKET', 'Cannot copy a socket file') +E('ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY', 'Cannot overwrite symlink in subdirectory of self') +E('ERR_FS_CP_UNKNOWN', 'Cannot copy an unknown file type') +E('ERR_FS_EISDIR', 'Path is a directory') + +module.exports.ERR_INVALID_ARG_TYPE = class ERR_INVALID_ARG_TYPE extends Error { + constructor (name, expected, actual) { + super() + this.code = 'ERR_INVALID_ARG_TYPE' + this.message = `The ${name} argument must be ${expected}. Received ${typeof actual}` + } +} diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/fs.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/fs.js new file mode 100644 index 0000000000000..457da10eed03e --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/fs.js @@ -0,0 +1,14 @@ +const fs = require('fs') +const promisify = require('@gar/promisify') + +const isLower = (s) => s === s.toLowerCase() && s !== s.toUpperCase() + +const fsSync = Object.fromEntries(Object.entries(fs).filter(([k, v]) => + typeof v === 'function' && (k.endsWith('Sync') || !isLower(k[0])) +)) + +// this module returns the core fs async fns wrapped in a proxy that promisifies +// method calls within the getter. we keep it in a separate module so that the +// overridden methods have a consistent way to get to promisified fs methods +// without creating a circular dependency. the ctors and sync methods are kept untouched +module.exports = { ...promisify(fs), ...fsSync } diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/index.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/index.js new file mode 100644 index 0000000000000..3a98648eca9a1 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/index.js @@ -0,0 +1,12 @@ +module.exports = { + ...require('./fs.js'), + copyFile: require('./copy-file.js'), + cp: require('./cp/index.js'), + mkdir: require('./mkdir.js'), + mkdtemp: require('./mkdtemp.js'), + rm: require('./rm/index.js'), + withTempDir: require('./with-temp-dir.js'), + withOwner: require('./with-owner.js'), + withOwnerSync: require('./with-owner-sync.js'), + writeFile: require('./write-file.js'), +} diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdir.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdir.js new file mode 100644 index 0000000000000..098d8d0a09ae3 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdir.js @@ -0,0 +1,19 @@ +const fs = require('./fs.js') +const getOptions = require('./common/get-options.js') +const withOwner = require('./with-owner.js') + +// extends mkdir with the ability to specify an owner of the new dir +const mkdir = async (path, opts) => { + const options = getOptions(opts, { + copy: ['mode', 'recursive'], + wrap: 'mode', + }) + + return withOwner( + path, + () => fs.mkdir(path, options), + opts + ) +} + +module.exports = mkdir diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdtemp.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdtemp.js new file mode 100644 index 0000000000000..60b12a788de90 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdtemp.js @@ -0,0 +1,23 @@ +const { dirname, sep } = require('path') + +const fs = require('./fs.js') +const getOptions = require('./common/get-options.js') +const withOwner = require('./with-owner.js') + +const mkdtemp = async (prefix, opts) => { + const options = getOptions(opts, { + copy: ['encoding'], + wrap: 'encoding', + }) + + // mkdtemp relies on the trailing path separator to indicate if it should + // create a directory inside of the prefix. if that's the case then the root + // we infer ownership from is the prefix itself, otherwise it's the dirname + // /tmp -> /tmpABCDEF, infers from / + // /tmp/ -> /tmp/ABCDEF, infers from /tmp + const root = prefix.endsWith(sep) ? prefix : dirname(prefix) + + return withOwner(root, () => fs.mkdtemp(prefix, options), opts) +} + +module.exports = mkdtemp diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/index.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/index.js new file mode 100644 index 0000000000000..cb81fbdf8cc47 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/index.js @@ -0,0 +1,22 @@ +const fs = require('../fs.js') +const getOptions = require('../common/get-options.js') +const node = require('../common/node.js') +const polyfill = require('./polyfill.js') + +// node 14.14.0 added fs.rm, which allows both the force and recursive options +const useNative = node.satisfies('>=14.14.0') + +const rm = async (path, opts) => { + const options = getOptions(opts, { + copy: ['retryDelay', 'maxRetries', 'recursive', 'force'], + }) + + // the polyfill is tested separately from this module, no need to hack + // process.version to try to trigger it just for coverage + // istanbul ignore next + return useNative + ? fs.rm(path, options) + : polyfill(path, options) +} + +module.exports = rm diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/polyfill.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/polyfill.js new file mode 100644 index 0000000000000..a25c17483b001 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/polyfill.js @@ -0,0 +1,239 @@ +// this file is a modified version of the code in node core >=14.14.0 +// which is, in turn, a modified version of the rimraf module on npm +// node core changes: +// - Use of the assert module has been replaced with core's error system. +// - All code related to the glob dependency has been removed. +// - Bring your own custom fs module is not currently supported. +// - Some basic code cleanup. +// changes here: +// - remove all callback related code +// - drop sync support +// - change assertions back to non-internal methods (see options.js) +// - throws ENOTDIR when rmdir gets an ENOENT for a path that exists in Windows +const errnos = require('os').constants.errno +const { join } = require('path') +const fs = require('../fs.js') + +// error codes that mean we need to remove contents +const notEmptyCodes = new Set([ + 'ENOTEMPTY', + 'EEXIST', + 'EPERM', +]) + +// error codes we can retry later +const retryCodes = new Set([ + 'EBUSY', + 'EMFILE', + 'ENFILE', + 'ENOTEMPTY', + 'EPERM', +]) + +const isWindows = process.platform === 'win32' + +const defaultOptions = { + retryDelay: 100, + maxRetries: 0, + recursive: false, + force: false, +} + +// this is drastically simplified, but should be roughly equivalent to what +// node core throws +class ERR_FS_EISDIR extends Error { + constructor (path) { + super() + this.info = { + code: 'EISDIR', + message: 'is a directory', + path, + syscall: 'rm', + errno: errnos.EISDIR, + } + this.name = 'SystemError' + this.code = 'ERR_FS_EISDIR' + this.errno = errnos.EISDIR + this.syscall = 'rm' + this.path = path + this.message = `Path is a directory: ${this.syscall} returned ` + + `${this.info.code} (is a directory) ${path}` + } + + toString () { + return `${this.name} [${this.code}]: ${this.message}` + } +} + +class ENOTDIR extends Error { + constructor (path) { + super() + this.name = 'Error' + this.code = 'ENOTDIR' + this.errno = errnos.ENOTDIR + this.syscall = 'rmdir' + this.path = path + this.message = `not a directory, ${this.syscall} '${this.path}'` + } + + toString () { + return `${this.name}: ${this.code}: ${this.message}` + } +} + +// force is passed separately here because we respect it for the first entry +// into rimraf only, any further calls that are spawned as a result (i.e. to +// delete content within the target) will ignore ENOENT errors +const rimraf = async (path, options, isTop = false) => { + const force = isTop ? options.force : true + const stat = await fs.lstat(path) + .catch((err) => { + // we only ignore ENOENT if we're forcing this call + if (err.code === 'ENOENT' && force) { + return + } + + if (isWindows && err.code === 'EPERM') { + return fixEPERM(path, options, err, isTop) + } + + throw err + }) + + // no stat object here means either lstat threw an ENOENT, or lstat threw + // an EPERM and the fixPERM function took care of things. either way, we're + // already done, so return early + if (!stat) { + return + } + + if (stat.isDirectory()) { + return rmdir(path, options, null, isTop) + } + + return fs.unlink(path) + .catch((err) => { + if (err.code === 'ENOENT' && force) { + return + } + + if (err.code === 'EISDIR') { + return rmdir(path, options, err, isTop) + } + + if (err.code === 'EPERM') { + // in windows, we handle this through fixEPERM which will also try to + // delete things again. everywhere else since deleting the target as a + // file didn't work we go ahead and try to delete it as a directory + return isWindows + ? fixEPERM(path, options, err, isTop) + : rmdir(path, options, err, isTop) + } + + throw err + }) +} + +const fixEPERM = async (path, options, originalErr, isTop) => { + const force = isTop ? options.force : true + const targetMissing = await fs.chmod(path, 0o666) + .catch((err) => { + if (err.code === 'ENOENT' && force) { + return true + } + + throw originalErr + }) + + // got an ENOENT above, return now. no file = no problem + if (targetMissing) { + return + } + + // this function does its own lstat rather than calling rimraf again to avoid + // infinite recursion for a repeating EPERM + const stat = await fs.lstat(path) + .catch((err) => { + if (err.code === 'ENOENT' && force) { + return + } + + throw originalErr + }) + + if (!stat) { + return + } + + if (stat.isDirectory()) { + return rmdir(path, options, originalErr, isTop) + } + + return fs.unlink(path) +} + +const rmdir = async (path, options, originalErr, isTop) => { + if (!options.recursive && isTop) { + throw originalErr || new ERR_FS_EISDIR(path) + } + const force = isTop ? options.force : true + + return fs.rmdir(path) + .catch(async (err) => { + // in Windows, calling rmdir on a file path will fail with ENOENT rather + // than ENOTDIR. to determine if that's what happened, we have to do + // another lstat on the path. if the path isn't actually gone, we throw + // away the ENOENT and replace it with our own ENOTDIR + if (isWindows && err.code === 'ENOENT') { + const stillExists = await fs.lstat(path).then(() => true, () => false) + if (stillExists) { + err = new ENOTDIR(path) + } + } + + // not there, not a problem + if (err.code === 'ENOENT' && force) { + return + } + + // we may not have originalErr if lstat tells us our target is a + // directory but that changes before we actually remove it, so + // only throw it here if it's set + if (originalErr && err.code === 'ENOTDIR') { + throw originalErr + } + + // the directory isn't empty, remove the contents and try again + if (notEmptyCodes.has(err.code)) { + const files = await fs.readdir(path) + await Promise.all(files.map((file) => { + const target = join(path, file) + return rimraf(target, options) + })) + return fs.rmdir(path) + } + + throw err + }) +} + +const rm = async (path, opts) => { + const options = { ...defaultOptions, ...opts } + let retries = 0 + + const errHandler = async (err) => { + if (retryCodes.has(err.code) && ++retries < options.maxRetries) { + const delay = retries * options.retryDelay + await promiseTimeout(delay) + return rimraf(path, options, true).catch(errHandler) + } + + throw err + } + + return rimraf(path, options, true).catch(errHandler) +} + +const promiseTimeout = (ms) => new Promise((r) => setTimeout(r, ms)) + +module.exports = rm diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner-sync.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner-sync.js new file mode 100644 index 0000000000000..3597d1c810475 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner-sync.js @@ -0,0 +1,21 @@ +const getOptions = require('./common/get-options.js') +const owner = require('./common/owner-sync.js') + +const withOwnerSync = (path, fn, opts) => { + const options = getOptions(opts, { + copy: ['owner'], + }) + + const { uid, gid } = owner.validate(path, options.owner) + + const result = fn({ uid, gid }) + + owner.update(path, uid, gid) + if (typeof result === 'string') { + owner.update(result, uid, gid) + } + + return result +} + +module.exports = withOwnerSync diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner.js new file mode 100644 index 0000000000000..a679102883dbb --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner.js @@ -0,0 +1,21 @@ +const getOptions = require('./common/get-options.js') +const owner = require('./common/owner.js') + +const withOwner = async (path, fn, opts) => { + const options = getOptions(opts, { + copy: ['owner'], + }) + + const { uid, gid } = await owner.validate(path, options.owner) + + const result = await fn({ uid, gid }) + + await Promise.all([ + owner.update(path, uid, gid), + typeof result === 'string' ? owner.update(result, uid, gid) : null, + ]) + + return result +} + +module.exports = withOwner diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-temp-dir.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-temp-dir.js new file mode 100644 index 0000000000000..81db59dd054b4 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-temp-dir.js @@ -0,0 +1,41 @@ +const { join, sep } = require('path') + +const getOptions = require('./common/get-options.js') +const mkdir = require('./mkdir.js') +const mkdtemp = require('./mkdtemp.js') +const rm = require('./rm/index.js') + +// create a temp directory, ensure its permissions match its parent, then call +// the supplied function passing it the path to the directory. clean up after +// the function finishes, whether it throws or not +const withTempDir = async (root, fn, opts) => { + const options = getOptions(opts, { + copy: ['tmpPrefix'], + }) + // create the directory, and fix its ownership + await mkdir(root, { recursive: true, owner: 'inherit' }) + + const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || ''), { owner: 'inherit' }) + let err + let result + + try { + result = await fn(target) + } catch (_err) { + err = _err + } + + try { + await rm(target, { force: true, recursive: true }) + } catch { + // ignore errors + } + + if (err) { + throw err + } + + return result +} + +module.exports = withTempDir diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/write-file.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/write-file.js new file mode 100644 index 0000000000000..ff900571a1f28 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/write-file.js @@ -0,0 +1,14 @@ +const fs = require('./fs.js') +const getOptions = require('./common/get-options.js') +const withOwner = require('./with-owner.js') + +const writeFile = async (file, data, opts) => { + const options = getOptions(opts, { + copy: ['encoding', 'mode', 'flag', 'signal'], + wrap: 'encoding', + }) + + return withOwner(file, () => fs.writeFile(file, data, options), opts) +} + +module.exports = writeFile diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/package.json b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/package.json new file mode 100644 index 0000000000000..1512fd6e4b0ac --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/package.json @@ -0,0 +1,50 @@ +{ + "name": "@npmcli/fs", + "version": "2.1.2", + "description": "filesystem utilities for the npm cli", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "snap": "tap", + "test": "tap", + "npmclilint": "npmcli-lint", + "lint": "eslint \"**/*.js\"", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint", + "postsnap": "npm run lintfix --", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/fs.git" + }, + "keywords": [ + "npm", + "oss" + ], + "author": "GitHub Inc.", + "license": "ISC", + "devDependencies": { + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.5.0", + "tap": "^16.0.1" + }, + "dependencies": { + "@gar/promisify": "^1.1.3", + "semver": "^7.3.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.5.0" + } +} diff --git a/node_modules/node-gyp/node_modules/abbrev/LICENSE b/node_modules/@npmcli/run-script/node_modules/abbrev/LICENSE similarity index 100% rename from node_modules/node-gyp/node_modules/abbrev/LICENSE rename to node_modules/@npmcli/run-script/node_modules/abbrev/LICENSE diff --git a/node_modules/node-gyp/node_modules/abbrev/abbrev.js b/node_modules/@npmcli/run-script/node_modules/abbrev/abbrev.js similarity index 100% rename from node_modules/node-gyp/node_modules/abbrev/abbrev.js rename to node_modules/@npmcli/run-script/node_modules/abbrev/abbrev.js diff --git a/node_modules/node-gyp/node_modules/abbrev/package.json b/node_modules/@npmcli/run-script/node_modules/abbrev/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/abbrev/package.json rename to node_modules/@npmcli/run-script/node_modules/abbrev/package.json diff --git a/node_modules/node-gyp/node_modules/are-we-there-yet/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/LICENSE.md similarity index 100% rename from node_modules/node-gyp/node_modules/are-we-there-yet/LICENSE.md rename to node_modules/@npmcli/run-script/node_modules/are-we-there-yet/LICENSE.md diff --git a/node_modules/node-gyp/node_modules/are-we-there-yet/lib/index.js b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/are-we-there-yet/lib/index.js rename to node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/index.js diff --git a/node_modules/node-gyp/node_modules/are-we-there-yet/lib/tracker-base.js b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-base.js similarity index 100% rename from node_modules/node-gyp/node_modules/are-we-there-yet/lib/tracker-base.js rename to node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-base.js diff --git a/node_modules/node-gyp/node_modules/are-we-there-yet/lib/tracker-group.js b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-group.js similarity index 100% rename from node_modules/node-gyp/node_modules/are-we-there-yet/lib/tracker-group.js rename to node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-group.js diff --git a/node_modules/node-gyp/node_modules/are-we-there-yet/lib/tracker-stream.js b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-stream.js similarity index 100% rename from node_modules/node-gyp/node_modules/are-we-there-yet/lib/tracker-stream.js rename to node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-stream.js diff --git a/node_modules/node-gyp/node_modules/are-we-there-yet/lib/tracker.js b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker.js similarity index 100% rename from node_modules/node-gyp/node_modules/are-we-there-yet/lib/tracker.js rename to node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker.js diff --git a/node_modules/node-gyp/node_modules/are-we-there-yet/package.json b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/are-we-there-yet/package.json rename to node_modules/@npmcli/run-script/node_modules/are-we-there-yet/package.json diff --git a/node_modules/node-gyp/node_modules/brace-expansion/LICENSE b/node_modules/@npmcli/run-script/node_modules/brace-expansion/LICENSE similarity index 100% rename from node_modules/node-gyp/node_modules/brace-expansion/LICENSE rename to node_modules/@npmcli/run-script/node_modules/brace-expansion/LICENSE diff --git a/node_modules/node-gyp/node_modules/brace-expansion/index.js b/node_modules/@npmcli/run-script/node_modules/brace-expansion/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/brace-expansion/index.js rename to node_modules/@npmcli/run-script/node_modules/brace-expansion/index.js diff --git a/node_modules/node-gyp/node_modules/brace-expansion/package.json b/node_modules/@npmcli/run-script/node_modules/brace-expansion/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/brace-expansion/package.json rename to node_modules/@npmcli/run-script/node_modules/brace-expansion/package.json diff --git a/node_modules/node-gyp/node_modules/cacache/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/cacache/LICENSE.md similarity index 100% rename from node_modules/node-gyp/node_modules/cacache/LICENSE.md rename to node_modules/@npmcli/run-script/node_modules/cacache/LICENSE.md diff --git a/node_modules/node-gyp/node_modules/cacache/lib/content/path.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/path.js similarity index 100% rename from node_modules/node-gyp/node_modules/cacache/lib/content/path.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/content/path.js diff --git a/node_modules/node-gyp/node_modules/cacache/lib/content/read.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/read.js similarity index 70% rename from node_modules/node-gyp/node_modules/cacache/lib/content/read.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/content/read.js index f41b539df65dc..7c20c75257b4f 100644 --- a/node_modules/node-gyp/node_modules/cacache/lib/content/read.js +++ b/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/read.js @@ -1,6 +1,6 @@ 'use strict' -const fs = require('fs/promises') +const fs = require('@npmcli/fs') const fsm = require('fs-minipass') const ssri = require('ssri') const contentPath = require('./path') @@ -46,6 +46,24 @@ const readPipeline = (cpath, size, sri, stream) => { return stream } +module.exports.sync = readSync + +function readSync (cache, integrity, opts = {}) { + const { size } = opts + return withContentSriSync(cache, integrity, (cpath, sri) => { + const data = fs.readFileSync(cpath, { encoding: null }) + if (typeof size === 'number' && size !== data.length) { + throw sizeError(size, data.length) + } + + if (ssri.checkData(data, sri)) { + return data + } + + throw integrityError(sri, cpath) + }) +} + module.exports.stream = readStream module.exports.readStream = readStream @@ -70,6 +88,7 @@ function readStream (cache, integrity, opts = {}) { } module.exports.copy = copy +module.exports.copy.sync = copySync function copy (cache, integrity, dest) { return withContentSri(cache, integrity, (cpath, sri) => { @@ -77,6 +96,12 @@ function copy (cache, integrity, dest) { }) } +function copySync (cache, integrity, dest) { + return withContentSriSync(cache, integrity, (cpath, sri) => { + return fs.copyFileSync(cpath, dest) + }) +} + module.exports.hasContent = hasContent async function hasContent (cache, integrity) { @@ -105,6 +130,34 @@ async function hasContent (cache, integrity) { } } +module.exports.hasContent.sync = hasContentSync + +function hasContentSync (cache, integrity) { + if (!integrity) { + return false + } + + return withContentSriSync(cache, integrity, (cpath, sri) => { + try { + const stat = fs.statSync(cpath) + return { size: stat.size, sri, stat } + } catch (err) { + if (err.code === 'ENOENT') { + return false + } + + if (err.code === 'EPERM') { + /* istanbul ignore else */ + if (process.platform !== 'win32') { + throw err + } else { + return false + } + } + } + }) +} + async function withContentSri (cache, integrity, fn) { const sri = ssri.parse(integrity) // If `integrity` has multiple entries, pick the first digest @@ -148,6 +201,28 @@ async function withContentSri (cache, integrity, fn) { } } +function withContentSriSync (cache, integrity, fn) { + const sri = ssri.parse(integrity) + // If `integrity` has multiple entries, pick the first digest + // with available local data. + const algo = sri.pickAlgorithm() + const digests = sri[algo] + if (digests.length <= 1) { + const cpath = contentPath(cache, digests[0]) + return fn(cpath, digests[0]) + } else { + let lastErr = null + for (const meta of digests) { + try { + return withContentSriSync(cache, meta, fn) + } catch (err) { + lastErr = err + } + } + throw lastErr + } +} + function sizeError (expected, found) { /* eslint-disable-next-line max-len */ const err = new Error(`Bad data size: expected inserted data to be ${expected} bytes, but got ${found} instead`) diff --git a/node_modules/node-gyp/node_modules/cacache/lib/content/rm.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/rm.js similarity index 73% rename from node_modules/node-gyp/node_modules/cacache/lib/content/rm.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/content/rm.js index ce58d679e4cb2..f7333053b393f 100644 --- a/node_modules/node-gyp/node_modules/cacache/lib/content/rm.js +++ b/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/rm.js @@ -1,8 +1,10 @@ 'use strict' -const fs = require('fs/promises') +const util = require('util') + const contentPath = require('./path') const { hasContent } = require('./read') +const rimraf = util.promisify(require('rimraf')) module.exports = rm @@ -10,7 +12,7 @@ async function rm (cache, integrity) { const content = await hasContent(cache, integrity) // ~pretty~ sure we can't end up with a content lacking sri, but be safe if (content && content.sri) { - await fs.rm(contentPath(cache, content.sri), { recursive: true, force: true }) + await rimraf(contentPath(cache, content.sri)) return true } else { return false diff --git a/node_modules/node-gyp/node_modules/cacache/lib/content/write.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/write.js similarity index 76% rename from node_modules/node-gyp/node_modules/cacache/lib/content/write.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/content/write.js index 7146146581287..0e8c0f4936064 100644 --- a/node_modules/node-gyp/node_modules/cacache/lib/content/write.js +++ b/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/write.js @@ -1,25 +1,28 @@ 'use strict' const events = require('events') +const util = require('util') const contentPath = require('./path') -const fs = require('fs/promises') -const { moveFile } = require('@npmcli/fs') -const { Minipass } = require('minipass') +const fixOwner = require('../util/fix-owner') +const fs = require('@npmcli/fs') +const moveFile = require('../util/move-file') +const Minipass = require('minipass') const Pipeline = require('minipass-pipeline') const Flush = require('minipass-flush') const path = require('path') +const rimraf = util.promisify(require('rimraf')) const ssri = require('ssri') const uniqueFilename = require('unique-filename') const fsm = require('fs-minipass') module.exports = write -// Cache of move operations in process so we don't duplicate -const moveOperations = new Map() - async function write (cache, data, opts = {}) { const { algorithms, size, integrity } = opts + if (algorithms && algorithms.length > 1) { + throw new Error('opts.algorithms only supports a single algorithm for now') + } if (typeof size === 'number' && data.length !== size) { throw sizeError(size, data.length) @@ -30,19 +33,16 @@ async function write (cache, data, opts = {}) { throw checksumError(integrity, sri) } - for (const algo in sri) { - const tmp = await makeTmp(cache, opts) - const hash = sri[algo].toString() - try { - await fs.writeFile(tmp.target, data, { flag: 'wx' }) - await moveToDestination(tmp, cache, hash, opts) - } finally { - if (!tmp.moved) { - await fs.rm(tmp.target, { recursive: true, force: true }) - } + const tmp = await makeTmp(cache, opts) + try { + await fs.writeFile(tmp.target, data, { flag: 'wx' }) + await moveToDestination(tmp, cache, sri, opts) + return { integrity: sri, size: data.length } + } finally { + if (!tmp.moved) { + await rimraf(tmp.target) } } - return { integrity: sri, size: data.length } } module.exports.stream = writeStream @@ -111,7 +111,7 @@ async function handleContent (inputStream, cache, opts) { return res } finally { if (!tmp.moved) { - await fs.rm(tmp.target, { recursive: true, force: true }) + await rimraf(tmp.target) } } } @@ -152,7 +152,7 @@ async function pipeToTmp (inputStream, cache, tmpTarget, opts) { async function makeTmp (cache, opts) { const tmpTarget = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix) - await fs.mkdir(path.dirname(tmpTarget), { recursive: true }) + await fixOwner.mkdirfix(cache, path.dirname(tmpTarget)) return { target: tmpTarget, moved: false, @@ -162,27 +162,11 @@ async function makeTmp (cache, opts) { async function moveToDestination (tmp, cache, sri, opts) { const destination = contentPath(cache, sri) const destDir = path.dirname(destination) - if (moveOperations.has(destination)) { - return moveOperations.get(destination) - } - moveOperations.set( - destination, - fs.mkdir(destDir, { recursive: true }) - .then(async () => { - await moveFile(tmp.target, destination, { overwrite: false }) - tmp.moved = true - return tmp.moved - }) - .catch(err => { - if (!err.message.startsWith('The destination file exists')) { - throw Object.assign(err, { code: 'EEXIST' }) - } - }).finally(() => { - moveOperations.delete(destination) - }) - - ) - return moveOperations.get(destination) + + await fixOwner.mkdirfix(cache, destDir) + await moveFile(tmp.target, destination) + tmp.moved = true + await fixOwner.chownr(cache, destination) } function sizeError (expected, found) { diff --git a/node_modules/node-gyp/node_modules/cacache/lib/entry-index.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/entry-index.js similarity index 74% rename from node_modules/node-gyp/node_modules/cacache/lib/entry-index.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/entry-index.js index 722a37af5ce15..1dc73a93f6b29 100644 --- a/node_modules/node-gyp/node_modules/cacache/lib/entry-index.js +++ b/node_modules/@npmcli/run-script/node_modules/cacache/lib/entry-index.js @@ -1,23 +1,21 @@ 'use strict' +const util = require('util') const crypto = require('crypto') -const { - appendFile, - mkdir, - readFile, - readdir, - rm, - writeFile, -} = require('fs/promises') -const { Minipass } = require('minipass') +const fs = require('@npmcli/fs') +const Minipass = require('minipass') const path = require('path') const ssri = require('ssri') const uniqueFilename = require('unique-filename') const contentPath = require('./content/path') +const fixOwner = require('./util/fix-owner') const hashToSegments = require('./util/hash-to-segments') const indexV = require('../package.json')['cache-version'].index -const { moveFile } = require('@npmcli/fs') +const moveFile = require('@npmcli/move-file') +const _rimraf = require('rimraf') +const rimraf = util.promisify(_rimraf) +rimraf.sync = _rimraf.sync module.exports.NotFoundError = class NotFoundError extends Error { constructor (cache, key) { @@ -68,7 +66,7 @@ async function compact (cache, key, matchFn, opts = {}) { const setup = async () => { const target = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix) - await mkdir(path.dirname(target), { recursive: true }) + await fixOwner.mkdirfix(cache, path.dirname(target)) return { target, moved: false, @@ -77,17 +75,24 @@ async function compact (cache, key, matchFn, opts = {}) { const teardown = async (tmp) => { if (!tmp.moved) { - return rm(tmp.target, { recursive: true, force: true }) + return rimraf(tmp.target) } } const write = async (tmp) => { - await writeFile(tmp.target, newIndex, { flag: 'wx' }) - await mkdir(path.dirname(bucket), { recursive: true }) + await fs.writeFile(tmp.target, newIndex, { flag: 'wx' }) + await fixOwner.mkdirfix(cache, path.dirname(bucket)) // we use @npmcli/move-file directly here because we // want to overwrite the existing file await moveFile(tmp.target, bucket) tmp.moved = true + try { + await fixOwner.chownr(cache, bucket) + } catch (err) { + if (err.code !== 'ENOENT') { + throw err + } + } } // write the file atomically @@ -109,17 +114,17 @@ async function compact (cache, key, matchFn, opts = {}) { module.exports.insert = insert async function insert (cache, key, integrity, opts = {}) { - const { metadata, size, time } = opts + const { metadata, size } = opts const bucket = bucketPath(cache, key) const entry = { key, integrity: integrity && ssri.stringify(integrity), - time: time || Date.now(), + time: Date.now(), size, metadata, } try { - await mkdir(path.dirname(bucket), { recursive: true }) + await fixOwner.mkdirfix(cache, path.dirname(bucket)) const stringified = JSON.stringify(entry) // NOTE - Cleverness ahoy! // @@ -129,13 +134,44 @@ async function insert (cache, key, integrity, opts = {}) { // // Thanks to @isaacs for the whiteboarding session that ended up with // this. - await appendFile(bucket, `\n${hashEntry(stringified)}\t${stringified}`) + await fs.appendFile(bucket, `\n${hashEntry(stringified)}\t${stringified}`) + await fixOwner.chownr(cache, bucket) } catch (err) { if (err.code === 'ENOENT') { return undefined } throw err + // There's a class of race conditions that happen when things get deleted + // during fixOwner, or between the two mkdirfix/chownr calls. + // + // It's perfectly fine to just not bother in those cases and lie + // that the index entry was written. Because it's a cache. + } + return formatEntry(cache, entry) +} + +module.exports.insert.sync = insertSync + +function insertSync (cache, key, integrity, opts = {}) { + const { metadata, size } = opts + const bucket = bucketPath(cache, key) + const entry = { + key, + integrity: integrity && ssri.stringify(integrity), + time: Date.now(), + size, + metadata, + } + fixOwner.mkdirfix.sync(cache, path.dirname(bucket)) + const stringified = JSON.stringify(entry) + fs.appendFileSync(bucket, `\n${hashEntry(stringified)}\t${stringified}`) + try { + fixOwner.chownr.sync(cache, bucket) + } catch (err) { + if (err.code !== 'ENOENT') { + throw err + } } return formatEntry(cache, entry) } @@ -162,6 +198,27 @@ async function find (cache, key) { } } +module.exports.find.sync = findSync + +function findSync (cache, key) { + const bucket = bucketPath(cache, key) + try { + return bucketEntriesSync(bucket).reduce((latest, next) => { + if (next && next.key === key) { + return formatEntry(cache, next) + } else { + return latest + } + }, null) + } catch (err) { + if (err.code === 'ENOENT') { + return null + } else { + throw err + } + } +} + module.exports.delete = del function del (cache, key, opts = {}) { @@ -170,7 +227,18 @@ function del (cache, key, opts = {}) { } const bucket = bucketPath(cache, key) - return rm(bucket, { recursive: true, force: true }) + return rimraf(bucket) +} + +module.exports.delete.sync = delSync + +function delSync (cache, key, opts = {}) { + if (!opts.removeFully) { + return insertSync(cache, key, null, opts) + } + + const bucket = bucketPath(cache, key) + return rimraf.sync(bucket) } module.exports.lsStream = lsStream @@ -236,7 +304,14 @@ async function ls (cache) { module.exports.bucketEntries = bucketEntries async function bucketEntries (bucket, filter) { - const data = await readFile(bucket, 'utf8') + const data = await fs.readFile(bucket, 'utf8') + return _bucketEntries(data, filter) +} + +module.exports.bucketEntries.sync = bucketEntriesSync + +function bucketEntriesSync (bucket, filter) { + const data = fs.readFileSync(bucket, 'utf8') return _bucketEntries(data, filter) } @@ -256,11 +331,10 @@ function _bucketEntries (data, filter) { let obj try { obj = JSON.parse(pieces[1]) - } catch (_) { - // eslint-ignore-next-line no-empty-block + } catch (e) { + // Entry is corrupted! + return } - // coverage disabled here, no need to test with an entry that parses to something falsey - // istanbul ignore else if (obj) { entries.push(obj) } @@ -320,7 +394,7 @@ function formatEntry (cache, entry, keepAll) { } function readdirOrEmpty (dir) { - return readdir(dir).catch((err) => { + return fs.readdir(dir).catch((err) => { if (err.code === 'ENOENT' || err.code === 'ENOTDIR') { return [] } diff --git a/node_modules/node-gyp/node_modules/cacache/lib/get.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/get.js similarity index 77% rename from node_modules/node-gyp/node_modules/cacache/lib/get.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/get.js index 80ec206c7ecaa..254b4ecc38b57 100644 --- a/node_modules/node-gyp/node_modules/cacache/lib/get.js +++ b/node_modules/@npmcli/run-script/node_modules/cacache/lib/get.js @@ -1,7 +1,7 @@ 'use strict' const Collect = require('minipass-collect') -const { Minipass } = require('minipass') +const Minipass = require('minipass') const Pipeline = require('minipass-pipeline') const index = require('./entry-index') @@ -53,6 +53,61 @@ async function getDataByDigest (cache, key, opts = {}) { } module.exports.byDigest = getDataByDigest +function getDataSync (cache, key, opts = {}) { + const { integrity, memoize, size } = opts + const memoized = memo.get(cache, key, opts) + + if (memoized && memoize !== false) { + return { + metadata: memoized.entry.metadata, + data: memoized.data, + integrity: memoized.entry.integrity, + size: memoized.entry.size, + } + } + const entry = index.find.sync(cache, key, opts) + if (!entry) { + throw new index.NotFoundError(cache, key) + } + const data = read.sync(cache, entry.integrity, { + integrity: integrity, + size: size, + }) + const res = { + metadata: entry.metadata, + data: data, + size: entry.size, + integrity: entry.integrity, + } + if (memoize) { + memo.put(cache, entry, res.data, opts) + } + + return res +} + +module.exports.sync = getDataSync + +function getDataByDigestSync (cache, digest, opts = {}) { + const { integrity, memoize, size } = opts + const memoized = memo.get.byDigest(cache, digest, opts) + + if (memoized && memoize !== false) { + return memoized + } + + const res = read.sync(cache, digest, { + integrity: integrity, + size: size, + }) + if (memoize) { + memo.put.byDigest(cache, digest, res, opts) + } + + return res +} +module.exports.sync.byDigest = getDataByDigestSync + const getMemoizedStream = (memoized) => { const stream = new Minipass() stream.on('newListener', function (ev, cb) { diff --git a/node_modules/node-gyp/node_modules/cacache/lib/index.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/index.js similarity index 89% rename from node_modules/node-gyp/node_modules/cacache/lib/index.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/index.js index c9b0da5f3a271..1c56be68dd8fd 100644 --- a/node_modules/node-gyp/node_modules/cacache/lib/index.js +++ b/node_modules/@npmcli/run-script/node_modules/cacache/lib/index.js @@ -17,12 +17,15 @@ module.exports.ls.stream = index.lsStream module.exports.get = get module.exports.get.byDigest = get.byDigest +module.exports.get.sync = get.sync +module.exports.get.sync.byDigest = get.sync.byDigest module.exports.get.stream = get.stream module.exports.get.stream.byDigest = get.stream.byDigest module.exports.get.copy = get.copy module.exports.get.copy.byDigest = get.copy.byDigest module.exports.get.info = get.info module.exports.get.hasContent = get.hasContent +module.exports.get.hasContent.sync = get.hasContent.sync module.exports.put = put module.exports.put.stream = put.stream diff --git a/node_modules/node-gyp/node_modules/cacache/lib/memoization.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/memoization.js similarity index 100% rename from node_modules/node-gyp/node_modules/cacache/lib/memoization.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/memoization.js diff --git a/node_modules/node-gyp/node_modules/cacache/lib/put.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/put.js similarity index 100% rename from node_modules/node-gyp/node_modules/cacache/lib/put.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/put.js diff --git a/node_modules/node-gyp/node_modules/cacache/lib/rm.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/rm.js similarity index 63% rename from node_modules/node-gyp/node_modules/cacache/lib/rm.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/rm.js index a94760c7cf243..5f00071770b8d 100644 --- a/node_modules/node-gyp/node_modules/cacache/lib/rm.js +++ b/node_modules/@npmcli/run-script/node_modules/cacache/lib/rm.js @@ -1,10 +1,11 @@ 'use strict' -const { rm } = require('fs/promises') -const glob = require('./util/glob.js') +const util = require('util') + const index = require('./entry-index') const memo = require('./memoization') const path = require('path') +const rimraf = util.promisify(require('rimraf')) const rmContent = require('./content/rm') module.exports = entry @@ -24,8 +25,7 @@ function content (cache, integrity) { module.exports.all = all -async function all (cache) { +function all (cache) { memo.clearMemoized() - const paths = await glob(path.join(cache, '*(content-*|index-*)'), { silent: true, nosort: true }) - return Promise.all(paths.map((p) => rm(p, { recursive: true, force: true }))) + return rimraf(path.join(cache, '*(content-*|index-*)')) } diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/fix-owner.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/fix-owner.js new file mode 100644 index 0000000000000..182fcb028f06c --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/fix-owner.js @@ -0,0 +1,145 @@ +'use strict' + +const util = require('util') + +const chownr = util.promisify(require('chownr')) +const mkdirp = require('mkdirp') +const inflight = require('promise-inflight') +const inferOwner = require('infer-owner') + +// Memoize getuid()/getgid() calls. +// patch process.setuid/setgid to invalidate cached value on change +const self = { uid: null, gid: null } +const getSelf = () => { + if (typeof self.uid !== 'number') { + self.uid = process.getuid() + const setuid = process.setuid + process.setuid = (uid) => { + self.uid = null + process.setuid = setuid + return process.setuid(uid) + } + } + if (typeof self.gid !== 'number') { + self.gid = process.getgid() + const setgid = process.setgid + process.setgid = (gid) => { + self.gid = null + process.setgid = setgid + return process.setgid(gid) + } + } +} + +module.exports.chownr = fixOwner + +async function fixOwner (cache, filepath) { + if (!process.getuid) { + // This platform doesn't need ownership fixing + return + } + + getSelf() + if (self.uid !== 0) { + // almost certainly can't chown anyway + return + } + + const { uid, gid } = await inferOwner(cache) + + // No need to override if it's already what we used. + if (self.uid === uid && self.gid === gid) { + return + } + + return inflight('fixOwner: fixing ownership on ' + filepath, () => + chownr( + filepath, + typeof uid === 'number' ? uid : self.uid, + typeof gid === 'number' ? gid : self.gid + ).catch((err) => { + if (err.code === 'ENOENT') { + return null + } + + throw err + }) + ) +} + +module.exports.chownr.sync = fixOwnerSync + +function fixOwnerSync (cache, filepath) { + if (!process.getuid) { + // This platform doesn't need ownership fixing + return + } + const { uid, gid } = inferOwner.sync(cache) + getSelf() + if (self.uid !== 0) { + // almost certainly can't chown anyway + return + } + + if (self.uid === uid && self.gid === gid) { + // No need to override if it's already what we used. + return + } + try { + chownr.sync( + filepath, + typeof uid === 'number' ? uid : self.uid, + typeof gid === 'number' ? gid : self.gid + ) + } catch (err) { + // only catch ENOENT, any other error is a problem. + if (err.code === 'ENOENT') { + return null + } + + throw err + } +} + +module.exports.mkdirfix = mkdirfix + +async function mkdirfix (cache, p, cb) { + // we have to infer the owner _before_ making the directory, even though + // we aren't going to use the results, since the cache itself might not + // exist yet. If we mkdirp it, then our current uid/gid will be assumed + // to be correct if it creates the cache folder in the process. + await inferOwner(cache) + try { + const made = await mkdirp(p) + if (made) { + await fixOwner(cache, made) + return made + } + } catch (err) { + if (err.code === 'EEXIST') { + await fixOwner(cache, p) + return null + } + throw err + } +} + +module.exports.mkdirfix.sync = mkdirfixSync + +function mkdirfixSync (cache, p) { + try { + inferOwner.sync(cache) + const made = mkdirp.sync(p) + if (made) { + fixOwnerSync(cache, made) + return made + } + } catch (err) { + if (err.code === 'EEXIST') { + fixOwnerSync(cache, p) + return null + } else { + throw err + } + } +} diff --git a/node_modules/node-gyp/node_modules/cacache/lib/util/hash-to-segments.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/hash-to-segments.js similarity index 100% rename from node_modules/node-gyp/node_modules/cacache/lib/util/hash-to-segments.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/util/hash-to-segments.js diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/move-file.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/move-file.js new file mode 100644 index 0000000000000..a0b40413cb56e --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/move-file.js @@ -0,0 +1,56 @@ +'use strict' + +const fs = require('@npmcli/fs') +const move = require('@npmcli/move-file') +const pinflight = require('promise-inflight') + +module.exports = moveFile + +async function moveFile (src, dest) { + const isWindows = process.platform === 'win32' + + // This isn't quite an fs.rename -- the assumption is that + // if `dest` already exists, and we get certain errors while + // trying to move it, we should just not bother. + // + // In the case of cache corruption, users will receive an + // EINTEGRITY error elsewhere, and can remove the offending + // content their own way. + // + // Note that, as the name suggests, this strictly only supports file moves. + try { + await fs.link(src, dest) + } catch (err) { + if (isWindows && err.code === 'EPERM') { + // XXX This is a really weird way to handle this situation, as it + // results in the src file being deleted even though the dest + // might not exist. Since we pretty much always write files to + // deterministic locations based on content hash, this is likely + // ok (or at worst, just ends in a future cache miss). But it would + // be worth investigating at some time in the future if this is + // really what we want to do here. + } else if (err.code === 'EEXIST' || err.code === 'EBUSY') { + // file already exists, so whatever + } else { + throw err + } + } + try { + await Promise.all([ + fs.unlink(src), + !isWindows && fs.chmod(dest, '0444'), + ]) + } catch (e) { + return pinflight('cacache-move-file:' + dest, async () => { + await fs.stat(dest).catch((err) => { + if (err.code !== 'ENOENT') { + // Something else is wrong here. Bail bail bail + throw err + } + }) + // file doesn't already exist! let's try a rename -> copy fallback + // only delete if it successfully copies + return move(src, dest) + }) + } +} diff --git a/node_modules/node-gyp/node_modules/cacache/lib/util/tmp.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/tmp.js similarity index 69% rename from node_modules/node-gyp/node_modules/cacache/lib/util/tmp.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/util/tmp.js index 0bf5302136ebe..b4437cfcbeed6 100644 --- a/node_modules/node-gyp/node_modules/cacache/lib/util/tmp.js +++ b/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/tmp.js @@ -1,7 +1,8 @@ 'use strict' -const { withTempDir } = require('@npmcli/fs') -const fs = require('fs/promises') +const fs = require('@npmcli/fs') + +const fixOwner = require('./fix-owner') const path = require('path') module.exports.mkdir = mktmpdir @@ -22,5 +23,11 @@ function withTmp (cache, opts, cb) { cb = opts opts = {} } - return withTempDir(path.join(cache, 'tmp'), cb, opts) + return fs.withTempDir(path.join(cache, 'tmp'), cb, opts) +} + +module.exports.fix = fixtmpdir + +function fixtmpdir (cache) { + return fixOwner(cache, path.join(cache, 'tmp')) } diff --git a/node_modules/node-gyp/node_modules/cacache/lib/verify.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/verify.js similarity index 84% rename from node_modules/node-gyp/node_modules/cacache/lib/verify.js rename to node_modules/@npmcli/run-script/node_modules/cacache/lib/verify.js index 62e85c946490f..52692a01d192f 100644 --- a/node_modules/node-gyp/node_modules/cacache/lib/verify.js +++ b/node_modules/@npmcli/run-script/node_modules/cacache/lib/verify.js @@ -1,21 +1,20 @@ 'use strict' -const { - mkdir, - readFile, - rm, - stat, - truncate, - writeFile, -} = require('fs/promises') +const util = require('util') + const pMap = require('p-map') const contentPath = require('./content/path') +const fixOwner = require('./util/fix-owner') +const fs = require('@npmcli/fs') const fsm = require('fs-minipass') -const glob = require('./util/glob.js') +const glob = util.promisify(require('glob')) const index = require('./entry-index') const path = require('path') +const rimraf = util.promisify(require('rimraf')) const ssri = require('ssri') +const globify = pattern => pattern.split('\\').join('/') + const hasOwnProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key) @@ -78,7 +77,9 @@ async function markEndTime (cache, opts) { async function fixPerms (cache, opts) { opts.log.silly('verify', 'fixing cache permissions') - await mkdir(cache, { recursive: true }) + await fixOwner.mkdirfix(cache, cache) + // TODO - fix file permissions too + await fixOwner.chownr(cache, cache) return null } @@ -89,7 +90,7 @@ async function fixPerms (cache, opts) { // 2. Mark each integrity value as "live" // 3. Read entire filesystem tree in `content-vX/` dir // 4. If content is live, verify its checksum and delete it if it fails -// 5. If content is not marked as live, rm it. +// 5. If content is not marked as live, rimraf it. // async function garbageCollect (cache, opts) { opts.log.silly('verify', 'garbage collecting content') @@ -100,17 +101,13 @@ async function garbageCollect (cache, opts) { return } - // integrity is stringified, re-parse it so we can get each hash - const integrity = ssri.parse(entry.integrity) - for (const algo in integrity) { - liveContent.add(integrity[algo].toString()) - } + liveContent.add(entry.integrity.toString()) }) await new Promise((resolve, reject) => { indexStream.on('end', resolve).on('error', reject) }) const contentDir = contentPath.contentDir(cache) - const files = await glob(path.join(contentDir, '**'), { + const files = await glob(globify(path.join(contentDir, '**')), { follow: false, nodir: true, nosort: true, @@ -142,8 +139,8 @@ async function garbageCollect (cache, opts) { } else { // No entries refer to this content. We can delete. stats.reclaimedCount++ - const s = await stat(f) - await rm(f, { recursive: true, force: true }) + const s = await fs.stat(f) + await rimraf(f) stats.reclaimedSize += s.size } return stats @@ -156,7 +153,7 @@ async function garbageCollect (cache, opts) { async function verifyContent (filepath, sri) { const contentInfo = {} try { - const { size } = await stat(filepath) + const { size } = await fs.stat(filepath) contentInfo.size = size contentInfo.valid = true await ssri.checkStream(new fsm.ReadStream(filepath), sri) @@ -168,7 +165,7 @@ async function verifyContent (filepath, sri) { throw err } - await rm(filepath, { recursive: true, force: true }) + await rimraf(filepath) contentInfo.valid = false } return contentInfo @@ -214,17 +211,16 @@ async function rebuildIndex (cache, opts) { } async function rebuildBucket (cache, bucket, stats, opts) { - await truncate(bucket._path) + await fs.truncate(bucket._path) // This needs to be serialized because cacache explicitly // lets very racy bucket conflicts clobber each other. for (const entry of bucket) { const content = contentPath(cache, entry.integrity) try { - await stat(content) + await fs.stat(content) await index.insert(cache, entry.key, entry.integrity, { metadata: entry.metadata, size: entry.size, - time: entry.time, }) stats.totalEntries++ } catch (err) { @@ -240,18 +236,22 @@ async function rebuildBucket (cache, bucket, stats, opts) { function cleanTmp (cache, opts) { opts.log.silly('verify', 'cleaning tmp directory') - return rm(path.join(cache, 'tmp'), { recursive: true, force: true }) + return rimraf(path.join(cache, 'tmp')) } -async function writeVerifile (cache, opts) { +function writeVerifile (cache, opts) { const verifile = path.join(cache, '_lastverified') opts.log.silly('verify', 'writing verifile to ' + verifile) - return writeFile(verifile, `${Date.now()}`) + try { + return fs.writeFile(verifile, `${Date.now()}`) + } finally { + fixOwner.chownr.sync(cache, verifile) + } } module.exports.lastRun = lastRun async function lastRun (cache) { - const data = await readFile(path.join(cache, '_lastverified'), { encoding: 'utf8' }) + const data = await fs.readFile(path.join(cache, '_lastverified'), { encoding: 'utf8' }) return new Date(+data) } diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion/LICENSE b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/LICENSE similarity index 100% rename from node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion/LICENSE rename to node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/LICENSE diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion/index.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion/index.js rename to node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/index.js diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion/package.json b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion/package.json rename to node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/package.json diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/LICENSE b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/LICENSE similarity index 92% rename from node_modules/node-gyp/node_modules/cacache/node_modules/glob/LICENSE rename to node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/LICENSE index ec7df93329abf..39e8fe16f665a 100644 --- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/LICENSE +++ b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) 2009-2023 Isaac Z. Schlueter and Contributors +Copyright (c) 2009-2022 Isaac Z. Schlueter and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/common.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/common.js new file mode 100644 index 0000000000000..61a4452f097dc --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/common.js @@ -0,0 +1,244 @@ +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var fs = require("fs") +var path = require("path") +var minimatch = require("minimatch") +var isAbsolute = require("path").isAbsolute +var Minimatch = minimatch.Minimatch + +function alphasort (a, b) { + return a.localeCompare(b, 'en') +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } + + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.windowsPathsNoEscape = !!options.windowsPathsNoEscape || + options.allowWindowsEscape === false + if (self.windowsPathsNoEscape) { + pattern = pattern.replace(/\\/g, '/') + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + self.absolute = !!options.absolute + self.fs = options.fs || fs + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = path.resolve(cwd) + else { + self.cwd = path.resolve(options.cwd) + self.changedCwd = self.cwd !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + self.nomount = !!options.nomount + + if (process.platform === "win32") { + self.root = self.root.replace(/\\/g, "/") + self.cwd = self.cwd.replace(/\\/g, "/") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") + } + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + var notDir = !(/\/$/.test(e)) + var c = self.cache[e] || self.cache[makeAbs(self, e)] + if (notDir && c) + notDir = c !== 'DIR' && !Array.isArray(c) + return notDir + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/') + + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/glob.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/glob.js new file mode 100644 index 0000000000000..2112a957dc501 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/glob.js @@ -0,0 +1,790 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path').isAbsolute +var globSync = require('./sync.js') +var common = require('./common.js') +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin +} + +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + + if (!pattern) + return false + + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + this._processing = 0 + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + sync = false + + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } + } + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || + isAbsolute(pattern.map(function (p) { + return typeof p === 'string' ? p : '[*]' + }).join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (isIgnored(this, e)) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = isAbsolute(e) ? e : this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) + e = abs + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + self.fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() + + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + self.fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } + + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + self.fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return self.fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return cb() + + return cb(null, c, stat) +} diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/package.json b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/package.json new file mode 100644 index 0000000000000..ca0fd916211b5 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/package.json @@ -0,0 +1,55 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "name": "glob", + "description": "a little globber", + "version": "8.1.0", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "main": "glob.js", + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "engines": { + "node": ">=12" + }, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "devDependencies": { + "memfs": "^3.2.0", + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^16.0.1", + "tick": "0.0.6" + }, + "tap": { + "before": "test/00-setup.js", + "after": "test/zz-cleanup.js", + "statements": 90, + "branches": 90, + "functions": 90, + "lines": 90, + "jobs": 1 + }, + "scripts": { + "prepublish": "npm run benchclean", + "profclean": "rm -f v8.log profile.txt", + "test": "tap", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", + "bench": "bash benchmark.sh", + "prof": "bash prof.sh && cat profile.txt", + "benchclean": "node benchclean.js" + }, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } +} diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/sync.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/sync.js new file mode 100644 index 0000000000000..af4600dd59508 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/sync.js @@ -0,0 +1,486 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path').isAbsolute +var common = require('./common.js') +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert.ok(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = rp.realpathSync(p, self.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert.ok(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || + isAbsolute(pattern.map(function (p) { + return typeof p === 'string' ? p : '[*]' + }).join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored(this, e)) + return + + var abs = this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) { + e = abs + } + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = this.fs.lstatSync(abs) + } catch (er) { + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null + } + } + + var isSym = lstat && lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, this.fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + throw error + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er + if (!this.silent) + console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = this.fs.lstatSync(abs) + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } + } + + if (lstat && lstat.isSymbolicLink()) { + try { + stat = this.fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/LICENSE b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/LICENSE similarity index 100% rename from node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/LICENSE rename to node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/LICENSE diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/lib/path.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/lib/path.js new file mode 100644 index 0000000000000..ffe453d9e0557 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/lib/path.js @@ -0,0 +1,4 @@ +const isWindows = typeof process === 'object' && + process && + process.platform === 'win32' +module.exports = isWindows ? { sep: '\\' } : { sep: '/' } diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/minimatch.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/minimatch.js new file mode 100644 index 0000000000000..6c8bfc35181c6 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/minimatch.js @@ -0,0 +1,944 @@ +const minimatch = module.exports = (p, pattern, options = {}) => { + assertValidPattern(pattern) + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + return new Minimatch(pattern, options).match(p) +} + +module.exports = minimatch + +const path = require('./lib/path.js') +minimatch.sep = path.sep + +const GLOBSTAR = Symbol('globstar **') +minimatch.GLOBSTAR = GLOBSTAR +const expand = require('brace-expansion') + +const plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +const qmark = '[^/]' + +// * => any number of characters +const star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +const twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +const twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// "abc" -> { a:true, b:true, c:true } +const charSet = s => s.split('').reduce((set, c) => { + set[c] = true + return set +}, {}) + +// characters that need to be escaped in RegExp. +const reSpecials = charSet('().*{}+?[]^$\\!') + +// characters that indicate we have to add the pattern start +const addPatternStartSet = charSet('[.(') + +// normalizes slashes. +const slashSplit = /\/+/ + +minimatch.filter = (pattern, options = {}) => + (p, i, list) => minimatch(p, pattern, options) + +const ext = (a, b = {}) => { + const t = {} + Object.keys(a).forEach(k => t[k] = a[k]) + Object.keys(b).forEach(k => t[k] = b[k]) + return t +} + +minimatch.defaults = def => { + if (!def || typeof def !== 'object' || !Object.keys(def).length) { + return minimatch + } + + const orig = minimatch + + const m = (p, pattern, options) => orig(p, pattern, ext(def, options)) + m.Minimatch = class Minimatch extends orig.Minimatch { + constructor (pattern, options) { + super(pattern, ext(def, options)) + } + } + m.Minimatch.defaults = options => orig.defaults(ext(def, options)).Minimatch + m.filter = (pattern, options) => orig.filter(pattern, ext(def, options)) + m.defaults = options => orig.defaults(ext(def, options)) + m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options)) + m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options)) + m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options)) + + return m +} + + + + + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options) + +const braceExpand = (pattern, options = {}) => { + assertValidPattern(pattern) + + // Thanks to Yeting Li for + // improving this regexp to avoid a ReDOS vulnerability. + if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +const MAX_PATTERN_LENGTH = 1024 * 64 +const assertValidPattern = pattern => { + if (typeof pattern !== 'string') { + throw new TypeError('invalid pattern') + } + + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError('pattern is too long') + } +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +const SUBPARSE = Symbol('subparse') + +minimatch.makeRe = (pattern, options) => + new Minimatch(pattern, options || {}).makeRe() + +minimatch.match = (list, pattern, options = {}) => { + const mm = new Minimatch(pattern, options) + list = list.filter(f => mm.match(f)) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +// replace stuff like \* with * +const globUnescape = s => s.replace(/\\(.)/g, '$1') +const charUnescape = s => s.replace(/\\([^-\]])/g, '$1') +const regExpEscape = s => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +const braExpEscape = s => s.replace(/[[\]\\]/g, '\\$&') + +class Minimatch { + constructor (pattern, options) { + assertValidPattern(pattern) + + if (!options) options = {} + + this.options = options + this.set = [] + this.pattern = pattern + this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || + options.allowWindowsEscape === false + if (this.windowsPathsNoEscape) { + this.pattern = this.pattern.replace(/\\/g, '/') + } + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + this.partial = !!options.partial + + // make the set of regexps etc. + this.make() + } + + debug () {} + + make () { + const pattern = this.pattern + const options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + let set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = (...args) => console.error(...args) + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(s => s.split(slashSplit)) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map((s, si, set) => s.map(this.parse, this)) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(s => s.indexOf(false) === -1) + + this.debug(this.pattern, set) + + this.set = set + } + + parseNegate () { + if (this.options.nonegate) return + + const pattern = this.pattern + let negate = false + let negateOffset = 0 + + for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.slice(negateOffset) + this.negate = negate + } + + // set partial to true to test if, for example, + // "/a/b" matches the start of "/*/b/*/d" + // Partial means, if you run out of file before you run + // out of pattern, then that's fine, as long as all + // the parts match. + matchOne (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + /* istanbul ignore if */ + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + /* istanbul ignore if */ + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + hit = f === p + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else /* istanbul ignore else */ if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return (fi === fl - 1) && (file[fi] === '') + } + + // should be unreachable. + /* istanbul ignore next */ + throw new Error('wtf?') + } + + braceExpand () { + return braceExpand(this.pattern, this.options) + } + + parse (pattern, isSub) { + assertValidPattern(pattern) + + const options = this.options + + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + if (pattern === '') return '' + + let re = '' + let hasMagic = false + let escaping = false + // ? => one single character + const patternListStack = [] + const negativeLists = [] + let stateChar + let inClass = false + let reClassStart = -1 + let classStart = -1 + let cs + let pl + let sp + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. However, if the pattern + // starts with ., then traversal patterns can match. + let dotTravAllowed = pattern.charAt(0) === '.' + let dotFileAllowed = options.dot || dotTravAllowed + const patternStart = () => + dotTravAllowed + ? '' + : dotFileAllowed + ? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))' + : '(?!\\.)' + const subPatternStart = (p) => + p.charAt(0) === '.' + ? '' + : options.dot + ? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))' + : '(?!\\.)' + + + const clearStateChar = () => { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + this.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (let i = 0, c; (i < pattern.length) && (c = pattern.charAt(i)); i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping) { + /* istanbul ignore next - completely not allowed, even escaped. */ + if (c === '/') { + return false + } + + if (reSpecials[c]) { + re += '\\' + } + re += c + escaping = false + continue + } + + switch (c) { + /* istanbul ignore next */ + case '/': { + // Should already be path-split by now. + return false + } + + case '\\': + if (inClass && pattern.charAt(i + 1) === '-') { + re += c + continue + } + + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + this.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': { + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + const plEntry = { + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close, + } + this.debug(this.pattern, '\t', plEntry) + patternListStack.push(plEntry) + // negation is (?:(?!(?:js)(?:))[^/]*) + re += plEntry.open + // next entry starts with a dot maybe? + if (plEntry.start === 0 && plEntry.type !== '!') { + dotTravAllowed = true + re += subPatternStart(pattern.slice(i + 1)) + } + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + } + + case ')': { + const plEntry = patternListStack[patternListStack.length - 1] + if (inClass || !plEntry) { + re += '\\)' + continue + } + patternListStack.pop() + + // closing an extglob + clearStateChar() + hasMagic = true + pl = plEntry + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(Object.assign(pl, { reEnd: re.length })) + } + continue + } + + case '|': { + const plEntry = patternListStack[patternListStack.length - 1] + if (inClass || !plEntry) { + re += '\\|' + continue + } + + clearStateChar() + re += '|' + // next subpattern can start with a dot? + if (plEntry.start === 0 && plEntry.type !== '!') { + dotTravAllowed = true + re += subPatternStart(pattern.slice(i + 1)) + } + continue + } + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + continue + } + + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + braExpEscape(charUnescape(cs)) + ']') + // looks good, finish up the class. + re += c + } catch (er) { + // out of order ranges in JS are errors, but in glob syntax, + // they're just a range that matches nothing. + re = re.substring(0, reClassStart) + '(?:$.)' // match nothing ever + } + hasMagic = true + inClass = false + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (reSpecials[c] && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + break + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.slice(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substring(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + let tail + tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => { + /* istanbul ignore else - should already be done */ + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + const t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + const addPatternStart = addPatternStartSet[re.charAt(0)] + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (let n = negativeLists.length - 1; n > -1; n--) { + const nl = negativeLists[n] + + const nlBefore = re.slice(0, nl.reStart) + const nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + let nlAfter = re.slice(nl.reEnd) + const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + const closeParensBefore = nlBefore.split(')').length + const openParensBefore = nlBefore.split('(').length - closeParensBefore + let cleanAfter = nlAfter + for (let i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + const dollar = nlAfter === '' && isSub !== SUBPARSE ? '(?:$|\\/)' : '' + + re = nlBefore + nlFirst + nlAfter + dollar + nlLast + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart() + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // if it's nocase, and the lcase/uppercase don't match, it's magic + if (options.nocase && !hasMagic) { + hasMagic = pattern.toUpperCase() !== pattern.toLowerCase() + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + const flags = options.nocase ? 'i' : '' + try { + return Object.assign(new RegExp('^' + re + '$', flags), { + _glob: pattern, + _src: re, + }) + } catch (er) /* istanbul ignore next - should be impossible */ { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + } + + makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + const set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + const options = this.options + + const twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + const flags = options.nocase ? 'i' : '' + + // coalesce globstars and regexpify non-globstar patterns + // if it's the only item, then we just do one twoStar + // if it's the first, and there are more, prepend (\/|twoStar\/)? to next + // if it's the last, append (\/twoStar|) to previous + // if it's in the middle, append (\/|\/twoStar\/) to previous + // then filter out GLOBSTAR symbols + let re = set.map(pattern => { + pattern = pattern.map(p => + typeof p === 'string' ? regExpEscape(p) + : p === GLOBSTAR ? GLOBSTAR + : p._src + ).reduce((set, p) => { + if (!(set[set.length - 1] === GLOBSTAR && p === GLOBSTAR)) { + set.push(p) + } + return set + }, []) + pattern.forEach((p, i) => { + if (p !== GLOBSTAR || pattern[i-1] === GLOBSTAR) { + return + } + if (i === 0) { + if (pattern.length > 1) { + pattern[i+1] = '(?:\\\/|' + twoStar + '\\\/)?' + pattern[i+1] + } else { + pattern[i] = twoStar + } + } else if (i === pattern.length - 1) { + pattern[i-1] += '(?:\\\/|' + twoStar + ')?' + } else { + pattern[i-1] += '(?:\\\/|\\\/' + twoStar + '\\\/)' + pattern[i+1] + pattern[i+1] = GLOBSTAR + } + }) + return pattern.filter(p => p !== GLOBSTAR).join('/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) /* istanbul ignore next - should be impossible */ { + this.regexp = false + } + return this.regexp + } + + match (f, partial = this.partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + const options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + const set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + let filename + for (let i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (let i = 0; i < set.length; i++) { + const pattern = set[i] + let file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + const hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate + } + + static defaults (def) { + return minimatch.defaults(def).Minimatch + } +} + +minimatch.Minimatch = Minimatch diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/package.json b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/package.json new file mode 100644 index 0000000000000..c8809dbb3119d --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/package.json @@ -0,0 +1,35 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me)", + "name": "minimatch", + "description": "a glob matcher in javascript", + "publishConfig": { + "tag": "legacy-v5" + }, + "version": "5.1.6", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "test": "tap", + "snap": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags" + }, + "engines": { + "node": ">=10" + }, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "devDependencies": { + "tap": "^16.3.2" + }, + "license": "ISC", + "files": [ + "minimatch.js", + "lib" + ] +} diff --git a/node_modules/node-gyp/node_modules/cacache/package.json b/node_modules/@npmcli/run-script/node_modules/cacache/package.json similarity index 70% rename from node_modules/node-gyp/node_modules/cacache/package.json rename to node_modules/@npmcli/run-script/node_modules/cacache/package.json index ab58cb8b7c50f..7dbd407d8fccf 100644 --- a/node_modules/node-gyp/node_modules/cacache/package.json +++ b/node_modules/@npmcli/run-script/node_modules/cacache/package.json @@ -1,6 +1,6 @@ { "name": "cacache", - "version": "17.1.4", + "version": "16.1.3", "cache-version": { "content": "2", "index": "5" @@ -12,6 +12,9 @@ "lib/" ], "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", "test": "tap", "snap": "tap", "coverage": "tap", @@ -45,38 +48,37 @@ ], "license": "ISC", "dependencies": { - "@npmcli/fs": "^3.1.0", - "fs-minipass": "^3.0.0", - "glob": "^10.2.2", + "@npmcli/fs": "^2.1.0", + "@npmcli/move-file": "^2.0.0", + "chownr": "^2.0.0", + "fs-minipass": "^2.1.0", + "glob": "^8.0.1", + "infer-owner": "^1.0.4", "lru-cache": "^7.7.1", - "minipass": "^7.0.3", + "minipass": "^3.1.6", "minipass-collect": "^1.0.2", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", + "mkdirp": "^1.0.4", "p-map": "^4.0.0", - "ssri": "^10.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^9.0.0", "tar": "^6.1.11", - "unique-filename": "^3.0.0" + "unique-filename": "^2.0.0" }, "devDependencies": { - "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.18.0", + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.5.0", "tap": "^16.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "windowsCI": false, - "version": "4.18.0", - "publish": "true" + "version": "3.5.0" }, - "author": "GitHub Inc.", - "tap": { - "nyc-arg": [ - "--exclude", - "tap-snapshots/**" - ] - } + "author": "GitHub Inc." } diff --git a/node_modules/node-gyp/node_modules/minimatch/LICENSE b/node_modules/@npmcli/run-script/node_modules/fs-minipass/LICENSE similarity index 100% rename from node_modules/node-gyp/node_modules/minimatch/LICENSE rename to node_modules/@npmcli/run-script/node_modules/fs-minipass/LICENSE diff --git a/node_modules/@npmcli/run-script/node_modules/fs-minipass/index.js b/node_modules/@npmcli/run-script/node_modules/fs-minipass/index.js new file mode 100644 index 0000000000000..9b0779c80c55e --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/fs-minipass/index.js @@ -0,0 +1,422 @@ +'use strict' +const MiniPass = require('minipass') +const EE = require('events').EventEmitter +const fs = require('fs') + +let writev = fs.writev +/* istanbul ignore next */ +if (!writev) { + // This entire block can be removed if support for earlier than Node.js + // 12.9.0 is not needed. + const binding = process.binding('fs') + const FSReqWrap = binding.FSReqWrap || binding.FSReqCallback + + writev = (fd, iovec, pos, cb) => { + const done = (er, bw) => cb(er, bw, iovec) + const req = new FSReqWrap() + req.oncomplete = done + binding.writeBuffers(fd, iovec, pos, req) + } +} + +const _autoClose = Symbol('_autoClose') +const _close = Symbol('_close') +const _ended = Symbol('_ended') +const _fd = Symbol('_fd') +const _finished = Symbol('_finished') +const _flags = Symbol('_flags') +const _flush = Symbol('_flush') +const _handleChunk = Symbol('_handleChunk') +const _makeBuf = Symbol('_makeBuf') +const _mode = Symbol('_mode') +const _needDrain = Symbol('_needDrain') +const _onerror = Symbol('_onerror') +const _onopen = Symbol('_onopen') +const _onread = Symbol('_onread') +const _onwrite = Symbol('_onwrite') +const _open = Symbol('_open') +const _path = Symbol('_path') +const _pos = Symbol('_pos') +const _queue = Symbol('_queue') +const _read = Symbol('_read') +const _readSize = Symbol('_readSize') +const _reading = Symbol('_reading') +const _remain = Symbol('_remain') +const _size = Symbol('_size') +const _write = Symbol('_write') +const _writing = Symbol('_writing') +const _defaultFlag = Symbol('_defaultFlag') +const _errored = Symbol('_errored') + +class ReadStream extends MiniPass { + constructor (path, opt) { + opt = opt || {} + super(opt) + + this.readable = true + this.writable = false + + if (typeof path !== 'string') + throw new TypeError('path must be a string') + + this[_errored] = false + this[_fd] = typeof opt.fd === 'number' ? opt.fd : null + this[_path] = path + this[_readSize] = opt.readSize || 16*1024*1024 + this[_reading] = false + this[_size] = typeof opt.size === 'number' ? opt.size : Infinity + this[_remain] = this[_size] + this[_autoClose] = typeof opt.autoClose === 'boolean' ? + opt.autoClose : true + + if (typeof this[_fd] === 'number') + this[_read]() + else + this[_open]() + } + + get fd () { return this[_fd] } + get path () { return this[_path] } + + write () { + throw new TypeError('this is a readable stream') + } + + end () { + throw new TypeError('this is a readable stream') + } + + [_open] () { + fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd)) + } + + [_onopen] (er, fd) { + if (er) + this[_onerror](er) + else { + this[_fd] = fd + this.emit('open', fd) + this[_read]() + } + } + + [_makeBuf] () { + return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain])) + } + + [_read] () { + if (!this[_reading]) { + this[_reading] = true + const buf = this[_makeBuf]() + /* istanbul ignore if */ + if (buf.length === 0) + return process.nextTick(() => this[_onread](null, 0, buf)) + fs.read(this[_fd], buf, 0, buf.length, null, (er, br, buf) => + this[_onread](er, br, buf)) + } + } + + [_onread] (er, br, buf) { + this[_reading] = false + if (er) + this[_onerror](er) + else if (this[_handleChunk](br, buf)) + this[_read]() + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')) + } + } + + [_onerror] (er) { + this[_reading] = true + this[_close]() + this.emit('error', er) + } + + [_handleChunk] (br, buf) { + let ret = false + // no effect if infinite + this[_remain] -= br + if (br > 0) + ret = super.write(br < buf.length ? buf.slice(0, br) : buf) + + if (br === 0 || this[_remain] <= 0) { + ret = false + this[_close]() + super.end() + } + + return ret + } + + emit (ev, data) { + switch (ev) { + case 'prefinish': + case 'finish': + break + + case 'drain': + if (typeof this[_fd] === 'number') + this[_read]() + break + + case 'error': + if (this[_errored]) + return + this[_errored] = true + return super.emit(ev, data) + + default: + return super.emit(ev, data) + } + } +} + +class ReadStreamSync extends ReadStream { + [_open] () { + let threw = true + try { + this[_onopen](null, fs.openSync(this[_path], 'r')) + threw = false + } finally { + if (threw) + this[_close]() + } + } + + [_read] () { + let threw = true + try { + if (!this[_reading]) { + this[_reading] = true + do { + const buf = this[_makeBuf]() + /* istanbul ignore next */ + const br = buf.length === 0 ? 0 + : fs.readSync(this[_fd], buf, 0, buf.length, null) + if (!this[_handleChunk](br, buf)) + break + } while (true) + this[_reading] = false + } + threw = false + } finally { + if (threw) + this[_close]() + } + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.closeSync(fd) + this.emit('close') + } + } +} + +class WriteStream extends EE { + constructor (path, opt) { + opt = opt || {} + super(opt) + this.readable = false + this.writable = true + this[_errored] = false + this[_writing] = false + this[_ended] = false + this[_needDrain] = false + this[_queue] = [] + this[_path] = path + this[_fd] = typeof opt.fd === 'number' ? opt.fd : null + this[_mode] = opt.mode === undefined ? 0o666 : opt.mode + this[_pos] = typeof opt.start === 'number' ? opt.start : null + this[_autoClose] = typeof opt.autoClose === 'boolean' ? + opt.autoClose : true + + // truncating makes no sense when writing into the middle + const defaultFlag = this[_pos] !== null ? 'r+' : 'w' + this[_defaultFlag] = opt.flags === undefined + this[_flags] = this[_defaultFlag] ? defaultFlag : opt.flags + + if (this[_fd] === null) + this[_open]() + } + + emit (ev, data) { + if (ev === 'error') { + if (this[_errored]) + return + this[_errored] = true + } + return super.emit(ev, data) + } + + + get fd () { return this[_fd] } + get path () { return this[_path] } + + [_onerror] (er) { + this[_close]() + this[_writing] = true + this.emit('error', er) + } + + [_open] () { + fs.open(this[_path], this[_flags], this[_mode], + (er, fd) => this[_onopen](er, fd)) + } + + [_onopen] (er, fd) { + if (this[_defaultFlag] && + this[_flags] === 'r+' && + er && er.code === 'ENOENT') { + this[_flags] = 'w' + this[_open]() + } else if (er) + this[_onerror](er) + else { + this[_fd] = fd + this.emit('open', fd) + this[_flush]() + } + } + + end (buf, enc) { + if (buf) + this.write(buf, enc) + + this[_ended] = true + + // synthetic after-write logic, where drain/finish live + if (!this[_writing] && !this[_queue].length && + typeof this[_fd] === 'number') + this[_onwrite](null, 0) + return this + } + + write (buf, enc) { + if (typeof buf === 'string') + buf = Buffer.from(buf, enc) + + if (this[_ended]) { + this.emit('error', new Error('write() after end()')) + return false + } + + if (this[_fd] === null || this[_writing] || this[_queue].length) { + this[_queue].push(buf) + this[_needDrain] = true + return false + } + + this[_writing] = true + this[_write](buf) + return true + } + + [_write] (buf) { + fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => + this[_onwrite](er, bw)) + } + + [_onwrite] (er, bw) { + if (er) + this[_onerror](er) + else { + if (this[_pos] !== null) + this[_pos] += bw + if (this[_queue].length) + this[_flush]() + else { + this[_writing] = false + + if (this[_ended] && !this[_finished]) { + this[_finished] = true + this[_close]() + this.emit('finish') + } else if (this[_needDrain]) { + this[_needDrain] = false + this.emit('drain') + } + } + } + } + + [_flush] () { + if (this[_queue].length === 0) { + if (this[_ended]) + this[_onwrite](null, 0) + } else if (this[_queue].length === 1) + this[_write](this[_queue].pop()) + else { + const iovec = this[_queue] + this[_queue] = [] + writev(this[_fd], iovec, this[_pos], + (er, bw) => this[_onwrite](er, bw)) + } + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')) + } + } +} + +class WriteStreamSync extends WriteStream { + [_open] () { + let fd + // only wrap in a try{} block if we know we'll retry, to avoid + // the rethrow obscuring the error's source frame in most cases. + if (this[_defaultFlag] && this[_flags] === 'r+') { + try { + fd = fs.openSync(this[_path], this[_flags], this[_mode]) + } catch (er) { + if (er.code === 'ENOENT') { + this[_flags] = 'w' + return this[_open]() + } else + throw er + } + } else + fd = fs.openSync(this[_path], this[_flags], this[_mode]) + + this[_onopen](null, fd) + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.closeSync(fd) + this.emit('close') + } + } + + [_write] (buf) { + // throw the original, but try to close if it fails + let threw = true + try { + this[_onwrite](null, + fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos])) + threw = false + } finally { + if (threw) + try { this[_close]() } catch (_) {} + } + } +} + +exports.ReadStream = ReadStream +exports.ReadStreamSync = ReadStreamSync + +exports.WriteStream = WriteStream +exports.WriteStreamSync = WriteStreamSync diff --git a/node_modules/@npmcli/run-script/node_modules/fs-minipass/package.json b/node_modules/@npmcli/run-script/node_modules/fs-minipass/package.json new file mode 100644 index 0000000000000..2f2436cb5c3b1 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/fs-minipass/package.json @@ -0,0 +1,39 @@ +{ + "name": "fs-minipass", + "version": "2.1.0", + "main": "index.js", + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags" + }, + "keywords": [], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/fs-minipass.git" + }, + "bugs": { + "url": "https://github.com/npm/fs-minipass/issues" + }, + "homepage": "https://github.com/npm/fs-minipass#readme", + "description": "fs read and write streams based on minipass", + "dependencies": { + "minipass": "^3.0.0" + }, + "devDependencies": { + "mutate-fs": "^2.0.1", + "tap": "^14.6.4" + }, + "files": [ + "index.js" + ], + "tap": { + "check-coverage": true + }, + "engines": { + "node": ">= 8" + } +} diff --git a/node_modules/node-gyp/node_modules/npmlog/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/gauge/LICENSE.md similarity index 100% rename from node_modules/node-gyp/node_modules/npmlog/LICENSE.md rename to node_modules/@npmcli/run-script/node_modules/gauge/LICENSE.md diff --git a/node_modules/node-gyp/node_modules/gauge/lib/base-theme.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/base-theme.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/base-theme.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/base-theme.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/error.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/error.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/error.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/error.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/has-color.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/has-color.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/has-color.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/has-color.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/index.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/index.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/index.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/plumbing.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/plumbing.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/plumbing.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/plumbing.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/process.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/process.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/process.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/process.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/progress-bar.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/progress-bar.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/progress-bar.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/progress-bar.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/render-template.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/render-template.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/render-template.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/render-template.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/set-immediate.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/set-immediate.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/set-immediate.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/set-immediate.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/set-interval.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/set-interval.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/set-interval.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/set-interval.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/spin.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/spin.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/spin.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/spin.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/template-item.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/template-item.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/template-item.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/template-item.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/theme-set.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/theme-set.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/theme-set.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/theme-set.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/themes.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/themes.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/themes.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/themes.js diff --git a/node_modules/node-gyp/node_modules/gauge/lib/wide-truncate.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/wide-truncate.js similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/lib/wide-truncate.js rename to node_modules/@npmcli/run-script/node_modules/gauge/lib/wide-truncate.js diff --git a/node_modules/node-gyp/node_modules/gauge/package.json b/node_modules/@npmcli/run-script/node_modules/gauge/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/gauge/package.json rename to node_modules/@npmcli/run-script/node_modules/gauge/package.json diff --git a/node_modules/node-gyp/node_modules/glob/LICENSE b/node_modules/@npmcli/run-script/node_modules/glob/LICENSE similarity index 100% rename from node_modules/node-gyp/node_modules/glob/LICENSE rename to node_modules/@npmcli/run-script/node_modules/glob/LICENSE diff --git a/node_modules/node-gyp/node_modules/glob/common.js b/node_modules/@npmcli/run-script/node_modules/glob/common.js similarity index 100% rename from node_modules/node-gyp/node_modules/glob/common.js rename to node_modules/@npmcli/run-script/node_modules/glob/common.js diff --git a/node_modules/node-gyp/node_modules/glob/glob.js b/node_modules/@npmcli/run-script/node_modules/glob/glob.js similarity index 100% rename from node_modules/node-gyp/node_modules/glob/glob.js rename to node_modules/@npmcli/run-script/node_modules/glob/glob.js diff --git a/node_modules/node-gyp/node_modules/glob/package.json b/node_modules/@npmcli/run-script/node_modules/glob/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/glob/package.json rename to node_modules/@npmcli/run-script/node_modules/glob/package.json diff --git a/node_modules/node-gyp/node_modules/glob/sync.js b/node_modules/@npmcli/run-script/node_modules/glob/sync.js similarity index 100% rename from node_modules/node-gyp/node_modules/glob/sync.js rename to node_modules/@npmcli/run-script/node_modules/glob/sync.js diff --git a/node_modules/node-gyp/node_modules/lru-cache/LICENSE b/node_modules/@npmcli/run-script/node_modules/lru-cache/LICENSE similarity index 100% rename from node_modules/node-gyp/node_modules/lru-cache/LICENSE rename to node_modules/@npmcli/run-script/node_modules/lru-cache/LICENSE diff --git a/node_modules/node-gyp/node_modules/lru-cache/index.js b/node_modules/@npmcli/run-script/node_modules/lru-cache/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/lru-cache/index.js rename to node_modules/@npmcli/run-script/node_modules/lru-cache/index.js diff --git a/node_modules/node-gyp/node_modules/lru-cache/index.mjs b/node_modules/@npmcli/run-script/node_modules/lru-cache/index.mjs similarity index 100% rename from node_modules/node-gyp/node_modules/lru-cache/index.mjs rename to node_modules/@npmcli/run-script/node_modules/lru-cache/index.mjs diff --git a/node_modules/node-gyp/node_modules/lru-cache/package.json b/node_modules/@npmcli/run-script/node_modules/lru-cache/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/lru-cache/package.json rename to node_modules/@npmcli/run-script/node_modules/lru-cache/package.json diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/LICENSE b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/LICENSE similarity index 100% rename from node_modules/node-gyp/node_modules/make-fetch-happen/LICENSE rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/LICENSE diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/agent.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/agent.js similarity index 100% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/agent.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/agent.js diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/entry.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/entry.js similarity index 92% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/entry.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/entry.js index 45141095074ec..dba89d715d8a5 100644 --- a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/entry.js +++ b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/entry.js @@ -1,5 +1,5 @@ const { Request, Response } = require('minipass-fetch') -const { Minipass } = require('minipass') +const Minipass = require('minipass') const MinipassFlush = require('minipass-flush') const cacache = require('cacache') const url = require('url') @@ -99,12 +99,6 @@ const getMetadata = (request, response, options) => { } } - for (const name of options.cacheAdditionalHeaders) { - if (response.headers.has(name)) { - metadata.resHeaders[name] = response.headers.get(name) - } - } - return metadata } @@ -337,7 +331,6 @@ class CacheEntry { // that reads from cacache and attach it to a new Response const body = new Minipass() const headers = { ...this.policy.responseHeaders() } - const onResume = () => { const cacheStream = cacache.get.stream.byDigest( this.options.cachePath, this.entry.integrity, { memoize: this.options.memoize } @@ -424,24 +417,6 @@ class CacheEntry { } } - for (const name of options.cacheAdditionalHeaders) { - const inMeta = hasOwnProperty(metadata.resHeaders, name) - const inEntry = hasOwnProperty(this.entry.metadata.resHeaders, name) - const inPolicy = hasOwnProperty(this.policy.response.headers, name) - - // if the header is in the existing entry, but it is not in the metadata - // then we need to write it to the metadata as this will refresh the on-disk cache - if (!inMeta && inEntry) { - metadata.resHeaders[name] = this.entry.metadata.resHeaders[name] - } - // if the header is in the metadata, but not in the policy, then we need to set - // it in the policy so that it's included in the immediate response. future - // responses will load a new cache entry, so we don't need to change that - if (!inPolicy && inMeta) { - this.policy.response.headers[name] = metadata.resHeaders[name] - } - } - try { await cacache.index.insert(options.cachePath, this.key, this.entry.integrity, { size: this.entry.size, diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/errors.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/errors.js similarity index 100% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/errors.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/errors.js diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/index.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/index.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/index.js diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/key.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/key.js similarity index 100% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/key.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/key.js diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/policy.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/policy.js similarity index 100% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/cache/policy.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/policy.js diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/dns.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/dns.js similarity index 100% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/dns.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/dns.js diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/fetch.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/fetch.js similarity index 100% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/fetch.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/fetch.js diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/index.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/index.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/index.js diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/options.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/options.js similarity index 95% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/options.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/options.js index f77511279f831..daa9ecd9d5d5f 100644 --- a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/options.js +++ b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/options.js @@ -40,8 +40,6 @@ const configureOptions = (opts) => { } } - options.cacheAdditionalHeaders = options.cacheAdditionalHeaders || [] - // cacheManager is deprecated, but if it's set and // cachePath is not we should copy it to the new field if (options.cacheManager && !options.cachePath) { diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/pipeline.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/pipeline.js similarity index 100% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/pipeline.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/pipeline.js diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/remote.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/remote.js similarity index 99% rename from node_modules/node-gyp/node_modules/make-fetch-happen/lib/remote.js rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/remote.js index bdbcc79cad908..068c73a8a7a7e 100644 --- a/node_modules/node-gyp/node_modules/make-fetch-happen/lib/remote.js +++ b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/remote.js @@ -1,4 +1,4 @@ -const { Minipass } = require('minipass') +const Minipass = require('minipass') const fetch = require('minipass-fetch') const promiseRetry = require('promise-retry') const ssri = require('ssri') diff --git a/node_modules/node-gyp/node_modules/make-fetch-happen/package.json b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/package.json similarity index 73% rename from node_modules/node-gyp/node_modules/make-fetch-happen/package.json rename to node_modules/@npmcli/run-script/node_modules/make-fetch-happen/package.json index fd415dc9966fa..fc491d1152e15 100644 --- a/node_modules/node-gyp/node_modules/make-fetch-happen/package.json +++ b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/package.json @@ -1,6 +1,6 @@ { "name": "make-fetch-happen", - "version": "11.1.1", + "version": "10.2.1", "description": "Opinionated, caching, retrying fetch client", "main": "lib/index.js", "files": [ @@ -8,6 +8,9 @@ "lib/" ], "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", "test": "tap", "posttest": "npm run lint", "eslint": "eslint", @@ -34,45 +37,43 @@ "license": "ISC", "dependencies": { "agentkeepalive": "^4.2.1", - "cacache": "^17.0.0", - "http-cache-semantics": "^4.1.1", + "cacache": "^16.1.0", + "http-cache-semantics": "^4.1.0", "http-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.0", "is-lambda": "^1.0.1", "lru-cache": "^7.7.1", - "minipass": "^5.0.0", - "minipass-fetch": "^3.0.0", + "minipass": "^3.1.6", + "minipass-collect": "^1.0.2", + "minipass-fetch": "^2.0.3", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^0.6.3", "promise-retry": "^2.0.1", "socks-proxy-agent": "^7.0.0", - "ssri": "^10.0.0" + "ssri": "^9.0.0" }, "devDependencies": { - "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.14.1", + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.5.0", + "mkdirp": "^1.0.4", "nock": "^13.2.4", + "rimraf": "^3.0.2", "safe-buffer": "^5.2.1", "standard-version": "^9.3.2", "tap": "^16.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" }, "tap": { "color": 1, "files": "test/*.js", "check-coverage": true, - "timeout": 60, - "nyc-arg": [ - "--exclude", - "tap-snapshots/**" - ] + "timeout": 60 }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.14.1", - "publish": "true" + "version": "3.5.0" } } diff --git a/node_modules/node-gyp/node_modules/nopt/LICENSE b/node_modules/@npmcli/run-script/node_modules/minimatch/LICENSE similarity index 100% rename from node_modules/node-gyp/node_modules/nopt/LICENSE rename to node_modules/@npmcli/run-script/node_modules/minimatch/LICENSE diff --git a/node_modules/node-gyp/node_modules/minimatch/minimatch.js b/node_modules/@npmcli/run-script/node_modules/minimatch/minimatch.js similarity index 100% rename from node_modules/node-gyp/node_modules/minimatch/minimatch.js rename to node_modules/@npmcli/run-script/node_modules/minimatch/minimatch.js diff --git a/node_modules/node-gyp/node_modules/minimatch/package.json b/node_modules/@npmcli/run-script/node_modules/minimatch/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/minimatch/package.json rename to node_modules/@npmcli/run-script/node_modules/minimatch/package.json diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/LICENSE b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/LICENSE new file mode 100644 index 0000000000000..3c3410cdc12ee --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/LICENSE @@ -0,0 +1,28 @@ +The MIT License (MIT) + +Copyright (c) Isaac Z. Schlueter and Contributors +Copyright (c) 2016 David Frank + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +Note: This is a derivative work based on "node-fetch" by David Frank, +modified and distributed under the terms of the MIT license above. +https://github.com/bitinn/node-fetch diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/abort-error.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/abort-error.js new file mode 100644 index 0000000000000..b18f643269e37 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/abort-error.js @@ -0,0 +1,17 @@ +'use strict' +class AbortError extends Error { + constructor (message) { + super(message) + this.code = 'FETCH_ABORTED' + this.type = 'aborted' + Error.captureStackTrace(this, this.constructor) + } + + get name () { + return 'AbortError' + } + + // don't allow name to be overridden, but don't throw either + set name (s) {} +} +module.exports = AbortError diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/blob.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/blob.js new file mode 100644 index 0000000000000..efe69a34458af --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/blob.js @@ -0,0 +1,97 @@ +'use strict' +const Minipass = require('minipass') +const TYPE = Symbol('type') +const BUFFER = Symbol('buffer') + +class Blob { + constructor (blobParts, options) { + this[TYPE] = '' + + const buffers = [] + let size = 0 + + if (blobParts) { + const a = blobParts + const length = Number(a.length) + for (let i = 0; i < length; i++) { + const element = a[i] + const buffer = element instanceof Buffer ? element + : ArrayBuffer.isView(element) + ? Buffer.from(element.buffer, element.byteOffset, element.byteLength) + : element instanceof ArrayBuffer ? Buffer.from(element) + : element instanceof Blob ? element[BUFFER] + : typeof element === 'string' ? Buffer.from(element) + : Buffer.from(String(element)) + size += buffer.length + buffers.push(buffer) + } + } + + this[BUFFER] = Buffer.concat(buffers, size) + + const type = options && options.type !== undefined + && String(options.type).toLowerCase() + if (type && !/[^\u0020-\u007E]/.test(type)) { + this[TYPE] = type + } + } + + get size () { + return this[BUFFER].length + } + + get type () { + return this[TYPE] + } + + text () { + return Promise.resolve(this[BUFFER].toString()) + } + + arrayBuffer () { + const buf = this[BUFFER] + const off = buf.byteOffset + const len = buf.byteLength + const ab = buf.buffer.slice(off, off + len) + return Promise.resolve(ab) + } + + stream () { + return new Minipass().end(this[BUFFER]) + } + + slice (start, end, type) { + const size = this.size + const relativeStart = start === undefined ? 0 + : start < 0 ? Math.max(size + start, 0) + : Math.min(start, size) + const relativeEnd = end === undefined ? size + : end < 0 ? Math.max(size + end, 0) + : Math.min(end, size) + const span = Math.max(relativeEnd - relativeStart, 0) + + const buffer = this[BUFFER] + const slicedBuffer = buffer.slice( + relativeStart, + relativeStart + span + ) + const blob = new Blob([], { type }) + blob[BUFFER] = slicedBuffer + return blob + } + + get [Symbol.toStringTag] () { + return 'Blob' + } + + static get BUFFER () { + return BUFFER + } +} + +Object.defineProperties(Blob.prototype, { + size: { enumerable: true }, + type: { enumerable: true }, +}) + +module.exports = Blob diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/body.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/body.js new file mode 100644 index 0000000000000..9d1b45de30ce9 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/body.js @@ -0,0 +1,350 @@ +'use strict' +const Minipass = require('minipass') +const MinipassSized = require('minipass-sized') + +const Blob = require('./blob.js') +const { BUFFER } = Blob +const FetchError = require('./fetch-error.js') + +// optional dependency on 'encoding' +let convert +try { + convert = require('encoding').convert +} catch (e) { + // defer error until textConverted is called +} + +const INTERNALS = Symbol('Body internals') +const CONSUME_BODY = Symbol('consumeBody') + +class Body { + constructor (bodyArg, options = {}) { + const { size = 0, timeout = 0 } = options + const body = bodyArg === undefined || bodyArg === null ? null + : isURLSearchParams(bodyArg) ? Buffer.from(bodyArg.toString()) + : isBlob(bodyArg) ? bodyArg + : Buffer.isBuffer(bodyArg) ? bodyArg + : Object.prototype.toString.call(bodyArg) === '[object ArrayBuffer]' + ? Buffer.from(bodyArg) + : ArrayBuffer.isView(bodyArg) + ? Buffer.from(bodyArg.buffer, bodyArg.byteOffset, bodyArg.byteLength) + : Minipass.isStream(bodyArg) ? bodyArg + : Buffer.from(String(bodyArg)) + + this[INTERNALS] = { + body, + disturbed: false, + error: null, + } + + this.size = size + this.timeout = timeout + + if (Minipass.isStream(body)) { + body.on('error', er => { + const error = er.name === 'AbortError' ? er + : new FetchError(`Invalid response while trying to fetch ${ + this.url}: ${er.message}`, 'system', er) + this[INTERNALS].error = error + }) + } + } + + get body () { + return this[INTERNALS].body + } + + get bodyUsed () { + return this[INTERNALS].disturbed + } + + arrayBuffer () { + return this[CONSUME_BODY]().then(buf => + buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)) + } + + blob () { + const ct = this.headers && this.headers.get('content-type') || '' + return this[CONSUME_BODY]().then(buf => Object.assign( + new Blob([], { type: ct.toLowerCase() }), + { [BUFFER]: buf } + )) + } + + async json () { + const buf = await this[CONSUME_BODY]() + try { + return JSON.parse(buf.toString()) + } catch (er) { + throw new FetchError( + `invalid json response body at ${this.url} reason: ${er.message}`, + 'invalid-json' + ) + } + } + + text () { + return this[CONSUME_BODY]().then(buf => buf.toString()) + } + + buffer () { + return this[CONSUME_BODY]() + } + + textConverted () { + return this[CONSUME_BODY]().then(buf => convertBody(buf, this.headers)) + } + + [CONSUME_BODY] () { + if (this[INTERNALS].disturbed) { + return Promise.reject(new TypeError(`body used already for: ${ + this.url}`)) + } + + this[INTERNALS].disturbed = true + + if (this[INTERNALS].error) { + return Promise.reject(this[INTERNALS].error) + } + + // body is null + if (this.body === null) { + return Promise.resolve(Buffer.alloc(0)) + } + + if (Buffer.isBuffer(this.body)) { + return Promise.resolve(this.body) + } + + const upstream = isBlob(this.body) ? this.body.stream() : this.body + + /* istanbul ignore if: should never happen */ + if (!Minipass.isStream(upstream)) { + return Promise.resolve(Buffer.alloc(0)) + } + + const stream = this.size && upstream instanceof MinipassSized ? upstream + : !this.size && upstream instanceof Minipass && + !(upstream instanceof MinipassSized) ? upstream + : this.size ? new MinipassSized({ size: this.size }) + : new Minipass() + + // allow timeout on slow response body, but only if the stream is still writable. this + // makes the timeout center on the socket stream from lib/index.js rather than the + // intermediary minipass stream we create to receive the data + const resTimeout = this.timeout && stream.writable ? setTimeout(() => { + stream.emit('error', new FetchError( + `Response timeout while trying to fetch ${ + this.url} (over ${this.timeout}ms)`, 'body-timeout')) + }, this.timeout) : null + + // do not keep the process open just for this timeout, even + // though we expect it'll get cleared eventually. + if (resTimeout && resTimeout.unref) { + resTimeout.unref() + } + + // do the pipe in the promise, because the pipe() can send too much + // data through right away and upset the MP Sized object + return new Promise((resolve, reject) => { + // if the stream is some other kind of stream, then pipe through a MP + // so we can collect it more easily. + if (stream !== upstream) { + upstream.on('error', er => stream.emit('error', er)) + upstream.pipe(stream) + } + resolve() + }).then(() => stream.concat()).then(buf => { + clearTimeout(resTimeout) + return buf + }).catch(er => { + clearTimeout(resTimeout) + // request was aborted, reject with this Error + if (er.name === 'AbortError' || er.name === 'FetchError') { + throw er + } else if (er.name === 'RangeError') { + throw new FetchError(`Could not create Buffer from response body for ${ + this.url}: ${er.message}`, 'system', er) + } else { + // other errors, such as incorrect content-encoding or content-length + throw new FetchError(`Invalid response body while trying to fetch ${ + this.url}: ${er.message}`, 'system', er) + } + }) + } + + static clone (instance) { + if (instance.bodyUsed) { + throw new Error('cannot clone body after it is used') + } + + const body = instance.body + + // check that body is a stream and not form-data object + // NB: can't clone the form-data object without having it as a dependency + if (Minipass.isStream(body) && typeof body.getBoundary !== 'function') { + // create a dedicated tee stream so that we don't lose data + // potentially sitting in the body stream's buffer by writing it + // immediately to p1 and not having it for p2. + const tee = new Minipass() + const p1 = new Minipass() + const p2 = new Minipass() + tee.on('error', er => { + p1.emit('error', er) + p2.emit('error', er) + }) + body.on('error', er => tee.emit('error', er)) + tee.pipe(p1) + tee.pipe(p2) + body.pipe(tee) + // set instance body to one fork, return the other + instance[INTERNALS].body = p1 + return p2 + } else { + return instance.body + } + } + + static extractContentType (body) { + return body === null || body === undefined ? null + : typeof body === 'string' ? 'text/plain;charset=UTF-8' + : isURLSearchParams(body) + ? 'application/x-www-form-urlencoded;charset=UTF-8' + : isBlob(body) ? body.type || null + : Buffer.isBuffer(body) ? null + : Object.prototype.toString.call(body) === '[object ArrayBuffer]' ? null + : ArrayBuffer.isView(body) ? null + : typeof body.getBoundary === 'function' + ? `multipart/form-data;boundary=${body.getBoundary()}` + : Minipass.isStream(body) ? null + : 'text/plain;charset=UTF-8' + } + + static getTotalBytes (instance) { + const { body } = instance + return (body === null || body === undefined) ? 0 + : isBlob(body) ? body.size + : Buffer.isBuffer(body) ? body.length + : body && typeof body.getLengthSync === 'function' && ( + // detect form data input from form-data module + body._lengthRetrievers && + /* istanbul ignore next */ body._lengthRetrievers.length === 0 || // 1.x + body.hasKnownLength && body.hasKnownLength()) // 2.x + ? body.getLengthSync() + : null + } + + static writeToStream (dest, instance) { + const { body } = instance + + if (body === null || body === undefined) { + dest.end() + } else if (Buffer.isBuffer(body) || typeof body === 'string') { + dest.end(body) + } else { + // body is stream or blob + const stream = isBlob(body) ? body.stream() : body + stream.on('error', er => dest.emit('error', er)).pipe(dest) + } + + return dest + } +} + +Object.defineProperties(Body.prototype, { + body: { enumerable: true }, + bodyUsed: { enumerable: true }, + arrayBuffer: { enumerable: true }, + blob: { enumerable: true }, + json: { enumerable: true }, + text: { enumerable: true }, +}) + +const isURLSearchParams = obj => + // Duck-typing as a necessary condition. + (typeof obj !== 'object' || + typeof obj.append !== 'function' || + typeof obj.delete !== 'function' || + typeof obj.get !== 'function' || + typeof obj.getAll !== 'function' || + typeof obj.has !== 'function' || + typeof obj.set !== 'function') ? false + // Brand-checking and more duck-typing as optional condition. + : obj.constructor.name === 'URLSearchParams' || + Object.prototype.toString.call(obj) === '[object URLSearchParams]' || + typeof obj.sort === 'function' + +const isBlob = obj => + typeof obj === 'object' && + typeof obj.arrayBuffer === 'function' && + typeof obj.type === 'string' && + typeof obj.stream === 'function' && + typeof obj.constructor === 'function' && + typeof obj.constructor.name === 'string' && + /^(Blob|File)$/.test(obj.constructor.name) && + /^(Blob|File)$/.test(obj[Symbol.toStringTag]) + +const convertBody = (buffer, headers) => { + /* istanbul ignore if */ + if (typeof convert !== 'function') { + throw new Error('The package `encoding` must be installed to use the textConverted() function') + } + + const ct = headers && headers.get('content-type') + let charset = 'utf-8' + let res + + // header + if (ct) { + res = /charset=([^;]*)/i.exec(ct) + } + + // no charset in content type, peek at response body for at most 1024 bytes + const str = buffer.slice(0, 1024).toString() + + // html5 + if (!res && str) { + res = / this.expect + ? 'max-size' : type + this.message = message + Error.captureStackTrace(this, this.constructor) + } + + get name () { + return 'FetchError' + } + + // don't allow name to be overwritten + set name (n) {} + + get [Symbol.toStringTag] () { + return 'FetchError' + } +} +module.exports = FetchError diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/headers.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/headers.js new file mode 100644 index 0000000000000..dd6e854d5ba39 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/headers.js @@ -0,0 +1,267 @@ +'use strict' +const invalidTokenRegex = /[^^_`a-zA-Z\-0-9!#$%&'*+.|~]/ +const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/ + +const validateName = name => { + name = `${name}` + if (invalidTokenRegex.test(name) || name === '') { + throw new TypeError(`${name} is not a legal HTTP header name`) + } +} + +const validateValue = value => { + value = `${value}` + if (invalidHeaderCharRegex.test(value)) { + throw new TypeError(`${value} is not a legal HTTP header value`) + } +} + +const find = (map, name) => { + name = name.toLowerCase() + for (const key in map) { + if (key.toLowerCase() === name) { + return key + } + } + return undefined +} + +const MAP = Symbol('map') +class Headers { + constructor (init = undefined) { + this[MAP] = Object.create(null) + if (init instanceof Headers) { + const rawHeaders = init.raw() + const headerNames = Object.keys(rawHeaders) + for (const headerName of headerNames) { + for (const value of rawHeaders[headerName]) { + this.append(headerName, value) + } + } + return + } + + // no-op + if (init === undefined || init === null) { + return + } + + if (typeof init === 'object') { + const method = init[Symbol.iterator] + if (method !== null && method !== undefined) { + if (typeof method !== 'function') { + throw new TypeError('Header pairs must be iterable') + } + + // sequence> + // Note: per spec we have to first exhaust the lists then process them + const pairs = [] + for (const pair of init) { + if (typeof pair !== 'object' || + typeof pair[Symbol.iterator] !== 'function') { + throw new TypeError('Each header pair must be iterable') + } + const arrPair = Array.from(pair) + if (arrPair.length !== 2) { + throw new TypeError('Each header pair must be a name/value tuple') + } + pairs.push(arrPair) + } + + for (const pair of pairs) { + this.append(pair[0], pair[1]) + } + } else { + // record + for (const key of Object.keys(init)) { + this.append(key, init[key]) + } + } + } else { + throw new TypeError('Provided initializer must be an object') + } + } + + get (name) { + name = `${name}` + validateName(name) + const key = find(this[MAP], name) + if (key === undefined) { + return null + } + + return this[MAP][key].join(', ') + } + + forEach (callback, thisArg = undefined) { + let pairs = getHeaders(this) + for (let i = 0; i < pairs.length; i++) { + const [name, value] = pairs[i] + callback.call(thisArg, value, name, this) + // refresh in case the callback added more headers + pairs = getHeaders(this) + } + } + + set (name, value) { + name = `${name}` + value = `${value}` + validateName(name) + validateValue(value) + const key = find(this[MAP], name) + this[MAP][key !== undefined ? key : name] = [value] + } + + append (name, value) { + name = `${name}` + value = `${value}` + validateName(name) + validateValue(value) + const key = find(this[MAP], name) + if (key !== undefined) { + this[MAP][key].push(value) + } else { + this[MAP][name] = [value] + } + } + + has (name) { + name = `${name}` + validateName(name) + return find(this[MAP], name) !== undefined + } + + delete (name) { + name = `${name}` + validateName(name) + const key = find(this[MAP], name) + if (key !== undefined) { + delete this[MAP][key] + } + } + + raw () { + return this[MAP] + } + + keys () { + return new HeadersIterator(this, 'key') + } + + values () { + return new HeadersIterator(this, 'value') + } + + [Symbol.iterator] () { + return new HeadersIterator(this, 'key+value') + } + + entries () { + return new HeadersIterator(this, 'key+value') + } + + get [Symbol.toStringTag] () { + return 'Headers' + } + + static exportNodeCompatibleHeaders (headers) { + const obj = Object.assign(Object.create(null), headers[MAP]) + + // http.request() only supports string as Host header. This hack makes + // specifying custom Host header possible. + const hostHeaderKey = find(headers[MAP], 'Host') + if (hostHeaderKey !== undefined) { + obj[hostHeaderKey] = obj[hostHeaderKey][0] + } + + return obj + } + + static createHeadersLenient (obj) { + const headers = new Headers() + for (const name of Object.keys(obj)) { + if (invalidTokenRegex.test(name)) { + continue + } + + if (Array.isArray(obj[name])) { + for (const val of obj[name]) { + if (invalidHeaderCharRegex.test(val)) { + continue + } + + if (headers[MAP][name] === undefined) { + headers[MAP][name] = [val] + } else { + headers[MAP][name].push(val) + } + } + } else if (!invalidHeaderCharRegex.test(obj[name])) { + headers[MAP][name] = [obj[name]] + } + } + return headers + } +} + +Object.defineProperties(Headers.prototype, { + get: { enumerable: true }, + forEach: { enumerable: true }, + set: { enumerable: true }, + append: { enumerable: true }, + has: { enumerable: true }, + delete: { enumerable: true }, + keys: { enumerable: true }, + values: { enumerable: true }, + entries: { enumerable: true }, +}) + +const getHeaders = (headers, kind = 'key+value') => + Object.keys(headers[MAP]).sort().map( + kind === 'key' ? k => k.toLowerCase() + : kind === 'value' ? k => headers[MAP][k].join(', ') + : k => [k.toLowerCase(), headers[MAP][k].join(', ')] + ) + +const INTERNAL = Symbol('internal') + +class HeadersIterator { + constructor (target, kind) { + this[INTERNAL] = { + target, + kind, + index: 0, + } + } + + get [Symbol.toStringTag] () { + return 'HeadersIterator' + } + + next () { + /* istanbul ignore if: should be impossible */ + if (!this || Object.getPrototypeOf(this) !== HeadersIterator.prototype) { + throw new TypeError('Value of `this` is not a HeadersIterator') + } + + const { target, kind, index } = this[INTERNAL] + const values = getHeaders(target, kind) + const len = values.length + if (index >= len) { + return { + value: undefined, + done: true, + } + } + + this[INTERNAL].index++ + + return { value: values[index], done: false } + } +} + +// manually extend because 'extends' requires a ctor +Object.setPrototypeOf(HeadersIterator.prototype, + Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))) + +module.exports = Headers diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/index.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/index.js new file mode 100644 index 0000000000000..b1878ac0c06b5 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/index.js @@ -0,0 +1,365 @@ +'use strict' +const { URL } = require('url') +const http = require('http') +const https = require('https') +const zlib = require('minizlib') +const Minipass = require('minipass') + +const Body = require('./body.js') +const { writeToStream, getTotalBytes } = Body +const Response = require('./response.js') +const Headers = require('./headers.js') +const { createHeadersLenient } = Headers +const Request = require('./request.js') +const { getNodeRequestOptions } = Request +const FetchError = require('./fetch-error.js') +const AbortError = require('./abort-error.js') + +// XXX this should really be split up and unit-ized for easier testing +// and better DRY implementation of data/http request aborting +const fetch = async (url, opts) => { + if (/^data:/.test(url)) { + const request = new Request(url, opts) + // delay 1 promise tick so that the consumer can abort right away + return Promise.resolve().then(() => new Promise((resolve, reject) => { + let type, data + try { + const { pathname, search } = new URL(url) + const split = pathname.split(',') + if (split.length < 2) { + throw new Error('invalid data: URI') + } + const mime = split.shift() + const base64 = /;base64$/.test(mime) + type = base64 ? mime.slice(0, -1 * ';base64'.length) : mime + const rawData = decodeURIComponent(split.join(',') + search) + data = base64 ? Buffer.from(rawData, 'base64') : Buffer.from(rawData) + } catch (er) { + return reject(new FetchError(`[${request.method}] ${ + request.url} invalid URL, ${er.message}`, 'system', er)) + } + + const { signal } = request + if (signal && signal.aborted) { + return reject(new AbortError('The user aborted a request.')) + } + + const headers = { 'Content-Length': data.length } + if (type) { + headers['Content-Type'] = type + } + return resolve(new Response(data, { headers })) + })) + } + + return new Promise((resolve, reject) => { + // build request object + const request = new Request(url, opts) + let options + try { + options = getNodeRequestOptions(request) + } catch (er) { + return reject(er) + } + + const send = (options.protocol === 'https:' ? https : http).request + const { signal } = request + let response = null + const abort = () => { + const error = new AbortError('The user aborted a request.') + reject(error) + if (Minipass.isStream(request.body) && + typeof request.body.destroy === 'function') { + request.body.destroy(error) + } + if (response && response.body) { + response.body.emit('error', error) + } + } + + if (signal && signal.aborted) { + return abort() + } + + const abortAndFinalize = () => { + abort() + finalize() + } + + const finalize = () => { + req.abort() + if (signal) { + signal.removeEventListener('abort', abortAndFinalize) + } + clearTimeout(reqTimeout) + } + + // send request + const req = send(options) + + if (signal) { + signal.addEventListener('abort', abortAndFinalize) + } + + let reqTimeout = null + if (request.timeout) { + req.once('socket', socket => { + reqTimeout = setTimeout(() => { + reject(new FetchError(`network timeout at: ${ + request.url}`, 'request-timeout')) + finalize() + }, request.timeout) + }) + } + + req.on('error', er => { + // if a 'response' event is emitted before the 'error' event, then by the + // time this handler is run it's too late to reject the Promise for the + // response. instead, we forward the error event to the response stream + // so that the error will surface to the user when they try to consume + // the body. this is done as a side effect of aborting the request except + // for in windows, where we must forward the event manually, otherwise + // there is no longer a ref'd socket attached to the request and the + // stream never ends so the event loop runs out of work and the process + // exits without warning. + // coverage skipped here due to the difficulty in testing + // istanbul ignore next + if (req.res) { + req.res.emit('error', er) + } + reject(new FetchError(`request to ${request.url} failed, reason: ${ + er.message}`, 'system', er)) + finalize() + }) + + req.on('response', res => { + clearTimeout(reqTimeout) + + const headers = createHeadersLenient(res.headers) + + // HTTP fetch step 5 + if (fetch.isRedirect(res.statusCode)) { + // HTTP fetch step 5.2 + const location = headers.get('Location') + + // HTTP fetch step 5.3 + const locationURL = location === null ? null + : (new URL(location, request.url)).toString() + + // HTTP fetch step 5.5 + if (request.redirect === 'error') { + reject(new FetchError('uri requested responds with a redirect, ' + + `redirect mode is set to error: ${request.url}`, 'no-redirect')) + finalize() + return + } else if (request.redirect === 'manual') { + // node-fetch-specific step: make manual redirect a bit easier to + // use by setting the Location header value to the resolved URL. + if (locationURL !== null) { + // handle corrupted header + try { + headers.set('Location', locationURL) + } catch (err) { + /* istanbul ignore next: nodejs server prevent invalid + response headers, we can't test this through normal + request */ + reject(err) + } + } + } else if (request.redirect === 'follow' && locationURL !== null) { + // HTTP-redirect fetch step 5 + if (request.counter >= request.follow) { + reject(new FetchError(`maximum redirect reached at: ${ + request.url}`, 'max-redirect')) + finalize() + return + } + + // HTTP-redirect fetch step 9 + if (res.statusCode !== 303 && + request.body && + getTotalBytes(request) === null) { + reject(new FetchError( + 'Cannot follow redirect with body being a readable stream', + 'unsupported-redirect' + )) + finalize() + return + } + + // Update host due to redirection + request.headers.set('host', (new URL(locationURL)).host) + + // HTTP-redirect fetch step 6 (counter increment) + // Create a new Request object. + const requestOpts = { + headers: new Headers(request.headers), + follow: request.follow, + counter: request.counter + 1, + agent: request.agent, + compress: request.compress, + method: request.method, + body: request.body, + signal: request.signal, + timeout: request.timeout, + } + + // if the redirect is to a new hostname, strip the authorization and cookie headers + const parsedOriginal = new URL(request.url) + const parsedRedirect = new URL(locationURL) + if (parsedOriginal.hostname !== parsedRedirect.hostname) { + requestOpts.headers.delete('authorization') + requestOpts.headers.delete('cookie') + } + + // HTTP-redirect fetch step 11 + if (res.statusCode === 303 || ( + (res.statusCode === 301 || res.statusCode === 302) && + request.method === 'POST' + )) { + requestOpts.method = 'GET' + requestOpts.body = undefined + requestOpts.headers.delete('content-length') + } + + // HTTP-redirect fetch step 15 + resolve(fetch(new Request(locationURL, requestOpts))) + finalize() + return + } + } // end if(isRedirect) + + // prepare response + res.once('end', () => + signal && signal.removeEventListener('abort', abortAndFinalize)) + + const body = new Minipass() + // if an error occurs, either on the response stream itself, on one of the + // decoder streams, or a response length timeout from the Body class, we + // forward the error through to our internal body stream. If we see an + // error event on that, we call finalize to abort the request and ensure + // we don't leave a socket believing a request is in flight. + // this is difficult to test, so lacks specific coverage. + body.on('error', finalize) + // exceedingly rare that the stream would have an error, + // but just in case we proxy it to the stream in use. + res.on('error', /* istanbul ignore next */ er => body.emit('error', er)) + res.on('data', (chunk) => body.write(chunk)) + res.on('end', () => body.end()) + + const responseOptions = { + url: request.url, + status: res.statusCode, + statusText: res.statusMessage, + headers: headers, + size: request.size, + timeout: request.timeout, + counter: request.counter, + trailer: new Promise(resolveTrailer => + res.on('end', () => resolveTrailer(createHeadersLenient(res.trailers)))), + } + + // HTTP-network fetch step 12.1.1.3 + const codings = headers.get('Content-Encoding') + + // HTTP-network fetch step 12.1.1.4: handle content codings + + // in following scenarios we ignore compression support + // 1. compression support is disabled + // 2. HEAD request + // 3. no Content-Encoding header + // 4. no content response (204) + // 5. content not modified response (304) + if (!request.compress || + request.method === 'HEAD' || + codings === null || + res.statusCode === 204 || + res.statusCode === 304) { + response = new Response(body, responseOptions) + resolve(response) + return + } + + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + const zlibOptions = { + flush: zlib.constants.Z_SYNC_FLUSH, + finishFlush: zlib.constants.Z_SYNC_FLUSH, + } + + // for gzip + if (codings === 'gzip' || codings === 'x-gzip') { + const unzip = new zlib.Gunzip(zlibOptions) + response = new Response( + // exceedingly rare that the stream would have an error, + // but just in case we proxy it to the stream in use. + body.on('error', /* istanbul ignore next */ er => unzip.emit('error', er)).pipe(unzip), + responseOptions + ) + resolve(response) + return + } + + // for deflate + if (codings === 'deflate' || codings === 'x-deflate') { + // handle the infamous raw deflate response from old servers + // a hack for old IIS and Apache servers + const raw = res.pipe(new Minipass()) + raw.once('data', chunk => { + // see http://stackoverflow.com/questions/37519828 + const decoder = (chunk[0] & 0x0F) === 0x08 + ? new zlib.Inflate() + : new zlib.InflateRaw() + // exceedingly rare that the stream would have an error, + // but just in case we proxy it to the stream in use. + body.on('error', /* istanbul ignore next */ er => decoder.emit('error', er)).pipe(decoder) + response = new Response(decoder, responseOptions) + resolve(response) + }) + return + } + + // for br + if (codings === 'br') { + // ignoring coverage so tests don't have to fake support (or lack of) for brotli + // istanbul ignore next + try { + var decoder = new zlib.BrotliDecompress() + } catch (err) { + reject(err) + finalize() + return + } + // exceedingly rare that the stream would have an error, + // but just in case we proxy it to the stream in use. + body.on('error', /* istanbul ignore next */ er => decoder.emit('error', er)).pipe(decoder) + response = new Response(decoder, responseOptions) + resolve(response) + return + } + + // otherwise, use response as-is + response = new Response(body, responseOptions) + resolve(response) + }) + + writeToStream(req, request) + }) +} + +module.exports = fetch + +fetch.isRedirect = code => + code === 301 || + code === 302 || + code === 303 || + code === 307 || + code === 308 + +fetch.Headers = Headers +fetch.Request = Request +fetch.Response = Response +fetch.FetchError = FetchError +fetch.AbortError = AbortError diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/request.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/request.js new file mode 100644 index 0000000000000..e620df6de2c01 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/request.js @@ -0,0 +1,281 @@ +'use strict' +const { URL } = require('url') +const Minipass = require('minipass') +const Headers = require('./headers.js') +const { exportNodeCompatibleHeaders } = Headers +const Body = require('./body.js') +const { clone, extractContentType, getTotalBytes } = Body + +const version = require('../package.json').version +const defaultUserAgent = + `minipass-fetch/${version} (+https://github.com/isaacs/minipass-fetch)` + +const INTERNALS = Symbol('Request internals') + +const isRequest = input => + typeof input === 'object' && typeof input[INTERNALS] === 'object' + +const isAbortSignal = signal => { + const proto = ( + signal + && typeof signal === 'object' + && Object.getPrototypeOf(signal) + ) + return !!(proto && proto.constructor.name === 'AbortSignal') +} + +class Request extends Body { + constructor (input, init = {}) { + const parsedURL = isRequest(input) ? new URL(input.url) + : input && input.href ? new URL(input.href) + : new URL(`${input}`) + + if (isRequest(input)) { + init = { ...input[INTERNALS], ...init } + } else if (!input || typeof input === 'string') { + input = {} + } + + const method = (init.method || input.method || 'GET').toUpperCase() + const isGETHEAD = method === 'GET' || method === 'HEAD' + + if ((init.body !== null && init.body !== undefined || + isRequest(input) && input.body !== null) && isGETHEAD) { + throw new TypeError('Request with GET/HEAD method cannot have body') + } + + const inputBody = init.body !== null && init.body !== undefined ? init.body + : isRequest(input) && input.body !== null ? clone(input) + : null + + super(inputBody, { + timeout: init.timeout || input.timeout || 0, + size: init.size || input.size || 0, + }) + + const headers = new Headers(init.headers || input.headers || {}) + + if (inputBody !== null && inputBody !== undefined && + !headers.has('Content-Type')) { + const contentType = extractContentType(inputBody) + if (contentType) { + headers.append('Content-Type', contentType) + } + } + + const signal = 'signal' in init ? init.signal + : null + + if (signal !== null && signal !== undefined && !isAbortSignal(signal)) { + throw new TypeError('Expected signal must be an instanceof AbortSignal') + } + + // TLS specific options that are handled by node + const { + ca, + cert, + ciphers, + clientCertEngine, + crl, + dhparam, + ecdhCurve, + family, + honorCipherOrder, + key, + passphrase, + pfx, + rejectUnauthorized = process.env.NODE_TLS_REJECT_UNAUTHORIZED !== '0', + secureOptions, + secureProtocol, + servername, + sessionIdContext, + } = init + + this[INTERNALS] = { + method, + redirect: init.redirect || input.redirect || 'follow', + headers, + parsedURL, + signal, + ca, + cert, + ciphers, + clientCertEngine, + crl, + dhparam, + ecdhCurve, + family, + honorCipherOrder, + key, + passphrase, + pfx, + rejectUnauthorized, + secureOptions, + secureProtocol, + servername, + sessionIdContext, + } + + // node-fetch-only options + this.follow = init.follow !== undefined ? init.follow + : input.follow !== undefined ? input.follow + : 20 + this.compress = init.compress !== undefined ? init.compress + : input.compress !== undefined ? input.compress + : true + this.counter = init.counter || input.counter || 0 + this.agent = init.agent || input.agent + } + + get method () { + return this[INTERNALS].method + } + + get url () { + return this[INTERNALS].parsedURL.toString() + } + + get headers () { + return this[INTERNALS].headers + } + + get redirect () { + return this[INTERNALS].redirect + } + + get signal () { + return this[INTERNALS].signal + } + + clone () { + return new Request(this) + } + + get [Symbol.toStringTag] () { + return 'Request' + } + + static getNodeRequestOptions (request) { + const parsedURL = request[INTERNALS].parsedURL + const headers = new Headers(request[INTERNALS].headers) + + // fetch step 1.3 + if (!headers.has('Accept')) { + headers.set('Accept', '*/*') + } + + // Basic fetch + if (!/^https?:$/.test(parsedURL.protocol)) { + throw new TypeError('Only HTTP(S) protocols are supported') + } + + if (request.signal && + Minipass.isStream(request.body) && + typeof request.body.destroy !== 'function') { + throw new Error( + 'Cancellation of streamed requests with AbortSignal is not supported') + } + + // HTTP-network-or-cache fetch steps 2.4-2.7 + const contentLengthValue = + (request.body === null || request.body === undefined) && + /^(POST|PUT)$/i.test(request.method) ? '0' + : request.body !== null && request.body !== undefined + ? getTotalBytes(request) + : null + + if (contentLengthValue) { + headers.set('Content-Length', contentLengthValue + '') + } + + // HTTP-network-or-cache fetch step 2.11 + if (!headers.has('User-Agent')) { + headers.set('User-Agent', defaultUserAgent) + } + + // HTTP-network-or-cache fetch step 2.15 + if (request.compress && !headers.has('Accept-Encoding')) { + headers.set('Accept-Encoding', 'gzip,deflate') + } + + const agent = typeof request.agent === 'function' + ? request.agent(parsedURL) + : request.agent + + if (!headers.has('Connection') && !agent) { + headers.set('Connection', 'close') + } + + // TLS specific options that are handled by node + const { + ca, + cert, + ciphers, + clientCertEngine, + crl, + dhparam, + ecdhCurve, + family, + honorCipherOrder, + key, + passphrase, + pfx, + rejectUnauthorized, + secureOptions, + secureProtocol, + servername, + sessionIdContext, + } = request[INTERNALS] + + // HTTP-network fetch step 4.2 + // chunked encoding is handled by Node.js + + // we cannot spread parsedURL directly, so we have to read each property one-by-one + // and map them to the equivalent https?.request() method options + const urlProps = { + auth: parsedURL.username || parsedURL.password + ? `${parsedURL.username}:${parsedURL.password}` + : '', + host: parsedURL.host, + hostname: parsedURL.hostname, + path: `${parsedURL.pathname}${parsedURL.search}`, + port: parsedURL.port, + protocol: parsedURL.protocol, + } + + return { + ...urlProps, + method: request.method, + headers: exportNodeCompatibleHeaders(headers), + agent, + ca, + cert, + ciphers, + clientCertEngine, + crl, + dhparam, + ecdhCurve, + family, + honorCipherOrder, + key, + passphrase, + pfx, + rejectUnauthorized, + secureOptions, + secureProtocol, + servername, + sessionIdContext, + } + } +} + +module.exports = Request + +Object.defineProperties(Request.prototype, { + method: { enumerable: true }, + url: { enumerable: true }, + headers: { enumerable: true }, + redirect: { enumerable: true }, + clone: { enumerable: true }, + signal: { enumerable: true }, +}) diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/response.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/response.js new file mode 100644 index 0000000000000..54cb52db3594a --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/response.js @@ -0,0 +1,90 @@ +'use strict' +const http = require('http') +const { STATUS_CODES } = http + +const Headers = require('./headers.js') +const Body = require('./body.js') +const { clone, extractContentType } = Body + +const INTERNALS = Symbol('Response internals') + +class Response extends Body { + constructor (body = null, opts = {}) { + super(body, opts) + + const status = opts.status || 200 + const headers = new Headers(opts.headers) + + if (body !== null && body !== undefined && !headers.has('Content-Type')) { + const contentType = extractContentType(body) + if (contentType) { + headers.append('Content-Type', contentType) + } + } + + this[INTERNALS] = { + url: opts.url, + status, + statusText: opts.statusText || STATUS_CODES[status], + headers, + counter: opts.counter, + trailer: Promise.resolve(opts.trailer || new Headers()), + } + } + + get trailer () { + return this[INTERNALS].trailer + } + + get url () { + return this[INTERNALS].url || '' + } + + get status () { + return this[INTERNALS].status + } + + get ok () { + return this[INTERNALS].status >= 200 && this[INTERNALS].status < 300 + } + + get redirected () { + return this[INTERNALS].counter > 0 + } + + get statusText () { + return this[INTERNALS].statusText + } + + get headers () { + return this[INTERNALS].headers + } + + clone () { + return new Response(clone(this), { + url: this.url, + status: this.status, + statusText: this.statusText, + headers: this.headers, + ok: this.ok, + redirected: this.redirected, + trailer: this.trailer, + }) + } + + get [Symbol.toStringTag] () { + return 'Response' + } +} + +module.exports = Response + +Object.defineProperties(Response.prototype, { + url: { enumerable: true }, + status: { enumerable: true }, + ok: { enumerable: true }, + redirected: { enumerable: true }, + statusText: { enumerable: true }, + headers: { enumerable: true }, + clone: { enumerable: true }, +}) diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/package.json b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/package.json new file mode 100644 index 0000000000000..ada5aed6d7cf6 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/package.json @@ -0,0 +1,67 @@ +{ + "name": "minipass-fetch", + "version": "2.1.2", + "description": "An implementation of window.fetch in Node.js using Minipass streams", + "license": "MIT", + "main": "lib/index.js", + "scripts": { + "test": "tap", + "snap": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "lintfix": "npm run lint -- --fix", + "prepublishOnly": "git push origin --follow-tags", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force" + }, + "tap": { + "coverage-map": "map.js", + "check-coverage": true + }, + "devDependencies": { + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.5.0", + "@ungap/url-search-params": "^0.2.2", + "abort-controller": "^3.0.0", + "abortcontroller-polyfill": "~1.7.3", + "encoding": "^0.1.13", + "form-data": "^4.0.0", + "nock": "^13.2.4", + "parted": "^0.1.1", + "string-to-arraybuffer": "^1.0.2", + "tap": "^16.0.0" + }, + "dependencies": { + "minipass": "^3.1.6", + "minipass-sized": "^1.0.3", + "minizlib": "^2.1.2" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/minipass-fetch.git" + }, + "keywords": [ + "fetch", + "minipass", + "node-fetch", + "window.fetch" + ], + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.5.0" + } +} diff --git a/node_modules/node-gyp/node_modules/minipass/LICENSE b/node_modules/@npmcli/run-script/node_modules/minipass/LICENSE similarity index 91% rename from node_modules/node-gyp/node_modules/minipass/LICENSE rename to node_modules/@npmcli/run-script/node_modules/minipass/LICENSE index 97f8e32ed82e4..bf1dece2e1f12 100644 --- a/node_modules/node-gyp/node_modules/minipass/LICENSE +++ b/node_modules/@npmcli/run-script/node_modules/minipass/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) 2017-2023 npm, Inc., Isaac Z. Schlueter, and Contributors +Copyright (c) 2017-2022 npm, Inc., Isaac Z. Schlueter, and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/node_modules/@npmcli/run-script/node_modules/minipass/index.js b/node_modules/@npmcli/run-script/node_modules/minipass/index.js new file mode 100644 index 0000000000000..e8797aab6cc27 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/minipass/index.js @@ -0,0 +1,649 @@ +'use strict' +const proc = typeof process === 'object' && process ? process : { + stdout: null, + stderr: null, +} +const EE = require('events') +const Stream = require('stream') +const SD = require('string_decoder').StringDecoder + +const EOF = Symbol('EOF') +const MAYBE_EMIT_END = Symbol('maybeEmitEnd') +const EMITTED_END = Symbol('emittedEnd') +const EMITTING_END = Symbol('emittingEnd') +const EMITTED_ERROR = Symbol('emittedError') +const CLOSED = Symbol('closed') +const READ = Symbol('read') +const FLUSH = Symbol('flush') +const FLUSHCHUNK = Symbol('flushChunk') +const ENCODING = Symbol('encoding') +const DECODER = Symbol('decoder') +const FLOWING = Symbol('flowing') +const PAUSED = Symbol('paused') +const RESUME = Symbol('resume') +const BUFFERLENGTH = Symbol('bufferLength') +const BUFFERPUSH = Symbol('bufferPush') +const BUFFERSHIFT = Symbol('bufferShift') +const OBJECTMODE = Symbol('objectMode') +const DESTROYED = Symbol('destroyed') +const EMITDATA = Symbol('emitData') +const EMITEND = Symbol('emitEnd') +const EMITEND2 = Symbol('emitEnd2') +const ASYNC = Symbol('async') + +const defer = fn => Promise.resolve().then(fn) + +// TODO remove when Node v8 support drops +const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1' +const ASYNCITERATOR = doIter && Symbol.asyncIterator + || Symbol('asyncIterator not implemented') +const ITERATOR = doIter && Symbol.iterator + || Symbol('iterator not implemented') + +// events that mean 'the stream is over' +// these are treated specially, and re-emitted +// if they are listened for after emitting. +const isEndish = ev => + ev === 'end' || + ev === 'finish' || + ev === 'prefinish' + +const isArrayBuffer = b => b instanceof ArrayBuffer || + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0 + +const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b) + +class Pipe { + constructor (src, dest, opts) { + this.src = src + this.dest = dest + this.opts = opts + this.ondrain = () => src[RESUME]() + dest.on('drain', this.ondrain) + } + unpipe () { + this.dest.removeListener('drain', this.ondrain) + } + // istanbul ignore next - only here for the prototype + proxyErrors () {} + end () { + this.unpipe() + if (this.opts.end) + this.dest.end() + } +} + +class PipeProxyErrors extends Pipe { + unpipe () { + this.src.removeListener('error', this.proxyErrors) + super.unpipe() + } + constructor (src, dest, opts) { + super(src, dest, opts) + this.proxyErrors = er => dest.emit('error', er) + src.on('error', this.proxyErrors) + } +} + +module.exports = class Minipass extends Stream { + constructor (options) { + super() + this[FLOWING] = false + // whether we're explicitly paused + this[PAUSED] = false + this.pipes = [] + this.buffer = [] + this[OBJECTMODE] = options && options.objectMode || false + if (this[OBJECTMODE]) + this[ENCODING] = null + else + this[ENCODING] = options && options.encoding || null + if (this[ENCODING] === 'buffer') + this[ENCODING] = null + this[ASYNC] = options && !!options.async || false + this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null + this[EOF] = false + this[EMITTED_END] = false + this[EMITTING_END] = false + this[CLOSED] = false + this[EMITTED_ERROR] = null + this.writable = true + this.readable = true + this[BUFFERLENGTH] = 0 + this[DESTROYED] = false + } + + get bufferLength () { return this[BUFFERLENGTH] } + + get encoding () { return this[ENCODING] } + set encoding (enc) { + if (this[OBJECTMODE]) + throw new Error('cannot set encoding in objectMode') + + if (this[ENCODING] && enc !== this[ENCODING] && + (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH])) + throw new Error('cannot change encoding') + + if (this[ENCODING] !== enc) { + this[DECODER] = enc ? new SD(enc) : null + if (this.buffer.length) + this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk)) + } + + this[ENCODING] = enc + } + + setEncoding (enc) { + this.encoding = enc + } + + get objectMode () { return this[OBJECTMODE] } + set objectMode (om) { this[OBJECTMODE] = this[OBJECTMODE] || !!om } + + get ['async'] () { return this[ASYNC] } + set ['async'] (a) { this[ASYNC] = this[ASYNC] || !!a } + + write (chunk, encoding, cb) { + if (this[EOF]) + throw new Error('write after end') + + if (this[DESTROYED]) { + this.emit('error', Object.assign( + new Error('Cannot call write after a stream was destroyed'), + { code: 'ERR_STREAM_DESTROYED' } + )) + return true + } + + if (typeof encoding === 'function') + cb = encoding, encoding = 'utf8' + + if (!encoding) + encoding = 'utf8' + + const fn = this[ASYNC] ? defer : f => f() + + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything else switches us into object mode + if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) + chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) + else if (isArrayBuffer(chunk)) + chunk = Buffer.from(chunk) + else if (typeof chunk !== 'string') + // use the setter so we throw if we have encoding set + this.objectMode = true + } + + // handle object mode up front, since it's simpler + // this yields better performance, fewer checks later. + if (this[OBJECTMODE]) { + /* istanbul ignore if - maybe impossible? */ + if (this.flowing && this[BUFFERLENGTH] !== 0) + this[FLUSH](true) + + if (this.flowing) + this.emit('data', chunk) + else + this[BUFFERPUSH](chunk) + + if (this[BUFFERLENGTH] !== 0) + this.emit('readable') + + if (cb) + fn(cb) + + return this.flowing + } + + // at this point the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!chunk.length) { + if (this[BUFFERLENGTH] !== 0) + this.emit('readable') + if (cb) + fn(cb) + return this.flowing + } + + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) { + chunk = Buffer.from(chunk, encoding) + } + + if (Buffer.isBuffer(chunk) && this[ENCODING]) + chunk = this[DECODER].write(chunk) + + // Note: flushing CAN potentially switch us into not-flowing mode + if (this.flowing && this[BUFFERLENGTH] !== 0) + this[FLUSH](true) + + if (this.flowing) + this.emit('data', chunk) + else + this[BUFFERPUSH](chunk) + + if (this[BUFFERLENGTH] !== 0) + this.emit('readable') + + if (cb) + fn(cb) + + return this.flowing + } + + read (n) { + if (this[DESTROYED]) + return null + + if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) { + this[MAYBE_EMIT_END]() + return null + } + + if (this[OBJECTMODE]) + n = null + + if (this.buffer.length > 1 && !this[OBJECTMODE]) { + if (this.encoding) + this.buffer = [this.buffer.join('')] + else + this.buffer = [Buffer.concat(this.buffer, this[BUFFERLENGTH])] + } + + const ret = this[READ](n || null, this.buffer[0]) + this[MAYBE_EMIT_END]() + return ret + } + + [READ] (n, chunk) { + if (n === chunk.length || n === null) + this[BUFFERSHIFT]() + else { + this.buffer[0] = chunk.slice(n) + chunk = chunk.slice(0, n) + this[BUFFERLENGTH] -= n + } + + this.emit('data', chunk) + + if (!this.buffer.length && !this[EOF]) + this.emit('drain') + + return chunk + } + + end (chunk, encoding, cb) { + if (typeof chunk === 'function') + cb = chunk, chunk = null + if (typeof encoding === 'function') + cb = encoding, encoding = 'utf8' + if (chunk) + this.write(chunk, encoding) + if (cb) + this.once('end', cb) + this[EOF] = true + this.writable = false + + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this.flowing || !this[PAUSED]) + this[MAYBE_EMIT_END]() + return this + } + + // don't let the internal resume be overwritten + [RESUME] () { + if (this[DESTROYED]) + return + + this[PAUSED] = false + this[FLOWING] = true + this.emit('resume') + if (this.buffer.length) + this[FLUSH]() + else if (this[EOF]) + this[MAYBE_EMIT_END]() + else + this.emit('drain') + } + + resume () { + return this[RESUME]() + } + + pause () { + this[FLOWING] = false + this[PAUSED] = true + } + + get destroyed () { + return this[DESTROYED] + } + + get flowing () { + return this[FLOWING] + } + + get paused () { + return this[PAUSED] + } + + [BUFFERPUSH] (chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1 + else + this[BUFFERLENGTH] += chunk.length + this.buffer.push(chunk) + } + + [BUFFERSHIFT] () { + if (this.buffer.length) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1 + else + this[BUFFERLENGTH] -= this.buffer[0].length + } + return this.buffer.shift() + } + + [FLUSH] (noDrain) { + do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]())) + + if (!noDrain && !this.buffer.length && !this[EOF]) + this.emit('drain') + } + + [FLUSHCHUNK] (chunk) { + return chunk ? (this.emit('data', chunk), this.flowing) : false + } + + pipe (dest, opts) { + if (this[DESTROYED]) + return + + const ended = this[EMITTED_END] + opts = opts || {} + if (dest === proc.stdout || dest === proc.stderr) + opts.end = false + else + opts.end = opts.end !== false + opts.proxyErrors = !!opts.proxyErrors + + // piping an ended stream ends immediately + if (ended) { + if (opts.end) + dest.end() + } else { + this.pipes.push(!opts.proxyErrors ? new Pipe(this, dest, opts) + : new PipeProxyErrors(this, dest, opts)) + if (this[ASYNC]) + defer(() => this[RESUME]()) + else + this[RESUME]() + } + + return dest + } + + unpipe (dest) { + const p = this.pipes.find(p => p.dest === dest) + if (p) { + this.pipes.splice(this.pipes.indexOf(p), 1) + p.unpipe() + } + } + + addListener (ev, fn) { + return this.on(ev, fn) + } + + on (ev, fn) { + const ret = super.on(ev, fn) + if (ev === 'data' && !this.pipes.length && !this.flowing) + this[RESUME]() + else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) + super.emit('readable') + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev) + this.removeAllListeners(ev) + } else if (ev === 'error' && this[EMITTED_ERROR]) { + if (this[ASYNC]) + defer(() => fn.call(this, this[EMITTED_ERROR])) + else + fn.call(this, this[EMITTED_ERROR]) + } + return ret + } + + get emittedEnd () { + return this[EMITTED_END] + } + + [MAYBE_EMIT_END] () { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this.buffer.length === 0 && + this[EOF]) { + this[EMITTING_END] = true + this.emit('end') + this.emit('prefinish') + this.emit('finish') + if (this[CLOSED]) + this.emit('close') + this[EMITTING_END] = false + } + } + + emit (ev, data, ...extra) { + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED]) + return + else if (ev === 'data') { + return !data ? false + : this[ASYNC] ? defer(() => this[EMITDATA](data)) + : this[EMITDATA](data) + } else if (ev === 'end') { + return this[EMITEND]() + } else if (ev === 'close') { + this[CLOSED] = true + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END] && !this[DESTROYED]) + return + const ret = super.emit('close') + this.removeAllListeners('close') + return ret + } else if (ev === 'error') { + this[EMITTED_ERROR] = data + const ret = super.emit('error', data) + this[MAYBE_EMIT_END]() + return ret + } else if (ev === 'resume') { + const ret = super.emit('resume') + this[MAYBE_EMIT_END]() + return ret + } else if (ev === 'finish' || ev === 'prefinish') { + const ret = super.emit(ev) + this.removeAllListeners(ev) + return ret + } + + // Some other unknown event + const ret = super.emit(ev, data, ...extra) + this[MAYBE_EMIT_END]() + return ret + } + + [EMITDATA] (data) { + for (const p of this.pipes) { + if (p.dest.write(data) === false) + this.pause() + } + const ret = super.emit('data', data) + this[MAYBE_EMIT_END]() + return ret + } + + [EMITEND] () { + if (this[EMITTED_END]) + return + + this[EMITTED_END] = true + this.readable = false + if (this[ASYNC]) + defer(() => this[EMITEND2]()) + else + this[EMITEND2]() + } + + [EMITEND2] () { + if (this[DECODER]) { + const data = this[DECODER].end() + if (data) { + for (const p of this.pipes) { + p.dest.write(data) + } + super.emit('data', data) + } + } + + for (const p of this.pipes) { + p.end() + } + const ret = super.emit('end') + this.removeAllListeners('end') + return ret + } + + // const all = await stream.collect() + collect () { + const buf = [] + if (!this[OBJECTMODE]) + buf.dataLength = 0 + // set the promise first, in case an error is raised + // by triggering the flow here. + const p = this.promise() + this.on('data', c => { + buf.push(c) + if (!this[OBJECTMODE]) + buf.dataLength += c.length + }) + return p.then(() => buf) + } + + // const data = await stream.concat() + concat () { + return this[OBJECTMODE] + ? Promise.reject(new Error('cannot concat in objectMode')) + : this.collect().then(buf => + this[OBJECTMODE] + ? Promise.reject(new Error('cannot concat in objectMode')) + : this[ENCODING] ? buf.join('') : Buffer.concat(buf, buf.dataLength)) + } + + // stream.promise().then(() => done, er => emitted error) + promise () { + return new Promise((resolve, reject) => { + this.on(DESTROYED, () => reject(new Error('stream destroyed'))) + this.on('error', er => reject(er)) + this.on('end', () => resolve()) + }) + } + + // for await (let chunk of stream) + [ASYNCITERATOR] () { + const next = () => { + const res = this.read() + if (res !== null) + return Promise.resolve({ done: false, value: res }) + + if (this[EOF]) + return Promise.resolve({ done: true }) + + let resolve = null + let reject = null + const onerr = er => { + this.removeListener('data', ondata) + this.removeListener('end', onend) + reject(er) + } + const ondata = value => { + this.removeListener('error', onerr) + this.removeListener('end', onend) + this.pause() + resolve({ value: value, done: !!this[EOF] }) + } + const onend = () => { + this.removeListener('error', onerr) + this.removeListener('data', ondata) + resolve({ done: true }) + } + const ondestroy = () => onerr(new Error('stream destroyed')) + return new Promise((res, rej) => { + reject = rej + resolve = res + this.once(DESTROYED, ondestroy) + this.once('error', onerr) + this.once('end', onend) + this.once('data', ondata) + }) + } + + return { next } + } + + // for (let chunk of stream) + [ITERATOR] () { + const next = () => { + const value = this.read() + const done = value === null + return { value, done } + } + return { next } + } + + destroy (er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er) + else + this.emit(DESTROYED) + return this + } + + this[DESTROYED] = true + + // throw away all buffered data, it's never coming out + this.buffer.length = 0 + this[BUFFERLENGTH] = 0 + + if (typeof this.close === 'function' && !this[CLOSED]) + this.close() + + if (er) + this.emit('error', er) + else // if no error to emit, still reject pending promises + this.emit(DESTROYED) + + return this + } + + static isStream (s) { + return !!s && (s instanceof Minipass || s instanceof Stream || + s instanceof EE && ( + typeof s.pipe === 'function' || // readable + (typeof s.write === 'function' && typeof s.end === 'function') // writable + )) + } +} diff --git a/node_modules/node-gyp/node_modules/minipass/package.json b/node_modules/@npmcli/run-script/node_modules/minipass/package.json similarity index 57% rename from node_modules/node-gyp/node_modules/minipass/package.json rename to node_modules/@npmcli/run-script/node_modules/minipass/package.json index 0e20e988047f2..548d03fa6d5d4 100644 --- a/node_modules/node-gyp/node_modules/minipass/package.json +++ b/node_modules/@npmcli/run-script/node_modules/minipass/package.json @@ -1,45 +1,26 @@ { "name": "minipass", - "version": "5.0.0", + "version": "3.3.6", "description": "minimal implementation of a PassThrough stream", - "main": "./index.js", - "module": "./index.mjs", - "types": "./index.d.ts", - "exports": { - ".": { - "import": { - "types": "./index.d.ts", - "default": "./index.mjs" - }, - "require": { - "types": "./index.d.ts", - "default": "./index.js" - } - }, - "./package.json": "./package.json" + "main": "index.js", + "types": "index.d.ts", + "dependencies": { + "yallist": "^4.0.0" }, "devDependencies": { "@types/node": "^17.0.41", "end-of-stream": "^1.4.0", - "node-abort-controller": "^3.1.1", "prettier": "^2.6.2", "tap": "^16.2.0", "through2": "^2.0.3", "ts-node": "^10.8.1", - "typedoc": "^0.23.24", "typescript": "^4.7.3" }, "scripts": { - "pretest": "npm run prepare", - "presnap": "npm run prepare", - "prepare": "node ./scripts/transpile-to-esm.js", - "snap": "tap", "test": "tap", "preversion": "npm test", "postversion": "npm publish", - "postpublish": "git push origin --follow-tags", - "typedoc": "typedoc ./index.d.ts", - "format": "prettier --write . --loglevel warn" + "postpublish": "git push origin --follow-tags" }, "repository": { "type": "git", @@ -53,8 +34,7 @@ "license": "ISC", "files": [ "index.d.ts", - "index.js", - "index.mjs" + "index.js" ], "tap": { "check-coverage": true diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/CONTRIBUTING.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/CONTRIBUTING.md new file mode 100644 index 0000000000000..c1c50eab4e58b --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/CONTRIBUTING.md @@ -0,0 +1,34 @@ +# Contributing to node-gyp + +## Code of Conduct + +Please read the +[Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md) +which explains the minimum behavior expectations for node-gyp contributors. + + +## Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +* (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +* (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +* (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +* (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/LICENSE b/node_modules/@npmcli/run-script/node_modules/node-gyp/LICENSE new file mode 100644 index 0000000000000..2ea4dc5efb872 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012 Nathan Rajlich + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/SECURITY.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/SECURITY.md new file mode 100644 index 0000000000000..1e168d76e3b1b --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/SECURITY.md @@ -0,0 +1,2 @@ +If you believe you have found a security issue in the software in this +repository, please consult https://github.com/nodejs/node/blob/HEAD/SECURITY.md. \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi b/node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi new file mode 100644 index 0000000000000..b4ac369acb4f1 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi @@ -0,0 +1,204 @@ +{ + 'variables' : { + 'node_engine_include_dir%': 'deps/v8/include', + 'node_host_binary%': 'node', + 'node_with_ltcg%': 'true', + }, + 'target_defaults': { + 'type': 'loadable_module', + 'win_delay_load_hook': 'true', + 'product_prefix': '', + + 'conditions': [ + [ 'node_engine=="chakracore"', { + 'variables': { + 'node_engine_include_dir%': 'deps/chakrashim/include' + }, + }] + ], + + 'include_dirs': [ + '<(node_root_dir)/include/node', + '<(node_root_dir)/src', + '<(node_root_dir)/deps/openssl/config', + '<(node_root_dir)/deps/openssl/openssl/include', + '<(node_root_dir)/deps/uv/include', + '<(node_root_dir)/deps/zlib', + '<(node_root_dir)/<(node_engine_include_dir)' + ], + 'defines!': [ + 'BUILDING_UV_SHARED=1', # Inherited from common.gypi. + 'BUILDING_V8_SHARED=1', # Inherited from common.gypi. + ], + 'defines': [ + 'NODE_GYP_MODULE_NAME=>(_target_name)', + 'USING_UV_SHARED=1', + 'USING_V8_SHARED=1', + # Warn when using deprecated V8 APIs. + 'V8_DEPRECATION_WARNINGS=1' + ], + + 'target_conditions': [ + ['_type=="loadable_module"', { + 'product_extension': 'node', + 'defines': [ + 'BUILDING_NODE_EXTENSION' + ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '-undefined dynamic_lookup' + ], + }, + }], + + ['_type=="static_library"', { + # set to `1` to *disable* the -T thin archive 'ld' flag. + # older linkers don't support this flag. + 'standalone_static_library': '<(standalone_static_library)' + }], + + ['_type!="executable"', { + 'conditions': [ + [ 'OS=="android"', { + 'cflags!': [ '-fPIE' ], + }] + ] + }], + + ['_win_delay_load_hook=="true"', { + # If the addon specifies `'win_delay_load_hook': 'true'` in its + # binding.gyp, link a delay-load hook into the DLL. This hook ensures + # that the addon will work regardless of whether the node/iojs binary + # is named node.exe, iojs.exe, or something else. + 'conditions': [ + [ 'OS=="win"', { + 'defines': [ 'HOST_BINARY=\"<(node_host_binary)<(EXECUTABLE_SUFFIX)\"', ], + 'sources': [ + '<(node_gyp_dir)/src/win_delay_load_hook.cc', + ], + 'msvs_settings': { + 'VCLinkerTool': { + 'DelayLoadDLLs': [ '<(node_host_binary)<(EXECUTABLE_SUFFIX)' ], + # Don't print a linker warning when no imports from either .exe + # are used. + 'AdditionalOptions': [ '/ignore:4199' ], + }, + }, + }], + ], + }], + ], + + 'conditions': [ + [ 'OS=="mac"', { + 'defines': [ + '_DARWIN_USE_64_BIT_INODE=1' + ], + 'xcode_settings': { + 'DYLIB_INSTALL_NAME_BASE': '@rpath' + }, + }], + [ 'OS=="aix"', { + 'ldflags': [ + '-Wl,-bimport:<(node_exp_file)' + ], + }], + [ 'OS=="os400"', { + 'ldflags': [ + '-Wl,-bimport:<(node_exp_file)' + ], + }], + [ 'OS=="zos"', { + 'conditions': [ + [ '"' + # needs to have dll-interface to be used by + # clients of class 'node::ObjectWrap' + 4251 + ], + }, { + # OS!="win" + 'defines': [ + '_LARGEFILE_SOURCE', + '_FILE_OFFSET_BITS=64' + ], + }], + [ 'OS in "freebsd openbsd netbsd solaris android" or \ + (OS=="linux" and target_arch!="ia32")', { + 'cflags': [ '-fPIC' ], + }], + ] + } +} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/bin/node-gyp.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/bin/node-gyp.js new file mode 100755 index 0000000000000..8652ea21eceeb --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/bin/node-gyp.js @@ -0,0 +1,140 @@ +#!/usr/bin/env node + +'use strict' + +process.title = 'node-gyp' + +const envPaths = require('env-paths') +const gyp = require('../') +const log = require('npmlog') +const os = require('os') + +/** + * Process and execute the selected commands. + */ + +const prog = gyp() +var completed = false +prog.parseArgv(process.argv) +prog.devDir = prog.opts.devdir + +var homeDir = os.homedir() +if (prog.devDir) { + prog.devDir = prog.devDir.replace(/^~/, homeDir) +} else if (homeDir) { + prog.devDir = envPaths('node-gyp', { suffix: '' }).cache +} else { + throw new Error( + "node-gyp requires that the user's home directory is specified " + + 'in either of the environmental variables HOME or USERPROFILE. ' + + 'Overide with: --devdir /path/to/.node-gyp') +} + +if (prog.todo.length === 0) { + if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) { + console.log('v%s', prog.version) + } else { + console.log('%s', prog.usage()) + } + process.exit(0) +} + +log.info('it worked if it ends with', 'ok') +log.verbose('cli', process.argv) +log.info('using', 'node-gyp@%s', prog.version) +log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch) + +/** + * Change dir if -C/--directory was passed. + */ + +var dir = prog.opts.directory +if (dir) { + var fs = require('fs') + try { + var stat = fs.statSync(dir) + if (stat.isDirectory()) { + log.info('chdir', dir) + process.chdir(dir) + } else { + log.warn('chdir', dir + ' is not a directory') + } + } catch (e) { + if (e.code === 'ENOENT') { + log.warn('chdir', dir + ' is not a directory') + } else { + log.warn('chdir', 'error during chdir() "%s"', e.message) + } + } +} + +function run () { + var command = prog.todo.shift() + if (!command) { + // done! + completed = true + log.info('ok') + return + } + + prog.commands[command.name](command.args, function (err) { + if (err) { + log.error(command.name + ' error') + log.error('stack', err.stack) + errorMessage() + log.error('not ok') + return process.exit(1) + } + if (command.name === 'list') { + var versions = arguments[1] + if (versions.length > 0) { + versions.forEach(function (version) { + console.log(version) + }) + } else { + console.log('No node development files installed. Use `node-gyp install` to install a version.') + } + } else if (arguments.length >= 2) { + console.log.apply(console, [].slice.call(arguments, 1)) + } + + // now run the next command in the queue + process.nextTick(run) + }) +} + +process.on('exit', function (code) { + if (!completed && !code) { + log.error('Completion callback never invoked!') + issueMessage() + process.exit(6) + } +}) + +process.on('uncaughtException', function (err) { + log.error('UNCAUGHT EXCEPTION') + log.error('stack', err.stack) + issueMessage() + process.exit(7) +}) + +function errorMessage () { + // copied from npm's lib/utils/error-handler.js + var os = require('os') + log.error('System', os.type() + ' ' + os.release()) + log.error('command', process.argv + .map(JSON.stringify).join(' ')) + log.error('cwd', process.cwd()) + log.error('node -v', process.version) + log.error('node-gyp -v', 'v' + prog.package.version) +} + +function issueMessage () { + errorMessage() + log.error('', ['Node-gyp failed to build your package.', + 'Try to update npm and/or node-gyp and if it does not help file an issue with the package author.' + ].join('\n')) +} + +// start running the given commands! +run() diff --git a/node_modules/node-gyp/docs/Error-pre-versions-of-node-cannot-be-installed.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Error-pre-versions-of-node-cannot-be-installed.md similarity index 100% rename from node_modules/node-gyp/docs/Error-pre-versions-of-node-cannot-be-installed.md rename to node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Error-pre-versions-of-node-cannot-be-installed.md diff --git a/node_modules/node-gyp/docs/Force-npm-to-use-global-node-gyp.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Force-npm-to-use-global-node-gyp.md similarity index 100% rename from node_modules/node-gyp/docs/Force-npm-to-use-global-node-gyp.md rename to node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Force-npm-to-use-global-node-gyp.md diff --git a/node_modules/node-gyp/docs/Home.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Home.md similarity index 100% rename from node_modules/node-gyp/docs/Home.md rename to node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Home.md diff --git a/node_modules/node-gyp/docs/Linking-to-OpenSSL.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Linking-to-OpenSSL.md similarity index 100% rename from node_modules/node-gyp/docs/Linking-to-OpenSSL.md rename to node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Linking-to-OpenSSL.md diff --git a/node_modules/node-gyp/docs/Updating-npm-bundled-node-gyp.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Updating-npm-bundled-node-gyp.md similarity index 100% rename from node_modules/node-gyp/docs/Updating-npm-bundled-node-gyp.md rename to node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Updating-npm-bundled-node-gyp.md diff --git a/node_modules/node-gyp/docs/binding.gyp-files-in-the-wild.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/binding.gyp-files-in-the-wild.md similarity index 100% rename from node_modules/node-gyp/docs/binding.gyp-files-in-the-wild.md rename to node_modules/@npmcli/run-script/node_modules/node-gyp/docs/binding.gyp-files-in-the-wild.md diff --git a/node_modules/node-gyp/gyp/.flake8 b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/.flake8 similarity index 100% rename from node_modules/node-gyp/gyp/.flake8 rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/.flake8 diff --git a/node_modules/node-gyp/gyp/AUTHORS b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/AUTHORS similarity index 100% rename from node_modules/node-gyp/gyp/AUTHORS rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/AUTHORS diff --git a/node_modules/node-gyp/gyp/CODE_OF_CONDUCT.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CODE_OF_CONDUCT.md similarity index 100% rename from node_modules/node-gyp/gyp/CODE_OF_CONDUCT.md rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CODE_OF_CONDUCT.md diff --git a/node_modules/node-gyp/gyp/CONTRIBUTING.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CONTRIBUTING.md similarity index 100% rename from node_modules/node-gyp/gyp/CONTRIBUTING.md rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CONTRIBUTING.md diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/LICENSE b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/LICENSE new file mode 100644 index 0000000000000..c6944c5e4ed48 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2020 Node.js contributors. All rights reserved. +Copyright (c) 2009 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc new file mode 100644 index 0000000000000..8bca510815e0a --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc @@ -0,0 +1,12 @@ +// Copyright (c) 2013 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file is used to generate an empty .pdb -- with a 4KB pagesize -- that is +// then used during the final link for modules that have large PDBs. Otherwise, +// the linker will generate a pdb with a page size of 1KB, which imposes a limit +// of 1GB on the .pdb. By generating an initial empty .pdb with the compiler +// (rather than the linker), this limit is avoided. With this in place PDBs may +// grow to 2GB. +// +// This file is referenced by the msvs_large_pdb mechanism in MSVSUtil.py. diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp new file mode 100755 index 0000000000000..1b8b9bdfb05f5 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp @@ -0,0 +1,8 @@ +#!/bin/sh +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e +base=$(dirname "$0") +exec python "${base}/gyp_main.py" "$@" diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp.bat b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp.bat new file mode 100755 index 0000000000000..c0b4ca24e5df0 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp.bat @@ -0,0 +1,5 @@ +@rem Copyright (c) 2009 Google Inc. All rights reserved. +@rem Use of this source code is governed by a BSD-style license that can be +@rem found in the LICENSE file. + +@python "%~dp0gyp_main.py" %* diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py new file mode 100755 index 0000000000000..f23dcdf882d1b --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import sys +import subprocess + + +def IsCygwin(): + # Function copied from pylib/gyp/common.py + try: + out = subprocess.Popen( + "uname", stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + stdout, _ = out.communicate() + return "CYGWIN" in stdout.decode("utf-8") + except Exception: + return False + + +def UnixifyPath(path): + try: + if not IsCygwin(): + return path + out = subprocess.Popen( + ["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + stdout, _ = out.communicate() + return stdout.decode("utf-8") + except Exception: + return path + + +# Make sure we're using the version of pylib in this repo, not one installed +# elsewhere on the system. Also convert to Unix style path on Cygwin systems, +# else the 'gyp' library will not be found +path = UnixifyPath(sys.argv[0]) +sys.path.insert(0, os.path.join(os.path.dirname(path), "pylib")) +import gyp # noqa: E402 + +if __name__ == "__main__": + sys.exit(gyp.script_main()) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py new file mode 100644 index 0000000000000..d6b189760cef9 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py @@ -0,0 +1,367 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""New implementation of Visual Studio project generation.""" + +import hashlib +import os +import random +from operator import attrgetter + +import gyp.common + + +def cmp(x, y): + return (x > y) - (x < y) + + +# Initialize random number generator +random.seed() + +# GUIDs for project types +ENTRY_TYPE_GUIDS = { + "project": "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}", + "folder": "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", +} + +# ------------------------------------------------------------------------------ +# Helper functions + + +def MakeGuid(name, seed="msvs_new"): + """Returns a GUID for the specified target name. + + Args: + name: Target name. + seed: Seed for MD5 hash. + Returns: + A GUID-line string calculated from the name and seed. + + This generates something which looks like a GUID, but depends only on the + name and seed. This means the same name/seed will always generate the same + GUID, so that projects and solutions which refer to each other can explicitly + determine the GUID to refer to explicitly. It also means that the GUID will + not change when the project for a target is rebuilt. + """ + # Calculate a MD5 signature for the seed and name. + d = hashlib.md5((str(seed) + str(name)).encode("utf-8")).hexdigest().upper() + # Convert most of the signature to GUID form (discard the rest) + guid = ( + "{" + + d[:8] + + "-" + + d[8:12] + + "-" + + d[12:16] + + "-" + + d[16:20] + + "-" + + d[20:32] + + "}" + ) + return guid + + +# ------------------------------------------------------------------------------ + + +class MSVSSolutionEntry: + def __cmp__(self, other): + # Sort by name then guid (so things are in order on vs2008). + return cmp((self.name, self.get_guid()), (other.name, other.get_guid())) + + +class MSVSFolder(MSVSSolutionEntry): + """Folder in a Visual Studio project or solution.""" + + def __init__(self, path, name=None, entries=None, guid=None, items=None): + """Initializes the folder. + + Args: + path: Full path to the folder. + name: Name of the folder. + entries: List of folder entries to nest inside this folder. May contain + Folder or Project objects. May be None, if the folder is empty. + guid: GUID to use for folder, if not None. + items: List of solution items to include in the folder project. May be + None, if the folder does not directly contain items. + """ + if name: + self.name = name + else: + # Use last layer. + self.name = os.path.basename(path) + + self.path = path + self.guid = guid + + # Copy passed lists (or set to empty lists) + self.entries = sorted(entries or [], key=attrgetter("path")) + self.items = list(items or []) + + self.entry_type_guid = ENTRY_TYPE_GUIDS["folder"] + + def get_guid(self): + if self.guid is None: + # Use consistent guids for folders (so things don't regenerate). + self.guid = MakeGuid(self.path, seed="msvs_folder") + return self.guid + + +# ------------------------------------------------------------------------------ + + +class MSVSProject(MSVSSolutionEntry): + """Visual Studio project.""" + + def __init__( + self, + path, + name=None, + dependencies=None, + guid=None, + spec=None, + build_file=None, + config_platform_overrides=None, + fixpath_prefix=None, + ): + """Initializes the project. + + Args: + path: Absolute path to the project file. + name: Name of project. If None, the name will be the same as the base + name of the project file. + dependencies: List of other Project objects this project is dependent + upon, if not None. + guid: GUID to use for project, if not None. + spec: Dictionary specifying how to build this project. + build_file: Filename of the .gyp file that the vcproj file comes from. + config_platform_overrides: optional dict of configuration platforms to + used in place of the default for this target. + fixpath_prefix: the path used to adjust the behavior of _fixpath + """ + self.path = path + self.guid = guid + self.spec = spec + self.build_file = build_file + # Use project filename if name not specified + self.name = name or os.path.splitext(os.path.basename(path))[0] + + # Copy passed lists (or set to empty lists) + self.dependencies = list(dependencies or []) + + self.entry_type_guid = ENTRY_TYPE_GUIDS["project"] + + if config_platform_overrides: + self.config_platform_overrides = config_platform_overrides + else: + self.config_platform_overrides = {} + self.fixpath_prefix = fixpath_prefix + self.msbuild_toolset = None + + def set_dependencies(self, dependencies): + self.dependencies = list(dependencies or []) + + def get_guid(self): + if self.guid is None: + # Set GUID from path + # TODO(rspangler): This is fragile. + # 1. We can't just use the project filename sans path, since there could + # be multiple projects with the same base name (for example, + # foo/unittest.vcproj and bar/unittest.vcproj). + # 2. The path needs to be relative to $SOURCE_ROOT, so that the project + # GUID is the same whether it's included from base/base.sln or + # foo/bar/baz/baz.sln. + # 3. The GUID needs to be the same each time this builder is invoked, so + # that we don't need to rebuild the solution when the project changes. + # 4. We should be able to handle pre-built project files by reading the + # GUID from the files. + self.guid = MakeGuid(self.name) + return self.guid + + def set_msbuild_toolset(self, msbuild_toolset): + self.msbuild_toolset = msbuild_toolset + + +# ------------------------------------------------------------------------------ + + +class MSVSSolution: + """Visual Studio solution.""" + + def __init__( + self, path, version, entries=None, variants=None, websiteProperties=True + ): + """Initializes the solution. + + Args: + path: Path to solution file. + version: Format version to emit. + entries: List of entries in solution. May contain Folder or Project + objects. May be None, if the folder is empty. + variants: List of build variant strings. If none, a default list will + be used. + websiteProperties: Flag to decide if the website properties section + is generated. + """ + self.path = path + self.websiteProperties = websiteProperties + self.version = version + + # Copy passed lists (or set to empty lists) + self.entries = list(entries or []) + + if variants: + # Copy passed list + self.variants = variants[:] + else: + # Use default + self.variants = ["Debug|Win32", "Release|Win32"] + # TODO(rspangler): Need to be able to handle a mapping of solution config + # to project config. Should we be able to handle variants being a dict, + # or add a separate variant_map variable? If it's a dict, we can't + # guarantee the order of variants since dict keys aren't ordered. + + # TODO(rspangler): Automatically write to disk for now; should delay until + # node-evaluation time. + self.Write() + + def Write(self, writer=gyp.common.WriteOnDiff): + """Writes the solution file to disk. + + Raises: + IndexError: An entry appears multiple times. + """ + # Walk the entry tree and collect all the folders and projects. + all_entries = set() + entries_to_check = self.entries[:] + while entries_to_check: + e = entries_to_check.pop(0) + + # If this entry has been visited, nothing to do. + if e in all_entries: + continue + + all_entries.add(e) + + # If this is a folder, check its entries too. + if isinstance(e, MSVSFolder): + entries_to_check += e.entries + + all_entries = sorted(all_entries, key=attrgetter("path")) + + # Open file and print header + f = writer(self.path) + f.write( + "Microsoft Visual Studio Solution File, " + "Format Version %s\r\n" % self.version.SolutionVersion() + ) + f.write("# %s\r\n" % self.version.Description()) + + # Project entries + sln_root = os.path.split(self.path)[0] + for e in all_entries: + relative_path = gyp.common.RelativePath(e.path, sln_root) + # msbuild does not accept an empty folder_name. + # use '.' in case relative_path is empty. + folder_name = relative_path.replace("/", "\\") or "." + f.write( + 'Project("%s") = "%s", "%s", "%s"\r\n' + % ( + e.entry_type_guid, # Entry type GUID + e.name, # Folder name + folder_name, # Folder name (again) + e.get_guid(), # Entry GUID + ) + ) + + # TODO(rspangler): Need a way to configure this stuff + if self.websiteProperties: + f.write( + "\tProjectSection(WebsiteProperties) = preProject\r\n" + '\t\tDebug.AspNetCompiler.Debug = "True"\r\n' + '\t\tRelease.AspNetCompiler.Debug = "False"\r\n' + "\tEndProjectSection\r\n" + ) + + if isinstance(e, MSVSFolder): + if e.items: + f.write("\tProjectSection(SolutionItems) = preProject\r\n") + for i in e.items: + f.write(f"\t\t{i} = {i}\r\n") + f.write("\tEndProjectSection\r\n") + + if isinstance(e, MSVSProject): + if e.dependencies: + f.write("\tProjectSection(ProjectDependencies) = postProject\r\n") + for d in e.dependencies: + f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n") + f.write("\tEndProjectSection\r\n") + + f.write("EndProject\r\n") + + # Global section + f.write("Global\r\n") + + # Configurations (variants) + f.write("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n") + for v in self.variants: + f.write(f"\t\t{v} = {v}\r\n") + f.write("\tEndGlobalSection\r\n") + + # Sort config guids for easier diffing of solution changes. + config_guids = [] + config_guids_overrides = {} + for e in all_entries: + if isinstance(e, MSVSProject): + config_guids.append(e.get_guid()) + config_guids_overrides[e.get_guid()] = e.config_platform_overrides + config_guids.sort() + + f.write("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n") + for g in config_guids: + for v in self.variants: + nv = config_guids_overrides[g].get(v, v) + # Pick which project configuration to build for this solution + # configuration. + f.write( + "\t\t%s.%s.ActiveCfg = %s\r\n" + % ( + g, # Project GUID + v, # Solution build configuration + nv, # Project build config for that solution config + ) + ) + + # Enable project in this solution configuration. + f.write( + "\t\t%s.%s.Build.0 = %s\r\n" + % ( + g, # Project GUID + v, # Solution build configuration + nv, # Project build config for that solution config + ) + ) + f.write("\tEndGlobalSection\r\n") + + # TODO(rspangler): Should be able to configure this stuff too (though I've + # never seen this be any different) + f.write("\tGlobalSection(SolutionProperties) = preSolution\r\n") + f.write("\t\tHideSolutionNode = FALSE\r\n") + f.write("\tEndGlobalSection\r\n") + + # Folder mappings + # Omit this section if there are no folders + if any([e.entries for e in all_entries if isinstance(e, MSVSFolder)]): + f.write("\tGlobalSection(NestedProjects) = preSolution\r\n") + for e in all_entries: + if not isinstance(e, MSVSFolder): + continue # Does not apply to projects, only folders + for subentry in e.entries: + f.write(f"\t\t{subentry.get_guid()} = {e.get_guid()}\r\n") + f.write("\tEndGlobalSection\r\n") + + f.write("EndGlobal\r\n") + + f.close() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py new file mode 100644 index 0000000000000..f0cfabe834909 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py @@ -0,0 +1,206 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Visual Studio project reader/writer.""" + +import gyp.easy_xml as easy_xml + +# ------------------------------------------------------------------------------ + + +class Tool: + """Visual Studio tool.""" + + def __init__(self, name, attrs=None): + """Initializes the tool. + + Args: + name: Tool name. + attrs: Dict of tool attributes; may be None. + """ + self._attrs = attrs or {} + self._attrs["Name"] = name + + def _GetSpecification(self): + """Creates an element for the tool. + + Returns: + A new xml.dom.Element for the tool. + """ + return ["Tool", self._attrs] + + +class Filter: + """Visual Studio filter - that is, a virtual folder.""" + + def __init__(self, name, contents=None): + """Initializes the folder. + + Args: + name: Filter (folder) name. + contents: List of filenames and/or Filter objects contained. + """ + self.name = name + self.contents = list(contents or []) + + +# ------------------------------------------------------------------------------ + + +class Writer: + """Visual Studio XML project writer.""" + + def __init__(self, project_path, version, name, guid=None, platforms=None): + """Initializes the project. + + Args: + project_path: Path to the project file. + version: Format version to emit. + name: Name of the project. + guid: GUID to use for project, if not None. + platforms: Array of string, the supported platforms. If null, ['Win32'] + """ + self.project_path = project_path + self.version = version + self.name = name + self.guid = guid + + # Default to Win32 for platforms. + if not platforms: + platforms = ["Win32"] + + # Initialize the specifications of the various sections. + self.platform_section = ["Platforms"] + for platform in platforms: + self.platform_section.append(["Platform", {"Name": platform}]) + self.tool_files_section = ["ToolFiles"] + self.configurations_section = ["Configurations"] + self.files_section = ["Files"] + + # Keep a dict keyed on filename to speed up access. + self.files_dict = dict() + + def AddToolFile(self, path): + """Adds a tool file to the project. + + Args: + path: Relative path from project to tool file. + """ + self.tool_files_section.append(["ToolFile", {"RelativePath": path}]) + + def _GetSpecForConfiguration(self, config_type, config_name, attrs, tools): + """Returns the specification for a configuration. + + Args: + config_type: Type of configuration node. + config_name: Configuration name. + attrs: Dict of configuration attributes; may be None. + tools: List of tools (strings or Tool objects); may be None. + Returns: + """ + # Handle defaults + if not attrs: + attrs = {} + if not tools: + tools = [] + + # Add configuration node and its attributes + node_attrs = attrs.copy() + node_attrs["Name"] = config_name + specification = [config_type, node_attrs] + + # Add tool nodes and their attributes + if tools: + for t in tools: + if isinstance(t, Tool): + specification.append(t._GetSpecification()) + else: + specification.append(Tool(t)._GetSpecification()) + return specification + + def AddConfig(self, name, attrs=None, tools=None): + """Adds a configuration to the project. + + Args: + name: Configuration name. + attrs: Dict of configuration attributes; may be None. + tools: List of tools (strings or Tool objects); may be None. + """ + spec = self._GetSpecForConfiguration("Configuration", name, attrs, tools) + self.configurations_section.append(spec) + + def _AddFilesToNode(self, parent, files): + """Adds files and/or filters to the parent node. + + Args: + parent: Destination node + files: A list of Filter objects and/or relative paths to files. + + Will call itself recursively, if the files list contains Filter objects. + """ + for f in files: + if isinstance(f, Filter): + node = ["Filter", {"Name": f.name}] + self._AddFilesToNode(node, f.contents) + else: + node = ["File", {"RelativePath": f}] + self.files_dict[f] = node + parent.append(node) + + def AddFiles(self, files): + """Adds files to the project. + + Args: + files: A list of Filter objects and/or relative paths to files. + + This makes a copy of the file/filter tree at the time of this call. If you + later add files to a Filter object which was passed into a previous call + to AddFiles(), it will not be reflected in this project. + """ + self._AddFilesToNode(self.files_section, files) + # TODO(rspangler) This also doesn't handle adding files to an existing + # filter. That is, it doesn't merge the trees. + + def AddFileConfig(self, path, config, attrs=None, tools=None): + """Adds a configuration to a file. + + Args: + path: Relative path to the file. + config: Name of configuration to add. + attrs: Dict of configuration attributes; may be None. + tools: List of tools (strings or Tool objects); may be None. + + Raises: + ValueError: Relative path does not match any file added via AddFiles(). + """ + # Find the file node with the right relative path + parent = self.files_dict.get(path) + if not parent: + raise ValueError('AddFileConfig: file "%s" not in project.' % path) + + # Add the config to the file node + spec = self._GetSpecForConfiguration("FileConfiguration", config, attrs, tools) + parent.append(spec) + + def WriteIfChanged(self): + """Writes the project file.""" + # First create XML content definition + content = [ + "VisualStudioProject", + { + "ProjectType": "Visual C++", + "Version": self.version.ProjectVersion(), + "Name": self.name, + "ProjectGUID": self.guid, + "RootNamespace": self.name, + "Keyword": "Win32Proj", + }, + self.platform_section, + self.tool_files_section, + self.configurations_section, + ["References"], # empty section + self.files_section, + ["Globals"], # empty section + ] + easy_xml.WriteXmlIfChanged(content, self.project_path, encoding="Windows-1252") diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py new file mode 100644 index 0000000000000..e89a971a3bb4f --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py @@ -0,0 +1,1270 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +r"""Code to validate and convert settings of the Microsoft build tools. + +This file contains code to validate and convert settings of the Microsoft +build tools. The function ConvertToMSBuildSettings(), ValidateMSVSSettings(), +and ValidateMSBuildSettings() are the entry points. + +This file was created by comparing the projects created by Visual Studio 2008 +and Visual Studio 2010 for all available settings through the user interface. +The MSBuild schemas were also considered. They are typically found in the +MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild +""" + +import re +import sys + +# Dictionaries of settings validators. The key is the tool name, the value is +# a dictionary mapping setting names to validation functions. +_msvs_validators = {} +_msbuild_validators = {} + + +# A dictionary of settings converters. The key is the tool name, the value is +# a dictionary mapping setting names to conversion functions. +_msvs_to_msbuild_converters = {} + + +# Tool name mapping from MSVS to MSBuild. +_msbuild_name_of_tool = {} + + +class _Tool: + """Represents a tool used by MSVS or MSBuild. + + Attributes: + msvs_name: The name of the tool in MSVS. + msbuild_name: The name of the tool in MSBuild. + """ + + def __init__(self, msvs_name, msbuild_name): + self.msvs_name = msvs_name + self.msbuild_name = msbuild_name + + +def _AddTool(tool): + """Adds a tool to the four dictionaries used to process settings. + + This only defines the tool. Each setting also needs to be added. + + Args: + tool: The _Tool object to be added. + """ + _msvs_validators[tool.msvs_name] = {} + _msbuild_validators[tool.msbuild_name] = {} + _msvs_to_msbuild_converters[tool.msvs_name] = {} + _msbuild_name_of_tool[tool.msvs_name] = tool.msbuild_name + + +def _GetMSBuildToolSettings(msbuild_settings, tool): + """Returns an MSBuild tool dictionary. Creates it if needed.""" + return msbuild_settings.setdefault(tool.msbuild_name, {}) + + +class _Type: + """Type of settings (Base class).""" + + def ValidateMSVS(self, value): + """Verifies that the value is legal for MSVS. + + Args: + value: the value to check for this type. + + Raises: + ValueError if value is not valid for MSVS. + """ + + def ValidateMSBuild(self, value): + """Verifies that the value is legal for MSBuild. + + Args: + value: the value to check for this type. + + Raises: + ValueError if value is not valid for MSBuild. + """ + + def ConvertToMSBuild(self, value): + """Returns the MSBuild equivalent of the MSVS value given. + + Args: + value: the MSVS value to convert. + + Returns: + the MSBuild equivalent. + + Raises: + ValueError if value is not valid. + """ + return value + + +class _String(_Type): + """A setting that's just a string.""" + + def ValidateMSVS(self, value): + if not isinstance(value, str): + raise ValueError("expected string; got %r" % value) + + def ValidateMSBuild(self, value): + if not isinstance(value, str): + raise ValueError("expected string; got %r" % value) + + def ConvertToMSBuild(self, value): + # Convert the macros + return ConvertVCMacrosToMSBuild(value) + + +class _StringList(_Type): + """A settings that's a list of strings.""" + + def ValidateMSVS(self, value): + if not isinstance(value, (list, str)): + raise ValueError("expected string list; got %r" % value) + + def ValidateMSBuild(self, value): + if not isinstance(value, (list, str)): + raise ValueError("expected string list; got %r" % value) + + def ConvertToMSBuild(self, value): + # Convert the macros + if isinstance(value, list): + return [ConvertVCMacrosToMSBuild(i) for i in value] + else: + return ConvertVCMacrosToMSBuild(value) + + +class _Boolean(_Type): + """Boolean settings, can have the values 'false' or 'true'.""" + + def _Validate(self, value): + if value != "true" and value != "false": + raise ValueError("expected bool; got %r" % value) + + def ValidateMSVS(self, value): + self._Validate(value) + + def ValidateMSBuild(self, value): + self._Validate(value) + + def ConvertToMSBuild(self, value): + self._Validate(value) + return value + + +class _Integer(_Type): + """Integer settings.""" + + def __init__(self, msbuild_base=10): + _Type.__init__(self) + self._msbuild_base = msbuild_base + + def ValidateMSVS(self, value): + # Try to convert, this will raise ValueError if invalid. + self.ConvertToMSBuild(value) + + def ValidateMSBuild(self, value): + # Try to convert, this will raise ValueError if invalid. + int(value, self._msbuild_base) + + def ConvertToMSBuild(self, value): + msbuild_format = (self._msbuild_base == 10) and "%d" or "0x%04x" + return msbuild_format % int(value) + + +class _Enumeration(_Type): + """Type of settings that is an enumeration. + + In MSVS, the values are indexes like '0', '1', and '2'. + MSBuild uses text labels that are more representative, like 'Win32'. + + Constructor args: + label_list: an array of MSBuild labels that correspond to the MSVS index. + In the rare cases where MSVS has skipped an index value, None is + used in the array to indicate the unused spot. + new: an array of labels that are new to MSBuild. + """ + + def __init__(self, label_list, new=None): + _Type.__init__(self) + self._label_list = label_list + self._msbuild_values = {value for value in label_list if value is not None} + if new is not None: + self._msbuild_values.update(new) + + def ValidateMSVS(self, value): + # Try to convert. It will raise an exception if not valid. + self.ConvertToMSBuild(value) + + def ValidateMSBuild(self, value): + if value not in self._msbuild_values: + raise ValueError("unrecognized enumerated value %s" % value) + + def ConvertToMSBuild(self, value): + index = int(value) + if index < 0 or index >= len(self._label_list): + raise ValueError( + "index value (%d) not in expected range [0, %d)" + % (index, len(self._label_list)) + ) + label = self._label_list[index] + if label is None: + raise ValueError("converted value for %s not specified." % value) + return label + + +# Instantiate the various generic types. +_boolean = _Boolean() +_integer = _Integer() +# For now, we don't do any special validation on these types: +_string = _String() +_file_name = _String() +_folder_name = _String() +_file_list = _StringList() +_folder_list = _StringList() +_string_list = _StringList() +# Some boolean settings went from numerical values to boolean. The +# mapping is 0: default, 1: false, 2: true. +_newly_boolean = _Enumeration(["", "false", "true"]) + + +def _Same(tool, name, setting_type): + """Defines a setting that has the same name in MSVS and MSBuild. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + name: the name of the setting. + setting_type: the type of this setting. + """ + _Renamed(tool, name, name, setting_type) + + +def _Renamed(tool, msvs_name, msbuild_name, setting_type): + """Defines a setting for which the name has changed. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + msvs_name: the name of the MSVS setting. + msbuild_name: the name of the MSBuild setting. + setting_type: the type of this setting. + """ + + def _Translate(value, msbuild_settings): + msbuild_tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool) + msbuild_tool_settings[msbuild_name] = setting_type.ConvertToMSBuild(value) + + _msvs_validators[tool.msvs_name][msvs_name] = setting_type.ValidateMSVS + _msbuild_validators[tool.msbuild_name][msbuild_name] = setting_type.ValidateMSBuild + _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate + + +def _Moved(tool, settings_name, msbuild_tool_name, setting_type): + _MovedAndRenamed( + tool, settings_name, msbuild_tool_name, settings_name, setting_type + ) + + +def _MovedAndRenamed( + tool, msvs_settings_name, msbuild_tool_name, msbuild_settings_name, setting_type +): + """Defines a setting that may have moved to a new section. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + msvs_settings_name: the MSVS name of the setting. + msbuild_tool_name: the name of the MSBuild tool to place the setting under. + msbuild_settings_name: the MSBuild name of the setting. + setting_type: the type of this setting. + """ + + def _Translate(value, msbuild_settings): + tool_settings = msbuild_settings.setdefault(msbuild_tool_name, {}) + tool_settings[msbuild_settings_name] = setting_type.ConvertToMSBuild(value) + + _msvs_validators[tool.msvs_name][msvs_settings_name] = setting_type.ValidateMSVS + validator = setting_type.ValidateMSBuild + _msbuild_validators[msbuild_tool_name][msbuild_settings_name] = validator + _msvs_to_msbuild_converters[tool.msvs_name][msvs_settings_name] = _Translate + + +def _MSVSOnly(tool, name, setting_type): + """Defines a setting that is only found in MSVS. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + name: the name of the setting. + setting_type: the type of this setting. + """ + + def _Translate(unused_value, unused_msbuild_settings): + # Since this is for MSVS only settings, no translation will happen. + pass + + _msvs_validators[tool.msvs_name][name] = setting_type.ValidateMSVS + _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate + + +def _MSBuildOnly(tool, name, setting_type): + """Defines a setting that is only found in MSBuild. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + name: the name of the setting. + setting_type: the type of this setting. + """ + + def _Translate(value, msbuild_settings): + # Let msbuild-only properties get translated as-is from msvs_settings. + tool_settings = msbuild_settings.setdefault(tool.msbuild_name, {}) + tool_settings[name] = value + + _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild + _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate + + +def _ConvertedToAdditionalOption(tool, msvs_name, flag): + """Defines a setting that's handled via a command line option in MSBuild. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + msvs_name: the name of the MSVS setting that if 'true' becomes a flag + flag: the flag to insert at the end of the AdditionalOptions + """ + + def _Translate(value, msbuild_settings): + if value == "true": + tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool) + if "AdditionalOptions" in tool_settings: + new_flags = "{} {}".format(tool_settings["AdditionalOptions"], flag) + else: + new_flags = flag + tool_settings["AdditionalOptions"] = new_flags + + _msvs_validators[tool.msvs_name][msvs_name] = _boolean.ValidateMSVS + _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate + + +def _CustomGeneratePreprocessedFile(tool, msvs_name): + def _Translate(value, msbuild_settings): + tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool) + if value == "0": + tool_settings["PreprocessToFile"] = "false" + tool_settings["PreprocessSuppressLineNumbers"] = "false" + elif value == "1": # /P + tool_settings["PreprocessToFile"] = "true" + tool_settings["PreprocessSuppressLineNumbers"] = "false" + elif value == "2": # /EP /P + tool_settings["PreprocessToFile"] = "true" + tool_settings["PreprocessSuppressLineNumbers"] = "true" + else: + raise ValueError("value must be one of [0, 1, 2]; got %s" % value) + + # Create a bogus validator that looks for '0', '1', or '2' + msvs_validator = _Enumeration(["a", "b", "c"]).ValidateMSVS + _msvs_validators[tool.msvs_name][msvs_name] = msvs_validator + msbuild_validator = _boolean.ValidateMSBuild + msbuild_tool_validators = _msbuild_validators[tool.msbuild_name] + msbuild_tool_validators["PreprocessToFile"] = msbuild_validator + msbuild_tool_validators["PreprocessSuppressLineNumbers"] = msbuild_validator + _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate + + +fix_vc_macro_slashes_regex_list = ("IntDir", "OutDir") +fix_vc_macro_slashes_regex = re.compile( + r"(\$\((?:%s)\))(?:[\\/]+)" % "|".join(fix_vc_macro_slashes_regex_list) +) + +# Regular expression to detect keys that were generated by exclusion lists +_EXCLUDED_SUFFIX_RE = re.compile("^(.*)_excluded$") + + +def _ValidateExclusionSetting(setting, settings, error_msg, stderr=sys.stderr): + """Verify that 'setting' is valid if it is generated from an exclusion list. + + If the setting appears to be generated from an exclusion list, the root name + is checked. + + Args: + setting: A string that is the setting name to validate + settings: A dictionary where the keys are valid settings + error_msg: The message to emit in the event of error + stderr: The stream receiving the error messages. + """ + # This may be unrecognized because it's an exclusion list. If the + # setting name has the _excluded suffix, then check the root name. + unrecognized = True + m = re.match(_EXCLUDED_SUFFIX_RE, setting) + if m: + root_setting = m.group(1) + unrecognized = root_setting not in settings + + if unrecognized: + # We don't know this setting. Give a warning. + print(error_msg, file=stderr) + + +def FixVCMacroSlashes(s): + """Replace macros which have excessive following slashes. + + These macros are known to have a built-in trailing slash. Furthermore, many + scripts hiccup on processing paths with extra slashes in the middle. + + This list is probably not exhaustive. Add as needed. + """ + if "$" in s: + s = fix_vc_macro_slashes_regex.sub(r"\1", s) + return s + + +def ConvertVCMacrosToMSBuild(s): + """Convert the MSVS macros found in the string to the MSBuild equivalent. + + This list is probably not exhaustive. Add as needed. + """ + if "$" in s: + replace_map = { + "$(ConfigurationName)": "$(Configuration)", + "$(InputDir)": "%(RelativeDir)", + "$(InputExt)": "%(Extension)", + "$(InputFileName)": "%(Filename)%(Extension)", + "$(InputName)": "%(Filename)", + "$(InputPath)": "%(Identity)", + "$(ParentName)": "$(ProjectFileName)", + "$(PlatformName)": "$(Platform)", + "$(SafeInputName)": "%(Filename)", + } + for old, new in replace_map.items(): + s = s.replace(old, new) + s = FixVCMacroSlashes(s) + return s + + +def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr): + """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+). + + Args: + msvs_settings: A dictionary. The key is the tool name. The values are + themselves dictionaries of settings and their values. + stderr: The stream receiving the error messages. + + Returns: + A dictionary of MSBuild settings. The key is either the MSBuild tool name + or the empty string (for the global settings). The values are themselves + dictionaries of settings and their values. + """ + msbuild_settings = {} + for msvs_tool_name, msvs_tool_settings in msvs_settings.items(): + if msvs_tool_name in _msvs_to_msbuild_converters: + msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name] + for msvs_setting, msvs_value in msvs_tool_settings.items(): + if msvs_setting in msvs_tool: + # Invoke the translation function. + try: + msvs_tool[msvs_setting](msvs_value, msbuild_settings) + except ValueError as e: + print( + "Warning: while converting %s/%s to MSBuild, " + "%s" % (msvs_tool_name, msvs_setting, e), + file=stderr, + ) + else: + _ValidateExclusionSetting( + msvs_setting, + msvs_tool, + ( + "Warning: unrecognized setting %s/%s " + "while converting to MSBuild." + % (msvs_tool_name, msvs_setting) + ), + stderr, + ) + else: + print( + "Warning: unrecognized tool %s while converting to " + "MSBuild." % msvs_tool_name, + file=stderr, + ) + return msbuild_settings + + +def ValidateMSVSSettings(settings, stderr=sys.stderr): + """Validates that the names of the settings are valid for MSVS. + + Args: + settings: A dictionary. The key is the tool name. The values are + themselves dictionaries of settings and their values. + stderr: The stream receiving the error messages. + """ + _ValidateSettings(_msvs_validators, settings, stderr) + + +def ValidateMSBuildSettings(settings, stderr=sys.stderr): + """Validates that the names of the settings are valid for MSBuild. + + Args: + settings: A dictionary. The key is the tool name. The values are + themselves dictionaries of settings and their values. + stderr: The stream receiving the error messages. + """ + _ValidateSettings(_msbuild_validators, settings, stderr) + + +def _ValidateSettings(validators, settings, stderr): + """Validates that the settings are valid for MSBuild or MSVS. + + We currently only validate the names of the settings, not their values. + + Args: + validators: A dictionary of tools and their validators. + settings: A dictionary. The key is the tool name. The values are + themselves dictionaries of settings and their values. + stderr: The stream receiving the error messages. + """ + for tool_name in settings: + if tool_name in validators: + tool_validators = validators[tool_name] + for setting, value in settings[tool_name].items(): + if setting in tool_validators: + try: + tool_validators[setting](value) + except ValueError as e: + print( + f"Warning: for {tool_name}/{setting}, {e}", + file=stderr, + ) + else: + _ValidateExclusionSetting( + setting, + tool_validators, + (f"Warning: unrecognized setting {tool_name}/{setting}"), + stderr, + ) + + else: + print("Warning: unrecognized tool %s" % (tool_name), file=stderr) + + +# MSVS and MBuild names of the tools. +_compile = _Tool("VCCLCompilerTool", "ClCompile") +_link = _Tool("VCLinkerTool", "Link") +_midl = _Tool("VCMIDLTool", "Midl") +_rc = _Tool("VCResourceCompilerTool", "ResourceCompile") +_lib = _Tool("VCLibrarianTool", "Lib") +_manifest = _Tool("VCManifestTool", "Manifest") +_masm = _Tool("MASM", "MASM") +_armasm = _Tool("ARMASM", "ARMASM") + + +_AddTool(_compile) +_AddTool(_link) +_AddTool(_midl) +_AddTool(_rc) +_AddTool(_lib) +_AddTool(_manifest) +_AddTool(_masm) +_AddTool(_armasm) +# Add sections only found in the MSBuild settings. +_msbuild_validators[""] = {} +_msbuild_validators["ProjectReference"] = {} +_msbuild_validators["ManifestResourceCompile"] = {} + +# Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and +# ClCompile in MSBuild. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for +# the schema of the MSBuild ClCompile settings. + +# Options that have the same name in MSVS and MSBuild +_Same(_compile, "AdditionalIncludeDirectories", _folder_list) # /I +_Same(_compile, "AdditionalOptions", _string_list) +_Same(_compile, "AdditionalUsingDirectories", _folder_list) # /AI +_Same(_compile, "AssemblerListingLocation", _file_name) # /Fa +_Same(_compile, "BrowseInformationFile", _file_name) +_Same(_compile, "BufferSecurityCheck", _boolean) # /GS +_Same(_compile, "DisableLanguageExtensions", _boolean) # /Za +_Same(_compile, "DisableSpecificWarnings", _string_list) # /wd +_Same(_compile, "EnableFiberSafeOptimizations", _boolean) # /GT +_Same(_compile, "EnablePREfast", _boolean) # /analyze Visible='false' +_Same(_compile, "ExpandAttributedSource", _boolean) # /Fx +_Same(_compile, "FloatingPointExceptions", _boolean) # /fp:except +_Same(_compile, "ForceConformanceInForLoopScope", _boolean) # /Zc:forScope +_Same(_compile, "ForcedIncludeFiles", _file_list) # /FI +_Same(_compile, "ForcedUsingFiles", _file_list) # /FU +_Same(_compile, "GenerateXMLDocumentationFiles", _boolean) # /doc +_Same(_compile, "IgnoreStandardIncludePath", _boolean) # /X +_Same(_compile, "MinimalRebuild", _boolean) # /Gm +_Same(_compile, "OmitDefaultLibName", _boolean) # /Zl +_Same(_compile, "OmitFramePointers", _boolean) # /Oy +_Same(_compile, "PreprocessorDefinitions", _string_list) # /D +_Same(_compile, "ProgramDataBaseFileName", _file_name) # /Fd +_Same(_compile, "RuntimeTypeInfo", _boolean) # /GR +_Same(_compile, "ShowIncludes", _boolean) # /showIncludes +_Same(_compile, "SmallerTypeCheck", _boolean) # /RTCc +_Same(_compile, "StringPooling", _boolean) # /GF +_Same(_compile, "SuppressStartupBanner", _boolean) # /nologo +_Same(_compile, "TreatWChar_tAsBuiltInType", _boolean) # /Zc:wchar_t +_Same(_compile, "UndefineAllPreprocessorDefinitions", _boolean) # /u +_Same(_compile, "UndefinePreprocessorDefinitions", _string_list) # /U +_Same(_compile, "UseFullPaths", _boolean) # /FC +_Same(_compile, "WholeProgramOptimization", _boolean) # /GL +_Same(_compile, "XMLDocumentationFileName", _file_name) +_Same(_compile, "CompileAsWinRT", _boolean) # /ZW + +_Same( + _compile, + "AssemblerOutput", + _Enumeration( + [ + "NoListing", + "AssemblyCode", # /FA + "All", # /FAcs + "AssemblyAndMachineCode", # /FAc + "AssemblyAndSourceCode", + ] + ), +) # /FAs +_Same( + _compile, + "BasicRuntimeChecks", + _Enumeration( + [ + "Default", + "StackFrameRuntimeCheck", # /RTCs + "UninitializedLocalUsageCheck", # /RTCu + "EnableFastChecks", + ] + ), +) # /RTC1 +_Same( + _compile, "BrowseInformation", _Enumeration(["false", "true", "true"]) # /FR +) # /Fr +_Same( + _compile, + "CallingConvention", + _Enumeration(["Cdecl", "FastCall", "StdCall", "VectorCall"]), # /Gd # /Gr # /Gz +) # /Gv +_Same( + _compile, + "CompileAs", + _Enumeration(["Default", "CompileAsC", "CompileAsCpp"]), # /TC +) # /TP +_Same( + _compile, + "DebugInformationFormat", + _Enumeration( + [ + "", # Disabled + "OldStyle", # /Z7 + None, + "ProgramDatabase", # /Zi + "EditAndContinue", + ] + ), +) # /ZI +_Same( + _compile, + "EnableEnhancedInstructionSet", + _Enumeration( + [ + "NotSet", + "StreamingSIMDExtensions", # /arch:SSE + "StreamingSIMDExtensions2", # /arch:SSE2 + "AdvancedVectorExtensions", # /arch:AVX (vs2012+) + "NoExtensions", # /arch:IA32 (vs2012+) + # This one only exists in the new msbuild format. + "AdvancedVectorExtensions2", # /arch:AVX2 (vs2013r2+) + ] + ), +) +_Same( + _compile, + "ErrorReporting", + _Enumeration( + [ + "None", # /errorReport:none + "Prompt", # /errorReport:prompt + "Queue", + ], # /errorReport:queue + new=["Send"], + ), +) # /errorReport:send" +_Same( + _compile, + "ExceptionHandling", + _Enumeration(["false", "Sync", "Async"], new=["SyncCThrow"]), # /EHsc # /EHa +) # /EHs +_Same( + _compile, "FavorSizeOrSpeed", _Enumeration(["Neither", "Speed", "Size"]) # /Ot +) # /Os +_Same( + _compile, + "FloatingPointModel", + _Enumeration(["Precise", "Strict", "Fast"]), # /fp:precise # /fp:strict +) # /fp:fast +_Same( + _compile, + "InlineFunctionExpansion", + _Enumeration( + ["Default", "OnlyExplicitInline", "AnySuitable"], # /Ob1 # /Ob2 + new=["Disabled"], + ), +) # /Ob0 +_Same( + _compile, + "Optimization", + _Enumeration(["Disabled", "MinSpace", "MaxSpeed", "Full"]), # /Od # /O1 # /O2 +) # /Ox +_Same( + _compile, + "RuntimeLibrary", + _Enumeration( + [ + "MultiThreaded", # /MT + "MultiThreadedDebug", # /MTd + "MultiThreadedDLL", # /MD + "MultiThreadedDebugDLL", + ] + ), +) # /MDd +_Same( + _compile, + "StructMemberAlignment", + _Enumeration( + [ + "Default", + "1Byte", # /Zp1 + "2Bytes", # /Zp2 + "4Bytes", # /Zp4 + "8Bytes", # /Zp8 + "16Bytes", + ] + ), +) # /Zp16 +_Same( + _compile, + "WarningLevel", + _Enumeration( + [ + "TurnOffAllWarnings", # /W0 + "Level1", # /W1 + "Level2", # /W2 + "Level3", # /W3 + "Level4", + ], # /W4 + new=["EnableAllWarnings"], + ), +) # /Wall + +# Options found in MSVS that have been renamed in MSBuild. +_Renamed( + _compile, "EnableFunctionLevelLinking", "FunctionLevelLinking", _boolean +) # /Gy +_Renamed(_compile, "EnableIntrinsicFunctions", "IntrinsicFunctions", _boolean) # /Oi +_Renamed(_compile, "KeepComments", "PreprocessKeepComments", _boolean) # /C +_Renamed(_compile, "ObjectFile", "ObjectFileName", _file_name) # /Fo +_Renamed(_compile, "OpenMP", "OpenMPSupport", _boolean) # /openmp +_Renamed( + _compile, "PrecompiledHeaderThrough", "PrecompiledHeaderFile", _file_name +) # Used with /Yc and /Yu +_Renamed( + _compile, "PrecompiledHeaderFile", "PrecompiledHeaderOutputFile", _file_name +) # /Fp +_Renamed( + _compile, + "UsePrecompiledHeader", + "PrecompiledHeader", + _Enumeration( + ["NotUsing", "Create", "Use"] # VS recognized '' for this value too. # /Yc + ), +) # /Yu +_Renamed(_compile, "WarnAsError", "TreatWarningAsError", _boolean) # /WX + +_ConvertedToAdditionalOption(_compile, "DefaultCharIsUnsigned", "/J") + +# MSVS options not found in MSBuild. +_MSVSOnly(_compile, "Detect64BitPortabilityProblems", _boolean) +_MSVSOnly(_compile, "UseUnicodeResponseFiles", _boolean) + +# MSBuild options not found in MSVS. +_MSBuildOnly(_compile, "BuildingInIDE", _boolean) +_MSBuildOnly( + _compile, "CompileAsManaged", _Enumeration([], new=["false", "true"]) +) # /clr +_MSBuildOnly(_compile, "CreateHotpatchableImage", _boolean) # /hotpatch +_MSBuildOnly(_compile, "MultiProcessorCompilation", _boolean) # /MP +_MSBuildOnly(_compile, "PreprocessOutputPath", _string) # /Fi +_MSBuildOnly(_compile, "ProcessorNumber", _integer) # the number of processors +_MSBuildOnly(_compile, "TrackerLogDirectory", _folder_name) +_MSBuildOnly(_compile, "TreatSpecificWarningsAsErrors", _string_list) # /we +_MSBuildOnly(_compile, "UseUnicodeForAssemblerListing", _boolean) # /FAu + +# Defines a setting that needs very customized processing +_CustomGeneratePreprocessedFile(_compile, "GeneratePreprocessedFile") + + +# Directives for converting MSVS VCLinkerTool to MSBuild Link. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\link.xml" for +# the schema of the MSBuild Link settings. + +# Options that have the same name in MSVS and MSBuild +_Same(_link, "AdditionalDependencies", _file_list) +_Same(_link, "AdditionalLibraryDirectories", _folder_list) # /LIBPATH +# /MANIFESTDEPENDENCY: +_Same(_link, "AdditionalManifestDependencies", _file_list) +_Same(_link, "AdditionalOptions", _string_list) +_Same(_link, "AddModuleNamesToAssembly", _file_list) # /ASSEMBLYMODULE +_Same(_link, "AllowIsolation", _boolean) # /ALLOWISOLATION +_Same(_link, "AssemblyLinkResource", _file_list) # /ASSEMBLYLINKRESOURCE +_Same(_link, "BaseAddress", _string) # /BASE +_Same(_link, "CLRUnmanagedCodeCheck", _boolean) # /CLRUNMANAGEDCODECHECK +_Same(_link, "DelayLoadDLLs", _file_list) # /DELAYLOAD +_Same(_link, "DelaySign", _boolean) # /DELAYSIGN +_Same(_link, "EmbedManagedResourceFile", _file_list) # /ASSEMBLYRESOURCE +_Same(_link, "EnableUAC", _boolean) # /MANIFESTUAC +_Same(_link, "EntryPointSymbol", _string) # /ENTRY +_Same(_link, "ForceSymbolReferences", _file_list) # /INCLUDE +_Same(_link, "FunctionOrder", _file_name) # /ORDER +_Same(_link, "GenerateDebugInformation", _boolean) # /DEBUG +_Same(_link, "GenerateMapFile", _boolean) # /MAP +_Same(_link, "HeapCommitSize", _string) +_Same(_link, "HeapReserveSize", _string) # /HEAP +_Same(_link, "IgnoreAllDefaultLibraries", _boolean) # /NODEFAULTLIB +_Same(_link, "IgnoreEmbeddedIDL", _boolean) # /IGNOREIDL +_Same(_link, "ImportLibrary", _file_name) # /IMPLIB +_Same(_link, "KeyContainer", _file_name) # /KEYCONTAINER +_Same(_link, "KeyFile", _file_name) # /KEYFILE +_Same(_link, "ManifestFile", _file_name) # /ManifestFile +_Same(_link, "MapExports", _boolean) # /MAPINFO:EXPORTS +_Same(_link, "MapFileName", _file_name) +_Same(_link, "MergedIDLBaseFileName", _file_name) # /IDLOUT +_Same(_link, "MergeSections", _string) # /MERGE +_Same(_link, "MidlCommandFile", _file_name) # /MIDL +_Same(_link, "ModuleDefinitionFile", _file_name) # /DEF +_Same(_link, "OutputFile", _file_name) # /OUT +_Same(_link, "PerUserRedirection", _boolean) +_Same(_link, "Profile", _boolean) # /PROFILE +_Same(_link, "ProfileGuidedDatabase", _file_name) # /PGD +_Same(_link, "ProgramDatabaseFile", _file_name) # /PDB +_Same(_link, "RegisterOutput", _boolean) +_Same(_link, "SetChecksum", _boolean) # /RELEASE +_Same(_link, "StackCommitSize", _string) +_Same(_link, "StackReserveSize", _string) # /STACK +_Same(_link, "StripPrivateSymbols", _file_name) # /PDBSTRIPPED +_Same(_link, "SupportUnloadOfDelayLoadedDLL", _boolean) # /DELAY:UNLOAD +_Same(_link, "SuppressStartupBanner", _boolean) # /NOLOGO +_Same(_link, "SwapRunFromCD", _boolean) # /SWAPRUN:CD +_Same(_link, "TurnOffAssemblyGeneration", _boolean) # /NOASSEMBLY +_Same(_link, "TypeLibraryFile", _file_name) # /TLBOUT +_Same(_link, "TypeLibraryResourceID", _integer) # /TLBID +_Same(_link, "UACUIAccess", _boolean) # /uiAccess='true' +_Same(_link, "Version", _string) # /VERSION + +_Same(_link, "EnableCOMDATFolding", _newly_boolean) # /OPT:ICF +_Same(_link, "FixedBaseAddress", _newly_boolean) # /FIXED +_Same(_link, "LargeAddressAware", _newly_boolean) # /LARGEADDRESSAWARE +_Same(_link, "OptimizeReferences", _newly_boolean) # /OPT:REF +_Same(_link, "RandomizedBaseAddress", _newly_boolean) # /DYNAMICBASE +_Same(_link, "TerminalServerAware", _newly_boolean) # /TSAWARE + +_subsystem_enumeration = _Enumeration( + [ + "NotSet", + "Console", # /SUBSYSTEM:CONSOLE + "Windows", # /SUBSYSTEM:WINDOWS + "Native", # /SUBSYSTEM:NATIVE + "EFI Application", # /SUBSYSTEM:EFI_APPLICATION + "EFI Boot Service Driver", # /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER + "EFI ROM", # /SUBSYSTEM:EFI_ROM + "EFI Runtime", # /SUBSYSTEM:EFI_RUNTIME_DRIVER + "WindowsCE", + ], # /SUBSYSTEM:WINDOWSCE + new=["POSIX"], +) # /SUBSYSTEM:POSIX + +_target_machine_enumeration = _Enumeration( + [ + "NotSet", + "MachineX86", # /MACHINE:X86 + None, + "MachineARM", # /MACHINE:ARM + "MachineEBC", # /MACHINE:EBC + "MachineIA64", # /MACHINE:IA64 + None, + "MachineMIPS", # /MACHINE:MIPS + "MachineMIPS16", # /MACHINE:MIPS16 + "MachineMIPSFPU", # /MACHINE:MIPSFPU + "MachineMIPSFPU16", # /MACHINE:MIPSFPU16 + None, + None, + None, + "MachineSH4", # /MACHINE:SH4 + None, + "MachineTHUMB", # /MACHINE:THUMB + "MachineX64", + ] +) # /MACHINE:X64 + +_Same( + _link, "AssemblyDebug", _Enumeration(["", "true", "false"]) # /ASSEMBLYDEBUG +) # /ASSEMBLYDEBUG:DISABLE +_Same( + _link, + "CLRImageType", + _Enumeration( + [ + "Default", + "ForceIJWImage", # /CLRIMAGETYPE:IJW + "ForcePureILImage", # /Switch="CLRIMAGETYPE:PURE + "ForceSafeILImage", + ] + ), +) # /Switch="CLRIMAGETYPE:SAFE +_Same( + _link, + "CLRThreadAttribute", + _Enumeration( + [ + "DefaultThreadingAttribute", # /CLRTHREADATTRIBUTE:NONE + "MTAThreadingAttribute", # /CLRTHREADATTRIBUTE:MTA + "STAThreadingAttribute", + ] + ), +) # /CLRTHREADATTRIBUTE:STA +_Same( + _link, + "DataExecutionPrevention", + _Enumeration(["", "false", "true"]), # /NXCOMPAT:NO +) # /NXCOMPAT +_Same( + _link, + "Driver", + _Enumeration(["NotSet", "Driver", "UpOnly", "WDM"]), # /Driver # /DRIVER:UPONLY +) # /DRIVER:WDM +_Same( + _link, + "LinkTimeCodeGeneration", + _Enumeration( + [ + "Default", + "UseLinkTimeCodeGeneration", # /LTCG + "PGInstrument", # /LTCG:PGInstrument + "PGOptimization", # /LTCG:PGOptimize + "PGUpdate", + ] + ), +) # /LTCG:PGUpdate +_Same( + _link, + "ShowProgress", + _Enumeration( + ["NotSet", "LinkVerbose", "LinkVerboseLib"], # /VERBOSE # /VERBOSE:Lib + new=[ + "LinkVerboseICF", # /VERBOSE:ICF + "LinkVerboseREF", # /VERBOSE:REF + "LinkVerboseSAFESEH", # /VERBOSE:SAFESEH + "LinkVerboseCLR", + ], + ), +) # /VERBOSE:CLR +_Same(_link, "SubSystem", _subsystem_enumeration) +_Same(_link, "TargetMachine", _target_machine_enumeration) +_Same( + _link, + "UACExecutionLevel", + _Enumeration( + [ + "AsInvoker", # /level='asInvoker' + "HighestAvailable", # /level='highestAvailable' + "RequireAdministrator", + ] + ), +) # /level='requireAdministrator' +_Same(_link, "MinimumRequiredVersion", _string) +_Same(_link, "TreatLinkerWarningAsErrors", _boolean) # /WX + + +# Options found in MSVS that have been renamed in MSBuild. +_Renamed( + _link, + "ErrorReporting", + "LinkErrorReporting", + _Enumeration( + [ + "NoErrorReport", # /ERRORREPORT:NONE + "PromptImmediately", # /ERRORREPORT:PROMPT + "QueueForNextLogin", + ], # /ERRORREPORT:QUEUE + new=["SendErrorReport"], + ), +) # /ERRORREPORT:SEND +_Renamed( + _link, "IgnoreDefaultLibraryNames", "IgnoreSpecificDefaultLibraries", _file_list +) # /NODEFAULTLIB +_Renamed(_link, "ResourceOnlyDLL", "NoEntryPoint", _boolean) # /NOENTRY +_Renamed(_link, "SwapRunFromNet", "SwapRunFromNET", _boolean) # /SWAPRUN:NET + +_Moved(_link, "GenerateManifest", "", _boolean) +_Moved(_link, "IgnoreImportLibrary", "", _boolean) +_Moved(_link, "LinkIncremental", "", _newly_boolean) +_Moved(_link, "LinkLibraryDependencies", "ProjectReference", _boolean) +_Moved(_link, "UseLibraryDependencyInputs", "ProjectReference", _boolean) + +# MSVS options not found in MSBuild. +_MSVSOnly(_link, "OptimizeForWindows98", _newly_boolean) +_MSVSOnly(_link, "UseUnicodeResponseFiles", _boolean) + +# MSBuild options not found in MSVS. +_MSBuildOnly(_link, "BuildingInIDE", _boolean) +_MSBuildOnly(_link, "ImageHasSafeExceptionHandlers", _boolean) # /SAFESEH +_MSBuildOnly(_link, "LinkDLL", _boolean) # /DLL Visible='false' +_MSBuildOnly(_link, "LinkStatus", _boolean) # /LTCG:STATUS +_MSBuildOnly(_link, "PreventDllBinding", _boolean) # /ALLOWBIND +_MSBuildOnly(_link, "SupportNobindOfDelayLoadedDLL", _boolean) # /DELAY:NOBIND +_MSBuildOnly(_link, "TrackerLogDirectory", _folder_name) +_MSBuildOnly(_link, "MSDOSStubFileName", _file_name) # /STUB Visible='false' +_MSBuildOnly(_link, "SectionAlignment", _integer) # /ALIGN +_MSBuildOnly(_link, "SpecifySectionAttributes", _string) # /SECTION +_MSBuildOnly( + _link, + "ForceFileOutput", + _Enumeration( + [], + new=[ + "Enabled", # /FORCE + # /FORCE:MULTIPLE + "MultiplyDefinedSymbolOnly", + "UndefinedSymbolOnly", + ], + ), +) # /FORCE:UNRESOLVED +_MSBuildOnly( + _link, + "CreateHotPatchableImage", + _Enumeration( + [], + new=[ + "Enabled", # /FUNCTIONPADMIN + "X86Image", # /FUNCTIONPADMIN:5 + "X64Image", # /FUNCTIONPADMIN:6 + "ItaniumImage", + ], + ), +) # /FUNCTIONPADMIN:16 +_MSBuildOnly( + _link, + "CLRSupportLastError", + _Enumeration( + [], + new=[ + "Enabled", # /CLRSupportLastError + "Disabled", # /CLRSupportLastError:NO + # /CLRSupportLastError:SYSTEMDLL + "SystemDlls", + ], + ), +) + + +# Directives for converting VCResourceCompilerTool to ResourceCompile. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\rc.xml" for +# the schema of the MSBuild ResourceCompile settings. + +_Same(_rc, "AdditionalOptions", _string_list) +_Same(_rc, "AdditionalIncludeDirectories", _folder_list) # /I +_Same(_rc, "Culture", _Integer(msbuild_base=16)) +_Same(_rc, "IgnoreStandardIncludePath", _boolean) # /X +_Same(_rc, "PreprocessorDefinitions", _string_list) # /D +_Same(_rc, "ResourceOutputFileName", _string) # /fo +_Same(_rc, "ShowProgress", _boolean) # /v +# There is no UI in VisualStudio 2008 to set the following properties. +# However they are found in CL and other tools. Include them here for +# completeness, as they are very likely to have the same usage pattern. +_Same(_rc, "SuppressStartupBanner", _boolean) # /nologo +_Same(_rc, "UndefinePreprocessorDefinitions", _string_list) # /u + +# MSBuild options not found in MSVS. +_MSBuildOnly(_rc, "NullTerminateStrings", _boolean) # /n +_MSBuildOnly(_rc, "TrackerLogDirectory", _folder_name) + + +# Directives for converting VCMIDLTool to Midl. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\midl.xml" for +# the schema of the MSBuild Midl settings. + +_Same(_midl, "AdditionalIncludeDirectories", _folder_list) # /I +_Same(_midl, "AdditionalOptions", _string_list) +_Same(_midl, "CPreprocessOptions", _string) # /cpp_opt +_Same(_midl, "ErrorCheckAllocations", _boolean) # /error allocation +_Same(_midl, "ErrorCheckBounds", _boolean) # /error bounds_check +_Same(_midl, "ErrorCheckEnumRange", _boolean) # /error enum +_Same(_midl, "ErrorCheckRefPointers", _boolean) # /error ref +_Same(_midl, "ErrorCheckStubData", _boolean) # /error stub_data +_Same(_midl, "GenerateStublessProxies", _boolean) # /Oicf +_Same(_midl, "GenerateTypeLibrary", _boolean) +_Same(_midl, "HeaderFileName", _file_name) # /h +_Same(_midl, "IgnoreStandardIncludePath", _boolean) # /no_def_idir +_Same(_midl, "InterfaceIdentifierFileName", _file_name) # /iid +_Same(_midl, "MkTypLibCompatible", _boolean) # /mktyplib203 +_Same(_midl, "OutputDirectory", _string) # /out +_Same(_midl, "PreprocessorDefinitions", _string_list) # /D +_Same(_midl, "ProxyFileName", _file_name) # /proxy +_Same(_midl, "RedirectOutputAndErrors", _file_name) # /o +_Same(_midl, "SuppressStartupBanner", _boolean) # /nologo +_Same(_midl, "TypeLibraryName", _file_name) # /tlb +_Same(_midl, "UndefinePreprocessorDefinitions", _string_list) # /U +_Same(_midl, "WarnAsError", _boolean) # /WX + +_Same( + _midl, + "DefaultCharType", + _Enumeration(["Unsigned", "Signed", "Ascii"]), # /char unsigned # /char signed +) # /char ascii7 +_Same( + _midl, + "TargetEnvironment", + _Enumeration( + [ + "NotSet", + "Win32", # /env win32 + "Itanium", # /env ia64 + "X64", # /env x64 + "ARM64", # /env arm64 + ] + ), +) +_Same( + _midl, + "EnableErrorChecks", + _Enumeration(["EnableCustom", "None", "All"]), # /error none +) # /error all +_Same( + _midl, + "StructMemberAlignment", + _Enumeration(["NotSet", "1", "2", "4", "8"]), # Zp1 # Zp2 # Zp4 +) # Zp8 +_Same( + _midl, + "WarningLevel", + _Enumeration(["0", "1", "2", "3", "4"]), # /W0 # /W1 # /W2 # /W3 +) # /W4 + +_Renamed(_midl, "DLLDataFileName", "DllDataFileName", _file_name) # /dlldata +_Renamed(_midl, "ValidateParameters", "ValidateAllParameters", _boolean) # /robust + +# MSBuild options not found in MSVS. +_MSBuildOnly(_midl, "ApplicationConfigurationMode", _boolean) # /app_config +_MSBuildOnly(_midl, "ClientStubFile", _file_name) # /cstub +_MSBuildOnly( + _midl, "GenerateClientFiles", _Enumeration([], new=["Stub", "None"]) # /client stub +) # /client none +_MSBuildOnly( + _midl, "GenerateServerFiles", _Enumeration([], new=["Stub", "None"]) # /client stub +) # /client none +_MSBuildOnly(_midl, "LocaleID", _integer) # /lcid DECIMAL +_MSBuildOnly(_midl, "ServerStubFile", _file_name) # /sstub +_MSBuildOnly(_midl, "SuppressCompilerWarnings", _boolean) # /no_warn +_MSBuildOnly(_midl, "TrackerLogDirectory", _folder_name) +_MSBuildOnly( + _midl, "TypeLibFormat", _Enumeration([], new=["NewFormat", "OldFormat"]) # /newtlb +) # /oldtlb + + +# Directives for converting VCLibrarianTool to Lib. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\lib.xml" for +# the schema of the MSBuild Lib settings. + +_Same(_lib, "AdditionalDependencies", _file_list) +_Same(_lib, "AdditionalLibraryDirectories", _folder_list) # /LIBPATH +_Same(_lib, "AdditionalOptions", _string_list) +_Same(_lib, "ExportNamedFunctions", _string_list) # /EXPORT +_Same(_lib, "ForceSymbolReferences", _string) # /INCLUDE +_Same(_lib, "IgnoreAllDefaultLibraries", _boolean) # /NODEFAULTLIB +_Same(_lib, "IgnoreSpecificDefaultLibraries", _file_list) # /NODEFAULTLIB +_Same(_lib, "ModuleDefinitionFile", _file_name) # /DEF +_Same(_lib, "OutputFile", _file_name) # /OUT +_Same(_lib, "SuppressStartupBanner", _boolean) # /NOLOGO +_Same(_lib, "UseUnicodeResponseFiles", _boolean) +_Same(_lib, "LinkTimeCodeGeneration", _boolean) # /LTCG +_Same(_lib, "TargetMachine", _target_machine_enumeration) + +# TODO(jeanluc) _link defines the same value that gets moved to +# ProjectReference. We may want to validate that they are consistent. +_Moved(_lib, "LinkLibraryDependencies", "ProjectReference", _boolean) + +_MSBuildOnly(_lib, "DisplayLibrary", _string) # /LIST Visible='false' +_MSBuildOnly( + _lib, + "ErrorReporting", + _Enumeration( + [], + new=[ + "PromptImmediately", # /ERRORREPORT:PROMPT + "QueueForNextLogin", # /ERRORREPORT:QUEUE + "SendErrorReport", # /ERRORREPORT:SEND + "NoErrorReport", + ], + ), +) # /ERRORREPORT:NONE +_MSBuildOnly(_lib, "MinimumRequiredVersion", _string) +_MSBuildOnly(_lib, "Name", _file_name) # /NAME +_MSBuildOnly(_lib, "RemoveObjects", _file_list) # /REMOVE +_MSBuildOnly(_lib, "SubSystem", _subsystem_enumeration) +_MSBuildOnly(_lib, "TrackerLogDirectory", _folder_name) +_MSBuildOnly(_lib, "TreatLibWarningAsErrors", _boolean) # /WX +_MSBuildOnly(_lib, "Verbose", _boolean) + + +# Directives for converting VCManifestTool to Mt. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\mt.xml" for +# the schema of the MSBuild Lib settings. + +# Options that have the same name in MSVS and MSBuild +_Same(_manifest, "AdditionalManifestFiles", _file_list) # /manifest +_Same(_manifest, "AdditionalOptions", _string_list) +_Same(_manifest, "AssemblyIdentity", _string) # /identity: +_Same(_manifest, "ComponentFileName", _file_name) # /dll +_Same(_manifest, "GenerateCatalogFiles", _boolean) # /makecdfs +_Same(_manifest, "InputResourceManifests", _string) # /inputresource +_Same(_manifest, "OutputManifestFile", _file_name) # /out +_Same(_manifest, "RegistrarScriptFile", _file_name) # /rgs +_Same(_manifest, "ReplacementsFile", _file_name) # /replacements +_Same(_manifest, "SuppressStartupBanner", _boolean) # /nologo +_Same(_manifest, "TypeLibraryFile", _file_name) # /tlb: +_Same(_manifest, "UpdateFileHashes", _boolean) # /hashupdate +_Same(_manifest, "UpdateFileHashesSearchPath", _file_name) +_Same(_manifest, "VerboseOutput", _boolean) # /verbose + +# Options that have moved location. +_MovedAndRenamed( + _manifest, + "ManifestResourceFile", + "ManifestResourceCompile", + "ResourceOutputFileName", + _file_name, +) +_Moved(_manifest, "EmbedManifest", "", _boolean) + +# MSVS options not found in MSBuild. +_MSVSOnly(_manifest, "DependencyInformationFile", _file_name) +_MSVSOnly(_manifest, "UseFAT32Workaround", _boolean) +_MSVSOnly(_manifest, "UseUnicodeResponseFiles", _boolean) + +# MSBuild options not found in MSVS. +_MSBuildOnly(_manifest, "EnableDPIAwareness", _boolean) +_MSBuildOnly(_manifest, "GenerateCategoryTags", _boolean) # /category +_MSBuildOnly( + _manifest, "ManifestFromManagedAssembly", _file_name +) # /managedassemblyname +_MSBuildOnly(_manifest, "OutputResourceManifests", _string) # /outputresource +_MSBuildOnly(_manifest, "SuppressDependencyElement", _boolean) # /nodependency +_MSBuildOnly(_manifest, "TrackerLogDirectory", _folder_name) + + +# Directives for MASM. +# See "$(VCTargetsPath)\BuildCustomizations\masm.xml" for the schema of the +# MSBuild MASM settings. + +# Options that have the same name in MSVS and MSBuild. +_Same(_masm, "UseSafeExceptionHandlers", _boolean) # /safeseh diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py new file mode 100755 index 0000000000000..6ca09687ad7f1 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py @@ -0,0 +1,1547 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Unit tests for the MSVSSettings.py file.""" + +import unittest +import gyp.MSVSSettings as MSVSSettings + +from io import StringIO + + +class TestSequenceFunctions(unittest.TestCase): + def setUp(self): + self.stderr = StringIO() + + def _ExpectedWarnings(self, expected): + """Compares recorded lines to expected warnings.""" + self.stderr.seek(0) + actual = self.stderr.read().split("\n") + actual = [line for line in actual if line] + self.assertEqual(sorted(expected), sorted(actual)) + + def testValidateMSVSSettings_tool_names(self): + """Tests that only MSVS tool names are allowed.""" + MSVSSettings.ValidateMSVSSettings( + { + "VCCLCompilerTool": {}, + "VCLinkerTool": {}, + "VCMIDLTool": {}, + "foo": {}, + "VCResourceCompilerTool": {}, + "VCLibrarianTool": {}, + "VCManifestTool": {}, + "ClCompile": {}, + }, + self.stderr, + ) + self._ExpectedWarnings( + ["Warning: unrecognized tool foo", "Warning: unrecognized tool ClCompile"] + ) + + def testValidateMSVSSettings_settings(self): + """Tests that for invalid MSVS settings.""" + MSVSSettings.ValidateMSVSSettings( + { + "VCCLCompilerTool": { + "AdditionalIncludeDirectories": "folder1;folder2", + "AdditionalOptions": ["string1", "string2"], + "AdditionalUsingDirectories": "folder1;folder2", + "AssemblerListingLocation": "a_file_name", + "AssemblerOutput": "0", + "BasicRuntimeChecks": "5", + "BrowseInformation": "fdkslj", + "BrowseInformationFile": "a_file_name", + "BufferSecurityCheck": "true", + "CallingConvention": "-1", + "CompileAs": "1", + "DebugInformationFormat": "2", + "DefaultCharIsUnsigned": "true", + "Detect64BitPortabilityProblems": "true", + "DisableLanguageExtensions": "true", + "DisableSpecificWarnings": "string1;string2", + "EnableEnhancedInstructionSet": "1", + "EnableFiberSafeOptimizations": "true", + "EnableFunctionLevelLinking": "true", + "EnableIntrinsicFunctions": "true", + "EnablePREfast": "true", + "Enableprefast": "bogus", + "ErrorReporting": "1", + "ExceptionHandling": "1", + "ExpandAttributedSource": "true", + "FavorSizeOrSpeed": "1", + "FloatingPointExceptions": "true", + "FloatingPointModel": "1", + "ForceConformanceInForLoopScope": "true", + "ForcedIncludeFiles": "file1;file2", + "ForcedUsingFiles": "file1;file2", + "GeneratePreprocessedFile": "1", + "GenerateXMLDocumentationFiles": "true", + "IgnoreStandardIncludePath": "true", + "InlineFunctionExpansion": "1", + "KeepComments": "true", + "MinimalRebuild": "true", + "ObjectFile": "a_file_name", + "OmitDefaultLibName": "true", + "OmitFramePointers": "true", + "OpenMP": "true", + "Optimization": "1", + "PrecompiledHeaderFile": "a_file_name", + "PrecompiledHeaderThrough": "a_file_name", + "PreprocessorDefinitions": "string1;string2", + "ProgramDataBaseFileName": "a_file_name", + "RuntimeLibrary": "1", + "RuntimeTypeInfo": "true", + "ShowIncludes": "true", + "SmallerTypeCheck": "true", + "StringPooling": "true", + "StructMemberAlignment": "1", + "SuppressStartupBanner": "true", + "TreatWChar_tAsBuiltInType": "true", + "UndefineAllPreprocessorDefinitions": "true", + "UndefinePreprocessorDefinitions": "string1;string2", + "UseFullPaths": "true", + "UsePrecompiledHeader": "1", + "UseUnicodeResponseFiles": "true", + "WarnAsError": "true", + "WarningLevel": "1", + "WholeProgramOptimization": "true", + "XMLDocumentationFileName": "a_file_name", + "ZZXYZ": "bogus", + }, + "VCLinkerTool": { + "AdditionalDependencies": "file1;file2", + "AdditionalDependencies_excluded": "file3", + "AdditionalLibraryDirectories": "folder1;folder2", + "AdditionalManifestDependencies": "file1;file2", + "AdditionalOptions": "a string1", + "AddModuleNamesToAssembly": "file1;file2", + "AllowIsolation": "true", + "AssemblyDebug": "2", + "AssemblyLinkResource": "file1;file2", + "BaseAddress": "a string1", + "CLRImageType": "2", + "CLRThreadAttribute": "2", + "CLRUnmanagedCodeCheck": "true", + "DataExecutionPrevention": "2", + "DelayLoadDLLs": "file1;file2", + "DelaySign": "true", + "Driver": "2", + "EmbedManagedResourceFile": "file1;file2", + "EnableCOMDATFolding": "2", + "EnableUAC": "true", + "EntryPointSymbol": "a string1", + "ErrorReporting": "2", + "FixedBaseAddress": "2", + "ForceSymbolReferences": "file1;file2", + "FunctionOrder": "a_file_name", + "GenerateDebugInformation": "true", + "GenerateManifest": "true", + "GenerateMapFile": "true", + "HeapCommitSize": "a string1", + "HeapReserveSize": "a string1", + "IgnoreAllDefaultLibraries": "true", + "IgnoreDefaultLibraryNames": "file1;file2", + "IgnoreEmbeddedIDL": "true", + "IgnoreImportLibrary": "true", + "ImportLibrary": "a_file_name", + "KeyContainer": "a_file_name", + "KeyFile": "a_file_name", + "LargeAddressAware": "2", + "LinkIncremental": "2", + "LinkLibraryDependencies": "true", + "LinkTimeCodeGeneration": "2", + "ManifestFile": "a_file_name", + "MapExports": "true", + "MapFileName": "a_file_name", + "MergedIDLBaseFileName": "a_file_name", + "MergeSections": "a string1", + "MidlCommandFile": "a_file_name", + "ModuleDefinitionFile": "a_file_name", + "OptimizeForWindows98": "1", + "OptimizeReferences": "2", + "OutputFile": "a_file_name", + "PerUserRedirection": "true", + "Profile": "true", + "ProfileGuidedDatabase": "a_file_name", + "ProgramDatabaseFile": "a_file_name", + "RandomizedBaseAddress": "2", + "RegisterOutput": "true", + "ResourceOnlyDLL": "true", + "SetChecksum": "true", + "ShowProgress": "2", + "StackCommitSize": "a string1", + "StackReserveSize": "a string1", + "StripPrivateSymbols": "a_file_name", + "SubSystem": "2", + "SupportUnloadOfDelayLoadedDLL": "true", + "SuppressStartupBanner": "true", + "SwapRunFromCD": "true", + "SwapRunFromNet": "true", + "TargetMachine": "2", + "TerminalServerAware": "2", + "TurnOffAssemblyGeneration": "true", + "TypeLibraryFile": "a_file_name", + "TypeLibraryResourceID": "33", + "UACExecutionLevel": "2", + "UACUIAccess": "true", + "UseLibraryDependencyInputs": "true", + "UseUnicodeResponseFiles": "true", + "Version": "a string1", + }, + "VCMIDLTool": { + "AdditionalIncludeDirectories": "folder1;folder2", + "AdditionalOptions": "a string1", + "CPreprocessOptions": "a string1", + "DefaultCharType": "1", + "DLLDataFileName": "a_file_name", + "EnableErrorChecks": "1", + "ErrorCheckAllocations": "true", + "ErrorCheckBounds": "true", + "ErrorCheckEnumRange": "true", + "ErrorCheckRefPointers": "true", + "ErrorCheckStubData": "true", + "GenerateStublessProxies": "true", + "GenerateTypeLibrary": "true", + "HeaderFileName": "a_file_name", + "IgnoreStandardIncludePath": "true", + "InterfaceIdentifierFileName": "a_file_name", + "MkTypLibCompatible": "true", + "notgood": "bogus", + "OutputDirectory": "a string1", + "PreprocessorDefinitions": "string1;string2", + "ProxyFileName": "a_file_name", + "RedirectOutputAndErrors": "a_file_name", + "StructMemberAlignment": "1", + "SuppressStartupBanner": "true", + "TargetEnvironment": "1", + "TypeLibraryName": "a_file_name", + "UndefinePreprocessorDefinitions": "string1;string2", + "ValidateParameters": "true", + "WarnAsError": "true", + "WarningLevel": "1", + }, + "VCResourceCompilerTool": { + "AdditionalOptions": "a string1", + "AdditionalIncludeDirectories": "folder1;folder2", + "Culture": "1003", + "IgnoreStandardIncludePath": "true", + "notgood2": "bogus", + "PreprocessorDefinitions": "string1;string2", + "ResourceOutputFileName": "a string1", + "ShowProgress": "true", + "SuppressStartupBanner": "true", + "UndefinePreprocessorDefinitions": "string1;string2", + }, + "VCLibrarianTool": { + "AdditionalDependencies": "file1;file2", + "AdditionalLibraryDirectories": "folder1;folder2", + "AdditionalOptions": "a string1", + "ExportNamedFunctions": "string1;string2", + "ForceSymbolReferences": "a string1", + "IgnoreAllDefaultLibraries": "true", + "IgnoreSpecificDefaultLibraries": "file1;file2", + "LinkLibraryDependencies": "true", + "ModuleDefinitionFile": "a_file_name", + "OutputFile": "a_file_name", + "SuppressStartupBanner": "true", + "UseUnicodeResponseFiles": "true", + }, + "VCManifestTool": { + "AdditionalManifestFiles": "file1;file2", + "AdditionalOptions": "a string1", + "AssemblyIdentity": "a string1", + "ComponentFileName": "a_file_name", + "DependencyInformationFile": "a_file_name", + "GenerateCatalogFiles": "true", + "InputResourceManifests": "a string1", + "ManifestResourceFile": "a_file_name", + "OutputManifestFile": "a_file_name", + "RegistrarScriptFile": "a_file_name", + "ReplacementsFile": "a_file_name", + "SuppressStartupBanner": "true", + "TypeLibraryFile": "a_file_name", + "UpdateFileHashes": "truel", + "UpdateFileHashesSearchPath": "a_file_name", + "UseFAT32Workaround": "true", + "UseUnicodeResponseFiles": "true", + "VerboseOutput": "true", + }, + }, + self.stderr, + ) + self._ExpectedWarnings( + [ + "Warning: for VCCLCompilerTool/BasicRuntimeChecks, " + "index value (5) not in expected range [0, 4)", + "Warning: for VCCLCompilerTool/BrowseInformation, " + "invalid literal for int() with base 10: 'fdkslj'", + "Warning: for VCCLCompilerTool/CallingConvention, " + "index value (-1) not in expected range [0, 4)", + "Warning: for VCCLCompilerTool/DebugInformationFormat, " + "converted value for 2 not specified.", + "Warning: unrecognized setting VCCLCompilerTool/Enableprefast", + "Warning: unrecognized setting VCCLCompilerTool/ZZXYZ", + "Warning: for VCLinkerTool/TargetMachine, " + "converted value for 2 not specified.", + "Warning: unrecognized setting VCMIDLTool/notgood", + "Warning: unrecognized setting VCResourceCompilerTool/notgood2", + "Warning: for VCManifestTool/UpdateFileHashes, " + "expected bool; got 'truel'" + "", + ] + ) + + def testValidateMSBuildSettings_settings(self): + """Tests that for invalid MSBuild settings.""" + MSVSSettings.ValidateMSBuildSettings( + { + "ClCompile": { + "AdditionalIncludeDirectories": "folder1;folder2", + "AdditionalOptions": ["string1", "string2"], + "AdditionalUsingDirectories": "folder1;folder2", + "AssemblerListingLocation": "a_file_name", + "AssemblerOutput": "NoListing", + "BasicRuntimeChecks": "StackFrameRuntimeCheck", + "BrowseInformation": "false", + "BrowseInformationFile": "a_file_name", + "BufferSecurityCheck": "true", + "BuildingInIDE": "true", + "CallingConvention": "Cdecl", + "CompileAs": "CompileAsC", + "CompileAsManaged": "true", + "CreateHotpatchableImage": "true", + "DebugInformationFormat": "ProgramDatabase", + "DisableLanguageExtensions": "true", + "DisableSpecificWarnings": "string1;string2", + "EnableEnhancedInstructionSet": "StreamingSIMDExtensions", + "EnableFiberSafeOptimizations": "true", + "EnablePREfast": "true", + "Enableprefast": "bogus", + "ErrorReporting": "Prompt", + "ExceptionHandling": "SyncCThrow", + "ExpandAttributedSource": "true", + "FavorSizeOrSpeed": "Neither", + "FloatingPointExceptions": "true", + "FloatingPointModel": "Precise", + "ForceConformanceInForLoopScope": "true", + "ForcedIncludeFiles": "file1;file2", + "ForcedUsingFiles": "file1;file2", + "FunctionLevelLinking": "false", + "GenerateXMLDocumentationFiles": "true", + "IgnoreStandardIncludePath": "true", + "InlineFunctionExpansion": "OnlyExplicitInline", + "IntrinsicFunctions": "false", + "MinimalRebuild": "true", + "MultiProcessorCompilation": "true", + "ObjectFileName": "a_file_name", + "OmitDefaultLibName": "true", + "OmitFramePointers": "true", + "OpenMPSupport": "true", + "Optimization": "Disabled", + "PrecompiledHeader": "NotUsing", + "PrecompiledHeaderFile": "a_file_name", + "PrecompiledHeaderOutputFile": "a_file_name", + "PreprocessKeepComments": "true", + "PreprocessorDefinitions": "string1;string2", + "PreprocessOutputPath": "a string1", + "PreprocessSuppressLineNumbers": "false", + "PreprocessToFile": "false", + "ProcessorNumber": "33", + "ProgramDataBaseFileName": "a_file_name", + "RuntimeLibrary": "MultiThreaded", + "RuntimeTypeInfo": "true", + "ShowIncludes": "true", + "SmallerTypeCheck": "true", + "StringPooling": "true", + "StructMemberAlignment": "1Byte", + "SuppressStartupBanner": "true", + "TrackerLogDirectory": "a_folder", + "TreatSpecificWarningsAsErrors": "string1;string2", + "TreatWarningAsError": "true", + "TreatWChar_tAsBuiltInType": "true", + "UndefineAllPreprocessorDefinitions": "true", + "UndefinePreprocessorDefinitions": "string1;string2", + "UseFullPaths": "true", + "UseUnicodeForAssemblerListing": "true", + "WarningLevel": "TurnOffAllWarnings", + "WholeProgramOptimization": "true", + "XMLDocumentationFileName": "a_file_name", + "ZZXYZ": "bogus", + }, + "Link": { + "AdditionalDependencies": "file1;file2", + "AdditionalLibraryDirectories": "folder1;folder2", + "AdditionalManifestDependencies": "file1;file2", + "AdditionalOptions": "a string1", + "AddModuleNamesToAssembly": "file1;file2", + "AllowIsolation": "true", + "AssemblyDebug": "", + "AssemblyLinkResource": "file1;file2", + "BaseAddress": "a string1", + "BuildingInIDE": "true", + "CLRImageType": "ForceIJWImage", + "CLRSupportLastError": "Enabled", + "CLRThreadAttribute": "MTAThreadingAttribute", + "CLRUnmanagedCodeCheck": "true", + "CreateHotPatchableImage": "X86Image", + "DataExecutionPrevention": "false", + "DelayLoadDLLs": "file1;file2", + "DelaySign": "true", + "Driver": "NotSet", + "EmbedManagedResourceFile": "file1;file2", + "EnableCOMDATFolding": "false", + "EnableUAC": "true", + "EntryPointSymbol": "a string1", + "FixedBaseAddress": "false", + "ForceFileOutput": "Enabled", + "ForceSymbolReferences": "file1;file2", + "FunctionOrder": "a_file_name", + "GenerateDebugInformation": "true", + "GenerateMapFile": "true", + "HeapCommitSize": "a string1", + "HeapReserveSize": "a string1", + "IgnoreAllDefaultLibraries": "true", + "IgnoreEmbeddedIDL": "true", + "IgnoreSpecificDefaultLibraries": "a_file_list", + "ImageHasSafeExceptionHandlers": "true", + "ImportLibrary": "a_file_name", + "KeyContainer": "a_file_name", + "KeyFile": "a_file_name", + "LargeAddressAware": "false", + "LinkDLL": "true", + "LinkErrorReporting": "SendErrorReport", + "LinkStatus": "true", + "LinkTimeCodeGeneration": "UseLinkTimeCodeGeneration", + "ManifestFile": "a_file_name", + "MapExports": "true", + "MapFileName": "a_file_name", + "MergedIDLBaseFileName": "a_file_name", + "MergeSections": "a string1", + "MidlCommandFile": "a_file_name", + "MinimumRequiredVersion": "a string1", + "ModuleDefinitionFile": "a_file_name", + "MSDOSStubFileName": "a_file_name", + "NoEntryPoint": "true", + "OptimizeReferences": "false", + "OutputFile": "a_file_name", + "PerUserRedirection": "true", + "PreventDllBinding": "true", + "Profile": "true", + "ProfileGuidedDatabase": "a_file_name", + "ProgramDatabaseFile": "a_file_name", + "RandomizedBaseAddress": "false", + "RegisterOutput": "true", + "SectionAlignment": "33", + "SetChecksum": "true", + "ShowProgress": "LinkVerboseREF", + "SpecifySectionAttributes": "a string1", + "StackCommitSize": "a string1", + "StackReserveSize": "a string1", + "StripPrivateSymbols": "a_file_name", + "SubSystem": "Console", + "SupportNobindOfDelayLoadedDLL": "true", + "SupportUnloadOfDelayLoadedDLL": "true", + "SuppressStartupBanner": "true", + "SwapRunFromCD": "true", + "SwapRunFromNET": "true", + "TargetMachine": "MachineX86", + "TerminalServerAware": "false", + "TrackerLogDirectory": "a_folder", + "TreatLinkerWarningAsErrors": "true", + "TurnOffAssemblyGeneration": "true", + "TypeLibraryFile": "a_file_name", + "TypeLibraryResourceID": "33", + "UACExecutionLevel": "AsInvoker", + "UACUIAccess": "true", + "Version": "a string1", + }, + "ResourceCompile": { + "AdditionalIncludeDirectories": "folder1;folder2", + "AdditionalOptions": "a string1", + "Culture": "0x236", + "IgnoreStandardIncludePath": "true", + "NullTerminateStrings": "true", + "PreprocessorDefinitions": "string1;string2", + "ResourceOutputFileName": "a string1", + "ShowProgress": "true", + "SuppressStartupBanner": "true", + "TrackerLogDirectory": "a_folder", + "UndefinePreprocessorDefinitions": "string1;string2", + }, + "Midl": { + "AdditionalIncludeDirectories": "folder1;folder2", + "AdditionalOptions": "a string1", + "ApplicationConfigurationMode": "true", + "ClientStubFile": "a_file_name", + "CPreprocessOptions": "a string1", + "DefaultCharType": "Signed", + "DllDataFileName": "a_file_name", + "EnableErrorChecks": "EnableCustom", + "ErrorCheckAllocations": "true", + "ErrorCheckBounds": "true", + "ErrorCheckEnumRange": "true", + "ErrorCheckRefPointers": "true", + "ErrorCheckStubData": "true", + "GenerateClientFiles": "Stub", + "GenerateServerFiles": "None", + "GenerateStublessProxies": "true", + "GenerateTypeLibrary": "true", + "HeaderFileName": "a_file_name", + "IgnoreStandardIncludePath": "true", + "InterfaceIdentifierFileName": "a_file_name", + "LocaleID": "33", + "MkTypLibCompatible": "true", + "OutputDirectory": "a string1", + "PreprocessorDefinitions": "string1;string2", + "ProxyFileName": "a_file_name", + "RedirectOutputAndErrors": "a_file_name", + "ServerStubFile": "a_file_name", + "StructMemberAlignment": "NotSet", + "SuppressCompilerWarnings": "true", + "SuppressStartupBanner": "true", + "TargetEnvironment": "Itanium", + "TrackerLogDirectory": "a_folder", + "TypeLibFormat": "NewFormat", + "TypeLibraryName": "a_file_name", + "UndefinePreprocessorDefinitions": "string1;string2", + "ValidateAllParameters": "true", + "WarnAsError": "true", + "WarningLevel": "1", + }, + "Lib": { + "AdditionalDependencies": "file1;file2", + "AdditionalLibraryDirectories": "folder1;folder2", + "AdditionalOptions": "a string1", + "DisplayLibrary": "a string1", + "ErrorReporting": "PromptImmediately", + "ExportNamedFunctions": "string1;string2", + "ForceSymbolReferences": "a string1", + "IgnoreAllDefaultLibraries": "true", + "IgnoreSpecificDefaultLibraries": "file1;file2", + "LinkTimeCodeGeneration": "true", + "MinimumRequiredVersion": "a string1", + "ModuleDefinitionFile": "a_file_name", + "Name": "a_file_name", + "OutputFile": "a_file_name", + "RemoveObjects": "file1;file2", + "SubSystem": "Console", + "SuppressStartupBanner": "true", + "TargetMachine": "MachineX86i", + "TrackerLogDirectory": "a_folder", + "TreatLibWarningAsErrors": "true", + "UseUnicodeResponseFiles": "true", + "Verbose": "true", + }, + "Manifest": { + "AdditionalManifestFiles": "file1;file2", + "AdditionalOptions": "a string1", + "AssemblyIdentity": "a string1", + "ComponentFileName": "a_file_name", + "EnableDPIAwareness": "fal", + "GenerateCatalogFiles": "truel", + "GenerateCategoryTags": "true", + "InputResourceManifests": "a string1", + "ManifestFromManagedAssembly": "a_file_name", + "notgood3": "bogus", + "OutputManifestFile": "a_file_name", + "OutputResourceManifests": "a string1", + "RegistrarScriptFile": "a_file_name", + "ReplacementsFile": "a_file_name", + "SuppressDependencyElement": "true", + "SuppressStartupBanner": "true", + "TrackerLogDirectory": "a_folder", + "TypeLibraryFile": "a_file_name", + "UpdateFileHashes": "true", + "UpdateFileHashesSearchPath": "a_file_name", + "VerboseOutput": "true", + }, + "ProjectReference": { + "LinkLibraryDependencies": "true", + "UseLibraryDependencyInputs": "true", + }, + "ManifestResourceCompile": {"ResourceOutputFileName": "a_file_name"}, + "": { + "EmbedManifest": "true", + "GenerateManifest": "true", + "IgnoreImportLibrary": "true", + "LinkIncremental": "false", + }, + }, + self.stderr, + ) + self._ExpectedWarnings( + [ + "Warning: unrecognized setting ClCompile/Enableprefast", + "Warning: unrecognized setting ClCompile/ZZXYZ", + "Warning: unrecognized setting Manifest/notgood3", + "Warning: for Manifest/GenerateCatalogFiles, " + "expected bool; got 'truel'", + "Warning: for Lib/TargetMachine, unrecognized enumerated value " + "MachineX86i", + "Warning: for Manifest/EnableDPIAwareness, expected bool; got 'fal'", + ] + ) + + def testConvertToMSBuildSettings_empty(self): + """Tests an empty conversion.""" + msvs_settings = {} + expected_msbuild_settings = {} + actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings( + msvs_settings, self.stderr + ) + self.assertEqual(expected_msbuild_settings, actual_msbuild_settings) + self._ExpectedWarnings([]) + + def testConvertToMSBuildSettings_minimal(self): + """Tests a minimal conversion.""" + msvs_settings = { + "VCCLCompilerTool": { + "AdditionalIncludeDirectories": "dir1", + "AdditionalOptions": "/foo", + "BasicRuntimeChecks": "0", + }, + "VCLinkerTool": { + "LinkTimeCodeGeneration": "1", + "ErrorReporting": "1", + "DataExecutionPrevention": "2", + }, + } + expected_msbuild_settings = { + "ClCompile": { + "AdditionalIncludeDirectories": "dir1", + "AdditionalOptions": "/foo", + "BasicRuntimeChecks": "Default", + }, + "Link": { + "LinkTimeCodeGeneration": "UseLinkTimeCodeGeneration", + "LinkErrorReporting": "PromptImmediately", + "DataExecutionPrevention": "true", + }, + } + actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings( + msvs_settings, self.stderr + ) + self.assertEqual(expected_msbuild_settings, actual_msbuild_settings) + self._ExpectedWarnings([]) + + def testConvertToMSBuildSettings_warnings(self): + """Tests conversion that generates warnings.""" + msvs_settings = { + "VCCLCompilerTool": { + "AdditionalIncludeDirectories": "1", + "AdditionalOptions": "2", + # These are incorrect values: + "BasicRuntimeChecks": "12", + "BrowseInformation": "21", + "UsePrecompiledHeader": "13", + "GeneratePreprocessedFile": "14", + }, + "VCLinkerTool": { + # These are incorrect values: + "Driver": "10", + "LinkTimeCodeGeneration": "31", + "ErrorReporting": "21", + "FixedBaseAddress": "6", + }, + "VCResourceCompilerTool": { + # Custom + "Culture": "1003" + }, + } + expected_msbuild_settings = { + "ClCompile": { + "AdditionalIncludeDirectories": "1", + "AdditionalOptions": "2", + }, + "Link": {}, + "ResourceCompile": { + # Custom + "Culture": "0x03eb" + }, + } + actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings( + msvs_settings, self.stderr + ) + self.assertEqual(expected_msbuild_settings, actual_msbuild_settings) + self._ExpectedWarnings( + [ + "Warning: while converting VCCLCompilerTool/BasicRuntimeChecks to " + "MSBuild, index value (12) not in expected range [0, 4)", + "Warning: while converting VCCLCompilerTool/BrowseInformation to " + "MSBuild, index value (21) not in expected range [0, 3)", + "Warning: while converting VCCLCompilerTool/UsePrecompiledHeader to " + "MSBuild, index value (13) not in expected range [0, 3)", + "Warning: while converting " + "VCCLCompilerTool/GeneratePreprocessedFile to " + "MSBuild, value must be one of [0, 1, 2]; got 14", + "Warning: while converting VCLinkerTool/Driver to " + "MSBuild, index value (10) not in expected range [0, 4)", + "Warning: while converting VCLinkerTool/LinkTimeCodeGeneration to " + "MSBuild, index value (31) not in expected range [0, 5)", + "Warning: while converting VCLinkerTool/ErrorReporting to " + "MSBuild, index value (21) not in expected range [0, 3)", + "Warning: while converting VCLinkerTool/FixedBaseAddress to " + "MSBuild, index value (6) not in expected range [0, 3)", + ] + ) + + def testConvertToMSBuildSettings_full_synthetic(self): + """Tests conversion of all the MSBuild settings.""" + msvs_settings = { + "VCCLCompilerTool": { + "AdditionalIncludeDirectories": "folder1;folder2;folder3", + "AdditionalOptions": "a_string", + "AdditionalUsingDirectories": "folder1;folder2;folder3", + "AssemblerListingLocation": "a_file_name", + "AssemblerOutput": "0", + "BasicRuntimeChecks": "1", + "BrowseInformation": "2", + "BrowseInformationFile": "a_file_name", + "BufferSecurityCheck": "true", + "CallingConvention": "0", + "CompileAs": "1", + "DebugInformationFormat": "4", + "DefaultCharIsUnsigned": "true", + "Detect64BitPortabilityProblems": "true", + "DisableLanguageExtensions": "true", + "DisableSpecificWarnings": "d1;d2;d3", + "EnableEnhancedInstructionSet": "0", + "EnableFiberSafeOptimizations": "true", + "EnableFunctionLevelLinking": "true", + "EnableIntrinsicFunctions": "true", + "EnablePREfast": "true", + "ErrorReporting": "1", + "ExceptionHandling": "2", + "ExpandAttributedSource": "true", + "FavorSizeOrSpeed": "0", + "FloatingPointExceptions": "true", + "FloatingPointModel": "1", + "ForceConformanceInForLoopScope": "true", + "ForcedIncludeFiles": "file1;file2;file3", + "ForcedUsingFiles": "file1;file2;file3", + "GeneratePreprocessedFile": "1", + "GenerateXMLDocumentationFiles": "true", + "IgnoreStandardIncludePath": "true", + "InlineFunctionExpansion": "2", + "KeepComments": "true", + "MinimalRebuild": "true", + "ObjectFile": "a_file_name", + "OmitDefaultLibName": "true", + "OmitFramePointers": "true", + "OpenMP": "true", + "Optimization": "3", + "PrecompiledHeaderFile": "a_file_name", + "PrecompiledHeaderThrough": "a_file_name", + "PreprocessorDefinitions": "d1;d2;d3", + "ProgramDataBaseFileName": "a_file_name", + "RuntimeLibrary": "0", + "RuntimeTypeInfo": "true", + "ShowIncludes": "true", + "SmallerTypeCheck": "true", + "StringPooling": "true", + "StructMemberAlignment": "1", + "SuppressStartupBanner": "true", + "TreatWChar_tAsBuiltInType": "true", + "UndefineAllPreprocessorDefinitions": "true", + "UndefinePreprocessorDefinitions": "d1;d2;d3", + "UseFullPaths": "true", + "UsePrecompiledHeader": "1", + "UseUnicodeResponseFiles": "true", + "WarnAsError": "true", + "WarningLevel": "2", + "WholeProgramOptimization": "true", + "XMLDocumentationFileName": "a_file_name", + }, + "VCLinkerTool": { + "AdditionalDependencies": "file1;file2;file3", + "AdditionalLibraryDirectories": "folder1;folder2;folder3", + "AdditionalLibraryDirectories_excluded": "folder1;folder2;folder3", + "AdditionalManifestDependencies": "file1;file2;file3", + "AdditionalOptions": "a_string", + "AddModuleNamesToAssembly": "file1;file2;file3", + "AllowIsolation": "true", + "AssemblyDebug": "0", + "AssemblyLinkResource": "file1;file2;file3", + "BaseAddress": "a_string", + "CLRImageType": "1", + "CLRThreadAttribute": "2", + "CLRUnmanagedCodeCheck": "true", + "DataExecutionPrevention": "0", + "DelayLoadDLLs": "file1;file2;file3", + "DelaySign": "true", + "Driver": "1", + "EmbedManagedResourceFile": "file1;file2;file3", + "EnableCOMDATFolding": "0", + "EnableUAC": "true", + "EntryPointSymbol": "a_string", + "ErrorReporting": "0", + "FixedBaseAddress": "1", + "ForceSymbolReferences": "file1;file2;file3", + "FunctionOrder": "a_file_name", + "GenerateDebugInformation": "true", + "GenerateManifest": "true", + "GenerateMapFile": "true", + "HeapCommitSize": "a_string", + "HeapReserveSize": "a_string", + "IgnoreAllDefaultLibraries": "true", + "IgnoreDefaultLibraryNames": "file1;file2;file3", + "IgnoreEmbeddedIDL": "true", + "IgnoreImportLibrary": "true", + "ImportLibrary": "a_file_name", + "KeyContainer": "a_file_name", + "KeyFile": "a_file_name", + "LargeAddressAware": "2", + "LinkIncremental": "1", + "LinkLibraryDependencies": "true", + "LinkTimeCodeGeneration": "2", + "ManifestFile": "a_file_name", + "MapExports": "true", + "MapFileName": "a_file_name", + "MergedIDLBaseFileName": "a_file_name", + "MergeSections": "a_string", + "MidlCommandFile": "a_file_name", + "ModuleDefinitionFile": "a_file_name", + "OptimizeForWindows98": "1", + "OptimizeReferences": "0", + "OutputFile": "a_file_name", + "PerUserRedirection": "true", + "Profile": "true", + "ProfileGuidedDatabase": "a_file_name", + "ProgramDatabaseFile": "a_file_name", + "RandomizedBaseAddress": "1", + "RegisterOutput": "true", + "ResourceOnlyDLL": "true", + "SetChecksum": "true", + "ShowProgress": "0", + "StackCommitSize": "a_string", + "StackReserveSize": "a_string", + "StripPrivateSymbols": "a_file_name", + "SubSystem": "2", + "SupportUnloadOfDelayLoadedDLL": "true", + "SuppressStartupBanner": "true", + "SwapRunFromCD": "true", + "SwapRunFromNet": "true", + "TargetMachine": "3", + "TerminalServerAware": "2", + "TurnOffAssemblyGeneration": "true", + "TypeLibraryFile": "a_file_name", + "TypeLibraryResourceID": "33", + "UACExecutionLevel": "1", + "UACUIAccess": "true", + "UseLibraryDependencyInputs": "false", + "UseUnicodeResponseFiles": "true", + "Version": "a_string", + }, + "VCResourceCompilerTool": { + "AdditionalIncludeDirectories": "folder1;folder2;folder3", + "AdditionalOptions": "a_string", + "Culture": "1003", + "IgnoreStandardIncludePath": "true", + "PreprocessorDefinitions": "d1;d2;d3", + "ResourceOutputFileName": "a_string", + "ShowProgress": "true", + "SuppressStartupBanner": "true", + "UndefinePreprocessorDefinitions": "d1;d2;d3", + }, + "VCMIDLTool": { + "AdditionalIncludeDirectories": "folder1;folder2;folder3", + "AdditionalOptions": "a_string", + "CPreprocessOptions": "a_string", + "DefaultCharType": "0", + "DLLDataFileName": "a_file_name", + "EnableErrorChecks": "2", + "ErrorCheckAllocations": "true", + "ErrorCheckBounds": "true", + "ErrorCheckEnumRange": "true", + "ErrorCheckRefPointers": "true", + "ErrorCheckStubData": "true", + "GenerateStublessProxies": "true", + "GenerateTypeLibrary": "true", + "HeaderFileName": "a_file_name", + "IgnoreStandardIncludePath": "true", + "InterfaceIdentifierFileName": "a_file_name", + "MkTypLibCompatible": "true", + "OutputDirectory": "a_string", + "PreprocessorDefinitions": "d1;d2;d3", + "ProxyFileName": "a_file_name", + "RedirectOutputAndErrors": "a_file_name", + "StructMemberAlignment": "3", + "SuppressStartupBanner": "true", + "TargetEnvironment": "1", + "TypeLibraryName": "a_file_name", + "UndefinePreprocessorDefinitions": "d1;d2;d3", + "ValidateParameters": "true", + "WarnAsError": "true", + "WarningLevel": "4", + }, + "VCLibrarianTool": { + "AdditionalDependencies": "file1;file2;file3", + "AdditionalLibraryDirectories": "folder1;folder2;folder3", + "AdditionalLibraryDirectories_excluded": "folder1;folder2;folder3", + "AdditionalOptions": "a_string", + "ExportNamedFunctions": "d1;d2;d3", + "ForceSymbolReferences": "a_string", + "IgnoreAllDefaultLibraries": "true", + "IgnoreSpecificDefaultLibraries": "file1;file2;file3", + "LinkLibraryDependencies": "true", + "ModuleDefinitionFile": "a_file_name", + "OutputFile": "a_file_name", + "SuppressStartupBanner": "true", + "UseUnicodeResponseFiles": "true", + }, + "VCManifestTool": { + "AdditionalManifestFiles": "file1;file2;file3", + "AdditionalOptions": "a_string", + "AssemblyIdentity": "a_string", + "ComponentFileName": "a_file_name", + "DependencyInformationFile": "a_file_name", + "EmbedManifest": "true", + "GenerateCatalogFiles": "true", + "InputResourceManifests": "a_string", + "ManifestResourceFile": "my_name", + "OutputManifestFile": "a_file_name", + "RegistrarScriptFile": "a_file_name", + "ReplacementsFile": "a_file_name", + "SuppressStartupBanner": "true", + "TypeLibraryFile": "a_file_name", + "UpdateFileHashes": "true", + "UpdateFileHashesSearchPath": "a_file_name", + "UseFAT32Workaround": "true", + "UseUnicodeResponseFiles": "true", + "VerboseOutput": "true", + }, + } + expected_msbuild_settings = { + "ClCompile": { + "AdditionalIncludeDirectories": "folder1;folder2;folder3", + "AdditionalOptions": "a_string /J", + "AdditionalUsingDirectories": "folder1;folder2;folder3", + "AssemblerListingLocation": "a_file_name", + "AssemblerOutput": "NoListing", + "BasicRuntimeChecks": "StackFrameRuntimeCheck", + "BrowseInformation": "true", + "BrowseInformationFile": "a_file_name", + "BufferSecurityCheck": "true", + "CallingConvention": "Cdecl", + "CompileAs": "CompileAsC", + "DebugInformationFormat": "EditAndContinue", + "DisableLanguageExtensions": "true", + "DisableSpecificWarnings": "d1;d2;d3", + "EnableEnhancedInstructionSet": "NotSet", + "EnableFiberSafeOptimizations": "true", + "EnablePREfast": "true", + "ErrorReporting": "Prompt", + "ExceptionHandling": "Async", + "ExpandAttributedSource": "true", + "FavorSizeOrSpeed": "Neither", + "FloatingPointExceptions": "true", + "FloatingPointModel": "Strict", + "ForceConformanceInForLoopScope": "true", + "ForcedIncludeFiles": "file1;file2;file3", + "ForcedUsingFiles": "file1;file2;file3", + "FunctionLevelLinking": "true", + "GenerateXMLDocumentationFiles": "true", + "IgnoreStandardIncludePath": "true", + "InlineFunctionExpansion": "AnySuitable", + "IntrinsicFunctions": "true", + "MinimalRebuild": "true", + "ObjectFileName": "a_file_name", + "OmitDefaultLibName": "true", + "OmitFramePointers": "true", + "OpenMPSupport": "true", + "Optimization": "Full", + "PrecompiledHeader": "Create", + "PrecompiledHeaderFile": "a_file_name", + "PrecompiledHeaderOutputFile": "a_file_name", + "PreprocessKeepComments": "true", + "PreprocessorDefinitions": "d1;d2;d3", + "PreprocessSuppressLineNumbers": "false", + "PreprocessToFile": "true", + "ProgramDataBaseFileName": "a_file_name", + "RuntimeLibrary": "MultiThreaded", + "RuntimeTypeInfo": "true", + "ShowIncludes": "true", + "SmallerTypeCheck": "true", + "StringPooling": "true", + "StructMemberAlignment": "1Byte", + "SuppressStartupBanner": "true", + "TreatWarningAsError": "true", + "TreatWChar_tAsBuiltInType": "true", + "UndefineAllPreprocessorDefinitions": "true", + "UndefinePreprocessorDefinitions": "d1;d2;d3", + "UseFullPaths": "true", + "WarningLevel": "Level2", + "WholeProgramOptimization": "true", + "XMLDocumentationFileName": "a_file_name", + }, + "Link": { + "AdditionalDependencies": "file1;file2;file3", + "AdditionalLibraryDirectories": "folder1;folder2;folder3", + "AdditionalManifestDependencies": "file1;file2;file3", + "AdditionalOptions": "a_string", + "AddModuleNamesToAssembly": "file1;file2;file3", + "AllowIsolation": "true", + "AssemblyDebug": "", + "AssemblyLinkResource": "file1;file2;file3", + "BaseAddress": "a_string", + "CLRImageType": "ForceIJWImage", + "CLRThreadAttribute": "STAThreadingAttribute", + "CLRUnmanagedCodeCheck": "true", + "DataExecutionPrevention": "", + "DelayLoadDLLs": "file1;file2;file3", + "DelaySign": "true", + "Driver": "Driver", + "EmbedManagedResourceFile": "file1;file2;file3", + "EnableCOMDATFolding": "", + "EnableUAC": "true", + "EntryPointSymbol": "a_string", + "FixedBaseAddress": "false", + "ForceSymbolReferences": "file1;file2;file3", + "FunctionOrder": "a_file_name", + "GenerateDebugInformation": "true", + "GenerateMapFile": "true", + "HeapCommitSize": "a_string", + "HeapReserveSize": "a_string", + "IgnoreAllDefaultLibraries": "true", + "IgnoreEmbeddedIDL": "true", + "IgnoreSpecificDefaultLibraries": "file1;file2;file3", + "ImportLibrary": "a_file_name", + "KeyContainer": "a_file_name", + "KeyFile": "a_file_name", + "LargeAddressAware": "true", + "LinkErrorReporting": "NoErrorReport", + "LinkTimeCodeGeneration": "PGInstrument", + "ManifestFile": "a_file_name", + "MapExports": "true", + "MapFileName": "a_file_name", + "MergedIDLBaseFileName": "a_file_name", + "MergeSections": "a_string", + "MidlCommandFile": "a_file_name", + "ModuleDefinitionFile": "a_file_name", + "NoEntryPoint": "true", + "OptimizeReferences": "", + "OutputFile": "a_file_name", + "PerUserRedirection": "true", + "Profile": "true", + "ProfileGuidedDatabase": "a_file_name", + "ProgramDatabaseFile": "a_file_name", + "RandomizedBaseAddress": "false", + "RegisterOutput": "true", + "SetChecksum": "true", + "ShowProgress": "NotSet", + "StackCommitSize": "a_string", + "StackReserveSize": "a_string", + "StripPrivateSymbols": "a_file_name", + "SubSystem": "Windows", + "SupportUnloadOfDelayLoadedDLL": "true", + "SuppressStartupBanner": "true", + "SwapRunFromCD": "true", + "SwapRunFromNET": "true", + "TargetMachine": "MachineARM", + "TerminalServerAware": "true", + "TurnOffAssemblyGeneration": "true", + "TypeLibraryFile": "a_file_name", + "TypeLibraryResourceID": "33", + "UACExecutionLevel": "HighestAvailable", + "UACUIAccess": "true", + "Version": "a_string", + }, + "ResourceCompile": { + "AdditionalIncludeDirectories": "folder1;folder2;folder3", + "AdditionalOptions": "a_string", + "Culture": "0x03eb", + "IgnoreStandardIncludePath": "true", + "PreprocessorDefinitions": "d1;d2;d3", + "ResourceOutputFileName": "a_string", + "ShowProgress": "true", + "SuppressStartupBanner": "true", + "UndefinePreprocessorDefinitions": "d1;d2;d3", + }, + "Midl": { + "AdditionalIncludeDirectories": "folder1;folder2;folder3", + "AdditionalOptions": "a_string", + "CPreprocessOptions": "a_string", + "DefaultCharType": "Unsigned", + "DllDataFileName": "a_file_name", + "EnableErrorChecks": "All", + "ErrorCheckAllocations": "true", + "ErrorCheckBounds": "true", + "ErrorCheckEnumRange": "true", + "ErrorCheckRefPointers": "true", + "ErrorCheckStubData": "true", + "GenerateStublessProxies": "true", + "GenerateTypeLibrary": "true", + "HeaderFileName": "a_file_name", + "IgnoreStandardIncludePath": "true", + "InterfaceIdentifierFileName": "a_file_name", + "MkTypLibCompatible": "true", + "OutputDirectory": "a_string", + "PreprocessorDefinitions": "d1;d2;d3", + "ProxyFileName": "a_file_name", + "RedirectOutputAndErrors": "a_file_name", + "StructMemberAlignment": "4", + "SuppressStartupBanner": "true", + "TargetEnvironment": "Win32", + "TypeLibraryName": "a_file_name", + "UndefinePreprocessorDefinitions": "d1;d2;d3", + "ValidateAllParameters": "true", + "WarnAsError": "true", + "WarningLevel": "4", + }, + "Lib": { + "AdditionalDependencies": "file1;file2;file3", + "AdditionalLibraryDirectories": "folder1;folder2;folder3", + "AdditionalOptions": "a_string", + "ExportNamedFunctions": "d1;d2;d3", + "ForceSymbolReferences": "a_string", + "IgnoreAllDefaultLibraries": "true", + "IgnoreSpecificDefaultLibraries": "file1;file2;file3", + "ModuleDefinitionFile": "a_file_name", + "OutputFile": "a_file_name", + "SuppressStartupBanner": "true", + "UseUnicodeResponseFiles": "true", + }, + "Manifest": { + "AdditionalManifestFiles": "file1;file2;file3", + "AdditionalOptions": "a_string", + "AssemblyIdentity": "a_string", + "ComponentFileName": "a_file_name", + "GenerateCatalogFiles": "true", + "InputResourceManifests": "a_string", + "OutputManifestFile": "a_file_name", + "RegistrarScriptFile": "a_file_name", + "ReplacementsFile": "a_file_name", + "SuppressStartupBanner": "true", + "TypeLibraryFile": "a_file_name", + "UpdateFileHashes": "true", + "UpdateFileHashesSearchPath": "a_file_name", + "VerboseOutput": "true", + }, + "ManifestResourceCompile": {"ResourceOutputFileName": "my_name"}, + "ProjectReference": { + "LinkLibraryDependencies": "true", + "UseLibraryDependencyInputs": "false", + }, + "": { + "EmbedManifest": "true", + "GenerateManifest": "true", + "IgnoreImportLibrary": "true", + "LinkIncremental": "false", + }, + } + self.maxDiff = 9999 # on failure display a long diff + actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings( + msvs_settings, self.stderr + ) + self.assertEqual(expected_msbuild_settings, actual_msbuild_settings) + self._ExpectedWarnings([]) + + def testConvertToMSBuildSettings_actual(self): + """Tests the conversion of an actual project. + + A VS2008 project with most of the options defined was created through the + VS2008 IDE. It was then converted to VS2010. The tool settings found in + the .vcproj and .vcxproj files were converted to the two dictionaries + msvs_settings and expected_msbuild_settings. + + Note that for many settings, the VS2010 converter adds macros like + %(AdditionalIncludeDirectories) to make sure than inherited values are + included. Since the Gyp projects we generate do not use inheritance, + we removed these macros. They were: + ClCompile: + AdditionalIncludeDirectories: ';%(AdditionalIncludeDirectories)' + AdditionalOptions: ' %(AdditionalOptions)' + AdditionalUsingDirectories: ';%(AdditionalUsingDirectories)' + DisableSpecificWarnings: ';%(DisableSpecificWarnings)', + ForcedIncludeFiles: ';%(ForcedIncludeFiles)', + ForcedUsingFiles: ';%(ForcedUsingFiles)', + PreprocessorDefinitions: ';%(PreprocessorDefinitions)', + UndefinePreprocessorDefinitions: + ';%(UndefinePreprocessorDefinitions)', + Link: + AdditionalDependencies: ';%(AdditionalDependencies)', + AdditionalLibraryDirectories: ';%(AdditionalLibraryDirectories)', + AdditionalManifestDependencies: + ';%(AdditionalManifestDependencies)', + AdditionalOptions: ' %(AdditionalOptions)', + AddModuleNamesToAssembly: ';%(AddModuleNamesToAssembly)', + AssemblyLinkResource: ';%(AssemblyLinkResource)', + DelayLoadDLLs: ';%(DelayLoadDLLs)', + EmbedManagedResourceFile: ';%(EmbedManagedResourceFile)', + ForceSymbolReferences: ';%(ForceSymbolReferences)', + IgnoreSpecificDefaultLibraries: + ';%(IgnoreSpecificDefaultLibraries)', + ResourceCompile: + AdditionalIncludeDirectories: ';%(AdditionalIncludeDirectories)', + AdditionalOptions: ' %(AdditionalOptions)', + PreprocessorDefinitions: ';%(PreprocessorDefinitions)', + Manifest: + AdditionalManifestFiles: ';%(AdditionalManifestFiles)', + AdditionalOptions: ' %(AdditionalOptions)', + InputResourceManifests: ';%(InputResourceManifests)', + """ + msvs_settings = { + "VCCLCompilerTool": { + "AdditionalIncludeDirectories": "dir1", + "AdditionalOptions": "/more", + "AdditionalUsingDirectories": "test", + "AssemblerListingLocation": "$(IntDir)\\a", + "AssemblerOutput": "1", + "BasicRuntimeChecks": "3", + "BrowseInformation": "1", + "BrowseInformationFile": "$(IntDir)\\e", + "BufferSecurityCheck": "false", + "CallingConvention": "1", + "CompileAs": "1", + "DebugInformationFormat": "4", + "DefaultCharIsUnsigned": "true", + "Detect64BitPortabilityProblems": "true", + "DisableLanguageExtensions": "true", + "DisableSpecificWarnings": "abc", + "EnableEnhancedInstructionSet": "1", + "EnableFiberSafeOptimizations": "true", + "EnableFunctionLevelLinking": "true", + "EnableIntrinsicFunctions": "true", + "EnablePREfast": "true", + "ErrorReporting": "2", + "ExceptionHandling": "2", + "ExpandAttributedSource": "true", + "FavorSizeOrSpeed": "2", + "FloatingPointExceptions": "true", + "FloatingPointModel": "1", + "ForceConformanceInForLoopScope": "false", + "ForcedIncludeFiles": "def", + "ForcedUsingFiles": "ge", + "GeneratePreprocessedFile": "2", + "GenerateXMLDocumentationFiles": "true", + "IgnoreStandardIncludePath": "true", + "InlineFunctionExpansion": "1", + "KeepComments": "true", + "MinimalRebuild": "true", + "ObjectFile": "$(IntDir)\\b", + "OmitDefaultLibName": "true", + "OmitFramePointers": "true", + "OpenMP": "true", + "Optimization": "3", + "PrecompiledHeaderFile": "$(IntDir)\\$(TargetName).pche", + "PrecompiledHeaderThrough": "StdAfx.hd", + "PreprocessorDefinitions": "WIN32;_DEBUG;_CONSOLE", + "ProgramDataBaseFileName": "$(IntDir)\\vc90b.pdb", + "RuntimeLibrary": "3", + "RuntimeTypeInfo": "false", + "ShowIncludes": "true", + "SmallerTypeCheck": "true", + "StringPooling": "true", + "StructMemberAlignment": "3", + "SuppressStartupBanner": "false", + "TreatWChar_tAsBuiltInType": "false", + "UndefineAllPreprocessorDefinitions": "true", + "UndefinePreprocessorDefinitions": "wer", + "UseFullPaths": "true", + "UsePrecompiledHeader": "0", + "UseUnicodeResponseFiles": "false", + "WarnAsError": "true", + "WarningLevel": "3", + "WholeProgramOptimization": "true", + "XMLDocumentationFileName": "$(IntDir)\\c", + }, + "VCLinkerTool": { + "AdditionalDependencies": "zx", + "AdditionalLibraryDirectories": "asd", + "AdditionalManifestDependencies": "s2", + "AdditionalOptions": "/mor2", + "AddModuleNamesToAssembly": "d1", + "AllowIsolation": "false", + "AssemblyDebug": "1", + "AssemblyLinkResource": "d5", + "BaseAddress": "23423", + "CLRImageType": "3", + "CLRThreadAttribute": "1", + "CLRUnmanagedCodeCheck": "true", + "DataExecutionPrevention": "0", + "DelayLoadDLLs": "d4", + "DelaySign": "true", + "Driver": "2", + "EmbedManagedResourceFile": "d2", + "EnableCOMDATFolding": "1", + "EnableUAC": "false", + "EntryPointSymbol": "f5", + "ErrorReporting": "2", + "FixedBaseAddress": "1", + "ForceSymbolReferences": "d3", + "FunctionOrder": "fssdfsd", + "GenerateDebugInformation": "true", + "GenerateManifest": "false", + "GenerateMapFile": "true", + "HeapCommitSize": "13", + "HeapReserveSize": "12", + "IgnoreAllDefaultLibraries": "true", + "IgnoreDefaultLibraryNames": "flob;flok", + "IgnoreEmbeddedIDL": "true", + "IgnoreImportLibrary": "true", + "ImportLibrary": "f4", + "KeyContainer": "f7", + "KeyFile": "f6", + "LargeAddressAware": "2", + "LinkIncremental": "0", + "LinkLibraryDependencies": "false", + "LinkTimeCodeGeneration": "1", + "ManifestFile": "$(IntDir)\\$(TargetFileName).2intermediate.manifest", + "MapExports": "true", + "MapFileName": "d5", + "MergedIDLBaseFileName": "f2", + "MergeSections": "f5", + "MidlCommandFile": "f1", + "ModuleDefinitionFile": "sdsd", + "OptimizeForWindows98": "2", + "OptimizeReferences": "2", + "OutputFile": "$(OutDir)\\$(ProjectName)2.exe", + "PerUserRedirection": "true", + "Profile": "true", + "ProfileGuidedDatabase": "$(TargetDir)$(TargetName).pgdd", + "ProgramDatabaseFile": "Flob.pdb", + "RandomizedBaseAddress": "1", + "RegisterOutput": "true", + "ResourceOnlyDLL": "true", + "SetChecksum": "false", + "ShowProgress": "1", + "StackCommitSize": "15", + "StackReserveSize": "14", + "StripPrivateSymbols": "d3", + "SubSystem": "1", + "SupportUnloadOfDelayLoadedDLL": "true", + "SuppressStartupBanner": "false", + "SwapRunFromCD": "true", + "SwapRunFromNet": "true", + "TargetMachine": "1", + "TerminalServerAware": "1", + "TurnOffAssemblyGeneration": "true", + "TypeLibraryFile": "f3", + "TypeLibraryResourceID": "12", + "UACExecutionLevel": "2", + "UACUIAccess": "true", + "UseLibraryDependencyInputs": "true", + "UseUnicodeResponseFiles": "false", + "Version": "333", + }, + "VCResourceCompilerTool": { + "AdditionalIncludeDirectories": "f3", + "AdditionalOptions": "/more3", + "Culture": "3084", + "IgnoreStandardIncludePath": "true", + "PreprocessorDefinitions": "_UNICODE;UNICODE2", + "ResourceOutputFileName": "$(IntDir)/$(InputName)3.res", + "ShowProgress": "true", + }, + "VCManifestTool": { + "AdditionalManifestFiles": "sfsdfsd", + "AdditionalOptions": "afdsdafsd", + "AssemblyIdentity": "sddfdsadfsa", + "ComponentFileName": "fsdfds", + "DependencyInformationFile": "$(IntDir)\\mt.depdfd", + "EmbedManifest": "false", + "GenerateCatalogFiles": "true", + "InputResourceManifests": "asfsfdafs", + "ManifestResourceFile": + "$(IntDir)\\$(TargetFileName).embed.manifest.resfdsf", + "OutputManifestFile": "$(TargetPath).manifestdfs", + "RegistrarScriptFile": "sdfsfd", + "ReplacementsFile": "sdffsd", + "SuppressStartupBanner": "false", + "TypeLibraryFile": "sfsd", + "UpdateFileHashes": "true", + "UpdateFileHashesSearchPath": "sfsd", + "UseFAT32Workaround": "true", + "UseUnicodeResponseFiles": "false", + "VerboseOutput": "true", + }, + } + expected_msbuild_settings = { + "ClCompile": { + "AdditionalIncludeDirectories": "dir1", + "AdditionalOptions": "/more /J", + "AdditionalUsingDirectories": "test", + "AssemblerListingLocation": "$(IntDir)a", + "AssemblerOutput": "AssemblyCode", + "BasicRuntimeChecks": "EnableFastChecks", + "BrowseInformation": "true", + "BrowseInformationFile": "$(IntDir)e", + "BufferSecurityCheck": "false", + "CallingConvention": "FastCall", + "CompileAs": "CompileAsC", + "DebugInformationFormat": "EditAndContinue", + "DisableLanguageExtensions": "true", + "DisableSpecificWarnings": "abc", + "EnableEnhancedInstructionSet": "StreamingSIMDExtensions", + "EnableFiberSafeOptimizations": "true", + "EnablePREfast": "true", + "ErrorReporting": "Queue", + "ExceptionHandling": "Async", + "ExpandAttributedSource": "true", + "FavorSizeOrSpeed": "Size", + "FloatingPointExceptions": "true", + "FloatingPointModel": "Strict", + "ForceConformanceInForLoopScope": "false", + "ForcedIncludeFiles": "def", + "ForcedUsingFiles": "ge", + "FunctionLevelLinking": "true", + "GenerateXMLDocumentationFiles": "true", + "IgnoreStandardIncludePath": "true", + "InlineFunctionExpansion": "OnlyExplicitInline", + "IntrinsicFunctions": "true", + "MinimalRebuild": "true", + "ObjectFileName": "$(IntDir)b", + "OmitDefaultLibName": "true", + "OmitFramePointers": "true", + "OpenMPSupport": "true", + "Optimization": "Full", + "PrecompiledHeader": "NotUsing", # Actual conversion gives '' + "PrecompiledHeaderFile": "StdAfx.hd", + "PrecompiledHeaderOutputFile": "$(IntDir)$(TargetName).pche", + "PreprocessKeepComments": "true", + "PreprocessorDefinitions": "WIN32;_DEBUG;_CONSOLE", + "PreprocessSuppressLineNumbers": "true", + "PreprocessToFile": "true", + "ProgramDataBaseFileName": "$(IntDir)vc90b.pdb", + "RuntimeLibrary": "MultiThreadedDebugDLL", + "RuntimeTypeInfo": "false", + "ShowIncludes": "true", + "SmallerTypeCheck": "true", + "StringPooling": "true", + "StructMemberAlignment": "4Bytes", + "SuppressStartupBanner": "false", + "TreatWarningAsError": "true", + "TreatWChar_tAsBuiltInType": "false", + "UndefineAllPreprocessorDefinitions": "true", + "UndefinePreprocessorDefinitions": "wer", + "UseFullPaths": "true", + "WarningLevel": "Level3", + "WholeProgramOptimization": "true", + "XMLDocumentationFileName": "$(IntDir)c", + }, + "Link": { + "AdditionalDependencies": "zx", + "AdditionalLibraryDirectories": "asd", + "AdditionalManifestDependencies": "s2", + "AdditionalOptions": "/mor2", + "AddModuleNamesToAssembly": "d1", + "AllowIsolation": "false", + "AssemblyDebug": "true", + "AssemblyLinkResource": "d5", + "BaseAddress": "23423", + "CLRImageType": "ForceSafeILImage", + "CLRThreadAttribute": "MTAThreadingAttribute", + "CLRUnmanagedCodeCheck": "true", + "DataExecutionPrevention": "", + "DelayLoadDLLs": "d4", + "DelaySign": "true", + "Driver": "UpOnly", + "EmbedManagedResourceFile": "d2", + "EnableCOMDATFolding": "false", + "EnableUAC": "false", + "EntryPointSymbol": "f5", + "FixedBaseAddress": "false", + "ForceSymbolReferences": "d3", + "FunctionOrder": "fssdfsd", + "GenerateDebugInformation": "true", + "GenerateMapFile": "true", + "HeapCommitSize": "13", + "HeapReserveSize": "12", + "IgnoreAllDefaultLibraries": "true", + "IgnoreEmbeddedIDL": "true", + "IgnoreSpecificDefaultLibraries": "flob;flok", + "ImportLibrary": "f4", + "KeyContainer": "f7", + "KeyFile": "f6", + "LargeAddressAware": "true", + "LinkErrorReporting": "QueueForNextLogin", + "LinkTimeCodeGeneration": "UseLinkTimeCodeGeneration", + "ManifestFile": "$(IntDir)$(TargetFileName).2intermediate.manifest", + "MapExports": "true", + "MapFileName": "d5", + "MergedIDLBaseFileName": "f2", + "MergeSections": "f5", + "MidlCommandFile": "f1", + "ModuleDefinitionFile": "sdsd", + "NoEntryPoint": "true", + "OptimizeReferences": "true", + "OutputFile": "$(OutDir)$(ProjectName)2.exe", + "PerUserRedirection": "true", + "Profile": "true", + "ProfileGuidedDatabase": "$(TargetDir)$(TargetName).pgdd", + "ProgramDatabaseFile": "Flob.pdb", + "RandomizedBaseAddress": "false", + "RegisterOutput": "true", + "SetChecksum": "false", + "ShowProgress": "LinkVerbose", + "StackCommitSize": "15", + "StackReserveSize": "14", + "StripPrivateSymbols": "d3", + "SubSystem": "Console", + "SupportUnloadOfDelayLoadedDLL": "true", + "SuppressStartupBanner": "false", + "SwapRunFromCD": "true", + "SwapRunFromNET": "true", + "TargetMachine": "MachineX86", + "TerminalServerAware": "false", + "TurnOffAssemblyGeneration": "true", + "TypeLibraryFile": "f3", + "TypeLibraryResourceID": "12", + "UACExecutionLevel": "RequireAdministrator", + "UACUIAccess": "true", + "Version": "333", + }, + "ResourceCompile": { + "AdditionalIncludeDirectories": "f3", + "AdditionalOptions": "/more3", + "Culture": "0x0c0c", + "IgnoreStandardIncludePath": "true", + "PreprocessorDefinitions": "_UNICODE;UNICODE2", + "ResourceOutputFileName": "$(IntDir)%(Filename)3.res", + "ShowProgress": "true", + }, + "Manifest": { + "AdditionalManifestFiles": "sfsdfsd", + "AdditionalOptions": "afdsdafsd", + "AssemblyIdentity": "sddfdsadfsa", + "ComponentFileName": "fsdfds", + "GenerateCatalogFiles": "true", + "InputResourceManifests": "asfsfdafs", + "OutputManifestFile": "$(TargetPath).manifestdfs", + "RegistrarScriptFile": "sdfsfd", + "ReplacementsFile": "sdffsd", + "SuppressStartupBanner": "false", + "TypeLibraryFile": "sfsd", + "UpdateFileHashes": "true", + "UpdateFileHashesSearchPath": "sfsd", + "VerboseOutput": "true", + }, + "ProjectReference": { + "LinkLibraryDependencies": "false", + "UseLibraryDependencyInputs": "true", + }, + "": { + "EmbedManifest": "false", + "GenerateManifest": "false", + "IgnoreImportLibrary": "true", + "LinkIncremental": "", + }, + "ManifestResourceCompile": { + "ResourceOutputFileName": + "$(IntDir)$(TargetFileName).embed.manifest.resfdsf" + }, + } + self.maxDiff = 9999 # on failure display a long diff + actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings( + msvs_settings, self.stderr + ) + self.assertEqual(expected_msbuild_settings, actual_msbuild_settings) + self._ExpectedWarnings([]) + + +if __name__ == "__main__": + unittest.main() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py new file mode 100644 index 0000000000000..2e5c811bdde32 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py @@ -0,0 +1,59 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Visual Studio project reader/writer.""" + +import gyp.easy_xml as easy_xml + + +class Writer: + """Visual Studio XML tool file writer.""" + + def __init__(self, tool_file_path, name): + """Initializes the tool file. + + Args: + tool_file_path: Path to the tool file. + name: Name of the tool file. + """ + self.tool_file_path = tool_file_path + self.name = name + self.rules_section = ["Rules"] + + def AddCustomBuildRule( + self, name, cmd, description, additional_dependencies, outputs, extensions + ): + """Adds a rule to the tool file. + + Args: + name: Name of the rule. + description: Description of the rule. + cmd: Command line of the rule. + additional_dependencies: other files which may trigger the rule. + outputs: outputs of the rule. + extensions: extensions handled by the rule. + """ + rule = [ + "CustomBuildRule", + { + "Name": name, + "ExecutionDescription": description, + "CommandLine": cmd, + "Outputs": ";".join(outputs), + "FileExtensions": ";".join(extensions), + "AdditionalDependencies": ";".join(additional_dependencies), + }, + ] + self.rules_section.append(rule) + + def WriteIfChanged(self): + """Writes the tool file.""" + content = [ + "VisualStudioToolFile", + {"Version": "8.00", "Name": self.name}, + self.rules_section, + ] + easy_xml.WriteXmlIfChanged( + content, self.tool_file_path, encoding="Windows-1252" + ) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py new file mode 100644 index 0000000000000..e580c00fb76d3 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py @@ -0,0 +1,153 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Visual Studio user preferences file writer.""" + +import os +import re +import socket # for gethostname + +import gyp.easy_xml as easy_xml + + +# ------------------------------------------------------------------------------ + + +def _FindCommandInPath(command): + """If there are no slashes in the command given, this function + searches the PATH env to find the given command, and converts it + to an absolute path. We have to do this because MSVS is looking + for an actual file to launch a debugger on, not just a command + line. Note that this happens at GYP time, so anything needing to + be built needs to have a full path.""" + if "/" in command or "\\" in command: + # If the command already has path elements (either relative or + # absolute), then assume it is constructed properly. + return command + else: + # Search through the path list and find an existing file that + # we can access. + paths = os.environ.get("PATH", "").split(os.pathsep) + for path in paths: + item = os.path.join(path, command) + if os.path.isfile(item) and os.access(item, os.X_OK): + return item + return command + + +def _QuoteWin32CommandLineArgs(args): + new_args = [] + for arg in args: + # Replace all double-quotes with double-double-quotes to escape + # them for cmd shell, and then quote the whole thing if there + # are any. + if arg.find('"') != -1: + arg = '""'.join(arg.split('"')) + arg = '"%s"' % arg + + # Otherwise, if there are any spaces, quote the whole arg. + elif re.search(r"[ \t\n]", arg): + arg = '"%s"' % arg + new_args.append(arg) + return new_args + + +class Writer: + """Visual Studio XML user user file writer.""" + + def __init__(self, user_file_path, version, name): + """Initializes the user file. + + Args: + user_file_path: Path to the user file. + version: Version info. + name: Name of the user file. + """ + self.user_file_path = user_file_path + self.version = version + self.name = name + self.configurations = {} + + def AddConfig(self, name): + """Adds a configuration to the project. + + Args: + name: Configuration name. + """ + self.configurations[name] = ["Configuration", {"Name": name}] + + def AddDebugSettings( + self, config_name, command, environment={}, working_directory="" + ): + """Adds a DebugSettings node to the user file for a particular config. + + Args: + command: command line to run. First element in the list is the + executable. All elements of the command will be quoted if + necessary. + working_directory: other files which may trigger the rule. (optional) + """ + command = _QuoteWin32CommandLineArgs(command) + + abs_command = _FindCommandInPath(command[0]) + + if environment and isinstance(environment, dict): + env_list = [f'{key}="{val}"' for (key, val) in environment.items()] + environment = " ".join(env_list) + else: + environment = "" + + n_cmd = [ + "DebugSettings", + { + "Command": abs_command, + "WorkingDirectory": working_directory, + "CommandArguments": " ".join(command[1:]), + "RemoteMachine": socket.gethostname(), + "Environment": environment, + "EnvironmentMerge": "true", + # Currently these are all "dummy" values that we're just setting + # in the default manner that MSVS does it. We could use some of + # these to add additional capabilities, I suppose, but they might + # not have parity with other platforms then. + "Attach": "false", + "DebuggerType": "3", # 'auto' debugger + "Remote": "1", + "RemoteCommand": "", + "HttpUrl": "", + "PDBPath": "", + "SQLDebugging": "", + "DebuggerFlavor": "0", + "MPIRunCommand": "", + "MPIRunArguments": "", + "MPIRunWorkingDirectory": "", + "ApplicationCommand": "", + "ApplicationArguments": "", + "ShimCommand": "", + "MPIAcceptMode": "", + "MPIAcceptFilter": "", + }, + ] + + # Find the config, and add it if it doesn't exist. + if config_name not in self.configurations: + self.AddConfig(config_name) + + # Add the DebugSettings onto the appropriate config. + self.configurations[config_name].append(n_cmd) + + def WriteIfChanged(self): + """Writes the user file.""" + configs = ["Configurations"] + for config, spec in sorted(self.configurations.items()): + configs.append(spec) + + content = [ + "VisualStudioUserFile", + {"Version": self.version.ProjectVersion(), "Name": self.name}, + configs, + ] + easy_xml.WriteXmlIfChanged( + content, self.user_file_path, encoding="Windows-1252" + ) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py new file mode 100644 index 0000000000000..36bb782bd319a --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py @@ -0,0 +1,271 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Utility functions shared amongst the Windows generators.""" + +import copy +import os + + +# A dictionary mapping supported target types to extensions. +TARGET_TYPE_EXT = { + "executable": "exe", + "loadable_module": "dll", + "shared_library": "dll", + "static_library": "lib", + "windows_driver": "sys", +} + + +def _GetLargePdbShimCcPath(): + """Returns the path of the large_pdb_shim.cc file.""" + this_dir = os.path.abspath(os.path.dirname(__file__)) + src_dir = os.path.abspath(os.path.join(this_dir, "..", "..")) + win_data_dir = os.path.join(src_dir, "data", "win") + large_pdb_shim_cc = os.path.join(win_data_dir, "large-pdb-shim.cc") + return large_pdb_shim_cc + + +def _DeepCopySomeKeys(in_dict, keys): + """Performs a partial deep-copy on |in_dict|, only copying the keys in |keys|. + + Arguments: + in_dict: The dictionary to copy. + keys: The keys to be copied. If a key is in this list and doesn't exist in + |in_dict| this is not an error. + Returns: + The partially deep-copied dictionary. + """ + d = {} + for key in keys: + if key not in in_dict: + continue + d[key] = copy.deepcopy(in_dict[key]) + return d + + +def _SuffixName(name, suffix): + """Add a suffix to the end of a target. + + Arguments: + name: name of the target (foo#target) + suffix: the suffix to be added + Returns: + Target name with suffix added (foo_suffix#target) + """ + parts = name.rsplit("#", 1) + parts[0] = f"{parts[0]}_{suffix}" + return "#".join(parts) + + +def _ShardName(name, number): + """Add a shard number to the end of a target. + + Arguments: + name: name of the target (foo#target) + number: shard number + Returns: + Target name with shard added (foo_1#target) + """ + return _SuffixName(name, str(number)) + + +def ShardTargets(target_list, target_dicts): + """Shard some targets apart to work around the linkers limits. + + Arguments: + target_list: List of target pairs: 'base/base.gyp:base'. + target_dicts: Dict of target properties keyed on target pair. + Returns: + Tuple of the new sharded versions of the inputs. + """ + # Gather the targets to shard, and how many pieces. + targets_to_shard = {} + for t in target_dicts: + shards = int(target_dicts[t].get("msvs_shard", 0)) + if shards: + targets_to_shard[t] = shards + # Shard target_list. + new_target_list = [] + for t in target_list: + if t in targets_to_shard: + for i in range(targets_to_shard[t]): + new_target_list.append(_ShardName(t, i)) + else: + new_target_list.append(t) + # Shard target_dict. + new_target_dicts = {} + for t in target_dicts: + if t in targets_to_shard: + for i in range(targets_to_shard[t]): + name = _ShardName(t, i) + new_target_dicts[name] = copy.copy(target_dicts[t]) + new_target_dicts[name]["target_name"] = _ShardName( + new_target_dicts[name]["target_name"], i + ) + sources = new_target_dicts[name].get("sources", []) + new_sources = [] + for pos in range(i, len(sources), targets_to_shard[t]): + new_sources.append(sources[pos]) + new_target_dicts[name]["sources"] = new_sources + else: + new_target_dicts[t] = target_dicts[t] + # Shard dependencies. + for t in sorted(new_target_dicts): + for deptype in ("dependencies", "dependencies_original"): + dependencies = copy.copy(new_target_dicts[t].get(deptype, [])) + new_dependencies = [] + for d in dependencies: + if d in targets_to_shard: + for i in range(targets_to_shard[d]): + new_dependencies.append(_ShardName(d, i)) + else: + new_dependencies.append(d) + new_target_dicts[t][deptype] = new_dependencies + + return (new_target_list, new_target_dicts) + + +def _GetPdbPath(target_dict, config_name, vars): + """Returns the path to the PDB file that will be generated by a given + configuration. + + The lookup proceeds as follows: + - Look for an explicit path in the VCLinkerTool configuration block. + - Look for an 'msvs_large_pdb_path' variable. + - Use '<(PRODUCT_DIR)/<(product_name).(exe|dll).pdb' if 'product_name' is + specified. + - Use '<(PRODUCT_DIR)/<(target_name).(exe|dll).pdb'. + + Arguments: + target_dict: The target dictionary to be searched. + config_name: The name of the configuration of interest. + vars: A dictionary of common GYP variables with generator-specific values. + Returns: + The path of the corresponding PDB file. + """ + config = target_dict["configurations"][config_name] + msvs = config.setdefault("msvs_settings", {}) + + linker = msvs.get("VCLinkerTool", {}) + + pdb_path = linker.get("ProgramDatabaseFile") + if pdb_path: + return pdb_path + + variables = target_dict.get("variables", {}) + pdb_path = variables.get("msvs_large_pdb_path", None) + if pdb_path: + return pdb_path + + pdb_base = target_dict.get("product_name", target_dict["target_name"]) + pdb_base = "{}.{}.pdb".format(pdb_base, TARGET_TYPE_EXT[target_dict["type"]]) + pdb_path = vars["PRODUCT_DIR"] + "/" + pdb_base + + return pdb_path + + +def InsertLargePdbShims(target_list, target_dicts, vars): + """Insert a shim target that forces the linker to use 4KB pagesize PDBs. + + This is a workaround for targets with PDBs greater than 1GB in size, the + limit for the 1KB pagesize PDBs created by the linker by default. + + Arguments: + target_list: List of target pairs: 'base/base.gyp:base'. + target_dicts: Dict of target properties keyed on target pair. + vars: A dictionary of common GYP variables with generator-specific values. + Returns: + Tuple of the shimmed version of the inputs. + """ + # Determine which targets need shimming. + targets_to_shim = [] + for t in target_dicts: + target_dict = target_dicts[t] + + # We only want to shim targets that have msvs_large_pdb enabled. + if not int(target_dict.get("msvs_large_pdb", 0)): + continue + # This is intended for executable, shared_library and loadable_module + # targets where every configuration is set up to produce a PDB output. + # If any of these conditions is not true then the shim logic will fail + # below. + targets_to_shim.append(t) + + large_pdb_shim_cc = _GetLargePdbShimCcPath() + + for t in targets_to_shim: + target_dict = target_dicts[t] + target_name = target_dict.get("target_name") + + base_dict = _DeepCopySomeKeys( + target_dict, ["configurations", "default_configuration", "toolset"] + ) + + # This is the dict for copying the source file (part of the GYP tree) + # to the intermediate directory of the project. This is necessary because + # we can't always build a relative path to the shim source file (on Windows + # GYP and the project may be on different drives), and Ninja hates absolute + # paths (it ends up generating the .obj and .obj.d alongside the source + # file, polluting GYPs tree). + copy_suffix = "large_pdb_copy" + copy_target_name = target_name + "_" + copy_suffix + full_copy_target_name = _SuffixName(t, copy_suffix) + shim_cc_basename = os.path.basename(large_pdb_shim_cc) + shim_cc_dir = vars["SHARED_INTERMEDIATE_DIR"] + "/" + copy_target_name + shim_cc_path = shim_cc_dir + "/" + shim_cc_basename + copy_dict = copy.deepcopy(base_dict) + copy_dict["target_name"] = copy_target_name + copy_dict["type"] = "none" + copy_dict["sources"] = [large_pdb_shim_cc] + copy_dict["copies"] = [ + {"destination": shim_cc_dir, "files": [large_pdb_shim_cc]} + ] + + # This is the dict for the PDB generating shim target. It depends on the + # copy target. + shim_suffix = "large_pdb_shim" + shim_target_name = target_name + "_" + shim_suffix + full_shim_target_name = _SuffixName(t, shim_suffix) + shim_dict = copy.deepcopy(base_dict) + shim_dict["target_name"] = shim_target_name + shim_dict["type"] = "static_library" + shim_dict["sources"] = [shim_cc_path] + shim_dict["dependencies"] = [full_copy_target_name] + + # Set up the shim to output its PDB to the same location as the final linker + # target. + for config_name, config in shim_dict.get("configurations").items(): + pdb_path = _GetPdbPath(target_dict, config_name, vars) + + # A few keys that we don't want to propagate. + for key in ["msvs_precompiled_header", "msvs_precompiled_source", "test"]: + config.pop(key, None) + + msvs = config.setdefault("msvs_settings", {}) + + # Update the compiler directives in the shim target. + compiler = msvs.setdefault("VCCLCompilerTool", {}) + compiler["DebugInformationFormat"] = "3" + compiler["ProgramDataBaseFileName"] = pdb_path + + # Set the explicit PDB path in the appropriate configuration of the + # original target. + config = target_dict["configurations"][config_name] + msvs = config.setdefault("msvs_settings", {}) + linker = msvs.setdefault("VCLinkerTool", {}) + linker["GenerateDebugInformation"] = "true" + linker["ProgramDatabaseFile"] = pdb_path + + # Add the new targets. They must go to the beginning of the list so that + # the dependency generation works as expected in ninja. + target_list.insert(0, full_copy_target_name) + target_list.insert(0, full_shim_target_name) + target_dicts[full_copy_target_name] = copy_dict + target_dicts[full_shim_target_name] = shim_dict + + # Update the original target to depend on the shim target. + target_dict.setdefault("dependencies", []).append(full_shim_target_name) + + return (target_list, target_dicts) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py new file mode 100644 index 0000000000000..8d7f21e82dd2f --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py @@ -0,0 +1,574 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Handle version information related to Visual Stuio.""" + +import errno +import os +import re +import subprocess +import sys +import glob + + +def JoinPath(*args): + return os.path.normpath(os.path.join(*args)) + + +class VisualStudioVersion: + """Information regarding a version of Visual Studio.""" + + def __init__( + self, + short_name, + description, + solution_version, + project_version, + flat_sln, + uses_vcxproj, + path, + sdk_based, + default_toolset=None, + compatible_sdks=None, + ): + self.short_name = short_name + self.description = description + self.solution_version = solution_version + self.project_version = project_version + self.flat_sln = flat_sln + self.uses_vcxproj = uses_vcxproj + self.path = path + self.sdk_based = sdk_based + self.default_toolset = default_toolset + compatible_sdks = compatible_sdks or [] + compatible_sdks.sort(key=lambda v: float(v.replace("v", "")), reverse=True) + self.compatible_sdks = compatible_sdks + + def ShortName(self): + return self.short_name + + def Description(self): + """Get the full description of the version.""" + return self.description + + def SolutionVersion(self): + """Get the version number of the sln files.""" + return self.solution_version + + def ProjectVersion(self): + """Get the version number of the vcproj or vcxproj files.""" + return self.project_version + + def FlatSolution(self): + return self.flat_sln + + def UsesVcxproj(self): + """Returns true if this version uses a vcxproj file.""" + return self.uses_vcxproj + + def ProjectExtension(self): + """Returns the file extension for the project.""" + return self.uses_vcxproj and ".vcxproj" or ".vcproj" + + def Path(self): + """Returns the path to Visual Studio installation.""" + return self.path + + def ToolPath(self, tool): + """Returns the path to a given compiler tool. """ + return os.path.normpath(os.path.join(self.path, "VC/bin", tool)) + + def DefaultToolset(self): + """Returns the msbuild toolset version that will be used in the absence + of a user override.""" + return self.default_toolset + + def _SetupScriptInternal(self, target_arch): + """Returns a command (with arguments) to be used to set up the + environment.""" + assert target_arch in ("x86", "x64"), "target_arch not supported" + # If WindowsSDKDir is set and SetEnv.Cmd exists then we are using the + # depot_tools build tools and should run SetEnv.Cmd to set up the + # environment. The check for WindowsSDKDir alone is not sufficient because + # this is set by running vcvarsall.bat. + sdk_dir = os.environ.get("WindowsSDKDir", "") + setup_path = JoinPath(sdk_dir, "Bin", "SetEnv.Cmd") + if self.sdk_based and sdk_dir and os.path.exists(setup_path): + return [setup_path, "/" + target_arch] + + is_host_arch_x64 = ( + os.environ.get("PROCESSOR_ARCHITECTURE") == "AMD64" + or os.environ.get("PROCESSOR_ARCHITEW6432") == "AMD64" + ) + + # For VS2017 (and newer) it's fairly easy + if self.short_name >= "2017": + script_path = JoinPath( + self.path, "VC", "Auxiliary", "Build", "vcvarsall.bat" + ) + + # Always use a native executable, cross-compiling if necessary. + host_arch = "amd64" if is_host_arch_x64 else "x86" + msvc_target_arch = "amd64" if target_arch == "x64" else "x86" + arg = host_arch + if host_arch != msvc_target_arch: + arg += "_" + msvc_target_arch + + return [script_path, arg] + + # We try to find the best version of the env setup batch. + vcvarsall = JoinPath(self.path, "VC", "vcvarsall.bat") + if target_arch == "x86": + if ( + self.short_name >= "2013" + and self.short_name[-1] != "e" + and is_host_arch_x64 + ): + # VS2013 and later, non-Express have a x64-x86 cross that we want + # to prefer. + return [vcvarsall, "amd64_x86"] + else: + # Otherwise, the standard x86 compiler. We don't use VC/vcvarsall.bat + # for x86 because vcvarsall calls vcvars32, which it can only find if + # VS??COMNTOOLS is set, which isn't guaranteed. + return [JoinPath(self.path, "Common7", "Tools", "vsvars32.bat")] + elif target_arch == "x64": + arg = "x86_amd64" + # Use the 64-on-64 compiler if we're not using an express edition and + # we're running on a 64bit OS. + if self.short_name[-1] != "e" and is_host_arch_x64: + arg = "amd64" + return [vcvarsall, arg] + + def SetupScript(self, target_arch): + script_data = self._SetupScriptInternal(target_arch) + script_path = script_data[0] + if not os.path.exists(script_path): + raise Exception( + "%s is missing - make sure VC++ tools are installed." % script_path + ) + return script_data + + +def _RegistryQueryBase(sysdir, key, value): + """Use reg.exe to read a particular key. + + While ideally we might use the win32 module, we would like gyp to be + python neutral, so for instance cygwin python lacks this module. + + Arguments: + sysdir: The system subdirectory to attempt to launch reg.exe from. + key: The registry key to read from. + value: The particular value to read. + Return: + stdout from reg.exe, or None for failure. + """ + # Skip if not on Windows or Python Win32 setup issue + if sys.platform not in ("win32", "cygwin"): + return None + # Setup params to pass to and attempt to launch reg.exe + cmd = [os.path.join(os.environ.get("WINDIR", ""), sysdir, "reg.exe"), "query", key] + if value: + cmd.extend(["/v", value]) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # Obtain the stdout from reg.exe, reading to the end so p.returncode is valid + # Note that the error text may be in [1] in some cases + text = p.communicate()[0].decode("utf-8") + # Check return code from reg.exe; officially 0==success and 1==error + if p.returncode: + return None + return text + + +def _RegistryQuery(key, value=None): + r"""Use reg.exe to read a particular key through _RegistryQueryBase. + + First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If + that fails, it falls back to System32. Sysnative is available on Vista and + up and available on Windows Server 2003 and XP through KB patch 942589. Note + that Sysnative will always fail if using 64-bit python due to it being a + virtual directory and System32 will work correctly in the first place. + + KB 942589 - http://support.microsoft.com/kb/942589/en-us. + + Arguments: + key: The registry key. + value: The particular registry value to read (optional). + Return: + stdout from reg.exe, or None for failure. + """ + text = None + try: + text = _RegistryQueryBase("Sysnative", key, value) + except OSError as e: + if e.errno == errno.ENOENT: + text = _RegistryQueryBase("System32", key, value) + else: + raise + return text + + +def _RegistryGetValueUsingWinReg(key, value): + """Use the _winreg module to obtain the value of a registry key. + + Args: + key: The registry key. + value: The particular registry value to read. + Return: + contents of the registry key's value, or None on failure. Throws + ImportError if winreg is unavailable. + """ + from winreg import HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx + try: + root, subkey = key.split("\\", 1) + assert root == "HKLM" # Only need HKLM for now. + with OpenKey(HKEY_LOCAL_MACHINE, subkey) as hkey: + return QueryValueEx(hkey, value)[0] + except OSError: + return None + + +def _RegistryGetValue(key, value): + """Use _winreg or reg.exe to obtain the value of a registry key. + + Using _winreg is preferable because it solves an issue on some corporate + environments where access to reg.exe is locked down. However, we still need + to fallback to reg.exe for the case where the _winreg module is not available + (for example in cygwin python). + + Args: + key: The registry key. + value: The particular registry value to read. + Return: + contents of the registry key's value, or None on failure. + """ + try: + return _RegistryGetValueUsingWinReg(key, value) + except ImportError: + pass + + # Fallback to reg.exe if we fail to import _winreg. + text = _RegistryQuery(key, value) + if not text: + return None + # Extract value. + match = re.search(r"REG_\w+\s+([^\r]+)\r\n", text) + if not match: + return None + return match.group(1) + + +def _CreateVersion(name, path, sdk_based=False): + """Sets up MSVS project generation. + + Setup is based off the GYP_MSVS_VERSION environment variable or whatever is + autodetected if GYP_MSVS_VERSION is not explicitly specified. If a version is + passed in that doesn't match a value in versions python will throw a error. + """ + if path: + path = os.path.normpath(path) + versions = { + "2022": VisualStudioVersion( + "2022", + "Visual Studio 2022", + solution_version="12.00", + project_version="17.0", + flat_sln=False, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based, + default_toolset="v143", + compatible_sdks=["v8.1", "v10.0"], + ), + "2019": VisualStudioVersion( + "2019", + "Visual Studio 2019", + solution_version="12.00", + project_version="16.0", + flat_sln=False, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based, + default_toolset="v142", + compatible_sdks=["v8.1", "v10.0"], + ), + "2017": VisualStudioVersion( + "2017", + "Visual Studio 2017", + solution_version="12.00", + project_version="15.0", + flat_sln=False, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based, + default_toolset="v141", + compatible_sdks=["v8.1", "v10.0"], + ), + "2015": VisualStudioVersion( + "2015", + "Visual Studio 2015", + solution_version="12.00", + project_version="14.0", + flat_sln=False, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based, + default_toolset="v140", + ), + "2013": VisualStudioVersion( + "2013", + "Visual Studio 2013", + solution_version="13.00", + project_version="12.0", + flat_sln=False, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based, + default_toolset="v120", + ), + "2013e": VisualStudioVersion( + "2013e", + "Visual Studio 2013", + solution_version="13.00", + project_version="12.0", + flat_sln=True, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based, + default_toolset="v120", + ), + "2012": VisualStudioVersion( + "2012", + "Visual Studio 2012", + solution_version="12.00", + project_version="4.0", + flat_sln=False, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based, + default_toolset="v110", + ), + "2012e": VisualStudioVersion( + "2012e", + "Visual Studio 2012", + solution_version="12.00", + project_version="4.0", + flat_sln=True, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based, + default_toolset="v110", + ), + "2010": VisualStudioVersion( + "2010", + "Visual Studio 2010", + solution_version="11.00", + project_version="4.0", + flat_sln=False, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based, + ), + "2010e": VisualStudioVersion( + "2010e", + "Visual C++ Express 2010", + solution_version="11.00", + project_version="4.0", + flat_sln=True, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based, + ), + "2008": VisualStudioVersion( + "2008", + "Visual Studio 2008", + solution_version="10.00", + project_version="9.00", + flat_sln=False, + uses_vcxproj=False, + path=path, + sdk_based=sdk_based, + ), + "2008e": VisualStudioVersion( + "2008e", + "Visual Studio 2008", + solution_version="10.00", + project_version="9.00", + flat_sln=True, + uses_vcxproj=False, + path=path, + sdk_based=sdk_based, + ), + "2005": VisualStudioVersion( + "2005", + "Visual Studio 2005", + solution_version="9.00", + project_version="8.00", + flat_sln=False, + uses_vcxproj=False, + path=path, + sdk_based=sdk_based, + ), + "2005e": VisualStudioVersion( + "2005e", + "Visual Studio 2005", + solution_version="9.00", + project_version="8.00", + flat_sln=True, + uses_vcxproj=False, + path=path, + sdk_based=sdk_based, + ), + } + return versions[str(name)] + + +def _ConvertToCygpath(path): + """Convert to cygwin path if we are using cygwin.""" + if sys.platform == "cygwin": + p = subprocess.Popen(["cygpath", path], stdout=subprocess.PIPE) + path = p.communicate()[0].decode("utf-8").strip() + return path + + +def _DetectVisualStudioVersions(versions_to_check, force_express): + """Collect the list of installed visual studio versions. + + Returns: + A list of visual studio versions installed in descending order of + usage preference. + Base this on the registry and a quick check if devenv.exe exists. + Possibilities are: + 2005(e) - Visual Studio 2005 (8) + 2008(e) - Visual Studio 2008 (9) + 2010(e) - Visual Studio 2010 (10) + 2012(e) - Visual Studio 2012 (11) + 2013(e) - Visual Studio 2013 (12) + 2015 - Visual Studio 2015 (14) + 2017 - Visual Studio 2017 (15) + 2019 - Visual Studio 2019 (16) + 2022 - Visual Studio 2022 (17) + Where (e) is e for express editions of MSVS and blank otherwise. + """ + version_to_year = { + "8.0": "2005", + "9.0": "2008", + "10.0": "2010", + "11.0": "2012", + "12.0": "2013", + "14.0": "2015", + "15.0": "2017", + "16.0": "2019", + "17.0": "2022", + } + versions = [] + for version in versions_to_check: + # Old method of searching for which VS version is installed + # We don't use the 2010-encouraged-way because we also want to get the + # path to the binaries, which it doesn't offer. + keys = [ + r"HKLM\Software\Microsoft\VisualStudio\%s" % version, + r"HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s" % version, + r"HKLM\Software\Microsoft\VCExpress\%s" % version, + r"HKLM\Software\Wow6432Node\Microsoft\VCExpress\%s" % version, + ] + for index in range(len(keys)): + path = _RegistryGetValue(keys[index], "InstallDir") + if not path: + continue + path = _ConvertToCygpath(path) + # Check for full. + full_path = os.path.join(path, "devenv.exe") + express_path = os.path.join(path, "*express.exe") + if not force_express and os.path.exists(full_path): + # Add this one. + versions.append( + _CreateVersion( + version_to_year[version], os.path.join(path, "..", "..") + ) + ) + # Check for express. + elif glob.glob(express_path): + # Add this one. + versions.append( + _CreateVersion( + version_to_year[version] + "e", os.path.join(path, "..", "..") + ) + ) + + # The old method above does not work when only SDK is installed. + keys = [ + r"HKLM\Software\Microsoft\VisualStudio\SxS\VC7", + r"HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7", + r"HKLM\Software\Microsoft\VisualStudio\SxS\VS7", + r"HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VS7", + ] + for index in range(len(keys)): + path = _RegistryGetValue(keys[index], version) + if not path: + continue + path = _ConvertToCygpath(path) + if version == "15.0": + if os.path.exists(path): + versions.append(_CreateVersion("2017", path)) + elif version != "14.0": # There is no Express edition for 2015. + versions.append( + _CreateVersion( + version_to_year[version] + "e", + os.path.join(path, ".."), + sdk_based=True, + ) + ) + + return versions + + +def SelectVisualStudioVersion(version="auto", allow_fallback=True): + """Select which version of Visual Studio projects to generate. + + Arguments: + version: Hook to allow caller to force a particular version (vs auto). + Returns: + An object representing a visual studio project format version. + """ + # In auto mode, check environment variable for override. + if version == "auto": + version = os.environ.get("GYP_MSVS_VERSION", "auto") + version_map = { + "auto": ("17.0", "16.0", "15.0", "14.0", "12.0", "10.0", "9.0", "8.0", "11.0"), + "2005": ("8.0",), + "2005e": ("8.0",), + "2008": ("9.0",), + "2008e": ("9.0",), + "2010": ("10.0",), + "2010e": ("10.0",), + "2012": ("11.0",), + "2012e": ("11.0",), + "2013": ("12.0",), + "2013e": ("12.0",), + "2015": ("14.0",), + "2017": ("15.0",), + "2019": ("16.0",), + "2022": ("17.0",), + } + override_path = os.environ.get("GYP_MSVS_OVERRIDE_PATH") + if override_path: + msvs_version = os.environ.get("GYP_MSVS_VERSION") + if not msvs_version: + raise ValueError( + "GYP_MSVS_OVERRIDE_PATH requires GYP_MSVS_VERSION to be " + "set to a particular version (e.g. 2010e)." + ) + return _CreateVersion(msvs_version, override_path, sdk_based=True) + version = str(version) + versions = _DetectVisualStudioVersions(version_map[version], "e" in version) + if not versions: + if not allow_fallback: + raise ValueError("Could not locate Visual Studio installation.") + if version == "auto": + # Default to 2005 if we couldn't find anything + return _CreateVersion("2005", None) + else: + return _CreateVersion(version, None) + return versions[0] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/__init__.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/__init__.py new file mode 100755 index 0000000000000..2aa39d0318860 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/__init__.py @@ -0,0 +1,690 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +import copy +import gyp.input +import argparse +import os.path +import re +import shlex +import sys +import traceback +from gyp.common import GypError + + +# Default debug modes for GYP +debug = {} + +# List of "official" debug modes, but you can use anything you like. +DEBUG_GENERAL = "general" +DEBUG_VARIABLES = "variables" +DEBUG_INCLUDES = "includes" + + +def DebugOutput(mode, message, *args): + if "all" in gyp.debug or mode in gyp.debug: + ctx = ("unknown", 0, "unknown") + try: + f = traceback.extract_stack(limit=2) + if f: + ctx = f[0][:3] + except Exception: + pass + if args: + message %= args + print( + "%s:%s:%d:%s %s" + % (mode.upper(), os.path.basename(ctx[0]), ctx[1], ctx[2], message) + ) + + +def FindBuildFiles(): + extension = ".gyp" + files = os.listdir(os.getcwd()) + build_files = [] + for file in files: + if file.endswith(extension): + build_files.append(file) + return build_files + + +def Load( + build_files, + format, + default_variables={}, + includes=[], + depth=".", + params=None, + check=False, + circular_check=True, +): + """ + Loads one or more specified build files. + default_variables and includes will be copied before use. + Returns the generator for the specified format and the + data returned by loading the specified build files. + """ + if params is None: + params = {} + + if "-" in format: + format, params["flavor"] = format.split("-", 1) + + default_variables = copy.copy(default_variables) + + # Default variables provided by this program and its modules should be + # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace, + # avoiding collisions with user and automatic variables. + default_variables["GENERATOR"] = format + default_variables["GENERATOR_FLAVOR"] = params.get("flavor", "") + + # Format can be a custom python file, or by default the name of a module + # within gyp.generator. + if format.endswith(".py"): + generator_name = os.path.splitext(format)[0] + path, generator_name = os.path.split(generator_name) + + # Make sure the path to the custom generator is in sys.path + # Don't worry about removing it once we are done. Keeping the path + # to each generator that is used in sys.path is likely harmless and + # arguably a good idea. + path = os.path.abspath(path) + if path not in sys.path: + sys.path.insert(0, path) + else: + generator_name = "gyp.generator." + format + + # These parameters are passed in order (as opposed to by key) + # because ActivePython cannot handle key parameters to __import__. + generator = __import__(generator_name, globals(), locals(), generator_name) + for (key, val) in generator.generator_default_variables.items(): + default_variables.setdefault(key, val) + + output_dir = params["options"].generator_output or params["options"].toplevel_dir + if default_variables["GENERATOR"] == "ninja": + default_variables.setdefault( + "PRODUCT_DIR_ABS", + os.path.join(output_dir, "out", default_variables["build_type"]), + ) + else: + default_variables.setdefault( + "PRODUCT_DIR_ABS", + os.path.join(output_dir, default_variables["CONFIGURATION_NAME"]), + ) + + # Give the generator the opportunity to set additional variables based on + # the params it will receive in the output phase. + if getattr(generator, "CalculateVariables", None): + generator.CalculateVariables(default_variables, params) + + # Give the generator the opportunity to set generator_input_info based on + # the params it will receive in the output phase. + if getattr(generator, "CalculateGeneratorInputInfo", None): + generator.CalculateGeneratorInputInfo(params) + + # Fetch the generator specific info that gets fed to input, we use getattr + # so we can default things and the generators only have to provide what + # they need. + generator_input_info = { + "non_configuration_keys": getattr( + generator, "generator_additional_non_configuration_keys", [] + ), + "path_sections": getattr(generator, "generator_additional_path_sections", []), + "extra_sources_for_rules": getattr( + generator, "generator_extra_sources_for_rules", [] + ), + "generator_supports_multiple_toolsets": getattr( + generator, "generator_supports_multiple_toolsets", False + ), + "generator_wants_static_library_dependencies_adjusted": getattr( + generator, "generator_wants_static_library_dependencies_adjusted", True + ), + "generator_wants_sorted_dependencies": getattr( + generator, "generator_wants_sorted_dependencies", False + ), + "generator_filelist_paths": getattr( + generator, "generator_filelist_paths", None + ), + } + + # Process the input specific to this generator. + result = gyp.input.Load( + build_files, + default_variables, + includes[:], + depth, + generator_input_info, + check, + circular_check, + params["parallel"], + params["root_targets"], + ) + return [generator] + result + + +def NameValueListToDict(name_value_list): + """ + Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary + of the pairs. If a string is simply NAME, then the value in the dictionary + is set to True. If VALUE can be converted to an integer, it is. + """ + result = {} + for item in name_value_list: + tokens = item.split("=", 1) + if len(tokens) == 2: + # If we can make it an int, use that, otherwise, use the string. + try: + token_value = int(tokens[1]) + except ValueError: + token_value = tokens[1] + # Set the variable to the supplied value. + result[tokens[0]] = token_value + else: + # No value supplied, treat it as a boolean and set it. + result[tokens[0]] = True + return result + + +def ShlexEnv(env_name): + flags = os.environ.get(env_name, []) + if flags: + flags = shlex.split(flags) + return flags + + +def FormatOpt(opt, value): + if opt.startswith("--"): + return f"{opt}={value}" + return opt + value + + +def RegenerateAppendFlag(flag, values, predicate, env_name, options): + """Regenerate a list of command line flags, for an option of action='append'. + + The |env_name|, if given, is checked in the environment and used to generate + an initial list of options, then the options that were specified on the + command line (given in |values|) are appended. This matches the handling of + environment variables and command line flags where command line flags override + the environment, while not requiring the environment to be set when the flags + are used again. + """ + flags = [] + if options.use_environment and env_name: + for flag_value in ShlexEnv(env_name): + value = FormatOpt(flag, predicate(flag_value)) + if value in flags: + flags.remove(value) + flags.append(value) + if values: + for flag_value in values: + flags.append(FormatOpt(flag, predicate(flag_value))) + return flags + + +def RegenerateFlags(options): + """Given a parsed options object, and taking the environment variables into + account, returns a list of flags that should regenerate an equivalent options + object (even in the absence of the environment variables.) + + Any path options will be normalized relative to depth. + + The format flag is not included, as it is assumed the calling generator will + set that as appropriate. + """ + + def FixPath(path): + path = gyp.common.FixIfRelativePath(path, options.depth) + if not path: + return os.path.curdir + return path + + def Noop(value): + return value + + # We always want to ignore the environment when regenerating, to avoid + # duplicate or changed flags in the environment at the time of regeneration. + flags = ["--ignore-environment"] + for name, metadata in options._regeneration_metadata.items(): + opt = metadata["opt"] + value = getattr(options, name) + value_predicate = metadata["type"] == "path" and FixPath or Noop + action = metadata["action"] + env_name = metadata["env_name"] + if action == "append": + flags.extend( + RegenerateAppendFlag(opt, value, value_predicate, env_name, options) + ) + elif action in ("store", None): # None is a synonym for 'store'. + if value: + flags.append(FormatOpt(opt, value_predicate(value))) + elif options.use_environment and env_name and os.environ.get(env_name): + flags.append(FormatOpt(opt, value_predicate(os.environ.get(env_name)))) + elif action in ("store_true", "store_false"): + if (action == "store_true" and value) or ( + action == "store_false" and not value + ): + flags.append(opt) + elif options.use_environment and env_name: + print( + "Warning: environment regeneration unimplemented " + "for %s flag %r env_name %r" % (action, opt, env_name), + file=sys.stderr, + ) + else: + print( + "Warning: regeneration unimplemented for action %r " + "flag %r" % (action, opt), + file=sys.stderr, + ) + + return flags + + +class RegeneratableOptionParser(argparse.ArgumentParser): + def __init__(self, usage): + self.__regeneratable_options = {} + argparse.ArgumentParser.__init__(self, usage=usage) + + def add_argument(self, *args, **kw): + """Add an option to the parser. + + This accepts the same arguments as ArgumentParser.add_argument, plus the + following: + regenerate: can be set to False to prevent this option from being included + in regeneration. + env_name: name of environment variable that additional values for this + option come from. + type: adds type='path', to tell the regenerator that the values of + this option need to be made relative to options.depth + """ + env_name = kw.pop("env_name", None) + if "dest" in kw and kw.pop("regenerate", True): + dest = kw["dest"] + + # The path type is needed for regenerating, for optparse we can just treat + # it as a string. + type = kw.get("type") + if type == "path": + kw["type"] = str + + self.__regeneratable_options[dest] = { + "action": kw.get("action"), + "type": type, + "env_name": env_name, + "opt": args[0], + } + + argparse.ArgumentParser.add_argument(self, *args, **kw) + + def parse_args(self, *args): + values, args = argparse.ArgumentParser.parse_known_args(self, *args) + values._regeneration_metadata = self.__regeneratable_options + return values, args + + +def gyp_main(args): + my_name = os.path.basename(sys.argv[0]) + usage = "usage: %(prog)s [options ...] [build_file ...]" + + parser = RegeneratableOptionParser(usage=usage.replace("%s", "%(prog)s")) + parser.add_argument( + "--build", + dest="configs", + action="append", + help="configuration for build after project generation", + ) + parser.add_argument( + "--check", dest="check", action="store_true", help="check format of gyp files" + ) + parser.add_argument( + "--config-dir", + dest="config_dir", + action="store", + env_name="GYP_CONFIG_DIR", + default=None, + help="The location for configuration files like " "include.gypi.", + ) + parser.add_argument( + "-d", + "--debug", + dest="debug", + metavar="DEBUGMODE", + action="append", + default=[], + help="turn on a debugging " + 'mode for debugging GYP. Supported modes are "variables", ' + '"includes" and "general" or "all" for all of them.', + ) + parser.add_argument( + "-D", + dest="defines", + action="append", + metavar="VAR=VAL", + env_name="GYP_DEFINES", + help="sets variable VAR to value VAL", + ) + parser.add_argument( + "--depth", + dest="depth", + metavar="PATH", + type="path", + help="set DEPTH gyp variable to a relative path to PATH", + ) + parser.add_argument( + "-f", + "--format", + dest="formats", + action="append", + env_name="GYP_GENERATORS", + regenerate=False, + help="output formats to generate", + ) + parser.add_argument( + "-G", + dest="generator_flags", + action="append", + default=[], + metavar="FLAG=VAL", + env_name="GYP_GENERATOR_FLAGS", + help="sets generator flag FLAG to VAL", + ) + parser.add_argument( + "--generator-output", + dest="generator_output", + action="store", + default=None, + metavar="DIR", + type="path", + env_name="GYP_GENERATOR_OUTPUT", + help="puts generated build files under DIR", + ) + parser.add_argument( + "--ignore-environment", + dest="use_environment", + action="store_false", + default=True, + regenerate=False, + help="do not read options from environment variables", + ) + parser.add_argument( + "-I", + "--include", + dest="includes", + action="append", + metavar="INCLUDE", + type="path", + help="files to include in all loaded .gyp files", + ) + # --no-circular-check disables the check for circular relationships between + # .gyp files. These relationships should not exist, but they've only been + # observed to be harmful with the Xcode generator. Chromium's .gyp files + # currently have some circular relationships on non-Mac platforms, so this + # option allows the strict behavior to be used on Macs and the lenient + # behavior to be used elsewhere. + # TODO(mark): Remove this option when http://crbug.com/35878 is fixed. + parser.add_argument( + "--no-circular-check", + dest="circular_check", + action="store_false", + default=True, + regenerate=False, + help="don't check for circular relationships between files", + ) + parser.add_argument( + "--no-parallel", + action="store_true", + default=False, + help="Disable multiprocessing", + ) + parser.add_argument( + "-S", + "--suffix", + dest="suffix", + default="", + help="suffix to add to generated files", + ) + parser.add_argument( + "--toplevel-dir", + dest="toplevel_dir", + action="store", + default=None, + metavar="DIR", + type="path", + help="directory to use as the root of the source tree", + ) + parser.add_argument( + "-R", + "--root-target", + dest="root_targets", + action="append", + metavar="TARGET", + help="include only TARGET and its deep dependencies", + ) + parser.add_argument( + "-V", + "--version", + dest="version", + action="store_true", + help="Show the version and exit.", + ) + + options, build_files_arg = parser.parse_args(args) + if options.version: + import pkg_resources + print(f"v{pkg_resources.get_distribution('gyp-next').version}") + return 0 + build_files = build_files_arg + + # Set up the configuration directory (defaults to ~/.gyp) + if not options.config_dir: + home = None + home_dot_gyp = None + if options.use_environment: + home_dot_gyp = os.environ.get("GYP_CONFIG_DIR", None) + if home_dot_gyp: + home_dot_gyp = os.path.expanduser(home_dot_gyp) + + if not home_dot_gyp: + home_vars = ["HOME"] + if sys.platform in ("cygwin", "win32"): + home_vars.append("USERPROFILE") + for home_var in home_vars: + home = os.getenv(home_var) + if home: + home_dot_gyp = os.path.join(home, ".gyp") + if not os.path.exists(home_dot_gyp): + home_dot_gyp = None + else: + break + else: + home_dot_gyp = os.path.expanduser(options.config_dir) + + if home_dot_gyp and not os.path.exists(home_dot_gyp): + home_dot_gyp = None + + if not options.formats: + # If no format was given on the command line, then check the env variable. + generate_formats = [] + if options.use_environment: + generate_formats = os.environ.get("GYP_GENERATORS", []) + if generate_formats: + generate_formats = re.split(r"[\s,]", generate_formats) + if generate_formats: + options.formats = generate_formats + else: + # Nothing in the variable, default based on platform. + if sys.platform == "darwin": + options.formats = ["xcode"] + elif sys.platform in ("win32", "cygwin"): + options.formats = ["msvs"] + else: + options.formats = ["make"] + + if not options.generator_output and options.use_environment: + g_o = os.environ.get("GYP_GENERATOR_OUTPUT") + if g_o: + options.generator_output = g_o + + options.parallel = not options.no_parallel + + for mode in options.debug: + gyp.debug[mode] = 1 + + # Do an extra check to avoid work when we're not debugging. + if DEBUG_GENERAL in gyp.debug: + DebugOutput(DEBUG_GENERAL, "running with these options:") + for option, value in sorted(options.__dict__.items()): + if option[0] == "_": + continue + if isinstance(value, str): + DebugOutput(DEBUG_GENERAL, " %s: '%s'", option, value) + else: + DebugOutput(DEBUG_GENERAL, " %s: %s", option, value) + + if not build_files: + build_files = FindBuildFiles() + if not build_files: + raise GypError((usage + "\n\n%s: error: no build_file") % (my_name, my_name)) + + # TODO(mark): Chromium-specific hack! + # For Chromium, the gyp "depth" variable should always be a relative path + # to Chromium's top-level "src" directory. If no depth variable was set + # on the command line, try to find a "src" directory by looking at the + # absolute path to each build file's directory. The first "src" component + # found will be treated as though it were the path used for --depth. + if not options.depth: + for build_file in build_files: + build_file_dir = os.path.abspath(os.path.dirname(build_file)) + build_file_dir_components = build_file_dir.split(os.path.sep) + components_len = len(build_file_dir_components) + for index in range(components_len - 1, -1, -1): + if build_file_dir_components[index] == "src": + options.depth = os.path.sep.join(build_file_dir_components) + break + del build_file_dir_components[index] + + # If the inner loop found something, break without advancing to another + # build file. + if options.depth: + break + + if not options.depth: + raise GypError( + "Could not automatically locate src directory. This is" + "a temporary Chromium feature that will be removed. Use" + "--depth as a workaround." + ) + + # If toplevel-dir is not set, we assume that depth is the root of our source + # tree. + if not options.toplevel_dir: + options.toplevel_dir = options.depth + + # -D on the command line sets variable defaults - D isn't just for define, + # it's for default. Perhaps there should be a way to force (-F?) a + # variable's value so that it can't be overridden by anything else. + cmdline_default_variables = {} + defines = [] + if options.use_environment: + defines += ShlexEnv("GYP_DEFINES") + if options.defines: + defines += options.defines + cmdline_default_variables = NameValueListToDict(defines) + if DEBUG_GENERAL in gyp.debug: + DebugOutput( + DEBUG_GENERAL, "cmdline_default_variables: %s", cmdline_default_variables + ) + + # Set up includes. + includes = [] + + # If ~/.gyp/include.gypi exists, it'll be forcibly included into every + # .gyp file that's loaded, before anything else is included. + if home_dot_gyp: + default_include = os.path.join(home_dot_gyp, "include.gypi") + if os.path.exists(default_include): + print("Using overrides found in " + default_include) + includes.append(default_include) + + # Command-line --include files come after the default include. + if options.includes: + includes.extend(options.includes) + + # Generator flags should be prefixed with the target generator since they + # are global across all generator runs. + gen_flags = [] + if options.use_environment: + gen_flags += ShlexEnv("GYP_GENERATOR_FLAGS") + if options.generator_flags: + gen_flags += options.generator_flags + generator_flags = NameValueListToDict(gen_flags) + if DEBUG_GENERAL in gyp.debug.keys(): + DebugOutput(DEBUG_GENERAL, "generator_flags: %s", generator_flags) + + # Generate all requested formats (use a set in case we got one format request + # twice) + for format in set(options.formats): + params = { + "options": options, + "build_files": build_files, + "generator_flags": generator_flags, + "cwd": os.getcwd(), + "build_files_arg": build_files_arg, + "gyp_binary": sys.argv[0], + "home_dot_gyp": home_dot_gyp, + "parallel": options.parallel, + "root_targets": options.root_targets, + "target_arch": cmdline_default_variables.get("target_arch", ""), + } + + # Start with the default variables from the command line. + [generator, flat_list, targets, data] = Load( + build_files, + format, + cmdline_default_variables, + includes, + options.depth, + params, + options.check, + options.circular_check, + ) + + # TODO(mark): Pass |data| for now because the generator needs a list of + # build files that came in. In the future, maybe it should just accept + # a list, and not the whole data dict. + # NOTE: flat_list is the flattened dependency graph specifying the order + # that targets may be built. Build systems that operate serially or that + # need to have dependencies defined before dependents reference them should + # generate targets in the order specified in flat_list. + generator.GenerateOutput(flat_list, targets, data, params) + + if options.configs: + valid_configs = targets[flat_list[0]]["configurations"] + for conf in options.configs: + if conf not in valid_configs: + raise GypError("Invalid config specified via --build: %s" % conf) + generator.PerformBuild(data, options.configs, params) + + # Done + return 0 + + +def main(args): + try: + return gyp_main(args) + except GypError as e: + sys.stderr.write("gyp: %s\n" % e) + return 1 + + +# NOTE: setuptools generated console_scripts calls function with no arguments +def script_main(): + return main(sys.argv[1:]) + + +if __name__ == "__main__": + sys.exit(script_main()) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common.py new file mode 100644 index 0000000000000..d77adee8afd55 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common.py @@ -0,0 +1,661 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import errno +import filecmp +import os.path +import re +import tempfile +import sys +import subprocess + +from collections.abc import MutableSet + + +# A minimal memoizing decorator. It'll blow up if the args aren't immutable, +# among other "problems". +class memoize: + def __init__(self, func): + self.func = func + self.cache = {} + + def __call__(self, *args): + try: + return self.cache[args] + except KeyError: + result = self.func(*args) + self.cache[args] = result + return result + + +class GypError(Exception): + """Error class representing an error, which is to be presented + to the user. The main entry point will catch and display this. + """ + + pass + + +def ExceptionAppend(e, msg): + """Append a message to the given exception's message.""" + if not e.args: + e.args = (msg,) + elif len(e.args) == 1: + e.args = (str(e.args[0]) + " " + msg,) + else: + e.args = (str(e.args[0]) + " " + msg,) + e.args[1:] + + +def FindQualifiedTargets(target, qualified_list): + """ + Given a list of qualified targets, return the qualified targets for the + specified |target|. + """ + return [t for t in qualified_list if ParseQualifiedTarget(t)[1] == target] + + +def ParseQualifiedTarget(target): + # Splits a qualified target into a build file, target name and toolset. + + # NOTE: rsplit is used to disambiguate the Windows drive letter separator. + target_split = target.rsplit(":", 1) + if len(target_split) == 2: + [build_file, target] = target_split + else: + build_file = None + + target_split = target.rsplit("#", 1) + if len(target_split) == 2: + [target, toolset] = target_split + else: + toolset = None + + return [build_file, target, toolset] + + +def ResolveTarget(build_file, target, toolset): + # This function resolves a target into a canonical form: + # - a fully defined build file, either absolute or relative to the current + # directory + # - a target name + # - a toolset + # + # build_file is the file relative to which 'target' is defined. + # target is the qualified target. + # toolset is the default toolset for that target. + [parsed_build_file, target, parsed_toolset] = ParseQualifiedTarget(target) + + if parsed_build_file: + if build_file: + # If a relative path, parsed_build_file is relative to the directory + # containing build_file. If build_file is not in the current directory, + # parsed_build_file is not a usable path as-is. Resolve it by + # interpreting it as relative to build_file. If parsed_build_file is + # absolute, it is usable as a path regardless of the current directory, + # and os.path.join will return it as-is. + build_file = os.path.normpath( + os.path.join(os.path.dirname(build_file), parsed_build_file) + ) + # Further (to handle cases like ../cwd), make it relative to cwd) + if not os.path.isabs(build_file): + build_file = RelativePath(build_file, ".") + else: + build_file = parsed_build_file + + if parsed_toolset: + toolset = parsed_toolset + + return [build_file, target, toolset] + + +def BuildFile(fully_qualified_target): + # Extracts the build file from the fully qualified target. + return ParseQualifiedTarget(fully_qualified_target)[0] + + +def GetEnvironFallback(var_list, default): + """Look up a key in the environment, with fallback to secondary keys + and finally falling back to a default value.""" + for var in var_list: + if var in os.environ: + return os.environ[var] + return default + + +def QualifiedTarget(build_file, target, toolset): + # "Qualified" means the file that a target was defined in and the target + # name, separated by a colon, suffixed by a # and the toolset name: + # /path/to/file.gyp:target_name#toolset + fully_qualified = build_file + ":" + target + if toolset: + fully_qualified = fully_qualified + "#" + toolset + return fully_qualified + + +@memoize +def RelativePath(path, relative_to, follow_path_symlink=True): + # Assuming both |path| and |relative_to| are relative to the current + # directory, returns a relative path that identifies path relative to + # relative_to. + # If |follow_symlink_path| is true (default) and |path| is a symlink, then + # this method returns a path to the real file represented by |path|. If it is + # false, this method returns a path to the symlink. If |path| is not a + # symlink, this option has no effect. + + # Convert to normalized (and therefore absolute paths). + if follow_path_symlink: + path = os.path.realpath(path) + else: + path = os.path.abspath(path) + relative_to = os.path.realpath(relative_to) + + # On Windows, we can't create a relative path to a different drive, so just + # use the absolute path. + if sys.platform == "win32": + if ( + os.path.splitdrive(path)[0].lower() + != os.path.splitdrive(relative_to)[0].lower() + ): + return path + + # Split the paths into components. + path_split = path.split(os.path.sep) + relative_to_split = relative_to.split(os.path.sep) + + # Determine how much of the prefix the two paths share. + prefix_len = len(os.path.commonprefix([path_split, relative_to_split])) + + # Put enough ".." components to back up out of relative_to to the common + # prefix, and then append the part of path_split after the common prefix. + relative_split = [os.path.pardir] * ( + len(relative_to_split) - prefix_len + ) + path_split[prefix_len:] + + if len(relative_split) == 0: + # The paths were the same. + return "" + + # Turn it back into a string and we're done. + return os.path.join(*relative_split) + + +@memoize +def InvertRelativePath(path, toplevel_dir=None): + """Given a path like foo/bar that is relative to toplevel_dir, return + the inverse relative path back to the toplevel_dir. + + E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path))) + should always produce the empty string, unless the path contains symlinks. + """ + if not path: + return path + toplevel_dir = "." if toplevel_dir is None else toplevel_dir + return RelativePath(toplevel_dir, os.path.join(toplevel_dir, path)) + + +def FixIfRelativePath(path, relative_to): + # Like RelativePath but returns |path| unchanged if it is absolute. + if os.path.isabs(path): + return path + return RelativePath(path, relative_to) + + +def UnrelativePath(path, relative_to): + # Assuming that |relative_to| is relative to the current directory, and |path| + # is a path relative to the dirname of |relative_to|, returns a path that + # identifies |path| relative to the current directory. + rel_dir = os.path.dirname(relative_to) + return os.path.normpath(os.path.join(rel_dir, path)) + + +# re objects used by EncodePOSIXShellArgument. See IEEE 1003.1 XCU.2.2 at +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_02 +# and the documentation for various shells. + +# _quote is a pattern that should match any argument that needs to be quoted +# with double-quotes by EncodePOSIXShellArgument. It matches the following +# characters appearing anywhere in an argument: +# \t, \n, space parameter separators +# # comments +# $ expansions (quoted to always expand within one argument) +# % called out by IEEE 1003.1 XCU.2.2 +# & job control +# ' quoting +# (, ) subshell execution +# *, ?, [ pathname expansion +# ; command delimiter +# <, >, | redirection +# = assignment +# {, } brace expansion (bash) +# ~ tilde expansion +# It also matches the empty string, because "" (or '') is the only way to +# represent an empty string literal argument to a POSIX shell. +# +# This does not match the characters in _escape, because those need to be +# backslash-escaped regardless of whether they appear in a double-quoted +# string. +_quote = re.compile("[\t\n #$%&'()*;<=>?[{|}~]|^$") + +# _escape is a pattern that should match any character that needs to be +# escaped with a backslash, whether or not the argument matched the _quote +# pattern. _escape is used with re.sub to backslash anything in _escape's +# first match group, hence the (parentheses) in the regular expression. +# +# _escape matches the following characters appearing anywhere in an argument: +# " to prevent POSIX shells from interpreting this character for quoting +# \ to prevent POSIX shells from interpreting this character for escaping +# ` to prevent POSIX shells from interpreting this character for command +# substitution +# Missing from this list is $, because the desired behavior of +# EncodePOSIXShellArgument is to permit parameter (variable) expansion. +# +# Also missing from this list is !, which bash will interpret as the history +# expansion character when history is enabled. bash does not enable history +# by default in non-interactive shells, so this is not thought to be a problem. +# ! was omitted from this list because bash interprets "\!" as a literal string +# including the backslash character (avoiding history expansion but retaining +# the backslash), which would not be correct for argument encoding. Handling +# this case properly would also be problematic because bash allows the history +# character to be changed with the histchars shell variable. Fortunately, +# as history is not enabled in non-interactive shells and +# EncodePOSIXShellArgument is only expected to encode for non-interactive +# shells, there is no room for error here by ignoring !. +_escape = re.compile(r'(["\\`])') + + +def EncodePOSIXShellArgument(argument): + """Encodes |argument| suitably for consumption by POSIX shells. + + argument may be quoted and escaped as necessary to ensure that POSIX shells + treat the returned value as a literal representing the argument passed to + this function. Parameter (variable) expansions beginning with $ are allowed + to remain intact without escaping the $, to allow the argument to contain + references to variables to be expanded by the shell. + """ + + if not isinstance(argument, str): + argument = str(argument) + + if _quote.search(argument): + quote = '"' + else: + quote = "" + + encoded = quote + re.sub(_escape, r"\\\1", argument) + quote + + return encoded + + +def EncodePOSIXShellList(list): + """Encodes |list| suitably for consumption by POSIX shells. + + Returns EncodePOSIXShellArgument for each item in list, and joins them + together using the space character as an argument separator. + """ + + encoded_arguments = [] + for argument in list: + encoded_arguments.append(EncodePOSIXShellArgument(argument)) + return " ".join(encoded_arguments) + + +def DeepDependencyTargets(target_dicts, roots): + """Returns the recursive list of target dependencies.""" + dependencies = set() + pending = set(roots) + while pending: + # Pluck out one. + r = pending.pop() + # Skip if visited already. + if r in dependencies: + continue + # Add it. + dependencies.add(r) + # Add its children. + spec = target_dicts[r] + pending.update(set(spec.get("dependencies", []))) + pending.update(set(spec.get("dependencies_original", []))) + return list(dependencies - set(roots)) + + +def BuildFileTargets(target_list, build_file): + """From a target_list, returns the subset from the specified build_file. + """ + return [p for p in target_list if BuildFile(p) == build_file] + + +def AllTargets(target_list, target_dicts, build_file): + """Returns all targets (direct and dependencies) for the specified build_file. + """ + bftargets = BuildFileTargets(target_list, build_file) + deptargets = DeepDependencyTargets(target_dicts, bftargets) + return bftargets + deptargets + + +def WriteOnDiff(filename): + """Write to a file only if the new contents differ. + + Arguments: + filename: name of the file to potentially write to. + Returns: + A file like object which will write to temporary file and only overwrite + the target if it differs (on close). + """ + + class Writer: + """Wrapper around file which only covers the target if it differs.""" + + def __init__(self): + # On Cygwin remove the "dir" argument + # `C:` prefixed paths are treated as relative, + # consequently ending up with current dir "/cygdrive/c/..." + # being prefixed to those, which was + # obviously a non-existent path, + # for example: "/cygdrive/c//C:\". + # For more details see: + # https://docs.python.org/2/library/tempfile.html#tempfile.mkstemp + base_temp_dir = "" if IsCygwin() else os.path.dirname(filename) + # Pick temporary file. + tmp_fd, self.tmp_path = tempfile.mkstemp( + suffix=".tmp", + prefix=os.path.split(filename)[1] + ".gyp.", + dir=base_temp_dir, + ) + try: + self.tmp_file = os.fdopen(tmp_fd, "wb") + except Exception: + # Don't leave turds behind. + os.unlink(self.tmp_path) + raise + + def __getattr__(self, attrname): + # Delegate everything else to self.tmp_file + return getattr(self.tmp_file, attrname) + + def close(self): + try: + # Close tmp file. + self.tmp_file.close() + # Determine if different. + same = False + try: + same = filecmp.cmp(self.tmp_path, filename, False) + except OSError as e: + if e.errno != errno.ENOENT: + raise + + if same: + # The new file is identical to the old one, just get rid of the new + # one. + os.unlink(self.tmp_path) + else: + # The new file is different from the old one, + # or there is no old one. + # Rename the new file to the permanent name. + # + # tempfile.mkstemp uses an overly restrictive mode, resulting in a + # file that can only be read by the owner, regardless of the umask. + # There's no reason to not respect the umask here, + # which means that an extra hoop is required + # to fetch it and reset the new file's mode. + # + # No way to get the umask without setting a new one? Set a safe one + # and then set it back to the old value. + umask = os.umask(0o77) + os.umask(umask) + os.chmod(self.tmp_path, 0o666 & ~umask) + if sys.platform == "win32" and os.path.exists(filename): + # NOTE: on windows (but not cygwin) rename will not replace an + # existing file, so it must be preceded with a remove. + # Sadly there is no way to make the switch atomic. + os.remove(filename) + os.rename(self.tmp_path, filename) + except Exception: + # Don't leave turds behind. + os.unlink(self.tmp_path) + raise + + def write(self, s): + self.tmp_file.write(s.encode("utf-8")) + + return Writer() + + +def EnsureDirExists(path): + """Make sure the directory for |path| exists.""" + try: + os.makedirs(os.path.dirname(path)) + except OSError: + pass + + +def GetFlavor(params): + """Returns |params.flavor| if it's set, the system's default flavor else.""" + flavors = { + "cygwin": "win", + "win32": "win", + "darwin": "mac", + } + + if "flavor" in params: + return params["flavor"] + if sys.platform in flavors: + return flavors[sys.platform] + if sys.platform.startswith("sunos"): + return "solaris" + if sys.platform.startswith(("dragonfly", "freebsd")): + return "freebsd" + if sys.platform.startswith("openbsd"): + return "openbsd" + if sys.platform.startswith("netbsd"): + return "netbsd" + if sys.platform.startswith("aix"): + return "aix" + if sys.platform.startswith(("os390", "zos")): + return "zos" + if sys.platform == "os400": + return "os400" + + return "linux" + + +def CopyTool(flavor, out_path, generator_flags={}): + """Finds (flock|mac|win)_tool.gyp in the gyp directory and copies it + to |out_path|.""" + # aix and solaris just need flock emulation. mac and win use more complicated + # support scripts. + prefix = { + "aix": "flock", + "os400": "flock", + "solaris": "flock", + "mac": "mac", + "ios": "mac", + "win": "win", + }.get(flavor, None) + if not prefix: + return + + # Slurp input file. + source_path = os.path.join( + os.path.dirname(os.path.abspath(__file__)), "%s_tool.py" % prefix + ) + with open(source_path) as source_file: + source = source_file.readlines() + + # Set custom header flags. + header = "# Generated by gyp. Do not edit.\n" + mac_toolchain_dir = generator_flags.get("mac_toolchain_dir", None) + if flavor == "mac" and mac_toolchain_dir: + header += "import os;\nos.environ['DEVELOPER_DIR']='%s'\n" % mac_toolchain_dir + + # Add header and write it out. + tool_path = os.path.join(out_path, "gyp-%s-tool" % prefix) + with open(tool_path, "w") as tool_file: + tool_file.write("".join([source[0], header] + source[1:])) + + # Make file executable. + os.chmod(tool_path, 0o755) + + +# From Alex Martelli, +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560 +# ASPN: Python Cookbook: Remove duplicates from a sequence +# First comment, dated 2001/10/13. +# (Also in the printed Python Cookbook.) + + +def uniquer(seq, idfun=lambda x: x): + seen = {} + result = [] + for item in seq: + marker = idfun(item) + if marker in seen: + continue + seen[marker] = 1 + result.append(item) + return result + + +# Based on http://code.activestate.com/recipes/576694/. +class OrderedSet(MutableSet): + def __init__(self, iterable=None): + self.end = end = [] + end += [None, end, end] # sentinel node for doubly linked list + self.map = {} # key --> [key, prev, next] + if iterable is not None: + self |= iterable + + def __len__(self): + return len(self.map) + + def __contains__(self, key): + return key in self.map + + def add(self, key): + if key not in self.map: + end = self.end + curr = end[1] + curr[2] = end[1] = self.map[key] = [key, curr, end] + + def discard(self, key): + if key in self.map: + key, prev_item, next_item = self.map.pop(key) + prev_item[2] = next_item + next_item[1] = prev_item + + def __iter__(self): + end = self.end + curr = end[2] + while curr is not end: + yield curr[0] + curr = curr[2] + + def __reversed__(self): + end = self.end + curr = end[1] + while curr is not end: + yield curr[0] + curr = curr[1] + + # The second argument is an addition that causes a pylint warning. + def pop(self, last=True): # pylint: disable=W0221 + if not self: + raise KeyError("set is empty") + key = self.end[1][0] if last else self.end[2][0] + self.discard(key) + return key + + def __repr__(self): + if not self: + return f"{self.__class__.__name__}()" + return f"{self.__class__.__name__}({list(self)!r})" + + def __eq__(self, other): + if isinstance(other, OrderedSet): + return len(self) == len(other) and list(self) == list(other) + return set(self) == set(other) + + # Extensions to the recipe. + def update(self, iterable): + for i in iterable: + if i not in self: + self.add(i) + + +class CycleError(Exception): + """An exception raised when an unexpected cycle is detected.""" + + def __init__(self, nodes): + self.nodes = nodes + + def __str__(self): + return "CycleError: cycle involving: " + str(self.nodes) + + +def TopologicallySorted(graph, get_edges): + r"""Topologically sort based on a user provided edge definition. + + Args: + graph: A list of node names. + get_edges: A function mapping from node name to a hashable collection + of node names which this node has outgoing edges to. + Returns: + A list containing all of the node in graph in topological order. + It is assumed that calling get_edges once for each node and caching is + cheaper than repeatedly calling get_edges. + Raises: + CycleError in the event of a cycle. + Example: + graph = {'a': '$(b) $(c)', 'b': 'hi', 'c': '$(b)'} + def GetEdges(node): + return re.findall(r'\$\(([^))]\)', graph[node]) + print TopologicallySorted(graph.keys(), GetEdges) + ==> + ['a', 'c', b'] + """ + get_edges = memoize(get_edges) + visited = set() + visiting = set() + ordered_nodes = [] + + def Visit(node): + if node in visiting: + raise CycleError(visiting) + if node in visited: + return + visited.add(node) + visiting.add(node) + for neighbor in get_edges(node): + Visit(neighbor) + visiting.remove(node) + ordered_nodes.insert(0, node) + + for node in sorted(graph): + Visit(node) + return ordered_nodes + + +def CrossCompileRequested(): + # TODO: figure out how to not build extra host objects in the + # non-cross-compile case when this is enabled, and enable unconditionally. + return ( + os.environ.get("GYP_CROSSCOMPILE") + or os.environ.get("AR_host") + or os.environ.get("CC_host") + or os.environ.get("CXX_host") + or os.environ.get("AR_target") + or os.environ.get("CC_target") + or os.environ.get("CXX_target") + ) + + +def IsCygwin(): + try: + out = subprocess.Popen( + "uname", stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + stdout = out.communicate()[0].decode("utf-8") + return "CYGWIN" in str(stdout) + except Exception: + return False diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common_test.py new file mode 100755 index 0000000000000..05344085ad3b1 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common_test.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Unit tests for the common.py file.""" + +import gyp.common +import unittest +import sys + + +class TestTopologicallySorted(unittest.TestCase): + def test_Valid(self): + """Test that sorting works on a valid graph with one possible order.""" + graph = { + "a": ["b", "c"], + "b": [], + "c": ["d"], + "d": ["b"], + } + + def GetEdge(node): + return tuple(graph[node]) + + self.assertEqual( + gyp.common.TopologicallySorted(graph.keys(), GetEdge), ["a", "c", "d", "b"] + ) + + def test_Cycle(self): + """Test that an exception is thrown on a cyclic graph.""" + graph = { + "a": ["b"], + "b": ["c"], + "c": ["d"], + "d": ["a"], + } + + def GetEdge(node): + return tuple(graph[node]) + + self.assertRaises( + gyp.common.CycleError, gyp.common.TopologicallySorted, graph.keys(), GetEdge + ) + + +class TestGetFlavor(unittest.TestCase): + """Test that gyp.common.GetFlavor works as intended""" + + original_platform = "" + + def setUp(self): + self.original_platform = sys.platform + + def tearDown(self): + sys.platform = self.original_platform + + def assertFlavor(self, expected, argument, param): + sys.platform = argument + self.assertEqual(expected, gyp.common.GetFlavor(param)) + + def test_platform_default(self): + self.assertFlavor("freebsd", "freebsd9", {}) + self.assertFlavor("freebsd", "freebsd10", {}) + self.assertFlavor("openbsd", "openbsd5", {}) + self.assertFlavor("solaris", "sunos5", {}) + self.assertFlavor("solaris", "sunos", {}) + self.assertFlavor("linux", "linux2", {}) + self.assertFlavor("linux", "linux3", {}) + self.assertFlavor("linux", "linux", {}) + + def test_param(self): + self.assertFlavor("foobar", "linux2", {"flavor": "foobar"}) + + +if __name__ == "__main__": + unittest.main() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py new file mode 100644 index 0000000000000..bda1a47468ae2 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py @@ -0,0 +1,165 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys +import re +import os +import locale +from functools import reduce + + +def XmlToString(content, encoding="utf-8", pretty=False): + """ Writes the XML content to disk, touching the file only if it has changed. + + Visual Studio files have a lot of pre-defined structures. This function makes + it easy to represent these structures as Python data structures, instead of + having to create a lot of function calls. + + Each XML element of the content is represented as a list composed of: + 1. The name of the element, a string, + 2. The attributes of the element, a dictionary (optional), and + 3+. The content of the element, if any. Strings are simple text nodes and + lists are child elements. + + Example 1: + + becomes + ['test'] + + Example 2: + + This is + it! + + + becomes + ['myelement', {'a':'value1', 'b':'value2'}, + ['childtype', 'This is'], + ['childtype', 'it!'], + ] + + Args: + content: The structured content to be converted. + encoding: The encoding to report on the first XML line. + pretty: True if we want pretty printing with indents and new lines. + + Returns: + The XML content as a string. + """ + # We create a huge list of all the elements of the file. + xml_parts = ['' % encoding] + if pretty: + xml_parts.append("\n") + _ConstructContentList(xml_parts, content, pretty) + + # Convert it to a string + return "".join(xml_parts) + + +def _ConstructContentList(xml_parts, specification, pretty, level=0): + """ Appends the XML parts corresponding to the specification. + + Args: + xml_parts: A list of XML parts to be appended to. + specification: The specification of the element. See EasyXml docs. + pretty: True if we want pretty printing with indents and new lines. + level: Indentation level. + """ + # The first item in a specification is the name of the element. + if pretty: + indentation = " " * level + new_line = "\n" + else: + indentation = "" + new_line = "" + name = specification[0] + if not isinstance(name, str): + raise Exception( + "The first item of an EasyXml specification should be " + "a string. Specification was " + str(specification) + ) + xml_parts.append(indentation + "<" + name) + + # Optionally in second position is a dictionary of the attributes. + rest = specification[1:] + if rest and isinstance(rest[0], dict): + for at, val in sorted(rest[0].items()): + xml_parts.append(f' {at}="{_XmlEscape(val, attr=True)}"') + rest = rest[1:] + if rest: + xml_parts.append(">") + all_strings = reduce(lambda x, y: x and isinstance(y, str), rest, True) + multi_line = not all_strings + if multi_line and new_line: + xml_parts.append(new_line) + for child_spec in rest: + # If it's a string, append a text node. + # Otherwise recurse over that child definition + if isinstance(child_spec, str): + xml_parts.append(_XmlEscape(child_spec)) + else: + _ConstructContentList(xml_parts, child_spec, pretty, level + 1) + if multi_line and indentation: + xml_parts.append(indentation) + xml_parts.append(f"{new_line}") + else: + xml_parts.append("/>%s" % new_line) + + +def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False, + win32=(sys.platform == "win32")): + """ Writes the XML content to disk, touching the file only if it has changed. + + Args: + content: The structured content to be written. + path: Location of the file. + encoding: The encoding to report on the first line of the XML file. + pretty: True if we want pretty printing with indents and new lines. + """ + xml_string = XmlToString(content, encoding, pretty) + if win32 and os.linesep != "\r\n": + xml_string = xml_string.replace("\n", "\r\n") + + default_encoding = locale.getdefaultlocale()[1] + if default_encoding and default_encoding.upper() != encoding.upper(): + xml_string = xml_string.encode(encoding) + + # Get the old content + try: + with open(path) as file: + existing = file.read() + except OSError: + existing = None + + # It has changed, write it + if existing != xml_string: + with open(path, "wb") as file: + file.write(xml_string) + + +_xml_escape_map = { + '"': """, + "'": "'", + "<": "<", + ">": ">", + "&": "&", + "\n": " ", + "\r": " ", +} + + +_xml_escape_re = re.compile("(%s)" % "|".join(map(re.escape, _xml_escape_map.keys()))) + + +def _XmlEscape(value, attr=False): + """ Escape a string for inclusion in XML.""" + + def replace(match): + m = match.string[match.start() : match.end()] + # don't replace single quotes in attrs + if attr and m == "'": + return m + return _xml_escape_map[m] + + return _xml_escape_re.sub(replace, value) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py new file mode 100755 index 0000000000000..342f693a329d2 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Unit tests for the easy_xml.py file. """ + +import gyp.easy_xml as easy_xml +import unittest + +from io import StringIO + + +class TestSequenceFunctions(unittest.TestCase): + def setUp(self): + self.stderr = StringIO() + + def test_EasyXml_simple(self): + self.assertEqual( + easy_xml.XmlToString(["test"]), + '', + ) + + self.assertEqual( + easy_xml.XmlToString(["test"], encoding="Windows-1252"), + '', + ) + + def test_EasyXml_simple_with_attributes(self): + self.assertEqual( + easy_xml.XmlToString(["test2", {"a": "value1", "b": "value2"}]), + '', + ) + + def test_EasyXml_escaping(self): + original = "'\"\r&\nfoo" + converted = "<test>'" & foo" + converted_apos = converted.replace("'", "'") + self.assertEqual( + easy_xml.XmlToString(["test3", {"a": original}, original]), + '%s' + % (converted, converted_apos), + ) + + def test_EasyXml_pretty(self): + self.assertEqual( + easy_xml.XmlToString( + ["test3", ["GrandParent", ["Parent1", ["Child"]], ["Parent2"]]], + pretty=True, + ), + '\n' + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n", + ) + + def test_EasyXml_complex(self): + # We want to create: + target = ( + '' + "" + '' + "{D2250C20-3A94-4FB9-AF73-11BC5B73884B}" + "Win32Proj" + "automated_ui_tests" + "" + '' + "' + "Application" + "Unicode" + "" + "" + ) + + xml = easy_xml.XmlToString( + [ + "Project", + [ + "PropertyGroup", + {"Label": "Globals"}, + ["ProjectGuid", "{D2250C20-3A94-4FB9-AF73-11BC5B73884B}"], + ["Keyword", "Win32Proj"], + ["RootNamespace", "automated_ui_tests"], + ], + ["Import", {"Project": "$(VCTargetsPath)\\Microsoft.Cpp.props"}], + [ + "PropertyGroup", + { + "Condition": "'$(Configuration)|$(Platform)'=='Debug|Win32'", + "Label": "Configuration", + }, + ["ConfigurationType", "Application"], + ["CharacterSet", "Unicode"], + ], + ] + ) + self.assertEqual(xml, target) + + +if __name__ == "__main__": + unittest.main() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py new file mode 100755 index 0000000000000..0754aff26fe7c --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""These functions are executed via gyp-flock-tool when using the Makefile +generator. Used on systems that don't have a built-in flock.""" + +import fcntl +import os +import struct +import subprocess +import sys + + +def main(args): + executor = FlockTool() + executor.Dispatch(args) + + +class FlockTool: + """This class emulates the 'flock' command.""" + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like copy-info-plist to CopyInfoPlist""" + return name_string.title().replace("-", "") + + def ExecFlock(self, lockfile, *cmd_list): + """Emulates the most basic behavior of Linux's flock(1).""" + # Rely on exception handling to report errors. + # Note that the stock python on SunOS has a bug + # where fcntl.flock(fd, LOCK_EX) always fails + # with EBADF, that's why we use this F_SETLK + # hack instead. + fd = os.open(lockfile, os.O_WRONLY | os.O_NOCTTY | os.O_CREAT, 0o666) + if sys.platform.startswith("aix") or sys.platform == "os400": + # Python on AIX is compiled with LARGEFILE support, which changes the + # struct size. + op = struct.pack("hhIllqq", fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0) + else: + op = struct.pack("hhllhhl", fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0) + fcntl.fcntl(fd, fcntl.F_SETLK, op) + return subprocess.call(cmd_list) + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py new file mode 100644 index 0000000000000..f15df00c36373 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py @@ -0,0 +1,808 @@ +# Copyright (c) 2014 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +This script is intended for use as a GYP_GENERATOR. It takes as input (by way of +the generator flag config_path) the path of a json file that dictates the files +and targets to search for. The following keys are supported: +files: list of paths (relative) of the files to search for. +test_targets: unqualified target names to search for. Any target in this list +that depends upon a file in |files| is output regardless of the type of target +or chain of dependencies. +additional_compile_targets: Unqualified targets to search for in addition to +test_targets. Targets in the combined list that depend upon a file in |files| +are not necessarily output. For example, if the target is of type none then the +target is not output (but one of the descendants of the target will be). + +The following is output: +error: only supplied if there is an error. +compile_targets: minimal set of targets that directly or indirectly (for + targets of type none) depend on the files in |files| and is one of the + supplied targets or a target that one of the supplied targets depends on. + The expectation is this set of targets is passed into a build step. This list + always contains the output of test_targets as well. +test_targets: set of targets from the supplied |test_targets| that either + directly or indirectly depend upon a file in |files|. This list if useful + if additional processing needs to be done for certain targets after the + build, such as running tests. +status: outputs one of three values: none of the supplied files were found, + one of the include files changed so that it should be assumed everything + changed (in this case test_targets and compile_targets are not output) or at + least one file was found. +invalid_targets: list of supplied targets that were not found. + +Example: +Consider a graph like the following: + A D + / \ +B C +A depends upon both B and C, A is of type none and B and C are executables. +D is an executable, has no dependencies and nothing depends on it. +If |additional_compile_targets| = ["A"], |test_targets| = ["B", "C"] and +files = ["b.cc", "d.cc"] (B depends upon b.cc and D depends upon d.cc), then +the following is output: +|compile_targets| = ["B"] B must built as it depends upon the changed file b.cc +and the supplied target A depends upon it. A is not output as a build_target +as it is of type none with no rules and actions. +|test_targets| = ["B"] B directly depends upon the change file b.cc. + +Even though the file d.cc, which D depends upon, has changed D is not output +as it was not supplied by way of |additional_compile_targets| or |test_targets|. + +If the generator flag analyzer_output_path is specified, output is written +there. Otherwise output is written to stdout. + +In Gyp the "all" target is shorthand for the root targets in the files passed +to gyp. For example, if file "a.gyp" contains targets "a1" and +"a2", and file "b.gyp" contains targets "b1" and "b2" and "a2" has a dependency +on "b2" and gyp is supplied "a.gyp" then "all" consists of "a1" and "a2". +Notice that "b1" and "b2" are not in the "all" target as "b.gyp" was not +directly supplied to gyp. OTOH if both "a.gyp" and "b.gyp" are supplied to gyp +then the "all" target includes "b1" and "b2". +""" + + +import gyp.common +import json +import os +import posixpath + +debug = False + +found_dependency_string = "Found dependency" +no_dependency_string = "No dependencies" +# Status when it should be assumed that everything has changed. +all_changed_string = "Found dependency (all)" + +# MatchStatus is used indicate if and how a target depends upon the supplied +# sources. +# The target's sources contain one of the supplied paths. +MATCH_STATUS_MATCHES = 1 +# The target has a dependency on another target that contains one of the +# supplied paths. +MATCH_STATUS_MATCHES_BY_DEPENDENCY = 2 +# The target's sources weren't in the supplied paths and none of the target's +# dependencies depend upon a target that matched. +MATCH_STATUS_DOESNT_MATCH = 3 +# The target doesn't contain the source, but the dependent targets have not yet +# been visited to determine a more specific status yet. +MATCH_STATUS_TBD = 4 + +generator_supports_multiple_toolsets = gyp.common.CrossCompileRequested() + +generator_wants_static_library_dependencies_adjusted = False + +generator_default_variables = {} +for dirname in [ + "INTERMEDIATE_DIR", + "SHARED_INTERMEDIATE_DIR", + "PRODUCT_DIR", + "LIB_DIR", + "SHARED_LIB_DIR", +]: + generator_default_variables[dirname] = "!!!" + +for unused in [ + "RULE_INPUT_PATH", + "RULE_INPUT_ROOT", + "RULE_INPUT_NAME", + "RULE_INPUT_DIRNAME", + "RULE_INPUT_EXT", + "EXECUTABLE_PREFIX", + "EXECUTABLE_SUFFIX", + "STATIC_LIB_PREFIX", + "STATIC_LIB_SUFFIX", + "SHARED_LIB_PREFIX", + "SHARED_LIB_SUFFIX", + "CONFIGURATION_NAME", +]: + generator_default_variables[unused] = "" + + +def _ToGypPath(path): + """Converts a path to the format used by gyp.""" + if os.sep == "\\" and os.altsep == "/": + return path.replace("\\", "/") + return path + + +def _ResolveParent(path, base_path_components): + """Resolves |path|, which starts with at least one '../'. Returns an empty + string if the path shouldn't be considered. See _AddSources() for a + description of |base_path_components|.""" + depth = 0 + while path.startswith("../"): + depth += 1 + path = path[3:] + # Relative includes may go outside the source tree. For example, an action may + # have inputs in /usr/include, which are not in the source tree. + if depth > len(base_path_components): + return "" + if depth == len(base_path_components): + return path + return ( + "/".join(base_path_components[0 : len(base_path_components) - depth]) + + "/" + + path + ) + + +def _AddSources(sources, base_path, base_path_components, result): + """Extracts valid sources from |sources| and adds them to |result|. Each + source file is relative to |base_path|, but may contain '..'. To make + resolving '..' easier |base_path_components| contains each of the + directories in |base_path|. Additionally each source may contain variables. + Such sources are ignored as it is assumed dependencies on them are expressed + and tracked in some other means.""" + # NOTE: gyp paths are always posix style. + for source in sources: + if not len(source) or source.startswith("!!!") or source.startswith("$"): + continue + # variable expansion may lead to //. + org_source = source + source = source[0] + source[1:].replace("//", "/") + if source.startswith("../"): + source = _ResolveParent(source, base_path_components) + if len(source): + result.append(source) + continue + result.append(base_path + source) + if debug: + print("AddSource", org_source, result[len(result) - 1]) + + +def _ExtractSourcesFromAction(action, base_path, base_path_components, results): + if "inputs" in action: + _AddSources(action["inputs"], base_path, base_path_components, results) + + +def _ToLocalPath(toplevel_dir, path): + """Converts |path| to a path relative to |toplevel_dir|.""" + if path == toplevel_dir: + return "" + if path.startswith(toplevel_dir + "/"): + return path[len(toplevel_dir) + len("/") :] + return path + + +def _ExtractSources(target, target_dict, toplevel_dir): + # |target| is either absolute or relative and in the format of the OS. Gyp + # source paths are always posix. Convert |target| to a posix path relative to + # |toplevel_dir_|. This is done to make it easy to build source paths. + base_path = posixpath.dirname(_ToLocalPath(toplevel_dir, _ToGypPath(target))) + base_path_components = base_path.split("/") + + # Add a trailing '/' so that _AddSources() can easily build paths. + if len(base_path): + base_path += "/" + + if debug: + print("ExtractSources", target, base_path) + + results = [] + if "sources" in target_dict: + _AddSources(target_dict["sources"], base_path, base_path_components, results) + # Include the inputs from any actions. Any changes to these affect the + # resulting output. + if "actions" in target_dict: + for action in target_dict["actions"]: + _ExtractSourcesFromAction(action, base_path, base_path_components, results) + if "rules" in target_dict: + for rule in target_dict["rules"]: + _ExtractSourcesFromAction(rule, base_path, base_path_components, results) + + return results + + +class Target: + """Holds information about a particular target: + deps: set of Targets this Target depends upon. This is not recursive, only the + direct dependent Targets. + match_status: one of the MatchStatus values. + back_deps: set of Targets that have a dependency on this Target. + visited: used during iteration to indicate whether we've visited this target. + This is used for two iterations, once in building the set of Targets and + again in _GetBuildTargets(). + name: fully qualified name of the target. + requires_build: True if the target type is such that it needs to be built. + See _DoesTargetTypeRequireBuild for details. + added_to_compile_targets: used when determining if the target was added to the + set of targets that needs to be built. + in_roots: true if this target is a descendant of one of the root nodes. + is_executable: true if the type of target is executable. + is_static_library: true if the type of target is static_library. + is_or_has_linked_ancestor: true if the target does a link (eg executable), or + if there is a target in back_deps that does a link.""" + + def __init__(self, name): + self.deps = set() + self.match_status = MATCH_STATUS_TBD + self.back_deps = set() + self.name = name + # TODO(sky): I don't like hanging this off Target. This state is specific + # to certain functions and should be isolated there. + self.visited = False + self.requires_build = False + self.added_to_compile_targets = False + self.in_roots = False + self.is_executable = False + self.is_static_library = False + self.is_or_has_linked_ancestor = False + + +class Config: + """Details what we're looking for + files: set of files to search for + targets: see file description for details.""" + + def __init__(self): + self.files = [] + self.targets = set() + self.additional_compile_target_names = set() + self.test_target_names = set() + + def Init(self, params): + """Initializes Config. This is a separate method as it raises an exception + if there is a parse error.""" + generator_flags = params.get("generator_flags", {}) + config_path = generator_flags.get("config_path", None) + if not config_path: + return + try: + f = open(config_path) + config = json.load(f) + f.close() + except OSError: + raise Exception("Unable to open file " + config_path) + except ValueError as e: + raise Exception("Unable to parse config file " + config_path + str(e)) + if not isinstance(config, dict): + raise Exception("config_path must be a JSON file containing a dictionary") + self.files = config.get("files", []) + self.additional_compile_target_names = set( + config.get("additional_compile_targets", []) + ) + self.test_target_names = set(config.get("test_targets", [])) + + +def _WasBuildFileModified(build_file, data, files, toplevel_dir): + """Returns true if the build file |build_file| is either in |files| or + one of the files included by |build_file| is in |files|. |toplevel_dir| is + the root of the source tree.""" + if _ToLocalPath(toplevel_dir, _ToGypPath(build_file)) in files: + if debug: + print("gyp file modified", build_file) + return True + + # First element of included_files is the file itself. + if len(data[build_file]["included_files"]) <= 1: + return False + + for include_file in data[build_file]["included_files"][1:]: + # |included_files| are relative to the directory of the |build_file|. + rel_include_file = _ToGypPath( + gyp.common.UnrelativePath(include_file, build_file) + ) + if _ToLocalPath(toplevel_dir, rel_include_file) in files: + if debug: + print( + "included gyp file modified, gyp_file=", + build_file, + "included file=", + rel_include_file, + ) + return True + return False + + +def _GetOrCreateTargetByName(targets, target_name): + """Creates or returns the Target at targets[target_name]. If there is no + Target for |target_name| one is created. Returns a tuple of whether a new + Target was created and the Target.""" + if target_name in targets: + return False, targets[target_name] + target = Target(target_name) + targets[target_name] = target + return True, target + + +def _DoesTargetTypeRequireBuild(target_dict): + """Returns true if the target type is such that it needs to be built.""" + # If a 'none' target has rules or actions we assume it requires a build. + return bool( + target_dict["type"] != "none" + or target_dict.get("actions") + or target_dict.get("rules") + ) + + +def _GenerateTargets(data, target_list, target_dicts, toplevel_dir, files, build_files): + """Returns a tuple of the following: + . A dictionary mapping from fully qualified name to Target. + . A list of the targets that have a source file in |files|. + . Targets that constitute the 'all' target. See description at top of file + for details on the 'all' target. + This sets the |match_status| of the targets that contain any of the source + files in |files| to MATCH_STATUS_MATCHES. + |toplevel_dir| is the root of the source tree.""" + # Maps from target name to Target. + name_to_target = {} + + # Targets that matched. + matching_targets = [] + + # Queue of targets to visit. + targets_to_visit = target_list[:] + + # Maps from build file to a boolean indicating whether the build file is in + # |files|. + build_file_in_files = {} + + # Root targets across all files. + roots = set() + + # Set of Targets in |build_files|. + build_file_targets = set() + + while len(targets_to_visit) > 0: + target_name = targets_to_visit.pop() + created_target, target = _GetOrCreateTargetByName(name_to_target, target_name) + if created_target: + roots.add(target) + elif target.visited: + continue + + target.visited = True + target.requires_build = _DoesTargetTypeRequireBuild(target_dicts[target_name]) + target_type = target_dicts[target_name]["type"] + target.is_executable = target_type == "executable" + target.is_static_library = target_type == "static_library" + target.is_or_has_linked_ancestor = ( + target_type == "executable" or target_type == "shared_library" + ) + + build_file = gyp.common.ParseQualifiedTarget(target_name)[0] + if build_file not in build_file_in_files: + build_file_in_files[build_file] = _WasBuildFileModified( + build_file, data, files, toplevel_dir + ) + + if build_file in build_files: + build_file_targets.add(target) + + # If a build file (or any of its included files) is modified we assume all + # targets in the file are modified. + if build_file_in_files[build_file]: + print("matching target from modified build file", target_name) + target.match_status = MATCH_STATUS_MATCHES + matching_targets.append(target) + else: + sources = _ExtractSources( + target_name, target_dicts[target_name], toplevel_dir + ) + for source in sources: + if _ToGypPath(os.path.normpath(source)) in files: + print("target", target_name, "matches", source) + target.match_status = MATCH_STATUS_MATCHES + matching_targets.append(target) + break + + # Add dependencies to visit as well as updating back pointers for deps. + for dep in target_dicts[target_name].get("dependencies", []): + targets_to_visit.append(dep) + + created_dep_target, dep_target = _GetOrCreateTargetByName( + name_to_target, dep + ) + if not created_dep_target: + roots.discard(dep_target) + + target.deps.add(dep_target) + dep_target.back_deps.add(target) + + return name_to_target, matching_targets, roots & build_file_targets + + +def _GetUnqualifiedToTargetMapping(all_targets, to_find): + """Returns a tuple of the following: + . mapping (dictionary) from unqualified name to Target for all the + Targets in |to_find|. + . any target names not found. If this is empty all targets were found.""" + result = {} + if not to_find: + return {}, [] + to_find = set(to_find) + for target_name in all_targets.keys(): + extracted = gyp.common.ParseQualifiedTarget(target_name) + if len(extracted) > 1 and extracted[1] in to_find: + to_find.remove(extracted[1]) + result[extracted[1]] = all_targets[target_name] + if not to_find: + return result, [] + return result, [x for x in to_find] + + +def _DoesTargetDependOnMatchingTargets(target): + """Returns true if |target| or any of its dependencies is one of the + targets containing the files supplied as input to analyzer. This updates + |matches| of the Targets as it recurses. + target: the Target to look for.""" + if target.match_status == MATCH_STATUS_DOESNT_MATCH: + return False + if ( + target.match_status == MATCH_STATUS_MATCHES + or target.match_status == MATCH_STATUS_MATCHES_BY_DEPENDENCY + ): + return True + for dep in target.deps: + if _DoesTargetDependOnMatchingTargets(dep): + target.match_status = MATCH_STATUS_MATCHES_BY_DEPENDENCY + print("\t", target.name, "matches by dep", dep.name) + return True + target.match_status = MATCH_STATUS_DOESNT_MATCH + return False + + +def _GetTargetsDependingOnMatchingTargets(possible_targets): + """Returns the list of Targets in |possible_targets| that depend (either + directly on indirectly) on at least one of the targets containing the files + supplied as input to analyzer. + possible_targets: targets to search from.""" + found = [] + print("Targets that matched by dependency:") + for target in possible_targets: + if _DoesTargetDependOnMatchingTargets(target): + found.append(target) + return found + + +def _AddCompileTargets(target, roots, add_if_no_ancestor, result): + """Recurses through all targets that depend on |target|, adding all targets + that need to be built (and are in |roots|) to |result|. + roots: set of root targets. + add_if_no_ancestor: If true and there are no ancestors of |target| then add + |target| to |result|. |target| must still be in |roots|. + result: targets that need to be built are added here.""" + if target.visited: + return + + target.visited = True + target.in_roots = target in roots + + for back_dep_target in target.back_deps: + _AddCompileTargets(back_dep_target, roots, False, result) + target.added_to_compile_targets |= back_dep_target.added_to_compile_targets + target.in_roots |= back_dep_target.in_roots + target.is_or_has_linked_ancestor |= back_dep_target.is_or_has_linked_ancestor + + # Always add 'executable' targets. Even though they may be built by other + # targets that depend upon them it makes detection of what is going to be + # built easier. + # And always add static_libraries that have no dependencies on them from + # linkables. This is necessary as the other dependencies on them may be + # static libraries themselves, which are not compile time dependencies. + if target.in_roots and ( + target.is_executable + or ( + not target.added_to_compile_targets + and (add_if_no_ancestor or target.requires_build) + ) + or ( + target.is_static_library + and add_if_no_ancestor + and not target.is_or_has_linked_ancestor + ) + ): + print( + "\t\tadding to compile targets", + target.name, + "executable", + target.is_executable, + "added_to_compile_targets", + target.added_to_compile_targets, + "add_if_no_ancestor", + add_if_no_ancestor, + "requires_build", + target.requires_build, + "is_static_library", + target.is_static_library, + "is_or_has_linked_ancestor", + target.is_or_has_linked_ancestor, + ) + result.add(target) + target.added_to_compile_targets = True + + +def _GetCompileTargets(matching_targets, supplied_targets): + """Returns the set of Targets that require a build. + matching_targets: targets that changed and need to be built. + supplied_targets: set of targets supplied to analyzer to search from.""" + result = set() + for target in matching_targets: + print("finding compile targets for match", target.name) + _AddCompileTargets(target, supplied_targets, True, result) + return result + + +def _WriteOutput(params, **values): + """Writes the output, either to stdout or a file is specified.""" + if "error" in values: + print("Error:", values["error"]) + if "status" in values: + print(values["status"]) + if "targets" in values: + values["targets"].sort() + print("Supplied targets that depend on changed files:") + for target in values["targets"]: + print("\t", target) + if "invalid_targets" in values: + values["invalid_targets"].sort() + print("The following targets were not found:") + for target in values["invalid_targets"]: + print("\t", target) + if "build_targets" in values: + values["build_targets"].sort() + print("Targets that require a build:") + for target in values["build_targets"]: + print("\t", target) + if "compile_targets" in values: + values["compile_targets"].sort() + print("Targets that need to be built:") + for target in values["compile_targets"]: + print("\t", target) + if "test_targets" in values: + values["test_targets"].sort() + print("Test targets:") + for target in values["test_targets"]: + print("\t", target) + + output_path = params.get("generator_flags", {}).get("analyzer_output_path", None) + if not output_path: + print(json.dumps(values)) + return + try: + f = open(output_path, "w") + f.write(json.dumps(values) + "\n") + f.close() + except OSError as e: + print("Error writing to output file", output_path, str(e)) + + +def _WasGypIncludeFileModified(params, files): + """Returns true if one of the files in |files| is in the set of included + files.""" + if params["options"].includes: + for include in params["options"].includes: + if _ToGypPath(os.path.normpath(include)) in files: + print("Include file modified, assuming all changed", include) + return True + return False + + +def _NamesNotIn(names, mapping): + """Returns a list of the values in |names| that are not in |mapping|.""" + return [name for name in names if name not in mapping] + + +def _LookupTargets(names, mapping): + """Returns a list of the mapping[name] for each value in |names| that is in + |mapping|.""" + return [mapping[name] for name in names if name in mapping] + + +def CalculateVariables(default_variables, params): + """Calculate additional variables for use in the build (called by gyp).""" + flavor = gyp.common.GetFlavor(params) + if flavor == "mac": + default_variables.setdefault("OS", "mac") + elif flavor == "win": + default_variables.setdefault("OS", "win") + gyp.msvs_emulation.CalculateCommonVariables(default_variables, params) + else: + operating_system = flavor + if flavor == "android": + operating_system = "linux" # Keep this legacy behavior for now. + default_variables.setdefault("OS", operating_system) + + +class TargetCalculator: + """Calculates the matching test_targets and matching compile_targets.""" + + def __init__( + self, + files, + additional_compile_target_names, + test_target_names, + data, + target_list, + target_dicts, + toplevel_dir, + build_files, + ): + self._additional_compile_target_names = set(additional_compile_target_names) + self._test_target_names = set(test_target_names) + ( + self._name_to_target, + self._changed_targets, + self._root_targets, + ) = _GenerateTargets( + data, target_list, target_dicts, toplevel_dir, frozenset(files), build_files + ) + ( + self._unqualified_mapping, + self.invalid_targets, + ) = _GetUnqualifiedToTargetMapping( + self._name_to_target, self._supplied_target_names_no_all() + ) + + def _supplied_target_names(self): + return self._additional_compile_target_names | self._test_target_names + + def _supplied_target_names_no_all(self): + """Returns the supplied test targets without 'all'.""" + result = self._supplied_target_names() + result.discard("all") + return result + + def is_build_impacted(self): + """Returns true if the supplied files impact the build at all.""" + return self._changed_targets + + def find_matching_test_target_names(self): + """Returns the set of output test targets.""" + assert self.is_build_impacted() + # Find the test targets first. 'all' is special cased to mean all the + # root targets. To deal with all the supplied |test_targets| are expanded + # to include the root targets during lookup. If any of the root targets + # match, we remove it and replace it with 'all'. + test_target_names_no_all = set(self._test_target_names) + test_target_names_no_all.discard("all") + test_targets_no_all = _LookupTargets( + test_target_names_no_all, self._unqualified_mapping + ) + test_target_names_contains_all = "all" in self._test_target_names + if test_target_names_contains_all: + test_targets = [ + x for x in (set(test_targets_no_all) | set(self._root_targets)) + ] + else: + test_targets = [x for x in test_targets_no_all] + print("supplied test_targets") + for target_name in self._test_target_names: + print("\t", target_name) + print("found test_targets") + for target in test_targets: + print("\t", target.name) + print("searching for matching test targets") + matching_test_targets = _GetTargetsDependingOnMatchingTargets(test_targets) + matching_test_targets_contains_all = test_target_names_contains_all and set( + matching_test_targets + ) & set(self._root_targets) + if matching_test_targets_contains_all: + # Remove any of the targets for all that were not explicitly supplied, + # 'all' is subsequentely added to the matching names below. + matching_test_targets = [ + x for x in (set(matching_test_targets) & set(test_targets_no_all)) + ] + print("matched test_targets") + for target in matching_test_targets: + print("\t", target.name) + matching_target_names = [ + gyp.common.ParseQualifiedTarget(target.name)[1] + for target in matching_test_targets + ] + if matching_test_targets_contains_all: + matching_target_names.append("all") + print("\tall") + return matching_target_names + + def find_matching_compile_target_names(self): + """Returns the set of output compile targets.""" + assert self.is_build_impacted() + # Compile targets are found by searching up from changed targets. + # Reset the visited status for _GetBuildTargets. + for target in self._name_to_target.values(): + target.visited = False + + supplied_targets = _LookupTargets( + self._supplied_target_names_no_all(), self._unqualified_mapping + ) + if "all" in self._supplied_target_names(): + supplied_targets = [ + x for x in (set(supplied_targets) | set(self._root_targets)) + ] + print("Supplied test_targets & compile_targets") + for target in supplied_targets: + print("\t", target.name) + print("Finding compile targets") + compile_targets = _GetCompileTargets(self._changed_targets, supplied_targets) + return [ + gyp.common.ParseQualifiedTarget(target.name)[1] + for target in compile_targets + ] + + +def GenerateOutput(target_list, target_dicts, data, params): + """Called by gyp as the final stage. Outputs results.""" + config = Config() + try: + config.Init(params) + + if not config.files: + raise Exception( + "Must specify files to analyze via config_path generator " "flag" + ) + + toplevel_dir = _ToGypPath(os.path.abspath(params["options"].toplevel_dir)) + if debug: + print("toplevel_dir", toplevel_dir) + + if _WasGypIncludeFileModified(params, config.files): + result_dict = { + "status": all_changed_string, + "test_targets": list(config.test_target_names), + "compile_targets": list( + config.additional_compile_target_names | config.test_target_names + ), + } + _WriteOutput(params, **result_dict) + return + + calculator = TargetCalculator( + config.files, + config.additional_compile_target_names, + config.test_target_names, + data, + target_list, + target_dicts, + toplevel_dir, + params["build_files"], + ) + if not calculator.is_build_impacted(): + result_dict = { + "status": no_dependency_string, + "test_targets": [], + "compile_targets": [], + } + if calculator.invalid_targets: + result_dict["invalid_targets"] = calculator.invalid_targets + _WriteOutput(params, **result_dict) + return + + test_target_names = calculator.find_matching_test_target_names() + compile_target_names = calculator.find_matching_compile_target_names() + found_at_least_one_target = compile_target_names or test_target_names + result_dict = { + "test_targets": test_target_names, + "status": found_dependency_string + if found_at_least_one_target + else no_dependency_string, + "compile_targets": list(set(compile_target_names) | set(test_target_names)), + } + if calculator.invalid_targets: + result_dict["invalid_targets"] = calculator.invalid_targets + _WriteOutput(params, **result_dict) + + except Exception as e: + _WriteOutput(params, error=str(e)) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py new file mode 100644 index 0000000000000..cdf1a4832cf1a --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py @@ -0,0 +1,1173 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Notes: +# +# This generates makefiles suitable for inclusion into the Android build system +# via an Android.mk file. It is based on make.py, the standard makefile +# generator. +# +# The code below generates a separate .mk file for each target, but +# all are sourced by the top-level GypAndroid.mk. This means that all +# variables in .mk-files clobber one another, and furthermore that any +# variables set potentially clash with other Android build system variables. +# Try to avoid setting global variables where possible. + + +import gyp +import gyp.common +import gyp.generator.make as make # Reuse global functions from make backend. +import os +import re +import subprocess + +generator_default_variables = { + "OS": "android", + "EXECUTABLE_PREFIX": "", + "EXECUTABLE_SUFFIX": "", + "STATIC_LIB_PREFIX": "lib", + "SHARED_LIB_PREFIX": "lib", + "STATIC_LIB_SUFFIX": ".a", + "SHARED_LIB_SUFFIX": ".so", + "INTERMEDIATE_DIR": "$(gyp_intermediate_dir)", + "SHARED_INTERMEDIATE_DIR": "$(gyp_shared_intermediate_dir)", + "PRODUCT_DIR": "$(gyp_shared_intermediate_dir)", + "SHARED_LIB_DIR": "$(builddir)/lib.$(TOOLSET)", + "LIB_DIR": "$(obj).$(TOOLSET)", + "RULE_INPUT_ROOT": "%(INPUT_ROOT)s", # This gets expanded by Python. + "RULE_INPUT_DIRNAME": "%(INPUT_DIRNAME)s", # This gets expanded by Python. + "RULE_INPUT_PATH": "$(RULE_SOURCES)", + "RULE_INPUT_EXT": "$(suffix $<)", + "RULE_INPUT_NAME": "$(notdir $<)", + "CONFIGURATION_NAME": "$(GYP_CONFIGURATION)", +} + +# Make supports multiple toolsets +generator_supports_multiple_toolsets = True + + +# Generator-specific gyp specs. +generator_additional_non_configuration_keys = [ + # Boolean to declare that this target does not want its name mangled. + "android_unmangled_name", + # Map of android build system variables to set. + "aosp_build_settings", +] +generator_additional_path_sections = [] +generator_extra_sources_for_rules = [] + + +ALL_MODULES_FOOTER = """\ +# "gyp_all_modules" is a concatenation of the "gyp_all_modules" targets from +# all the included sub-makefiles. This is just here to clarify. +gyp_all_modules: +""" + +header = """\ +# This file is generated by gyp; do not edit. + +""" + +# Map gyp target types to Android module classes. +MODULE_CLASSES = { + "static_library": "STATIC_LIBRARIES", + "shared_library": "SHARED_LIBRARIES", + "executable": "EXECUTABLES", +} + + +def IsCPPExtension(ext): + return make.COMPILABLE_EXTENSIONS.get(ext) == "cxx" + + +def Sourceify(path): + """Convert a path to its source directory form. The Android backend does not + support options.generator_output, so this function is a noop.""" + return path + + +# Map from qualified target to path to output. +# For Android, the target of these maps is a tuple ('static', 'modulename'), +# ('dynamic', 'modulename'), or ('path', 'some/path') instead of a string, +# since we link by module. +target_outputs = {} +# Map from qualified target to any linkable output. A subset +# of target_outputs. E.g. when mybinary depends on liba, we want to +# include liba in the linker line; when otherbinary depends on +# mybinary, we just want to build mybinary first. +target_link_deps = {} + + +class AndroidMkWriter: + """AndroidMkWriter packages up the writing of one target-specific Android.mk. + + Its only real entry point is Write(), and is mostly used for namespacing. + """ + + def __init__(self, android_top_dir): + self.android_top_dir = android_top_dir + + def Write( + self, + qualified_target, + relative_target, + base_path, + output_filename, + spec, + configs, + part_of_all, + write_alias_target, + sdk_version, + ): + """The main entry point: writes a .mk file for a single target. + + Arguments: + qualified_target: target we're generating + relative_target: qualified target name relative to the root + base_path: path relative to source root we're building in, used to resolve + target-relative paths + output_filename: output .mk file name to write + spec, configs: gyp info + part_of_all: flag indicating this target is part of 'all' + write_alias_target: flag indicating whether to create short aliases for + this target + sdk_version: what to emit for LOCAL_SDK_VERSION in output + """ + gyp.common.EnsureDirExists(output_filename) + + self.fp = open(output_filename, "w") + + self.fp.write(header) + + self.qualified_target = qualified_target + self.relative_target = relative_target + self.path = base_path + self.target = spec["target_name"] + self.type = spec["type"] + self.toolset = spec["toolset"] + + deps, link_deps = self.ComputeDeps(spec) + + # Some of the generation below can add extra output, sources, or + # link dependencies. All of the out params of the functions that + # follow use names like extra_foo. + extra_outputs = [] + extra_sources = [] + + self.android_class = MODULE_CLASSES.get(self.type, "GYP") + self.android_module = self.ComputeAndroidModule(spec) + (self.android_stem, self.android_suffix) = self.ComputeOutputParts(spec) + self.output = self.output_binary = self.ComputeOutput(spec) + + # Standard header. + self.WriteLn("include $(CLEAR_VARS)\n") + + # Module class and name. + self.WriteLn("LOCAL_MODULE_CLASS := " + self.android_class) + self.WriteLn("LOCAL_MODULE := " + self.android_module) + # Only emit LOCAL_MODULE_STEM if it's different to LOCAL_MODULE. + # The library module classes fail if the stem is set. ComputeOutputParts + # makes sure that stem == modulename in these cases. + if self.android_stem != self.android_module: + self.WriteLn("LOCAL_MODULE_STEM := " + self.android_stem) + self.WriteLn("LOCAL_MODULE_SUFFIX := " + self.android_suffix) + if self.toolset == "host": + self.WriteLn("LOCAL_IS_HOST_MODULE := true") + self.WriteLn("LOCAL_MULTILIB := $(GYP_HOST_MULTILIB)") + elif sdk_version > 0: + self.WriteLn( + "LOCAL_MODULE_TARGET_ARCH := " "$(TARGET_$(GYP_VAR_PREFIX)ARCH)" + ) + self.WriteLn("LOCAL_SDK_VERSION := %s" % sdk_version) + + # Grab output directories; needed for Actions and Rules. + if self.toolset == "host": + self.WriteLn( + "gyp_intermediate_dir := " + "$(call local-intermediates-dir,,$(GYP_HOST_VAR_PREFIX))" + ) + else: + self.WriteLn( + "gyp_intermediate_dir := " + "$(call local-intermediates-dir,,$(GYP_VAR_PREFIX))" + ) + self.WriteLn( + "gyp_shared_intermediate_dir := " + "$(call intermediates-dir-for,GYP,shared,,,$(GYP_VAR_PREFIX))" + ) + self.WriteLn() + + # List files this target depends on so that actions/rules/copies/sources + # can depend on the list. + # TODO: doesn't pull in things through transitive link deps; needed? + target_dependencies = [x[1] for x in deps if x[0] == "path"] + self.WriteLn("# Make sure our deps are built first.") + self.WriteList( + target_dependencies, "GYP_TARGET_DEPENDENCIES", local_pathify=True + ) + + # Actions must come first, since they can generate more OBJs for use below. + if "actions" in spec: + self.WriteActions(spec["actions"], extra_sources, extra_outputs) + + # Rules must be early like actions. + if "rules" in spec: + self.WriteRules(spec["rules"], extra_sources, extra_outputs) + + if "copies" in spec: + self.WriteCopies(spec["copies"], extra_outputs) + + # GYP generated outputs. + self.WriteList(extra_outputs, "GYP_GENERATED_OUTPUTS", local_pathify=True) + + # Set LOCAL_ADDITIONAL_DEPENDENCIES so that Android's build rules depend + # on both our dependency targets and our generated files. + self.WriteLn("# Make sure our deps and generated files are built first.") + self.WriteLn( + "LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) " + "$(GYP_GENERATED_OUTPUTS)" + ) + self.WriteLn() + + # Sources. + if spec.get("sources", []) or extra_sources: + self.WriteSources(spec, configs, extra_sources) + + self.WriteTarget( + spec, configs, deps, link_deps, part_of_all, write_alias_target + ) + + # Update global list of target outputs, used in dependency tracking. + target_outputs[qualified_target] = ("path", self.output_binary) + + # Update global list of link dependencies. + if self.type == "static_library": + target_link_deps[qualified_target] = ("static", self.android_module) + elif self.type == "shared_library": + target_link_deps[qualified_target] = ("shared", self.android_module) + + self.fp.close() + return self.android_module + + def WriteActions(self, actions, extra_sources, extra_outputs): + """Write Makefile code for any 'actions' from the gyp input. + + extra_sources: a list that will be filled in with newly generated source + files, if any + extra_outputs: a list that will be filled in with any outputs of these + actions (used to make other pieces dependent on these + actions) + """ + for action in actions: + name = make.StringToMakefileVariable( + "{}_{}".format(self.relative_target, action["action_name"]) + ) + self.WriteLn('### Rules for action "%s":' % action["action_name"]) + inputs = action["inputs"] + outputs = action["outputs"] + + # Build up a list of outputs. + # Collect the output dirs we'll need. + dirs = set() + for out in outputs: + if not out.startswith("$"): + print( + 'WARNING: Action for target "%s" writes output to local path ' + '"%s".' % (self.target, out) + ) + dir = os.path.split(out)[0] + if dir: + dirs.add(dir) + if int(action.get("process_outputs_as_sources", False)): + extra_sources += outputs + + # Prepare the actual command. + command = gyp.common.EncodePOSIXShellList(action["action"]) + if "message" in action: + quiet_cmd = "Gyp action: %s ($@)" % action["message"] + else: + quiet_cmd = "Gyp action: %s ($@)" % name + if len(dirs) > 0: + command = "mkdir -p %s" % " ".join(dirs) + "; " + command + + cd_action = "cd $(gyp_local_path)/%s; " % self.path + command = cd_action + command + + # The makefile rules are all relative to the top dir, but the gyp actions + # are defined relative to their containing dir. This replaces the gyp_* + # variables for the action rule with an absolute version so that the + # output goes in the right place. + # Only write the gyp_* rules for the "primary" output (:1); + # it's superfluous for the "extra outputs", and this avoids accidentally + # writing duplicate dummy rules for those outputs. + main_output = make.QuoteSpaces(self.LocalPathify(outputs[0])) + self.WriteLn("%s: gyp_local_path := $(LOCAL_PATH)" % main_output) + self.WriteLn("%s: gyp_var_prefix := $(GYP_VAR_PREFIX)" % main_output) + self.WriteLn( + "%s: gyp_intermediate_dir := " + "$(abspath $(gyp_intermediate_dir))" % main_output + ) + self.WriteLn( + "%s: gyp_shared_intermediate_dir := " + "$(abspath $(gyp_shared_intermediate_dir))" % main_output + ) + + # Android's envsetup.sh adds a number of directories to the path including + # the built host binary directory. This causes actions/rules invoked by + # gyp to sometimes use these instead of system versions, e.g. bison. + # The built host binaries may not be suitable, and can cause errors. + # So, we remove them from the PATH using the ANDROID_BUILD_PATHS variable + # set by envsetup. + self.WriteLn( + "%s: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))" + % main_output + ) + + # Don't allow spaces in input/output filenames, but make an exception for + # filenames which start with '$(' since it's okay for there to be spaces + # inside of make function/macro invocations. + for input in inputs: + if not input.startswith("$(") and " " in input: + raise gyp.common.GypError( + 'Action input filename "%s" in target %s contains a space' + % (input, self.target) + ) + for output in outputs: + if not output.startswith("$(") and " " in output: + raise gyp.common.GypError( + 'Action output filename "%s" in target %s contains a space' + % (output, self.target) + ) + + self.WriteLn( + "%s: %s $(GYP_TARGET_DEPENDENCIES)" + % (main_output, " ".join(map(self.LocalPathify, inputs))) + ) + self.WriteLn('\t@echo "%s"' % quiet_cmd) + self.WriteLn("\t$(hide)%s\n" % command) + for output in outputs[1:]: + # Make each output depend on the main output, with an empty command + # to force make to notice that the mtime has changed. + self.WriteLn(f"{self.LocalPathify(output)}: {main_output} ;") + + extra_outputs += outputs + self.WriteLn() + + self.WriteLn() + + def WriteRules(self, rules, extra_sources, extra_outputs): + """Write Makefile code for any 'rules' from the gyp input. + + extra_sources: a list that will be filled in with newly generated source + files, if any + extra_outputs: a list that will be filled in with any outputs of these + rules (used to make other pieces dependent on these rules) + """ + if len(rules) == 0: + return + + for rule in rules: + if len(rule.get("rule_sources", [])) == 0: + continue + name = make.StringToMakefileVariable( + "{}_{}".format(self.relative_target, rule["rule_name"]) + ) + self.WriteLn('\n### Generated for rule "%s":' % name) + self.WriteLn('# "%s":' % rule) + + inputs = rule.get("inputs") + for rule_source in rule.get("rule_sources", []): + (rule_source_dirname, rule_source_basename) = os.path.split(rule_source) + (rule_source_root, rule_source_ext) = os.path.splitext( + rule_source_basename + ) + + outputs = [ + self.ExpandInputRoot(out, rule_source_root, rule_source_dirname) + for out in rule["outputs"] + ] + + dirs = set() + for out in outputs: + if not out.startswith("$"): + print( + "WARNING: Rule for target %s writes output to local path %s" + % (self.target, out) + ) + dir = os.path.dirname(out) + if dir: + dirs.add(dir) + extra_outputs += outputs + if int(rule.get("process_outputs_as_sources", False)): + extra_sources.extend(outputs) + + components = [] + for component in rule["action"]: + component = self.ExpandInputRoot( + component, rule_source_root, rule_source_dirname + ) + if "$(RULE_SOURCES)" in component: + component = component.replace("$(RULE_SOURCES)", rule_source) + components.append(component) + + command = gyp.common.EncodePOSIXShellList(components) + cd_action = "cd $(gyp_local_path)/%s; " % self.path + command = cd_action + command + if dirs: + command = "mkdir -p %s" % " ".join(dirs) + "; " + command + + # We set up a rule to build the first output, and then set up + # a rule for each additional output to depend on the first. + outputs = map(self.LocalPathify, outputs) + main_output = outputs[0] + self.WriteLn("%s: gyp_local_path := $(LOCAL_PATH)" % main_output) + self.WriteLn("%s: gyp_var_prefix := $(GYP_VAR_PREFIX)" % main_output) + self.WriteLn( + "%s: gyp_intermediate_dir := " + "$(abspath $(gyp_intermediate_dir))" % main_output + ) + self.WriteLn( + "%s: gyp_shared_intermediate_dir := " + "$(abspath $(gyp_shared_intermediate_dir))" % main_output + ) + + # See explanation in WriteActions. + self.WriteLn( + "%s: export PATH := " + "$(subst $(ANDROID_BUILD_PATHS),,$(PATH))" % main_output + ) + + main_output_deps = self.LocalPathify(rule_source) + if inputs: + main_output_deps += " " + main_output_deps += " ".join([self.LocalPathify(f) for f in inputs]) + + self.WriteLn( + "%s: %s $(GYP_TARGET_DEPENDENCIES)" + % (main_output, main_output_deps) + ) + self.WriteLn("\t%s\n" % command) + for output in outputs[1:]: + # Make each output depend on the main output, with an empty command + # to force make to notice that the mtime has changed. + self.WriteLn(f"{output}: {main_output} ;") + self.WriteLn() + + self.WriteLn() + + def WriteCopies(self, copies, extra_outputs): + """Write Makefile code for any 'copies' from the gyp input. + + extra_outputs: a list that will be filled in with any outputs of this action + (used to make other pieces dependent on this action) + """ + self.WriteLn("### Generated for copy rule.") + + variable = make.StringToMakefileVariable(self.relative_target + "_copies") + outputs = [] + for copy in copies: + for path in copy["files"]: + # The Android build system does not allow generation of files into the + # source tree. The destination should start with a variable, which will + # typically be $(gyp_intermediate_dir) or + # $(gyp_shared_intermediate_dir). Note that we can't use an assertion + # because some of the gyp tests depend on this. + if not copy["destination"].startswith("$"): + print( + "WARNING: Copy rule for target %s writes output to " + "local path %s" % (self.target, copy["destination"]) + ) + + # LocalPathify() calls normpath, stripping trailing slashes. + path = Sourceify(self.LocalPathify(path)) + filename = os.path.split(path)[1] + output = Sourceify( + self.LocalPathify(os.path.join(copy["destination"], filename)) + ) + + self.WriteLn(f"{output}: {path} $(GYP_TARGET_DEPENDENCIES) | $(ACP)") + self.WriteLn("\t@echo Copying: $@") + self.WriteLn("\t$(hide) mkdir -p $(dir $@)") + self.WriteLn("\t$(hide) $(ACP) -rpf $< $@") + self.WriteLn() + outputs.append(output) + self.WriteLn( + "{} = {}".format(variable, " ".join(map(make.QuoteSpaces, outputs))) + ) + extra_outputs.append("$(%s)" % variable) + self.WriteLn() + + def WriteSourceFlags(self, spec, configs): + """Write out the flags and include paths used to compile source files for + the current target. + + Args: + spec, configs: input from gyp. + """ + for configname, config in sorted(configs.items()): + extracted_includes = [] + + self.WriteLn("\n# Flags passed to both C and C++ files.") + cflags, includes_from_cflags = self.ExtractIncludesFromCFlags( + config.get("cflags", []) + config.get("cflags_c", []) + ) + extracted_includes.extend(includes_from_cflags) + self.WriteList(cflags, "MY_CFLAGS_%s" % configname) + + self.WriteList( + config.get("defines"), + "MY_DEFS_%s" % configname, + prefix="-D", + quoter=make.EscapeCppDefine, + ) + + self.WriteLn("\n# Include paths placed before CFLAGS/CPPFLAGS") + includes = list(config.get("include_dirs", [])) + includes.extend(extracted_includes) + includes = map(Sourceify, map(self.LocalPathify, includes)) + includes = self.NormalizeIncludePaths(includes) + self.WriteList(includes, "LOCAL_C_INCLUDES_%s" % configname) + + self.WriteLn("\n# Flags passed to only C++ (and not C) files.") + self.WriteList(config.get("cflags_cc"), "LOCAL_CPPFLAGS_%s" % configname) + + self.WriteLn( + "\nLOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) " + "$(MY_DEFS_$(GYP_CONFIGURATION))" + ) + # Undefine ANDROID for host modules + # TODO: the source code should not use macro ANDROID to tell if it's host + # or target module. + if self.toolset == "host": + self.WriteLn("# Undefine ANDROID for host modules") + self.WriteLn("LOCAL_CFLAGS += -UANDROID") + self.WriteLn( + "LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) " + "$(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION))" + ) + self.WriteLn("LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION))") + # Android uses separate flags for assembly file invocations, but gyp expects + # the same CFLAGS to be applied: + self.WriteLn("LOCAL_ASFLAGS := $(LOCAL_CFLAGS)") + + def WriteSources(self, spec, configs, extra_sources): + """Write Makefile code for any 'sources' from the gyp input. + These are source files necessary to build the current target. + We need to handle shared_intermediate directory source files as + a special case by copying them to the intermediate directory and + treating them as a generated sources. Otherwise the Android build + rules won't pick them up. + + Args: + spec, configs: input from gyp. + extra_sources: Sources generated from Actions or Rules. + """ + sources = filter(make.Compilable, spec.get("sources", [])) + generated_not_sources = [x for x in extra_sources if not make.Compilable(x)] + extra_sources = filter(make.Compilable, extra_sources) + + # Determine and output the C++ extension used by these sources. + # We simply find the first C++ file and use that extension. + all_sources = sources + extra_sources + local_cpp_extension = ".cpp" + for source in all_sources: + (root, ext) = os.path.splitext(source) + if IsCPPExtension(ext): + local_cpp_extension = ext + break + if local_cpp_extension != ".cpp": + self.WriteLn("LOCAL_CPP_EXTENSION := %s" % local_cpp_extension) + + # We need to move any non-generated sources that are coming from the + # shared intermediate directory out of LOCAL_SRC_FILES and put them + # into LOCAL_GENERATED_SOURCES. We also need to move over any C++ files + # that don't match our local_cpp_extension, since Android will only + # generate Makefile rules for a single LOCAL_CPP_EXTENSION. + local_files = [] + for source in sources: + (root, ext) = os.path.splitext(source) + if "$(gyp_shared_intermediate_dir)" in source: + extra_sources.append(source) + elif "$(gyp_intermediate_dir)" in source: + extra_sources.append(source) + elif IsCPPExtension(ext) and ext != local_cpp_extension: + extra_sources.append(source) + else: + local_files.append(os.path.normpath(os.path.join(self.path, source))) + + # For any generated source, if it is coming from the shared intermediate + # directory then we add a Make rule to copy them to the local intermediate + # directory first. This is because the Android LOCAL_GENERATED_SOURCES + # must be in the local module intermediate directory for the compile rules + # to work properly. If the file has the wrong C++ extension, then we add + # a rule to copy that to intermediates and use the new version. + final_generated_sources = [] + # If a source file gets copied, we still need to add the original source + # directory as header search path, for GCC searches headers in the + # directory that contains the source file by default. + origin_src_dirs = [] + for source in extra_sources: + local_file = source + if "$(gyp_intermediate_dir)/" not in local_file: + basename = os.path.basename(local_file) + local_file = "$(gyp_intermediate_dir)/" + basename + (root, ext) = os.path.splitext(local_file) + if IsCPPExtension(ext) and ext != local_cpp_extension: + local_file = root + local_cpp_extension + if local_file != source: + self.WriteLn(f"{local_file}: {self.LocalPathify(source)}") + self.WriteLn("\tmkdir -p $(@D); cp $< $@") + origin_src_dirs.append(os.path.dirname(source)) + final_generated_sources.append(local_file) + + # We add back in all of the non-compilable stuff to make sure that the + # make rules have dependencies on them. + final_generated_sources.extend(generated_not_sources) + self.WriteList(final_generated_sources, "LOCAL_GENERATED_SOURCES") + + origin_src_dirs = gyp.common.uniquer(origin_src_dirs) + origin_src_dirs = map(Sourceify, map(self.LocalPathify, origin_src_dirs)) + self.WriteList(origin_src_dirs, "GYP_COPIED_SOURCE_ORIGIN_DIRS") + + self.WriteList(local_files, "LOCAL_SRC_FILES") + + # Write out the flags used to compile the source; this must be done last + # so that GYP_COPIED_SOURCE_ORIGIN_DIRS can be used as an include path. + self.WriteSourceFlags(spec, configs) + + def ComputeAndroidModule(self, spec): + """Return the Android module name used for a gyp spec. + + We use the complete qualified target name to avoid collisions between + duplicate targets in different directories. We also add a suffix to + distinguish gyp-generated module names. + """ + + if int(spec.get("android_unmangled_name", 0)): + assert self.type != "shared_library" or self.target.startswith("lib") + return self.target + + if self.type == "shared_library": + # For reasons of convention, the Android build system requires that all + # shared library modules are named 'libfoo' when generating -l flags. + prefix = "lib_" + else: + prefix = "" + + if spec["toolset"] == "host": + suffix = "_$(TARGET_$(GYP_VAR_PREFIX)ARCH)_host_gyp" + else: + suffix = "_gyp" + + if self.path: + middle = make.StringToMakefileVariable(f"{self.path}_{self.target}") + else: + middle = make.StringToMakefileVariable(self.target) + + return "".join([prefix, middle, suffix]) + + def ComputeOutputParts(self, spec): + """Return the 'output basename' of a gyp spec, split into filename + ext. + + Android libraries must be named the same thing as their module name, + otherwise the linker can't find them, so product_name and so on must be + ignored if we are building a library, and the "lib" prepending is + not done for Android. + """ + assert self.type != "loadable_module" # TODO: not supported? + + target = spec["target_name"] + target_prefix = "" + target_ext = "" + if self.type == "static_library": + target = self.ComputeAndroidModule(spec) + target_ext = ".a" + elif self.type == "shared_library": + target = self.ComputeAndroidModule(spec) + target_ext = ".so" + elif self.type == "none": + target_ext = ".stamp" + elif self.type != "executable": + print( + "ERROR: What output file should be generated?", + "type", + self.type, + "target", + target, + ) + + if self.type != "static_library" and self.type != "shared_library": + target_prefix = spec.get("product_prefix", target_prefix) + target = spec.get("product_name", target) + product_ext = spec.get("product_extension") + if product_ext: + target_ext = "." + product_ext + + target_stem = target_prefix + target + return (target_stem, target_ext) + + def ComputeOutputBasename(self, spec): + """Return the 'output basename' of a gyp spec. + + E.g., the loadable module 'foobar' in directory 'baz' will produce + 'libfoobar.so' + """ + return "".join(self.ComputeOutputParts(spec)) + + def ComputeOutput(self, spec): + """Return the 'output' (full output path) of a gyp spec. + + E.g., the loadable module 'foobar' in directory 'baz' will produce + '$(obj)/baz/libfoobar.so' + """ + if self.type == "executable": + # We install host executables into shared_intermediate_dir so they can be + # run by gyp rules that refer to PRODUCT_DIR. + path = "$(gyp_shared_intermediate_dir)" + elif self.type == "shared_library": + if self.toolset == "host": + path = "$($(GYP_HOST_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)" + else: + path = "$($(GYP_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)" + else: + # Other targets just get built into their intermediate dir. + if self.toolset == "host": + path = ( + "$(call intermediates-dir-for,%s,%s,true,," + "$(GYP_HOST_VAR_PREFIX))" + % (self.android_class, self.android_module) + ) + else: + path = "$(call intermediates-dir-for,{},{},,,$(GYP_VAR_PREFIX))".format( + self.android_class, + self.android_module, + ) + + assert spec.get("product_dir") is None # TODO: not supported? + return os.path.join(path, self.ComputeOutputBasename(spec)) + + def NormalizeIncludePaths(self, include_paths): + """Normalize include_paths. + Convert absolute paths to relative to the Android top directory. + + Args: + include_paths: A list of unprocessed include paths. + Returns: + A list of normalized include paths. + """ + normalized = [] + for path in include_paths: + if path[0] == "/": + path = gyp.common.RelativePath(path, self.android_top_dir) + normalized.append(path) + return normalized + + def ExtractIncludesFromCFlags(self, cflags): + """Extract includes "-I..." out from cflags + + Args: + cflags: A list of compiler flags, which may be mixed with "-I.." + Returns: + A tuple of lists: (clean_clfags, include_paths). "-I.." is trimmed. + """ + clean_cflags = [] + include_paths = [] + for flag in cflags: + if flag.startswith("-I"): + include_paths.append(flag[2:]) + else: + clean_cflags.append(flag) + + return (clean_cflags, include_paths) + + def FilterLibraries(self, libraries): + """Filter the 'libraries' key to separate things that shouldn't be ldflags. + + Library entries that look like filenames should be converted to android + module names instead of being passed to the linker as flags. + + Args: + libraries: the value of spec.get('libraries') + Returns: + A tuple (static_lib_modules, dynamic_lib_modules, ldflags) + """ + static_lib_modules = [] + dynamic_lib_modules = [] + ldflags = [] + for libs in libraries: + # Libs can have multiple words. + for lib in libs.split(): + # Filter the system libraries, which are added by default by the Android + # build system. + if ( + lib == "-lc" + or lib == "-lstdc++" + or lib == "-lm" + or lib.endswith("libgcc.a") + ): + continue + match = re.search(r"([^/]+)\.a$", lib) + if match: + static_lib_modules.append(match.group(1)) + continue + match = re.search(r"([^/]+)\.so$", lib) + if match: + dynamic_lib_modules.append(match.group(1)) + continue + if lib.startswith("-l"): + ldflags.append(lib) + return (static_lib_modules, dynamic_lib_modules, ldflags) + + def ComputeDeps(self, spec): + """Compute the dependencies of a gyp spec. + + Returns a tuple (deps, link_deps), where each is a list of + filenames that will need to be put in front of make for either + building (deps) or linking (link_deps). + """ + deps = [] + link_deps = [] + if "dependencies" in spec: + deps.extend( + [ + target_outputs[dep] + for dep in spec["dependencies"] + if target_outputs[dep] + ] + ) + for dep in spec["dependencies"]: + if dep in target_link_deps: + link_deps.append(target_link_deps[dep]) + deps.extend(link_deps) + return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps)) + + def WriteTargetFlags(self, spec, configs, link_deps): + """Write Makefile code to specify the link flags and library dependencies. + + spec, configs: input from gyp. + link_deps: link dependency list; see ComputeDeps() + """ + # Libraries (i.e. -lfoo) + # These must be included even for static libraries as some of them provide + # implicit include paths through the build system. + libraries = gyp.common.uniquer(spec.get("libraries", [])) + static_libs, dynamic_libs, ldflags_libs = self.FilterLibraries(libraries) + + if self.type != "static_library": + for configname, config in sorted(configs.items()): + ldflags = list(config.get("ldflags", [])) + self.WriteLn("") + self.WriteList(ldflags, "LOCAL_LDFLAGS_%s" % configname) + self.WriteList(ldflags_libs, "LOCAL_GYP_LIBS") + self.WriteLn( + "LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) " + "$(LOCAL_GYP_LIBS)" + ) + + # Link dependencies (i.e. other gyp targets this target depends on) + # These need not be included for static libraries as within the gyp build + # we do not use the implicit include path mechanism. + if self.type != "static_library": + static_link_deps = [x[1] for x in link_deps if x[0] == "static"] + shared_link_deps = [x[1] for x in link_deps if x[0] == "shared"] + else: + static_link_deps = [] + shared_link_deps = [] + + # Only write the lists if they are non-empty. + if static_libs or static_link_deps: + self.WriteLn("") + self.WriteList(static_libs + static_link_deps, "LOCAL_STATIC_LIBRARIES") + self.WriteLn("# Enable grouping to fix circular references") + self.WriteLn("LOCAL_GROUP_STATIC_LIBRARIES := true") + if dynamic_libs or shared_link_deps: + self.WriteLn("") + self.WriteList(dynamic_libs + shared_link_deps, "LOCAL_SHARED_LIBRARIES") + + def WriteTarget( + self, spec, configs, deps, link_deps, part_of_all, write_alias_target + ): + """Write Makefile code to produce the final target of the gyp spec. + + spec, configs: input from gyp. + deps, link_deps: dependency lists; see ComputeDeps() + part_of_all: flag indicating this target is part of 'all' + write_alias_target: flag indicating whether to create short aliases for this + target + """ + self.WriteLn("### Rules for final target.") + + if self.type != "none": + self.WriteTargetFlags(spec, configs, link_deps) + + settings = spec.get("aosp_build_settings", {}) + if settings: + self.WriteLn("### Set directly by aosp_build_settings.") + for k, v in settings.items(): + if isinstance(v, list): + self.WriteList(v, k) + else: + self.WriteLn(f"{k} := {make.QuoteIfNecessary(v)}") + self.WriteLn("") + + # Add to the set of targets which represent the gyp 'all' target. We use the + # name 'gyp_all_modules' as the Android build system doesn't allow the use + # of the Make target 'all' and because 'all_modules' is the equivalent of + # the Make target 'all' on Android. + if part_of_all and write_alias_target: + self.WriteLn('# Add target alias to "gyp_all_modules" target.') + self.WriteLn(".PHONY: gyp_all_modules") + self.WriteLn("gyp_all_modules: %s" % self.android_module) + self.WriteLn("") + + # Add an alias from the gyp target name to the Android module name. This + # simplifies manual builds of the target, and is required by the test + # framework. + if self.target != self.android_module and write_alias_target: + self.WriteLn("# Alias gyp target name.") + self.WriteLn(".PHONY: %s" % self.target) + self.WriteLn(f"{self.target}: {self.android_module}") + self.WriteLn("") + + # Add the command to trigger build of the target type depending + # on the toolset. Ex: BUILD_STATIC_LIBRARY vs. BUILD_HOST_STATIC_LIBRARY + # NOTE: This has to come last! + modifier = "" + if self.toolset == "host": + modifier = "HOST_" + if self.type == "static_library": + self.WriteLn("include $(BUILD_%sSTATIC_LIBRARY)" % modifier) + elif self.type == "shared_library": + self.WriteLn("LOCAL_PRELINK_MODULE := false") + self.WriteLn("include $(BUILD_%sSHARED_LIBRARY)" % modifier) + elif self.type == "executable": + self.WriteLn("LOCAL_CXX_STL := libc++_static") + # Executables are for build and test purposes only, so they're installed + # to a directory that doesn't get included in the system image. + self.WriteLn("LOCAL_MODULE_PATH := $(gyp_shared_intermediate_dir)") + self.WriteLn("include $(BUILD_%sEXECUTABLE)" % modifier) + else: + self.WriteLn("LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp") + self.WriteLn("LOCAL_UNINSTALLABLE_MODULE := true") + if self.toolset == "target": + self.WriteLn("LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_VAR_PREFIX)") + else: + self.WriteLn("LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_HOST_VAR_PREFIX)") + self.WriteLn() + self.WriteLn("include $(BUILD_SYSTEM)/base_rules.mk") + self.WriteLn() + self.WriteLn("$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)") + self.WriteLn('\t$(hide) echo "Gyp timestamp: $@"') + self.WriteLn("\t$(hide) mkdir -p $(dir $@)") + self.WriteLn("\t$(hide) touch $@") + self.WriteLn() + self.WriteLn("LOCAL_2ND_ARCH_VAR_PREFIX :=") + + def WriteList( + self, + value_list, + variable=None, + prefix="", + quoter=make.QuoteIfNecessary, + local_pathify=False, + ): + """Write a variable definition that is a list of values. + + E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out + foo = blaha blahb + but in a pretty-printed style. + """ + values = "" + if value_list: + value_list = [quoter(prefix + value) for value in value_list] + if local_pathify: + value_list = [self.LocalPathify(value) for value in value_list] + values = " \\\n\t" + " \\\n\t".join(value_list) + self.fp.write(f"{variable} :={values}\n\n") + + def WriteLn(self, text=""): + self.fp.write(text + "\n") + + def LocalPathify(self, path): + """Convert a subdirectory-relative path into a normalized path which starts + with the make variable $(LOCAL_PATH) (i.e. the top of the project tree). + Absolute paths, or paths that contain variables, are just normalized.""" + if "$(" in path or os.path.isabs(path): + # path is not a file in the project tree in this case, but calling + # normpath is still important for trimming trailing slashes. + return os.path.normpath(path) + local_path = os.path.join("$(LOCAL_PATH)", self.path, path) + local_path = os.path.normpath(local_path) + # Check that normalizing the path didn't ../ itself out of $(LOCAL_PATH) + # - i.e. that the resulting path is still inside the project tree. The + # path may legitimately have ended up containing just $(LOCAL_PATH), though, + # so we don't look for a slash. + assert local_path.startswith( + "$(LOCAL_PATH)" + ), f"Path {path} attempts to escape from gyp path {self.path} !)" + return local_path + + def ExpandInputRoot(self, template, expansion, dirname): + if "%(INPUT_ROOT)s" not in template and "%(INPUT_DIRNAME)s" not in template: + return template + path = template % { + "INPUT_ROOT": expansion, + "INPUT_DIRNAME": dirname, + } + return os.path.normpath(path) + + +def PerformBuild(data, configurations, params): + # The android backend only supports the default configuration. + options = params["options"] + makefile = os.path.abspath(os.path.join(options.toplevel_dir, "GypAndroid.mk")) + env = dict(os.environ) + env["ONE_SHOT_MAKEFILE"] = makefile + arguments = ["make", "-C", os.environ["ANDROID_BUILD_TOP"], "gyp_all_modules"] + print("Building: %s" % arguments) + subprocess.check_call(arguments, env=env) + + +def GenerateOutput(target_list, target_dicts, data, params): + options = params["options"] + generator_flags = params.get("generator_flags", {}) + limit_to_target_all = generator_flags.get("limit_to_target_all", False) + write_alias_targets = generator_flags.get("write_alias_targets", True) + sdk_version = generator_flags.get("aosp_sdk_version", 0) + android_top_dir = os.environ.get("ANDROID_BUILD_TOP") + assert android_top_dir, "$ANDROID_BUILD_TOP not set; you need to run lunch." + + def CalculateMakefilePath(build_file, base_name): + """Determine where to write a Makefile for a given gyp file.""" + # Paths in gyp files are relative to the .gyp file, but we want + # paths relative to the source root for the master makefile. Grab + # the path of the .gyp file as the base to relativize against. + # E.g. "foo/bar" when we're constructing targets for "foo/bar/baz.gyp". + base_path = gyp.common.RelativePath(os.path.dirname(build_file), options.depth) + # We write the file in the base_path directory. + output_file = os.path.join(options.depth, base_path, base_name) + assert ( + not options.generator_output + ), "The Android backend does not support options.generator_output." + base_path = gyp.common.RelativePath( + os.path.dirname(build_file), options.toplevel_dir + ) + return base_path, output_file + + # TODO: search for the first non-'Default' target. This can go + # away when we add verification that all targets have the + # necessary configurations. + default_configuration = None + for target in target_list: + spec = target_dicts[target] + if spec["default_configuration"] != "Default": + default_configuration = spec["default_configuration"] + break + if not default_configuration: + default_configuration = "Default" + + makefile_name = "GypAndroid" + options.suffix + ".mk" + makefile_path = os.path.join(options.toplevel_dir, makefile_name) + assert ( + not options.generator_output + ), "The Android backend does not support options.generator_output." + gyp.common.EnsureDirExists(makefile_path) + root_makefile = open(makefile_path, "w") + + root_makefile.write(header) + + # We set LOCAL_PATH just once, here, to the top of the project tree. This + # allows all the other paths we use to be relative to the Android.mk file, + # as the Android build system expects. + root_makefile.write("\nLOCAL_PATH := $(call my-dir)\n") + + # Find the list of targets that derive from the gyp file(s) being built. + needed_targets = set() + for build_file in params["build_files"]: + for target in gyp.common.AllTargets(target_list, target_dicts, build_file): + needed_targets.add(target) + + build_files = set() + include_list = set() + android_modules = {} + for qualified_target in target_list: + build_file, target, toolset = gyp.common.ParseQualifiedTarget(qualified_target) + relative_build_file = gyp.common.RelativePath(build_file, options.toplevel_dir) + build_files.add(relative_build_file) + included_files = data[build_file]["included_files"] + for included_file in included_files: + # The included_files entries are relative to the dir of the build file + # that included them, so we have to undo that and then make them relative + # to the root dir. + relative_include_file = gyp.common.RelativePath( + gyp.common.UnrelativePath(included_file, build_file), + options.toplevel_dir, + ) + abs_include_file = os.path.abspath(relative_include_file) + # If the include file is from the ~/.gyp dir, we should use absolute path + # so that relocating the src dir doesn't break the path. + if params["home_dot_gyp"] and abs_include_file.startswith( + params["home_dot_gyp"] + ): + build_files.add(abs_include_file) + else: + build_files.add(relative_include_file) + + base_path, output_file = CalculateMakefilePath( + build_file, target + "." + toolset + options.suffix + ".mk" + ) + + spec = target_dicts[qualified_target] + configs = spec["configurations"] + + part_of_all = qualified_target in needed_targets + if limit_to_target_all and not part_of_all: + continue + + relative_target = gyp.common.QualifiedTarget( + relative_build_file, target, toolset + ) + writer = AndroidMkWriter(android_top_dir) + android_module = writer.Write( + qualified_target, + relative_target, + base_path, + output_file, + spec, + configs, + part_of_all=part_of_all, + write_alias_target=write_alias_targets, + sdk_version=sdk_version, + ) + if android_module in android_modules: + print( + "ERROR: Android module names must be unique. The following " + "targets both generate Android module name %s.\n %s\n %s" + % (android_module, android_modules[android_module], qualified_target) + ) + return + android_modules[android_module] = qualified_target + + # Our root_makefile lives at the source root. Compute the relative path + # from there to the output_file for including. + mkfile_rel_path = gyp.common.RelativePath( + output_file, os.path.dirname(makefile_path) + ) + include_list.add(mkfile_rel_path) + + root_makefile.write("GYP_CONFIGURATION ?= %s\n" % default_configuration) + root_makefile.write("GYP_VAR_PREFIX ?=\n") + root_makefile.write("GYP_HOST_VAR_PREFIX ?=\n") + root_makefile.write("GYP_HOST_MULTILIB ?= first\n") + + # Write out the sorted list of includes. + root_makefile.write("\n") + for include_file in sorted(include_list): + root_makefile.write("include $(LOCAL_PATH)/" + include_file + "\n") + root_makefile.write("\n") + + if write_alias_targets: + root_makefile.write(ALL_MODULES_FOOTER) + + root_makefile.close() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py new file mode 100644 index 0000000000000..c95d18415cdb3 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py @@ -0,0 +1,1321 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""cmake output module + +This module is under development and should be considered experimental. + +This module produces cmake (2.8.8+) input as its output. One CMakeLists.txt is +created for each configuration. + +This module's original purpose was to support editing in IDEs like KDevelop +which use CMake for project management. It is also possible to use CMake to +generate projects for other IDEs such as eclipse cdt and code::blocks. QtCreator +will convert the CMakeLists.txt to a code::blocks cbp for the editor to read, +but build using CMake. As a result QtCreator editor is unaware of compiler +defines. The generated CMakeLists.txt can also be used to build on Linux. There +is currently no support for building on platforms other than Linux. + +The generated CMakeLists.txt should properly compile all projects. However, +there is a mismatch between gyp and cmake with regard to linking. All attempts +are made to work around this, but CMake sometimes sees -Wl,--start-group as a +library and incorrectly repeats it. As a result the output of this generator +should not be relied on for building. + +When using with kdevelop, use version 4.4+. Previous versions of kdevelop will +not be able to find the header file directories described in the generated +CMakeLists.txt file. +""" + + +import multiprocessing +import os +import signal +import subprocess +import gyp.common +import gyp.xcode_emulation + +_maketrans = str.maketrans + +generator_default_variables = { + "EXECUTABLE_PREFIX": "", + "EXECUTABLE_SUFFIX": "", + "STATIC_LIB_PREFIX": "lib", + "STATIC_LIB_SUFFIX": ".a", + "SHARED_LIB_PREFIX": "lib", + "SHARED_LIB_SUFFIX": ".so", + "SHARED_LIB_DIR": "${builddir}/lib.${TOOLSET}", + "LIB_DIR": "${obj}.${TOOLSET}", + "INTERMEDIATE_DIR": "${obj}.${TOOLSET}/${TARGET}/geni", + "SHARED_INTERMEDIATE_DIR": "${obj}/gen", + "PRODUCT_DIR": "${builddir}", + "RULE_INPUT_PATH": "${RULE_INPUT_PATH}", + "RULE_INPUT_DIRNAME": "${RULE_INPUT_DIRNAME}", + "RULE_INPUT_NAME": "${RULE_INPUT_NAME}", + "RULE_INPUT_ROOT": "${RULE_INPUT_ROOT}", + "RULE_INPUT_EXT": "${RULE_INPUT_EXT}", + "CONFIGURATION_NAME": "${configuration}", +} + +FULL_PATH_VARS = ("${CMAKE_CURRENT_LIST_DIR}", "${builddir}", "${obj}") + +generator_supports_multiple_toolsets = True +generator_wants_static_library_dependencies_adjusted = True + +COMPILABLE_EXTENSIONS = { + ".c": "cc", + ".cc": "cxx", + ".cpp": "cxx", + ".cxx": "cxx", + ".s": "s", # cc + ".S": "s", # cc +} + + +def RemovePrefix(a, prefix): + """Returns 'a' without 'prefix' if it starts with 'prefix'.""" + return a[len(prefix) :] if a.startswith(prefix) else a + + +def CalculateVariables(default_variables, params): + """Calculate additional variables for use in the build (called by gyp).""" + default_variables.setdefault("OS", gyp.common.GetFlavor(params)) + + +def Compilable(filename): + """Return true if the file is compilable (should be in OBJS).""" + return any(filename.endswith(e) for e in COMPILABLE_EXTENSIONS) + + +def Linkable(filename): + """Return true if the file is linkable (should be on the link line).""" + return filename.endswith(".o") + + +def NormjoinPathForceCMakeSource(base_path, rel_path): + """Resolves rel_path against base_path and returns the result. + + If rel_path is an absolute path it is returned unchanged. + Otherwise it is resolved against base_path and normalized. + If the result is a relative path, it is forced to be relative to the + CMakeLists.txt. + """ + if os.path.isabs(rel_path): + return rel_path + if any([rel_path.startswith(var) for var in FULL_PATH_VARS]): + return rel_path + # TODO: do we need to check base_path for absolute variables as well? + return os.path.join( + "${CMAKE_CURRENT_LIST_DIR}", os.path.normpath(os.path.join(base_path, rel_path)) + ) + + +def NormjoinPath(base_path, rel_path): + """Resolves rel_path against base_path and returns the result. + TODO: what is this really used for? + If rel_path begins with '$' it is returned unchanged. + Otherwise it is resolved against base_path if relative, then normalized. + """ + if rel_path.startswith("$") and not rel_path.startswith("${configuration}"): + return rel_path + return os.path.normpath(os.path.join(base_path, rel_path)) + + +def CMakeStringEscape(a): + """Escapes the string 'a' for use inside a CMake string. + + This means escaping + '\' otherwise it may be seen as modifying the next character + '"' otherwise it will end the string + ';' otherwise the string becomes a list + + The following do not need to be escaped + '#' when the lexer is in string state, this does not start a comment + + The following are yet unknown + '$' generator variables (like ${obj}) must not be escaped, + but text $ should be escaped + what is wanted is to know which $ come from generator variables + """ + return a.replace("\\", "\\\\").replace(";", "\\;").replace('"', '\\"') + + +def SetFileProperty(output, source_name, property_name, values, sep): + """Given a set of source file, sets the given property on them.""" + output.write("set_source_files_properties(") + output.write(source_name) + output.write(" PROPERTIES ") + output.write(property_name) + output.write(' "') + for value in values: + output.write(CMakeStringEscape(value)) + output.write(sep) + output.write('")\n') + + +def SetFilesProperty(output, variable, property_name, values, sep): + """Given a set of source files, sets the given property on them.""" + output.write("set_source_files_properties(") + WriteVariable(output, variable) + output.write(" PROPERTIES ") + output.write(property_name) + output.write(' "') + for value in values: + output.write(CMakeStringEscape(value)) + output.write(sep) + output.write('")\n') + + +def SetTargetProperty(output, target_name, property_name, values, sep=""): + """Given a target, sets the given property.""" + output.write("set_target_properties(") + output.write(target_name) + output.write(" PROPERTIES ") + output.write(property_name) + output.write(' "') + for value in values: + output.write(CMakeStringEscape(value)) + output.write(sep) + output.write('")\n') + + +def SetVariable(output, variable_name, value): + """Sets a CMake variable.""" + output.write("set(") + output.write(variable_name) + output.write(' "') + output.write(CMakeStringEscape(value)) + output.write('")\n') + + +def SetVariableList(output, variable_name, values): + """Sets a CMake variable to a list.""" + if not values: + return SetVariable(output, variable_name, "") + if len(values) == 1: + return SetVariable(output, variable_name, values[0]) + output.write("list(APPEND ") + output.write(variable_name) + output.write('\n "') + output.write('"\n "'.join([CMakeStringEscape(value) for value in values])) + output.write('")\n') + + +def UnsetVariable(output, variable_name): + """Unsets a CMake variable.""" + output.write("unset(") + output.write(variable_name) + output.write(")\n") + + +def WriteVariable(output, variable_name, prepend=None): + if prepend: + output.write(prepend) + output.write("${") + output.write(variable_name) + output.write("}") + + +class CMakeTargetType: + def __init__(self, command, modifier, property_modifier): + self.command = command + self.modifier = modifier + self.property_modifier = property_modifier + + +cmake_target_type_from_gyp_target_type = { + "executable": CMakeTargetType("add_executable", None, "RUNTIME"), + "static_library": CMakeTargetType("add_library", "STATIC", "ARCHIVE"), + "shared_library": CMakeTargetType("add_library", "SHARED", "LIBRARY"), + "loadable_module": CMakeTargetType("add_library", "MODULE", "LIBRARY"), + "none": CMakeTargetType("add_custom_target", "SOURCES", None), +} + + +def StringToCMakeTargetName(a): + """Converts the given string 'a' to a valid CMake target name. + + All invalid characters are replaced by '_'. + Invalid for cmake: ' ', '/', '(', ')', '"' + Invalid for make: ':' + Invalid for unknown reasons but cause failures: '.' + """ + return a.translate(_maketrans(' /():."', "_______")) + + +def WriteActions(target_name, actions, extra_sources, extra_deps, path_to_gyp, output): + """Write CMake for the 'actions' in the target. + + Args: + target_name: the name of the CMake target being generated. + actions: the Gyp 'actions' dict for this target. + extra_sources: [(, )] to append with generated source files. + extra_deps: [] to append with generated targets. + path_to_gyp: relative path from CMakeLists.txt being generated to + the Gyp file in which the target being generated is defined. + """ + for action in actions: + action_name = StringToCMakeTargetName(action["action_name"]) + action_target_name = f"{target_name}__{action_name}" + + inputs = action["inputs"] + inputs_name = action_target_name + "__input" + SetVariableList( + output, + inputs_name, + [NormjoinPathForceCMakeSource(path_to_gyp, dep) for dep in inputs], + ) + + outputs = action["outputs"] + cmake_outputs = [ + NormjoinPathForceCMakeSource(path_to_gyp, out) for out in outputs + ] + outputs_name = action_target_name + "__output" + SetVariableList(output, outputs_name, cmake_outputs) + + # Build up a list of outputs. + # Collect the output dirs we'll need. + dirs = {dir for dir in (os.path.dirname(o) for o in outputs) if dir} + + if int(action.get("process_outputs_as_sources", False)): + extra_sources.extend(zip(cmake_outputs, outputs)) + + # add_custom_command + output.write("add_custom_command(OUTPUT ") + WriteVariable(output, outputs_name) + output.write("\n") + + if len(dirs) > 0: + for directory in dirs: + output.write(" COMMAND ${CMAKE_COMMAND} -E make_directory ") + output.write(directory) + output.write("\n") + + output.write(" COMMAND ") + output.write(gyp.common.EncodePOSIXShellList(action["action"])) + output.write("\n") + + output.write(" DEPENDS ") + WriteVariable(output, inputs_name) + output.write("\n") + + output.write(" WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/") + output.write(path_to_gyp) + output.write("\n") + + output.write(" COMMENT ") + if "message" in action: + output.write(action["message"]) + else: + output.write(action_target_name) + output.write("\n") + + output.write(" VERBATIM\n") + output.write(")\n") + + # add_custom_target + output.write("add_custom_target(") + output.write(action_target_name) + output.write("\n DEPENDS ") + WriteVariable(output, outputs_name) + output.write("\n SOURCES ") + WriteVariable(output, inputs_name) + output.write("\n)\n") + + extra_deps.append(action_target_name) + + +def NormjoinRulePathForceCMakeSource(base_path, rel_path, rule_source): + if rel_path.startswith(("${RULE_INPUT_PATH}", "${RULE_INPUT_DIRNAME}")): + if any([rule_source.startswith(var) for var in FULL_PATH_VARS]): + return rel_path + return NormjoinPathForceCMakeSource(base_path, rel_path) + + +def WriteRules(target_name, rules, extra_sources, extra_deps, path_to_gyp, output): + """Write CMake for the 'rules' in the target. + + Args: + target_name: the name of the CMake target being generated. + actions: the Gyp 'actions' dict for this target. + extra_sources: [(, )] to append with generated source files. + extra_deps: [] to append with generated targets. + path_to_gyp: relative path from CMakeLists.txt being generated to + the Gyp file in which the target being generated is defined. + """ + for rule in rules: + rule_name = StringToCMakeTargetName(target_name + "__" + rule["rule_name"]) + + inputs = rule.get("inputs", []) + inputs_name = rule_name + "__input" + SetVariableList( + output, + inputs_name, + [NormjoinPathForceCMakeSource(path_to_gyp, dep) for dep in inputs], + ) + outputs = rule["outputs"] + var_outputs = [] + + for count, rule_source in enumerate(rule.get("rule_sources", [])): + action_name = rule_name + "_" + str(count) + + rule_source_dirname, rule_source_basename = os.path.split(rule_source) + rule_source_root, rule_source_ext = os.path.splitext(rule_source_basename) + + SetVariable(output, "RULE_INPUT_PATH", rule_source) + SetVariable(output, "RULE_INPUT_DIRNAME", rule_source_dirname) + SetVariable(output, "RULE_INPUT_NAME", rule_source_basename) + SetVariable(output, "RULE_INPUT_ROOT", rule_source_root) + SetVariable(output, "RULE_INPUT_EXT", rule_source_ext) + + # Build up a list of outputs. + # Collect the output dirs we'll need. + dirs = {dir for dir in (os.path.dirname(o) for o in outputs) if dir} + + # Create variables for the output, as 'local' variable will be unset. + these_outputs = [] + for output_index, out in enumerate(outputs): + output_name = action_name + "_" + str(output_index) + SetVariable( + output, + output_name, + NormjoinRulePathForceCMakeSource(path_to_gyp, out, rule_source), + ) + if int(rule.get("process_outputs_as_sources", False)): + extra_sources.append(("${" + output_name + "}", out)) + these_outputs.append("${" + output_name + "}") + var_outputs.append("${" + output_name + "}") + + # add_custom_command + output.write("add_custom_command(OUTPUT\n") + for out in these_outputs: + output.write(" ") + output.write(out) + output.write("\n") + + for directory in dirs: + output.write(" COMMAND ${CMAKE_COMMAND} -E make_directory ") + output.write(directory) + output.write("\n") + + output.write(" COMMAND ") + output.write(gyp.common.EncodePOSIXShellList(rule["action"])) + output.write("\n") + + output.write(" DEPENDS ") + WriteVariable(output, inputs_name) + output.write(" ") + output.write(NormjoinPath(path_to_gyp, rule_source)) + output.write("\n") + + # CMAKE_CURRENT_LIST_DIR is where the CMakeLists.txt lives. + # The cwd is the current build directory. + output.write(" WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/") + output.write(path_to_gyp) + output.write("\n") + + output.write(" COMMENT ") + if "message" in rule: + output.write(rule["message"]) + else: + output.write(action_name) + output.write("\n") + + output.write(" VERBATIM\n") + output.write(")\n") + + UnsetVariable(output, "RULE_INPUT_PATH") + UnsetVariable(output, "RULE_INPUT_DIRNAME") + UnsetVariable(output, "RULE_INPUT_NAME") + UnsetVariable(output, "RULE_INPUT_ROOT") + UnsetVariable(output, "RULE_INPUT_EXT") + + # add_custom_target + output.write("add_custom_target(") + output.write(rule_name) + output.write(" DEPENDS\n") + for out in var_outputs: + output.write(" ") + output.write(out) + output.write("\n") + output.write("SOURCES ") + WriteVariable(output, inputs_name) + output.write("\n") + for rule_source in rule.get("rule_sources", []): + output.write(" ") + output.write(NormjoinPath(path_to_gyp, rule_source)) + output.write("\n") + output.write(")\n") + + extra_deps.append(rule_name) + + +def WriteCopies(target_name, copies, extra_deps, path_to_gyp, output): + """Write CMake for the 'copies' in the target. + + Args: + target_name: the name of the CMake target being generated. + actions: the Gyp 'actions' dict for this target. + extra_deps: [] to append with generated targets. + path_to_gyp: relative path from CMakeLists.txt being generated to + the Gyp file in which the target being generated is defined. + """ + copy_name = target_name + "__copies" + + # CMake gets upset with custom targets with OUTPUT which specify no output. + have_copies = any(copy["files"] for copy in copies) + if not have_copies: + output.write("add_custom_target(") + output.write(copy_name) + output.write(")\n") + extra_deps.append(copy_name) + return + + class Copy: + def __init__(self, ext, command): + self.cmake_inputs = [] + self.cmake_outputs = [] + self.gyp_inputs = [] + self.gyp_outputs = [] + self.ext = ext + self.inputs_name = None + self.outputs_name = None + self.command = command + + file_copy = Copy("", "copy") + dir_copy = Copy("_dirs", "copy_directory") + + for copy in copies: + files = copy["files"] + destination = copy["destination"] + for src in files: + path = os.path.normpath(src) + basename = os.path.split(path)[1] + dst = os.path.join(destination, basename) + + copy = file_copy if os.path.basename(src) else dir_copy + + copy.cmake_inputs.append(NormjoinPathForceCMakeSource(path_to_gyp, src)) + copy.cmake_outputs.append(NormjoinPathForceCMakeSource(path_to_gyp, dst)) + copy.gyp_inputs.append(src) + copy.gyp_outputs.append(dst) + + for copy in (file_copy, dir_copy): + if copy.cmake_inputs: + copy.inputs_name = copy_name + "__input" + copy.ext + SetVariableList(output, copy.inputs_name, copy.cmake_inputs) + + copy.outputs_name = copy_name + "__output" + copy.ext + SetVariableList(output, copy.outputs_name, copy.cmake_outputs) + + # add_custom_command + output.write("add_custom_command(\n") + + output.write("OUTPUT") + for copy in (file_copy, dir_copy): + if copy.outputs_name: + WriteVariable(output, copy.outputs_name, " ") + output.write("\n") + + for copy in (file_copy, dir_copy): + for src, dst in zip(copy.gyp_inputs, copy.gyp_outputs): + # 'cmake -E copy src dst' will create the 'dst' directory if needed. + output.write("COMMAND ${CMAKE_COMMAND} -E %s " % copy.command) + output.write(src) + output.write(" ") + output.write(dst) + output.write("\n") + + output.write("DEPENDS") + for copy in (file_copy, dir_copy): + if copy.inputs_name: + WriteVariable(output, copy.inputs_name, " ") + output.write("\n") + + output.write("WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/") + output.write(path_to_gyp) + output.write("\n") + + output.write("COMMENT Copying for ") + output.write(target_name) + output.write("\n") + + output.write("VERBATIM\n") + output.write(")\n") + + # add_custom_target + output.write("add_custom_target(") + output.write(copy_name) + output.write("\n DEPENDS") + for copy in (file_copy, dir_copy): + if copy.outputs_name: + WriteVariable(output, copy.outputs_name, " ") + output.write("\n SOURCES") + if file_copy.inputs_name: + WriteVariable(output, file_copy.inputs_name, " ") + output.write("\n)\n") + + extra_deps.append(copy_name) + + +def CreateCMakeTargetBaseName(qualified_target): + """This is the name we would like the target to have.""" + _, gyp_target_name, gyp_target_toolset = gyp.common.ParseQualifiedTarget( + qualified_target + ) + cmake_target_base_name = gyp_target_name + if gyp_target_toolset and gyp_target_toolset != "target": + cmake_target_base_name += "_" + gyp_target_toolset + return StringToCMakeTargetName(cmake_target_base_name) + + +def CreateCMakeTargetFullName(qualified_target): + """An unambiguous name for the target.""" + gyp_file, gyp_target_name, gyp_target_toolset = gyp.common.ParseQualifiedTarget( + qualified_target + ) + cmake_target_full_name = gyp_file + ":" + gyp_target_name + if gyp_target_toolset and gyp_target_toolset != "target": + cmake_target_full_name += "_" + gyp_target_toolset + return StringToCMakeTargetName(cmake_target_full_name) + + +class CMakeNamer: + """Converts Gyp target names into CMake target names. + + CMake requires that target names be globally unique. One way to ensure + this is to fully qualify the names of the targets. Unfortunately, this + ends up with all targets looking like "chrome_chrome_gyp_chrome" instead + of just "chrome". If this generator were only interested in building, it + would be possible to fully qualify all target names, then create + unqualified target names which depend on all qualified targets which + should have had that name. This is more or less what the 'make' generator + does with aliases. However, one goal of this generator is to create CMake + files for use with IDEs, and fully qualified names are not as user + friendly. + + Since target name collision is rare, we do the above only when required. + + Toolset variants are always qualified from the base, as this is required for + building. However, it also makes sense for an IDE, as it is possible for + defines to be different. + """ + + def __init__(self, target_list): + self.cmake_target_base_names_conficting = set() + + cmake_target_base_names_seen = set() + for qualified_target in target_list: + cmake_target_base_name = CreateCMakeTargetBaseName(qualified_target) + + if cmake_target_base_name not in cmake_target_base_names_seen: + cmake_target_base_names_seen.add(cmake_target_base_name) + else: + self.cmake_target_base_names_conficting.add(cmake_target_base_name) + + def CreateCMakeTargetName(self, qualified_target): + base_name = CreateCMakeTargetBaseName(qualified_target) + if base_name in self.cmake_target_base_names_conficting: + return CreateCMakeTargetFullName(qualified_target) + return base_name + + +def WriteTarget( + namer, + qualified_target, + target_dicts, + build_dir, + config_to_use, + options, + generator_flags, + all_qualified_targets, + flavor, + output, +): + # The make generator does this always. + # TODO: It would be nice to be able to tell CMake all dependencies. + circular_libs = generator_flags.get("circular", True) + + if not generator_flags.get("standalone", False): + output.write("\n#") + output.write(qualified_target) + output.write("\n") + + gyp_file, _, _ = gyp.common.ParseQualifiedTarget(qualified_target) + rel_gyp_file = gyp.common.RelativePath(gyp_file, options.toplevel_dir) + rel_gyp_dir = os.path.dirname(rel_gyp_file) + + # Relative path from build dir to top dir. + build_to_top = gyp.common.InvertRelativePath(build_dir, options.toplevel_dir) + # Relative path from build dir to gyp dir. + build_to_gyp = os.path.join(build_to_top, rel_gyp_dir) + + path_from_cmakelists_to_gyp = build_to_gyp + + spec = target_dicts.get(qualified_target, {}) + config = spec.get("configurations", {}).get(config_to_use, {}) + + xcode_settings = None + if flavor == "mac": + xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) + + target_name = spec.get("target_name", "") + target_type = spec.get("type", "") + target_toolset = spec.get("toolset") + + cmake_target_type = cmake_target_type_from_gyp_target_type.get(target_type) + if cmake_target_type is None: + print( + "Target %s has unknown target type %s, skipping." + % (target_name, target_type) + ) + return + + SetVariable(output, "TARGET", target_name) + SetVariable(output, "TOOLSET", target_toolset) + + cmake_target_name = namer.CreateCMakeTargetName(qualified_target) + + extra_sources = [] + extra_deps = [] + + # Actions must come first, since they can generate more OBJs for use below. + if "actions" in spec: + WriteActions( + cmake_target_name, + spec["actions"], + extra_sources, + extra_deps, + path_from_cmakelists_to_gyp, + output, + ) + + # Rules must be early like actions. + if "rules" in spec: + WriteRules( + cmake_target_name, + spec["rules"], + extra_sources, + extra_deps, + path_from_cmakelists_to_gyp, + output, + ) + + # Copies + if "copies" in spec: + WriteCopies( + cmake_target_name, + spec["copies"], + extra_deps, + path_from_cmakelists_to_gyp, + output, + ) + + # Target and sources + srcs = spec.get("sources", []) + + # Gyp separates the sheep from the goats based on file extensions. + # A full separation is done here because of flag handing (see below). + s_sources = [] + c_sources = [] + cxx_sources = [] + linkable_sources = [] + other_sources = [] + for src in srcs: + _, ext = os.path.splitext(src) + src_type = COMPILABLE_EXTENSIONS.get(ext, None) + src_norm_path = NormjoinPath(path_from_cmakelists_to_gyp, src) + + if src_type == "s": + s_sources.append(src_norm_path) + elif src_type == "cc": + c_sources.append(src_norm_path) + elif src_type == "cxx": + cxx_sources.append(src_norm_path) + elif Linkable(ext): + linkable_sources.append(src_norm_path) + else: + other_sources.append(src_norm_path) + + for extra_source in extra_sources: + src, real_source = extra_source + _, ext = os.path.splitext(real_source) + src_type = COMPILABLE_EXTENSIONS.get(ext, None) + + if src_type == "s": + s_sources.append(src) + elif src_type == "cc": + c_sources.append(src) + elif src_type == "cxx": + cxx_sources.append(src) + elif Linkable(ext): + linkable_sources.append(src) + else: + other_sources.append(src) + + s_sources_name = None + if s_sources: + s_sources_name = cmake_target_name + "__asm_srcs" + SetVariableList(output, s_sources_name, s_sources) + + c_sources_name = None + if c_sources: + c_sources_name = cmake_target_name + "__c_srcs" + SetVariableList(output, c_sources_name, c_sources) + + cxx_sources_name = None + if cxx_sources: + cxx_sources_name = cmake_target_name + "__cxx_srcs" + SetVariableList(output, cxx_sources_name, cxx_sources) + + linkable_sources_name = None + if linkable_sources: + linkable_sources_name = cmake_target_name + "__linkable_srcs" + SetVariableList(output, linkable_sources_name, linkable_sources) + + other_sources_name = None + if other_sources: + other_sources_name = cmake_target_name + "__other_srcs" + SetVariableList(output, other_sources_name, other_sources) + + # CMake gets upset when executable targets provide no sources. + # http://www.cmake.org/pipermail/cmake/2010-July/038461.html + dummy_sources_name = None + has_sources = ( + s_sources_name + or c_sources_name + or cxx_sources_name + or linkable_sources_name + or other_sources_name + ) + if target_type == "executable" and not has_sources: + dummy_sources_name = cmake_target_name + "__dummy_srcs" + SetVariable( + output, dummy_sources_name, "${obj}.${TOOLSET}/${TARGET}/genc/dummy.c" + ) + output.write('if(NOT EXISTS "') + WriteVariable(output, dummy_sources_name) + output.write('")\n') + output.write(' file(WRITE "') + WriteVariable(output, dummy_sources_name) + output.write('" "")\n') + output.write("endif()\n") + + # CMake is opposed to setting linker directories and considers the practice + # of setting linker directories dangerous. Instead, it favors the use of + # find_library and passing absolute paths to target_link_libraries. + # However, CMake does provide the command link_directories, which adds + # link directories to targets defined after it is called. + # As a result, link_directories must come before the target definition. + # CMake unfortunately has no means of removing entries from LINK_DIRECTORIES. + library_dirs = config.get("library_dirs") + if library_dirs is not None: + output.write("link_directories(") + for library_dir in library_dirs: + output.write(" ") + output.write(NormjoinPath(path_from_cmakelists_to_gyp, library_dir)) + output.write("\n") + output.write(")\n") + + output.write(cmake_target_type.command) + output.write("(") + output.write(cmake_target_name) + + if cmake_target_type.modifier is not None: + output.write(" ") + output.write(cmake_target_type.modifier) + + if s_sources_name: + WriteVariable(output, s_sources_name, " ") + if c_sources_name: + WriteVariable(output, c_sources_name, " ") + if cxx_sources_name: + WriteVariable(output, cxx_sources_name, " ") + if linkable_sources_name: + WriteVariable(output, linkable_sources_name, " ") + if other_sources_name: + WriteVariable(output, other_sources_name, " ") + if dummy_sources_name: + WriteVariable(output, dummy_sources_name, " ") + + output.write(")\n") + + # Let CMake know if the 'all' target should depend on this target. + exclude_from_all = ( + "TRUE" if qualified_target not in all_qualified_targets else "FALSE" + ) + SetTargetProperty(output, cmake_target_name, "EXCLUDE_FROM_ALL", exclude_from_all) + for extra_target_name in extra_deps: + SetTargetProperty( + output, extra_target_name, "EXCLUDE_FROM_ALL", exclude_from_all + ) + + # Output name and location. + if target_type != "none": + # Link as 'C' if there are no other files + if not c_sources and not cxx_sources: + SetTargetProperty(output, cmake_target_name, "LINKER_LANGUAGE", ["C"]) + + # Mark uncompiled sources as uncompiled. + if other_sources_name: + output.write("set_source_files_properties(") + WriteVariable(output, other_sources_name, "") + output.write(' PROPERTIES HEADER_FILE_ONLY "TRUE")\n') + + # Mark object sources as linkable. + if linkable_sources_name: + output.write("set_source_files_properties(") + WriteVariable(output, other_sources_name, "") + output.write(' PROPERTIES EXTERNAL_OBJECT "TRUE")\n') + + # Output directory + target_output_directory = spec.get("product_dir") + if target_output_directory is None: + if target_type in ("executable", "loadable_module"): + target_output_directory = generator_default_variables["PRODUCT_DIR"] + elif target_type == "shared_library": + target_output_directory = "${builddir}/lib.${TOOLSET}" + elif spec.get("standalone_static_library", False): + target_output_directory = generator_default_variables["PRODUCT_DIR"] + else: + base_path = gyp.common.RelativePath( + os.path.dirname(gyp_file), options.toplevel_dir + ) + target_output_directory = "${obj}.${TOOLSET}" + target_output_directory = os.path.join( + target_output_directory, base_path + ) + + cmake_target_output_directory = NormjoinPathForceCMakeSource( + path_from_cmakelists_to_gyp, target_output_directory + ) + SetTargetProperty( + output, + cmake_target_name, + cmake_target_type.property_modifier + "_OUTPUT_DIRECTORY", + cmake_target_output_directory, + ) + + # Output name + default_product_prefix = "" + default_product_name = target_name + default_product_ext = "" + if target_type == "static_library": + static_library_prefix = generator_default_variables["STATIC_LIB_PREFIX"] + default_product_name = RemovePrefix( + default_product_name, static_library_prefix + ) + default_product_prefix = static_library_prefix + default_product_ext = generator_default_variables["STATIC_LIB_SUFFIX"] + + elif target_type in ("loadable_module", "shared_library"): + shared_library_prefix = generator_default_variables["SHARED_LIB_PREFIX"] + default_product_name = RemovePrefix( + default_product_name, shared_library_prefix + ) + default_product_prefix = shared_library_prefix + default_product_ext = generator_default_variables["SHARED_LIB_SUFFIX"] + + elif target_type != "executable": + print( + "ERROR: What output file should be generated?", + "type", + target_type, + "target", + target_name, + ) + + product_prefix = spec.get("product_prefix", default_product_prefix) + product_name = spec.get("product_name", default_product_name) + product_ext = spec.get("product_extension") + if product_ext: + product_ext = "." + product_ext + else: + product_ext = default_product_ext + + SetTargetProperty(output, cmake_target_name, "PREFIX", product_prefix) + SetTargetProperty( + output, + cmake_target_name, + cmake_target_type.property_modifier + "_OUTPUT_NAME", + product_name, + ) + SetTargetProperty(output, cmake_target_name, "SUFFIX", product_ext) + + # Make the output of this target referenceable as a source. + cmake_target_output_basename = product_prefix + product_name + product_ext + cmake_target_output = os.path.join( + cmake_target_output_directory, cmake_target_output_basename + ) + SetFileProperty(output, cmake_target_output, "GENERATED", ["TRUE"], "") + + # Includes + includes = config.get("include_dirs") + if includes: + # This (target include directories) is what requires CMake 2.8.8 + includes_name = cmake_target_name + "__include_dirs" + SetVariableList( + output, + includes_name, + [ + NormjoinPathForceCMakeSource(path_from_cmakelists_to_gyp, include) + for include in includes + ], + ) + output.write("set_property(TARGET ") + output.write(cmake_target_name) + output.write(" APPEND PROPERTY INCLUDE_DIRECTORIES ") + WriteVariable(output, includes_name, "") + output.write(")\n") + + # Defines + defines = config.get("defines") + if defines is not None: + SetTargetProperty( + output, cmake_target_name, "COMPILE_DEFINITIONS", defines, ";" + ) + + # Compile Flags - http://www.cmake.org/Bug/view.php?id=6493 + # CMake currently does not have target C and CXX flags. + # So, instead of doing... + + # cflags_c = config.get('cflags_c') + # if cflags_c is not None: + # SetTargetProperty(output, cmake_target_name, + # 'C_COMPILE_FLAGS', cflags_c, ' ') + + # cflags_cc = config.get('cflags_cc') + # if cflags_cc is not None: + # SetTargetProperty(output, cmake_target_name, + # 'CXX_COMPILE_FLAGS', cflags_cc, ' ') + + # Instead we must... + cflags = config.get("cflags", []) + cflags_c = config.get("cflags_c", []) + cflags_cxx = config.get("cflags_cc", []) + if xcode_settings: + cflags = xcode_settings.GetCflags(config_to_use) + cflags_c = xcode_settings.GetCflagsC(config_to_use) + cflags_cxx = xcode_settings.GetCflagsCC(config_to_use) + # cflags_objc = xcode_settings.GetCflagsObjC(config_to_use) + # cflags_objcc = xcode_settings.GetCflagsObjCC(config_to_use) + + if (not cflags_c or not c_sources) and (not cflags_cxx or not cxx_sources): + SetTargetProperty(output, cmake_target_name, "COMPILE_FLAGS", cflags, " ") + + elif c_sources and not (s_sources or cxx_sources): + flags = [] + flags.extend(cflags) + flags.extend(cflags_c) + SetTargetProperty(output, cmake_target_name, "COMPILE_FLAGS", flags, " ") + + elif cxx_sources and not (s_sources or c_sources): + flags = [] + flags.extend(cflags) + flags.extend(cflags_cxx) + SetTargetProperty(output, cmake_target_name, "COMPILE_FLAGS", flags, " ") + + else: + # TODO: This is broken, one cannot generally set properties on files, + # as other targets may require different properties on the same files. + if s_sources and cflags: + SetFilesProperty(output, s_sources_name, "COMPILE_FLAGS", cflags, " ") + + if c_sources and (cflags or cflags_c): + flags = [] + flags.extend(cflags) + flags.extend(cflags_c) + SetFilesProperty(output, c_sources_name, "COMPILE_FLAGS", flags, " ") + + if cxx_sources and (cflags or cflags_cxx): + flags = [] + flags.extend(cflags) + flags.extend(cflags_cxx) + SetFilesProperty(output, cxx_sources_name, "COMPILE_FLAGS", flags, " ") + + # Linker flags + ldflags = config.get("ldflags") + if ldflags is not None: + SetTargetProperty(output, cmake_target_name, "LINK_FLAGS", ldflags, " ") + + # XCode settings + xcode_settings = config.get("xcode_settings", {}) + for xcode_setting, xcode_value in xcode_settings.items(): + SetTargetProperty( + output, + cmake_target_name, + "XCODE_ATTRIBUTE_%s" % xcode_setting, + xcode_value, + "" if isinstance(xcode_value, str) else " ", + ) + + # Note on Dependencies and Libraries: + # CMake wants to handle link order, resolving the link line up front. + # Gyp does not retain or enforce specifying enough information to do so. + # So do as other gyp generators and use --start-group and --end-group. + # Give CMake as little information as possible so that it doesn't mess it up. + + # Dependencies + rawDeps = spec.get("dependencies", []) + + static_deps = [] + shared_deps = [] + other_deps = [] + for rawDep in rawDeps: + dep_cmake_name = namer.CreateCMakeTargetName(rawDep) + dep_spec = target_dicts.get(rawDep, {}) + dep_target_type = dep_spec.get("type", None) + + if dep_target_type == "static_library": + static_deps.append(dep_cmake_name) + elif dep_target_type == "shared_library": + shared_deps.append(dep_cmake_name) + else: + other_deps.append(dep_cmake_name) + + # ensure all external dependencies are complete before internal dependencies + # extra_deps currently only depend on their own deps, so otherwise run early + if static_deps or shared_deps or other_deps: + for extra_dep in extra_deps: + output.write("add_dependencies(") + output.write(extra_dep) + output.write("\n") + for deps in (static_deps, shared_deps, other_deps): + for dep in gyp.common.uniquer(deps): + output.write(" ") + output.write(dep) + output.write("\n") + output.write(")\n") + + linkable = target_type in ("executable", "loadable_module", "shared_library") + other_deps.extend(extra_deps) + if other_deps or (not linkable and (static_deps or shared_deps)): + output.write("add_dependencies(") + output.write(cmake_target_name) + output.write("\n") + for dep in gyp.common.uniquer(other_deps): + output.write(" ") + output.write(dep) + output.write("\n") + if not linkable: + for deps in (static_deps, shared_deps): + for lib_dep in gyp.common.uniquer(deps): + output.write(" ") + output.write(lib_dep) + output.write("\n") + output.write(")\n") + + # Libraries + if linkable: + external_libs = [lib for lib in spec.get("libraries", []) if len(lib) > 0] + if external_libs or static_deps or shared_deps: + output.write("target_link_libraries(") + output.write(cmake_target_name) + output.write("\n") + if static_deps: + write_group = circular_libs and len(static_deps) > 1 and flavor != "mac" + if write_group: + output.write("-Wl,--start-group\n") + for dep in gyp.common.uniquer(static_deps): + output.write(" ") + output.write(dep) + output.write("\n") + if write_group: + output.write("-Wl,--end-group\n") + if shared_deps: + for dep in gyp.common.uniquer(shared_deps): + output.write(" ") + output.write(dep) + output.write("\n") + if external_libs: + for lib in gyp.common.uniquer(external_libs): + output.write(' "') + output.write(RemovePrefix(lib, "$(SDKROOT)")) + output.write('"\n') + + output.write(")\n") + + UnsetVariable(output, "TOOLSET") + UnsetVariable(output, "TARGET") + + +def GenerateOutputForConfig(target_list, target_dicts, data, params, config_to_use): + options = params["options"] + generator_flags = params["generator_flags"] + flavor = gyp.common.GetFlavor(params) + + # generator_dir: relative path from pwd to where make puts build files. + # Makes migrating from make to cmake easier, cmake doesn't put anything here. + # Each Gyp configuration creates a different CMakeLists.txt file + # to avoid incompatibilities between Gyp and CMake configurations. + generator_dir = os.path.relpath(options.generator_output or ".") + + # output_dir: relative path from generator_dir to the build directory. + output_dir = generator_flags.get("output_dir", "out") + + # build_dir: relative path from source root to our output files. + # e.g. "out/Debug" + build_dir = os.path.normpath(os.path.join(generator_dir, output_dir, config_to_use)) + + toplevel_build = os.path.join(options.toplevel_dir, build_dir) + + output_file = os.path.join(toplevel_build, "CMakeLists.txt") + gyp.common.EnsureDirExists(output_file) + + output = open(output_file, "w") + output.write("cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)\n") + output.write("cmake_policy(VERSION 2.8.8)\n") + + gyp_file, project_target, _ = gyp.common.ParseQualifiedTarget(target_list[-1]) + output.write("project(") + output.write(project_target) + output.write(")\n") + + SetVariable(output, "configuration", config_to_use) + + ar = None + cc = None + cxx = None + + make_global_settings = data[gyp_file].get("make_global_settings", []) + build_to_top = gyp.common.InvertRelativePath(build_dir, options.toplevel_dir) + for key, value in make_global_settings: + if key == "AR": + ar = os.path.join(build_to_top, value) + if key == "CC": + cc = os.path.join(build_to_top, value) + if key == "CXX": + cxx = os.path.join(build_to_top, value) + + ar = gyp.common.GetEnvironFallback(["AR_target", "AR"], ar) + cc = gyp.common.GetEnvironFallback(["CC_target", "CC"], cc) + cxx = gyp.common.GetEnvironFallback(["CXX_target", "CXX"], cxx) + + if ar: + SetVariable(output, "CMAKE_AR", ar) + if cc: + SetVariable(output, "CMAKE_C_COMPILER", cc) + if cxx: + SetVariable(output, "CMAKE_CXX_COMPILER", cxx) + + # The following appears to be as-yet undocumented. + # http://public.kitware.com/Bug/view.php?id=8392 + output.write("enable_language(ASM)\n") + # ASM-ATT does not support .S files. + # output.write('enable_language(ASM-ATT)\n') + + if cc: + SetVariable(output, "CMAKE_ASM_COMPILER", cc) + + SetVariable(output, "builddir", "${CMAKE_CURRENT_BINARY_DIR}") + SetVariable(output, "obj", "${builddir}/obj") + output.write("\n") + + # TODO: Undocumented/unsupported (the CMake Java generator depends on it). + # CMake by default names the object resulting from foo.c to be foo.c.o. + # Gyp traditionally names the object resulting from foo.c foo.o. + # This should be irrelevant, but some targets extract .o files from .a + # and depend on the name of the extracted .o files. + output.write("set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)\n") + output.write("set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)\n") + output.write("\n") + + # Force ninja to use rsp files. Otherwise link and ar lines can get too long, + # resulting in 'Argument list too long' errors. + # However, rsp files don't work correctly on Mac. + if flavor != "mac": + output.write("set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1)\n") + output.write("\n") + + namer = CMakeNamer(target_list) + + # The list of targets upon which the 'all' target should depend. + # CMake has it's own implicit 'all' target, one is not created explicitly. + all_qualified_targets = set() + for build_file in params["build_files"]: + for qualified_target in gyp.common.AllTargets( + target_list, target_dicts, os.path.normpath(build_file) + ): + all_qualified_targets.add(qualified_target) + + for qualified_target in target_list: + if flavor == "mac": + gyp_file, _, _ = gyp.common.ParseQualifiedTarget(qualified_target) + spec = target_dicts[qualified_target] + gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[gyp_file], spec) + + WriteTarget( + namer, + qualified_target, + target_dicts, + build_dir, + config_to_use, + options, + generator_flags, + all_qualified_targets, + flavor, + output, + ) + + output.close() + + +def PerformBuild(data, configurations, params): + options = params["options"] + generator_flags = params["generator_flags"] + + # generator_dir: relative path from pwd to where make puts build files. + # Makes migrating from make to cmake easier, cmake doesn't put anything here. + generator_dir = os.path.relpath(options.generator_output or ".") + + # output_dir: relative path from generator_dir to the build directory. + output_dir = generator_flags.get("output_dir", "out") + + for config_name in configurations: + # build_dir: relative path from source root to our output files. + # e.g. "out/Debug" + build_dir = os.path.normpath( + os.path.join(generator_dir, output_dir, config_name) + ) + arguments = ["cmake", "-G", "Ninja"] + print(f"Generating [{config_name}]: {arguments}") + subprocess.check_call(arguments, cwd=build_dir) + + arguments = ["ninja", "-C", build_dir] + print(f"Building [{config_name}]: {arguments}") + subprocess.check_call(arguments) + + +def CallGenerateOutputForConfig(arglist): + # Ignore the interrupt signal so that the parent process catches it and + # kills all multiprocessing children. + signal.signal(signal.SIGINT, signal.SIG_IGN) + + target_list, target_dicts, data, params, config_name = arglist + GenerateOutputForConfig(target_list, target_dicts, data, params, config_name) + + +def GenerateOutput(target_list, target_dicts, data, params): + user_config = params.get("generator_flags", {}).get("config", None) + if user_config: + GenerateOutputForConfig(target_list, target_dicts, data, params, user_config) + else: + config_names = target_dicts[target_list[0]]["configurations"] + if params["parallel"]: + try: + pool = multiprocessing.Pool(len(config_names)) + arglists = [] + for config_name in config_names: + arglists.append( + (target_list, target_dicts, data, params, config_name) + ) + pool.map(CallGenerateOutputForConfig, arglists) + except KeyboardInterrupt as e: + pool.terminate() + raise e + else: + for config_name in config_names: + GenerateOutputForConfig( + target_list, target_dicts, data, params, config_name + ) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py new file mode 100644 index 0000000000000..f330a04dea4c5 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py @@ -0,0 +1,120 @@ +# Copyright (c) 2016 Ben Noordhuis . All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import gyp.common +import gyp.xcode_emulation +import json +import os + +generator_additional_non_configuration_keys = [] +generator_additional_path_sections = [] +generator_extra_sources_for_rules = [] +generator_filelist_paths = None +generator_supports_multiple_toolsets = True +generator_wants_sorted_dependencies = False + +# Lifted from make.py. The actual values don't matter much. +generator_default_variables = { + "CONFIGURATION_NAME": "$(BUILDTYPE)", + "EXECUTABLE_PREFIX": "", + "EXECUTABLE_SUFFIX": "", + "INTERMEDIATE_DIR": "$(obj).$(TOOLSET)/$(TARGET)/geni", + "PRODUCT_DIR": "$(builddir)", + "RULE_INPUT_DIRNAME": "%(INPUT_DIRNAME)s", + "RULE_INPUT_EXT": "$(suffix $<)", + "RULE_INPUT_NAME": "$(notdir $<)", + "RULE_INPUT_PATH": "$(abspath $<)", + "RULE_INPUT_ROOT": "%(INPUT_ROOT)s", + "SHARED_INTERMEDIATE_DIR": "$(obj)/gen", + "SHARED_LIB_PREFIX": "lib", + "STATIC_LIB_PREFIX": "lib", + "STATIC_LIB_SUFFIX": ".a", +} + + +def IsMac(params): + return "mac" == gyp.common.GetFlavor(params) + + +def CalculateVariables(default_variables, params): + default_variables.setdefault("OS", gyp.common.GetFlavor(params)) + + +def AddCommandsForTarget(cwd, target, params, per_config_commands): + output_dir = params["generator_flags"].get("output_dir", "out") + for configuration_name, configuration in target["configurations"].items(): + if IsMac(params): + xcode_settings = gyp.xcode_emulation.XcodeSettings(target) + cflags = xcode_settings.GetCflags(configuration_name) + cflags_c = xcode_settings.GetCflagsC(configuration_name) + cflags_cc = xcode_settings.GetCflagsCC(configuration_name) + else: + cflags = configuration.get("cflags", []) + cflags_c = configuration.get("cflags_c", []) + cflags_cc = configuration.get("cflags_cc", []) + + cflags_c = cflags + cflags_c + cflags_cc = cflags + cflags_cc + + defines = configuration.get("defines", []) + defines = ["-D" + s for s in defines] + + # TODO(bnoordhuis) Handle generated source files. + extensions = (".c", ".cc", ".cpp", ".cxx") + sources = [s for s in target.get("sources", []) if s.endswith(extensions)] + + def resolve(filename): + return os.path.abspath(os.path.join(cwd, filename)) + + # TODO(bnoordhuis) Handle generated header files. + include_dirs = configuration.get("include_dirs", []) + include_dirs = [s for s in include_dirs if not s.startswith("$(obj)")] + includes = ["-I" + resolve(s) for s in include_dirs] + + defines = gyp.common.EncodePOSIXShellList(defines) + includes = gyp.common.EncodePOSIXShellList(includes) + cflags_c = gyp.common.EncodePOSIXShellList(cflags_c) + cflags_cc = gyp.common.EncodePOSIXShellList(cflags_cc) + + commands = per_config_commands.setdefault(configuration_name, []) + for source in sources: + file = resolve(source) + isc = source.endswith(".c") + cc = "cc" if isc else "c++" + cflags = cflags_c if isc else cflags_cc + command = " ".join( + ( + cc, + defines, + includes, + cflags, + "-c", + gyp.common.EncodePOSIXShellArgument(file), + ) + ) + commands.append(dict(command=command, directory=output_dir, file=file)) + + +def GenerateOutput(target_list, target_dicts, data, params): + per_config_commands = {} + for qualified_target, target in target_dicts.items(): + build_file, target_name, toolset = gyp.common.ParseQualifiedTarget( + qualified_target + ) + if IsMac(params): + settings = data[build_file] + gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(settings, target) + cwd = os.path.dirname(build_file) + AddCommandsForTarget(cwd, target, params, per_config_commands) + + output_dir = params["generator_flags"].get("output_dir", "out") + for configuration_name, commands in per_config_commands.items(): + filename = os.path.join(output_dir, configuration_name, "compile_commands.json") + gyp.common.EnsureDirExists(filename) + fp = open(filename, "w") + json.dump(commands, fp=fp, indent=0, check_circular=False) + + +def PerformBuild(data, configurations, params): + pass diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py new file mode 100644 index 0000000000000..99d5c1fd69db3 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py @@ -0,0 +1,103 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +import os +import gyp +import gyp.common +import gyp.msvs_emulation +import json + +generator_supports_multiple_toolsets = True + +generator_wants_static_library_dependencies_adjusted = False + +generator_filelist_paths = {} + +generator_default_variables = {} +for dirname in [ + "INTERMEDIATE_DIR", + "SHARED_INTERMEDIATE_DIR", + "PRODUCT_DIR", + "LIB_DIR", + "SHARED_LIB_DIR", +]: + # Some gyp steps fail if these are empty(!). + generator_default_variables[dirname] = "dir" +for unused in [ + "RULE_INPUT_PATH", + "RULE_INPUT_ROOT", + "RULE_INPUT_NAME", + "RULE_INPUT_DIRNAME", + "RULE_INPUT_EXT", + "EXECUTABLE_PREFIX", + "EXECUTABLE_SUFFIX", + "STATIC_LIB_PREFIX", + "STATIC_LIB_SUFFIX", + "SHARED_LIB_PREFIX", + "SHARED_LIB_SUFFIX", + "CONFIGURATION_NAME", +]: + generator_default_variables[unused] = "" + + +def CalculateVariables(default_variables, params): + generator_flags = params.get("generator_flags", {}) + for key, val in generator_flags.items(): + default_variables.setdefault(key, val) + default_variables.setdefault("OS", gyp.common.GetFlavor(params)) + + flavor = gyp.common.GetFlavor(params) + if flavor == "win": + gyp.msvs_emulation.CalculateCommonVariables(default_variables, params) + + +def CalculateGeneratorInputInfo(params): + """Calculate the generator specific info that gets fed to input (called by + gyp).""" + generator_flags = params.get("generator_flags", {}) + if generator_flags.get("adjust_static_libraries", False): + global generator_wants_static_library_dependencies_adjusted + generator_wants_static_library_dependencies_adjusted = True + + toplevel = params["options"].toplevel_dir + generator_dir = os.path.relpath(params["options"].generator_output or ".") + # output_dir: relative path from generator_dir to the build directory. + output_dir = generator_flags.get("output_dir", "out") + qualified_out_dir = os.path.normpath( + os.path.join(toplevel, generator_dir, output_dir, "gypfiles") + ) + global generator_filelist_paths + generator_filelist_paths = { + "toplevel": toplevel, + "qualified_out_dir": qualified_out_dir, + } + + +def GenerateOutput(target_list, target_dicts, data, params): + # Map of target -> list of targets it depends on. + edges = {} + + # Queue of targets to visit. + targets_to_visit = target_list[:] + + while len(targets_to_visit) > 0: + target = targets_to_visit.pop() + if target in edges: + continue + edges[target] = [] + + for dep in target_dicts[target].get("dependencies", []): + edges[target].append(dep) + targets_to_visit.append(dep) + + try: + filepath = params["generator_flags"]["output_dir"] + except KeyError: + filepath = "." + filename = os.path.join(filepath, "dump.json") + f = open(filename, "w") + json.dump(edges, f) + f.close() + print("Wrote json to %s." % filename) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py new file mode 100644 index 0000000000000..a851b4db757ed --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py @@ -0,0 +1,464 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""GYP backend that generates Eclipse CDT settings files. + +This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML +files that can be imported into an Eclipse CDT project. The XML file contains a +list of include paths and symbols (i.e. defines). + +Because a full .cproject definition is not created by this generator, it's not +possible to properly define the include dirs and symbols for each file +individually. Instead, one set of includes/symbols is generated for the entire +project. This works fairly well (and is a vast improvement in general), but may +still result in a few indexer issues here and there. + +This generator has no automated tests, so expect it to be broken. +""" + +from xml.sax.saxutils import escape +import os.path +import subprocess +import gyp +import gyp.common +import gyp.msvs_emulation +import shlex +import xml.etree.ElementTree as ET + +generator_wants_static_library_dependencies_adjusted = False + +generator_default_variables = {} + +for dirname in ["INTERMEDIATE_DIR", "PRODUCT_DIR", "LIB_DIR", "SHARED_LIB_DIR"]: + # Some gyp steps fail if these are empty(!), so we convert them to variables + generator_default_variables[dirname] = "$" + dirname + +for unused in [ + "RULE_INPUT_PATH", + "RULE_INPUT_ROOT", + "RULE_INPUT_NAME", + "RULE_INPUT_DIRNAME", + "RULE_INPUT_EXT", + "EXECUTABLE_PREFIX", + "EXECUTABLE_SUFFIX", + "STATIC_LIB_PREFIX", + "STATIC_LIB_SUFFIX", + "SHARED_LIB_PREFIX", + "SHARED_LIB_SUFFIX", + "CONFIGURATION_NAME", +]: + generator_default_variables[unused] = "" + +# Include dirs will occasionally use the SHARED_INTERMEDIATE_DIR variable as +# part of the path when dealing with generated headers. This value will be +# replaced dynamically for each configuration. +generator_default_variables["SHARED_INTERMEDIATE_DIR"] = "$SHARED_INTERMEDIATE_DIR" + + +def CalculateVariables(default_variables, params): + generator_flags = params.get("generator_flags", {}) + for key, val in generator_flags.items(): + default_variables.setdefault(key, val) + flavor = gyp.common.GetFlavor(params) + default_variables.setdefault("OS", flavor) + if flavor == "win": + gyp.msvs_emulation.CalculateCommonVariables(default_variables, params) + + +def CalculateGeneratorInputInfo(params): + """Calculate the generator specific info that gets fed to input (called by + gyp).""" + generator_flags = params.get("generator_flags", {}) + if generator_flags.get("adjust_static_libraries", False): + global generator_wants_static_library_dependencies_adjusted + generator_wants_static_library_dependencies_adjusted = True + + +def GetAllIncludeDirectories( + target_list, + target_dicts, + shared_intermediate_dirs, + config_name, + params, + compiler_path, +): + """Calculate the set of include directories to be used. + + Returns: + A list including all the include_dir's specified for every target followed + by any include directories that were added as cflag compiler options. + """ + + gyp_includes_set = set() + compiler_includes_list = [] + + # Find compiler's default include dirs. + if compiler_path: + command = shlex.split(compiler_path) + command.extend(["-E", "-xc++", "-v", "-"]) + proc = subprocess.Popen( + args=command, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + output = proc.communicate()[1].decode("utf-8") + # Extract the list of include dirs from the output, which has this format: + # ... + # #include "..." search starts here: + # #include <...> search starts here: + # /usr/include/c++/4.6 + # /usr/local/include + # End of search list. + # ... + in_include_list = False + for line in output.splitlines(): + if line.startswith("#include"): + in_include_list = True + continue + if line.startswith("End of search list."): + break + if in_include_list: + include_dir = line.strip() + if include_dir not in compiler_includes_list: + compiler_includes_list.append(include_dir) + + flavor = gyp.common.GetFlavor(params) + if flavor == "win": + generator_flags = params.get("generator_flags", {}) + for target_name in target_list: + target = target_dicts[target_name] + if config_name in target["configurations"]: + config = target["configurations"][config_name] + + # Look for any include dirs that were explicitly added via cflags. This + # may be done in gyp files to force certain includes to come at the end. + # TODO(jgreenwald): Change the gyp files to not abuse cflags for this, and + # remove this. + if flavor == "win": + msvs_settings = gyp.msvs_emulation.MsvsSettings(target, generator_flags) + cflags = msvs_settings.GetCflags(config_name) + else: + cflags = config["cflags"] + for cflag in cflags: + if cflag.startswith("-I"): + include_dir = cflag[2:] + if include_dir not in compiler_includes_list: + compiler_includes_list.append(include_dir) + + # Find standard gyp include dirs. + if "include_dirs" in config: + include_dirs = config["include_dirs"] + for shared_intermediate_dir in shared_intermediate_dirs: + for include_dir in include_dirs: + include_dir = include_dir.replace( + "$SHARED_INTERMEDIATE_DIR", shared_intermediate_dir + ) + if not os.path.isabs(include_dir): + base_dir = os.path.dirname(target_name) + + include_dir = base_dir + "/" + include_dir + include_dir = os.path.abspath(include_dir) + + gyp_includes_set.add(include_dir) + + # Generate a list that has all the include dirs. + all_includes_list = list(gyp_includes_set) + all_includes_list.sort() + for compiler_include in compiler_includes_list: + if compiler_include not in gyp_includes_set: + all_includes_list.append(compiler_include) + + # All done. + return all_includes_list + + +def GetCompilerPath(target_list, data, options): + """Determine a command that can be used to invoke the compiler. + + Returns: + If this is a gyp project that has explicit make settings, try to determine + the compiler from that. Otherwise, see if a compiler was specified via the + CC_target environment variable. + """ + # First, see if the compiler is configured in make's settings. + build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) + make_global_settings_dict = data[build_file].get("make_global_settings", {}) + for key, value in make_global_settings_dict: + if key in ["CC", "CXX"]: + return os.path.join(options.toplevel_dir, value) + + # Check to see if the compiler was specified as an environment variable. + for key in ["CC_target", "CC", "CXX"]: + compiler = os.environ.get(key) + if compiler: + return compiler + + return "gcc" + + +def GetAllDefines(target_list, target_dicts, data, config_name, params, compiler_path): + """Calculate the defines for a project. + + Returns: + A dict that includes explicit defines declared in gyp files along with all + of the default defines that the compiler uses. + """ + + # Get defines declared in the gyp files. + all_defines = {} + flavor = gyp.common.GetFlavor(params) + if flavor == "win": + generator_flags = params.get("generator_flags", {}) + for target_name in target_list: + target = target_dicts[target_name] + + if flavor == "win": + msvs_settings = gyp.msvs_emulation.MsvsSettings(target, generator_flags) + extra_defines = msvs_settings.GetComputedDefines(config_name) + else: + extra_defines = [] + if config_name in target["configurations"]: + config = target["configurations"][config_name] + target_defines = config["defines"] + else: + target_defines = [] + for define in target_defines + extra_defines: + split_define = define.split("=", 1) + if len(split_define) == 1: + split_define.append("1") + if split_define[0].strip() in all_defines: + # Already defined + continue + all_defines[split_define[0].strip()] = split_define[1].strip() + # Get default compiler defines (if possible). + if flavor == "win": + return all_defines # Default defines already processed in the loop above. + if compiler_path: + command = shlex.split(compiler_path) + command.extend(["-E", "-dM", "-"]) + cpp_proc = subprocess.Popen( + args=command, cwd=".", stdin=subprocess.PIPE, stdout=subprocess.PIPE + ) + cpp_output = cpp_proc.communicate()[0].decode("utf-8") + cpp_lines = cpp_output.split("\n") + for cpp_line in cpp_lines: + if not cpp_line.strip(): + continue + cpp_line_parts = cpp_line.split(" ", 2) + key = cpp_line_parts[1] + if len(cpp_line_parts) >= 3: + val = cpp_line_parts[2] + else: + val = "1" + all_defines[key] = val + + return all_defines + + +def WriteIncludePaths(out, eclipse_langs, include_dirs): + """Write the includes section of a CDT settings export file.""" + + out.write( + '
\n' + ) + out.write(' \n') + for lang in eclipse_langs: + out.write(' \n' % lang) + for include_dir in include_dirs: + out.write( + ' %s\n' + % include_dir + ) + out.write(" \n") + out.write("
\n") + + +def WriteMacros(out, eclipse_langs, defines): + """Write the macros section of a CDT settings export file.""" + + out.write( + '
\n' + ) + out.write(' \n') + for lang in eclipse_langs: + out.write(' \n' % lang) + for key in sorted(defines): + out.write( + " %s%s\n" + % (escape(key), escape(defines[key])) + ) + out.write(" \n") + out.write("
\n") + + +def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name): + options = params["options"] + generator_flags = params.get("generator_flags", {}) + + # build_dir: relative path from source root to our output files. + # e.g. "out/Debug" + build_dir = os.path.join(generator_flags.get("output_dir", "out"), config_name) + + toplevel_build = os.path.join(options.toplevel_dir, build_dir) + # Ninja uses out/Debug/gen while make uses out/Debug/obj/gen as the + # SHARED_INTERMEDIATE_DIR. Include both possible locations. + shared_intermediate_dirs = [ + os.path.join(toplevel_build, "obj", "gen"), + os.path.join(toplevel_build, "gen"), + ] + + GenerateCdtSettingsFile( + target_list, + target_dicts, + data, + params, + config_name, + os.path.join(toplevel_build, "eclipse-cdt-settings.xml"), + options, + shared_intermediate_dirs, + ) + GenerateClasspathFile( + target_list, + target_dicts, + options.toplevel_dir, + toplevel_build, + os.path.join(toplevel_build, "eclipse-classpath.xml"), + ) + + +def GenerateCdtSettingsFile( + target_list, + target_dicts, + data, + params, + config_name, + out_name, + options, + shared_intermediate_dirs, +): + gyp.common.EnsureDirExists(out_name) + with open(out_name, "w") as out: + out.write('\n') + out.write("\n") + + eclipse_langs = [ + "C++ Source File", + "C Source File", + "Assembly Source File", + "GNU C++", + "GNU C", + "Assembly", + ] + compiler_path = GetCompilerPath(target_list, data, options) + include_dirs = GetAllIncludeDirectories( + target_list, + target_dicts, + shared_intermediate_dirs, + config_name, + params, + compiler_path, + ) + WriteIncludePaths(out, eclipse_langs, include_dirs) + defines = GetAllDefines( + target_list, target_dicts, data, config_name, params, compiler_path + ) + WriteMacros(out, eclipse_langs, defines) + + out.write("\n") + + +def GenerateClasspathFile( + target_list, target_dicts, toplevel_dir, toplevel_build, out_name +): + """Generates a classpath file suitable for symbol navigation and code + completion of Java code (such as in Android projects) by finding all + .java and .jar files used as action inputs.""" + gyp.common.EnsureDirExists(out_name) + result = ET.Element("classpath") + + def AddElements(kind, paths): + # First, we need to normalize the paths so they are all relative to the + # toplevel dir. + rel_paths = set() + for path in paths: + if os.path.isabs(path): + rel_paths.add(os.path.relpath(path, toplevel_dir)) + else: + rel_paths.add(path) + + for path in sorted(rel_paths): + entry_element = ET.SubElement(result, "classpathentry") + entry_element.set("kind", kind) + entry_element.set("path", path) + + AddElements("lib", GetJavaJars(target_list, target_dicts, toplevel_dir)) + AddElements("src", GetJavaSourceDirs(target_list, target_dicts, toplevel_dir)) + # Include the standard JRE container and a dummy out folder + AddElements("con", ["org.eclipse.jdt.launching.JRE_CONTAINER"]) + # Include a dummy out folder so that Eclipse doesn't use the default /bin + # folder in the root of the project. + AddElements("output", [os.path.join(toplevel_build, ".eclipse-java-build")]) + + ET.ElementTree(result).write(out_name) + + +def GetJavaJars(target_list, target_dicts, toplevel_dir): + """Generates a sequence of all .jars used as inputs.""" + for target_name in target_list: + target = target_dicts[target_name] + for action in target.get("actions", []): + for input_ in action["inputs"]: + if os.path.splitext(input_)[1] == ".jar" and not input_.startswith("$"): + if os.path.isabs(input_): + yield input_ + else: + yield os.path.join(os.path.dirname(target_name), input_) + + +def GetJavaSourceDirs(target_list, target_dicts, toplevel_dir): + """Generates a sequence of all likely java package root directories.""" + for target_name in target_list: + target = target_dicts[target_name] + for action in target.get("actions", []): + for input_ in action["inputs"]: + if os.path.splitext(input_)[1] == ".java" and not input_.startswith( + "$" + ): + dir_ = os.path.dirname( + os.path.join(os.path.dirname(target_name), input_) + ) + # If there is a parent 'src' or 'java' folder, navigate up to it - + # these are canonical package root names in Chromium. This will + # break if 'src' or 'java' exists in the package structure. This + # could be further improved by inspecting the java file for the + # package name if this proves to be too fragile in practice. + parent_search = dir_ + while os.path.basename(parent_search) not in ["src", "java"]: + parent_search, _ = os.path.split(parent_search) + if not parent_search or parent_search == toplevel_dir: + # Didn't find a known root, just return the original path + yield dir_ + break + else: + yield parent_search + + +def GenerateOutput(target_list, target_dicts, data, params): + """Generate an XML settings file that can be imported into a CDT project.""" + + if params["options"].generator_output: + raise NotImplementedError("--generator_output not implemented for eclipse") + + user_config = params.get("generator_flags", {}).get("config", None) + if user_config: + GenerateOutputForConfig(target_list, target_dicts, data, params, user_config) + else: + config_names = target_dicts[target_list[0]]["configurations"] + for config_name in config_names: + GenerateOutputForConfig( + target_list, target_dicts, data, params, config_name + ) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py new file mode 100644 index 0000000000000..4171704c47a4b --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py @@ -0,0 +1,89 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""gypd output module + +This module produces gyp input as its output. Output files are given the +.gypd extension to avoid overwriting the .gyp files that they are generated +from. Internal references to .gyp files (such as those found in +"dependencies" sections) are not adjusted to point to .gypd files instead; +unlike other paths, which are relative to the .gyp or .gypd file, such paths +are relative to the directory from which gyp was run to create the .gypd file. + +This generator module is intended to be a sample and a debugging aid, hence +the "d" for "debug" in .gypd. It is useful to inspect the results of the +various merges, expansions, and conditional evaluations performed by gyp +and to see a representation of what would be fed to a generator module. + +It's not advisable to rename .gypd files produced by this module to .gyp, +because they will have all merges, expansions, and evaluations already +performed and the relevant constructs not present in the output; paths to +dependencies may be wrong; and various sections that do not belong in .gyp +files such as such as "included_files" and "*_excluded" will be present. +Output will also be stripped of comments. This is not intended to be a +general-purpose gyp pretty-printer; for that, you probably just want to +run "pprint.pprint(eval(open('source.gyp').read()))", which will still strip +comments but won't do all of the other things done to this module's output. + +The specific formatting of the output generated by this module is subject +to change. +""" + + +import gyp.common +import pprint + + +# These variables should just be spit back out as variable references. +_generator_identity_variables = [ + "CONFIGURATION_NAME", + "EXECUTABLE_PREFIX", + "EXECUTABLE_SUFFIX", + "INTERMEDIATE_DIR", + "LIB_DIR", + "PRODUCT_DIR", + "RULE_INPUT_ROOT", + "RULE_INPUT_DIRNAME", + "RULE_INPUT_EXT", + "RULE_INPUT_NAME", + "RULE_INPUT_PATH", + "SHARED_INTERMEDIATE_DIR", + "SHARED_LIB_DIR", + "SHARED_LIB_PREFIX", + "SHARED_LIB_SUFFIX", + "STATIC_LIB_PREFIX", + "STATIC_LIB_SUFFIX", +] + +# gypd doesn't define a default value for OS like many other generator +# modules. Specify "-D OS=whatever" on the command line to provide a value. +generator_default_variables = {} + +# gypd supports multiple toolsets +generator_supports_multiple_toolsets = True + +# TODO(mark): This always uses <, which isn't right. The input module should +# notify the generator to tell it which phase it is operating in, and this +# module should use < for the early phase and then switch to > for the late +# phase. Bonus points for carrying @ back into the output too. +for v in _generator_identity_variables: + generator_default_variables[v] = "<(%s)" % v + + +def GenerateOutput(target_list, target_dicts, data, params): + output_files = {} + for qualified_target in target_list: + [input_file, target] = gyp.common.ParseQualifiedTarget(qualified_target)[0:2] + + if input_file[-4:] != ".gyp": + continue + input_file_stem = input_file[:-4] + output_file = input_file_stem + params["options"].suffix + ".gypd" + + output_files[output_file] = output_files.get(output_file, input_file) + + for output_file, input_file in output_files.items(): + output = open(output_file, "w") + pprint.pprint(data[input_file], output) + output.close() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py new file mode 100644 index 0000000000000..82a07ddc6577b --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py @@ -0,0 +1,58 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""gypsh output module + +gypsh is a GYP shell. It's not really a generator per se. All it does is +fire up an interactive Python session with a few local variables set to the +variables passed to the generator. Like gypd, it's intended as a debugging +aid, to facilitate the exploration of .gyp structures after being processed +by the input module. + +The expected usage is "gyp -f gypsh -D OS=desired_os". +""" + + +import code +import sys + + +# All of this stuff about generator variables was lovingly ripped from gypd.py. +# That module has a much better description of what's going on and why. +_generator_identity_variables = [ + "EXECUTABLE_PREFIX", + "EXECUTABLE_SUFFIX", + "INTERMEDIATE_DIR", + "PRODUCT_DIR", + "RULE_INPUT_ROOT", + "RULE_INPUT_DIRNAME", + "RULE_INPUT_EXT", + "RULE_INPUT_NAME", + "RULE_INPUT_PATH", + "SHARED_INTERMEDIATE_DIR", +] + +generator_default_variables = {} + +for v in _generator_identity_variables: + generator_default_variables[v] = "<(%s)" % v + + +def GenerateOutput(target_list, target_dicts, data, params): + locals = { + "target_list": target_list, + "target_dicts": target_dicts, + "data": data, + } + + # Use a banner that looks like the stock Python one and like what + # code.interact uses by default, but tack on something to indicate what + # locals are available, and identify gypsh. + banner = "Python {} on {}\nlocals.keys() = {}\ngypsh".format( + sys.version, + sys.platform, + repr(sorted(locals.keys())), + ) + + code.interact(banner, local=locals) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py new file mode 100644 index 0000000000000..05bb609d16000 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py @@ -0,0 +1,2714 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Notes: +# +# This is all roughly based on the Makefile system used by the Linux +# kernel, but is a non-recursive make -- we put the entire dependency +# graph in front of make and let it figure it out. +# +# The code below generates a separate .mk file for each target, but +# all are sourced by the top-level Makefile. This means that all +# variables in .mk-files clobber one another. Be careful to use := +# where appropriate for immediate evaluation, and similarly to watch +# that you're not relying on a variable value to last between different +# .mk files. +# +# TODOs: +# +# Global settings and utility functions are currently stuffed in the +# toplevel Makefile. It may make sense to generate some .mk files on +# the side to keep the files readable. + + +import os +import re +import subprocess +import gyp +import gyp.common +import gyp.xcode_emulation +from gyp.common import GetEnvironFallback + +import hashlib + +generator_default_variables = { + "EXECUTABLE_PREFIX": "", + "EXECUTABLE_SUFFIX": "", + "STATIC_LIB_PREFIX": "lib", + "SHARED_LIB_PREFIX": "lib", + "STATIC_LIB_SUFFIX": ".a", + "INTERMEDIATE_DIR": "$(obj).$(TOOLSET)/$(TARGET)/geni", + "SHARED_INTERMEDIATE_DIR": "$(obj)/gen", + "PRODUCT_DIR": "$(builddir)", + "RULE_INPUT_ROOT": "%(INPUT_ROOT)s", # This gets expanded by Python. + "RULE_INPUT_DIRNAME": "%(INPUT_DIRNAME)s", # This gets expanded by Python. + "RULE_INPUT_PATH": "$(abspath $<)", + "RULE_INPUT_EXT": "$(suffix $<)", + "RULE_INPUT_NAME": "$(notdir $<)", + "CONFIGURATION_NAME": "$(BUILDTYPE)", +} + +# Make supports multiple toolsets +generator_supports_multiple_toolsets = gyp.common.CrossCompileRequested() + +# Request sorted dependencies in the order from dependents to dependencies. +generator_wants_sorted_dependencies = False + +# Placates pylint. +generator_additional_non_configuration_keys = [] +generator_additional_path_sections = [] +generator_extra_sources_for_rules = [] +generator_filelist_paths = None + + +def CalculateVariables(default_variables, params): + """Calculate additional variables for use in the build (called by gyp).""" + flavor = gyp.common.GetFlavor(params) + if flavor == "mac": + default_variables.setdefault("OS", "mac") + default_variables.setdefault("SHARED_LIB_SUFFIX", ".dylib") + default_variables.setdefault( + "SHARED_LIB_DIR", generator_default_variables["PRODUCT_DIR"] + ) + default_variables.setdefault( + "LIB_DIR", generator_default_variables["PRODUCT_DIR"] + ) + + # Copy additional generator configuration data from Xcode, which is shared + # by the Mac Make generator. + import gyp.generator.xcode as xcode_generator + + global generator_additional_non_configuration_keys + generator_additional_non_configuration_keys = getattr( + xcode_generator, "generator_additional_non_configuration_keys", [] + ) + global generator_additional_path_sections + generator_additional_path_sections = getattr( + xcode_generator, "generator_additional_path_sections", [] + ) + global generator_extra_sources_for_rules + generator_extra_sources_for_rules = getattr( + xcode_generator, "generator_extra_sources_for_rules", [] + ) + COMPILABLE_EXTENSIONS.update({".m": "objc", ".mm": "objcxx"}) + else: + operating_system = flavor + if flavor == "android": + operating_system = "linux" # Keep this legacy behavior for now. + default_variables.setdefault("OS", operating_system) + if flavor == "aix": + default_variables.setdefault("SHARED_LIB_SUFFIX", ".a") + elif flavor == "zos": + default_variables.setdefault("SHARED_LIB_SUFFIX", ".x") + COMPILABLE_EXTENSIONS.update({".pli": "pli"}) + else: + default_variables.setdefault("SHARED_LIB_SUFFIX", ".so") + default_variables.setdefault("SHARED_LIB_DIR", "$(builddir)/lib.$(TOOLSET)") + default_variables.setdefault("LIB_DIR", "$(obj).$(TOOLSET)") + + +def CalculateGeneratorInputInfo(params): + """Calculate the generator specific info that gets fed to input (called by + gyp).""" + generator_flags = params.get("generator_flags", {}) + android_ndk_version = generator_flags.get("android_ndk_version", None) + # Android NDK requires a strict link order. + if android_ndk_version: + global generator_wants_sorted_dependencies + generator_wants_sorted_dependencies = True + + output_dir = params["options"].generator_output or params["options"].toplevel_dir + builddir_name = generator_flags.get("output_dir", "out") + qualified_out_dir = os.path.normpath( + os.path.join(output_dir, builddir_name, "gypfiles") + ) + + global generator_filelist_paths + generator_filelist_paths = { + "toplevel": params["options"].toplevel_dir, + "qualified_out_dir": qualified_out_dir, + } + + +# The .d checking code below uses these functions: +# wildcard, sort, foreach, shell, wordlist +# wildcard can handle spaces, the rest can't. +# Since I could find no way to make foreach work with spaces in filenames +# correctly, the .d files have spaces replaced with another character. The .d +# file for +# Chromium\ Framework.framework/foo +# is for example +# out/Release/.deps/out/Release/Chromium?Framework.framework/foo +# This is the replacement character. +SPACE_REPLACEMENT = "?" + + +LINK_COMMANDS_LINUX = """\ +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) + +quiet_cmd_alink_thin = AR($(TOOLSET)) $@ +cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) + +# Due to circular dependencies between libraries :(, we wrap the +# special "figure out circular dependencies" flags around the entire +# input list during linking. +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group + +# Note: this does not handle spaces in paths +define xargs + $(1) $(word 1,$(2)) +$(if $(word 2,$(2)),$(call xargs,$(1),$(wordlist 2,$(words $(2)),$(2)))) +endef + +define write-to-file + @: >$(1) +$(call xargs,@printf "%s\\n" >>$(1),$(2)) +endef + +OBJ_FILE_LIST := ar-file-list + +define create_archive + rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)` + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) + $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST) +endef + +define create_thin_archive + rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)` + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) + $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST) +endef + +# We support two kinds of shared objects (.so): +# 1) shared_library, which is just bundling together many dependent libraries +# into a link line. +# 2) loadable_module, which is generating a module intended for dlopen(). +# +# They differ only slightly: +# In the former case, we want to package all dependent code into the .so. +# In the latter case, we want to package just the API exposed by the +# outermost module. +# This means shared_library uses --whole-archive, while loadable_module doesn't. +# (Note that --whole-archive is incompatible with the --start-group used in +# normal linking.) + +# Other shared-object link notes: +# - Set SONAME to the library filename so our binaries don't reference +# the local, absolute paths used on the link command-line. +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) +""" # noqa: E501 + +LINK_COMMANDS_MAC = """\ +quiet_cmd_alink = LIBTOOL-STATIC $@ +cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^) + +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) +""" # noqa: E501 + +LINK_COMMANDS_ANDROID = """\ +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) + +quiet_cmd_alink_thin = AR($(TOOLSET)) $@ +cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) + +# Note: this does not handle spaces in paths +define xargs + $(1) $(word 1,$(2)) +$(if $(word 2,$(2)),$(call xargs,$(1),$(wordlist 2,$(words $(2)),$(2)))) +endef + +define write-to-file + @: >$(1) +$(call xargs,@printf "%s\\n" >>$(1),$(2)) +endef + +OBJ_FILE_LIST := ar-file-list + +define create_archive + rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)` + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) + $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST) +endef + +define create_thin_archive + rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)` + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) + $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST) +endef + +# Due to circular dependencies between libraries :(, we wrap the +# special "figure out circular dependencies" flags around the entire +# input list during linking. +quiet_cmd_link = LINK($(TOOLSET)) $@ +quiet_cmd_link_host = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) +cmd_link_host = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) + +# Other shared-object link notes: +# - Set SONAME to the library filename so our binaries don't reference +# the local, absolute paths used on the link command-line. +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) +quiet_cmd_solink_module_host = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module_host = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) +""" # noqa: E501 + + +LINK_COMMANDS_AIX = """\ +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X32_64 crs $@ $(filter %.o,$^) + +quiet_cmd_alink_thin = AR($(TOOLSET)) $@ +cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) -X32_64 crs $@ $(filter %.o,$^) + +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) +""" # noqa: E501 + + +LINK_COMMANDS_OS400 = """\ +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^) + +quiet_cmd_alink_thin = AR($(TOOLSET)) $@ +cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^) + +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) +""" # noqa: E501 + + +LINK_COMMANDS_OS390 = """\ +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) + +quiet_cmd_alink_thin = AR($(TOOLSET)) $@ +cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) + +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) +""" # noqa: E501 + + +# Header of toplevel Makefile. +# This should go into the build tree, but it's easier to keep it here for now. +SHARED_HEADER = ( + """\ +# We borrow heavily from the kernel build setup, though we are simpler since +# we don't have Kconfig tweaking settings on us. + +# The implicit make rules have it looking for RCS files, among other things. +# We instead explicitly write all the rules we care about. +# It's even quicker (saves ~200ms) to pass -r on the command line. +MAKEFLAGS=-r + +# The source directory tree. +srcdir := %(srcdir)s +abs_srcdir := $(abspath $(srcdir)) + +# The name of the builddir. +builddir_name ?= %(builddir)s + +# The V=1 flag on command line makes us verbosely print command lines. +ifdef V + quiet= +else + quiet=quiet_ +endif + +# Specify BUILDTYPE=Release on the command line for a release build. +BUILDTYPE ?= %(default_configuration)s + +# Directory all our build output goes into. +# Note that this must be two directories beneath src/ for unit tests to pass, +# as they reach into the src/ directory for data with relative paths. +builddir ?= $(builddir_name)/$(BUILDTYPE) +abs_builddir := $(abspath $(builddir)) +depsdir := $(builddir)/.deps + +# Object output directory. +obj := $(builddir)/obj +abs_obj := $(abspath $(obj)) + +# We build up a list of every single one of the targets so we can slurp in the +# generated dependency rule Makefiles in one pass. +all_deps := + +%(make_global_settings)s + +CC.target ?= %(CC.target)s +CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS) +CXX.target ?= %(CXX.target)s +CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS) +LINK.target ?= %(LINK.target)s +LDFLAGS.target ?= $(LDFLAGS) +AR.target ?= $(AR) +PLI.target ?= %(PLI.target)s + +# C++ apps need to be linked with g++. +LINK ?= $(CXX.target) + +# TODO(evan): move all cross-compilation logic to gyp-time so we don't need +# to replicate this environment fallback in make as well. +CC.host ?= %(CC.host)s +CFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host) +CXX.host ?= %(CXX.host)s +CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host) +LINK.host ?= %(LINK.host)s +LDFLAGS.host ?= $(LDFLAGS_host) +AR.host ?= %(AR.host)s +PLI.host ?= %(PLI.host)s + +# Define a dir function that can handle spaces. +# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions +# "leading spaces cannot appear in the text of the first argument as written. +# These characters can be put into the argument value by variable substitution." +empty := +space := $(empty) $(empty) + +# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces +replace_spaces = $(subst $(space),""" + + SPACE_REPLACEMENT + + """,$1) +unreplace_spaces = $(subst """ + + SPACE_REPLACEMENT + + """,$(space),$1) +dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1))) + +# Flags to make gcc output dependency info. Note that you need to be +# careful here to use the flags that ccache and distcc can understand. +# We write to a dep file on the side first and then rename at the end +# so we can't end up with a broken dep file. +depfile = $(depsdir)/$(call replace_spaces,$@).d +DEPFLAGS = %(makedep_args)s -MF $(depfile).raw + +# We have to fixup the deps output in a few ways. +# (1) the file output should mention the proper .o file. +# ccache or distcc lose the path to the target, so we convert a rule of +# the form: +# foobar.o: DEP1 DEP2 +# into +# path/to/foobar.o: DEP1 DEP2 +# (2) we want missing files not to cause us to fail to build. +# We want to rewrite +# foobar.o: DEP1 DEP2 \\ +# DEP3 +# to +# DEP1: +# DEP2: +# DEP3: +# so if the files are missing, they're just considered phony rules. +# We have to do some pretty insane escaping to get those backslashes +# and dollar signs past make, the shell, and sed at the same time. +# Doesn't work with spaces, but that's fine: .d files have spaces in +# their names replaced with other characters.""" + r""" +define fixup_dep +# The depfile may not exist if the input file didn't have any #includes. +touch $(depfile).raw +# Fixup path as in (1). +sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef +""" + """ +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c +%(extra_commands)s +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp %(copy_archive_args)s "$<" "$@") + +quiet_cmd_symlink = SYMLINK $@ +cmd_symlink = ln -sf "$<" "$@" + +%(link_commands)s +""" # noqa: E501 + r""" +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%%s\n' '$(call escape_quotes,$(1))' +""" + """ +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \\ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain """ + + SPACE_REPLACEMENT + + """ instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds until one fails. +define do_postbuilds + @E=0;\\ + for p in $(POSTBUILDS); do\\ + eval $$p;\\ + E=$$?;\\ + if [ $$E -ne 0 ]; then\\ + break;\\ + fi;\\ + done;\\ + if [ $$E -ne 0 ]; then\\ + rm -rf "$@";\\ + exit $$E;\\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains """ + + SPACE_REPLACEMENT + + """ for +# spaces already and dirx strips the """ + + SPACE_REPLACEMENT + + """ characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word %(flock_index)d,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "%(default_target)s" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: %(default_target)s +%(default_target)s: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +""" # noqa: E501 +) + +SHARED_HEADER_MAC_COMMANDS = """ +quiet_cmd_objc = CXX($(TOOLSET)) $@ +cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< + +quiet_cmd_objcxx = CXX($(TOOLSET)) $@ +cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# Commands for precompiled header files. +quiet_cmd_pch_c = CXX($(TOOLSET)) $@ +cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_cc = CXX($(TOOLSET)) $@ +cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_m = CXX($(TOOLSET)) $@ +cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< +quiet_cmd_pch_mm = CXX($(TOOLSET)) $@ +cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# gyp-mac-tool is written next to the root Makefile by gyp. +# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd +# already. +quiet_cmd_mac_tool = MACTOOL $(4) $< +cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@" + +quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@ +cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4) + +quiet_cmd_infoplist = INFOPLIST $@ +cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@" +""" # noqa: E501 + + +def WriteRootHeaderSuffixRules(writer): + extensions = sorted(COMPILABLE_EXTENSIONS.keys(), key=str.lower) + + writer.write("# Suffix rules, putting all outputs into $(obj).\n") + for ext in extensions: + writer.write("$(obj).$(TOOLSET)/%%.o: $(srcdir)/%%%s FORCE_DO_CMD\n" % ext) + writer.write("\t@$(call do_cmd,%s,1)\n" % COMPILABLE_EXTENSIONS[ext]) + + writer.write("\n# Try building from generated source, too.\n") + for ext in extensions: + writer.write( + "$(obj).$(TOOLSET)/%%.o: $(obj).$(TOOLSET)/%%%s FORCE_DO_CMD\n" % ext + ) + writer.write("\t@$(call do_cmd,%s,1)\n" % COMPILABLE_EXTENSIONS[ext]) + writer.write("\n") + for ext in extensions: + writer.write("$(obj).$(TOOLSET)/%%.o: $(obj)/%%%s FORCE_DO_CMD\n" % ext) + writer.write("\t@$(call do_cmd,%s,1)\n" % COMPILABLE_EXTENSIONS[ext]) + writer.write("\n") + + +SHARED_HEADER_OS390_COMMANDS = """ +PLIFLAGS.target ?= -qlp=64 -qlimits=extname=31 $(PLIFLAGS) +PLIFLAGS.host ?= -qlp=64 -qlimits=extname=31 $(PLIFLAGS) + +quiet_cmd_pli = PLI($(TOOLSET)) $@ +cmd_pli = $(PLI.$(TOOLSET)) $(GYP_PLIFLAGS) $(PLIFLAGS.$(TOOLSET)) -c $< && \ + if [ -f $(notdir $@) ]; then /bin/cp $(notdir $@) $@; else true; fi +""" + +SHARED_HEADER_SUFFIX_RULES_COMMENT1 = """\ +# Suffix rules, putting all outputs into $(obj). +""" + + +SHARED_HEADER_SUFFIX_RULES_COMMENT2 = """\ +# Try building from generated source, too. +""" + + +SHARED_FOOTER = """\ +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif +""" + +header = """\ +# This file is generated by gyp; do not edit. + +""" + +# Maps every compilable file extension to the do_cmd that compiles it. +COMPILABLE_EXTENSIONS = { + ".c": "cc", + ".cc": "cxx", + ".cpp": "cxx", + ".cxx": "cxx", + ".s": "cc", + ".S": "cc", +} + + +def Compilable(filename): + """Return true if the file is compilable (should be in OBJS).""" + for res in (filename.endswith(e) for e in COMPILABLE_EXTENSIONS): + if res: + return True + return False + + +def Linkable(filename): + """Return true if the file is linkable (should be on the link line).""" + return filename.endswith(".o") + + +def Target(filename): + """Translate a compilable filename to its .o target.""" + return os.path.splitext(filename)[0] + ".o" + + +def EscapeShellArgument(s): + """Quotes an argument so that it will be interpreted literally by a POSIX + shell. Taken from + http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python + """ + return "'" + s.replace("'", "'\\''") + "'" + + +def EscapeMakeVariableExpansion(s): + """Make has its own variable expansion syntax using $. We must escape it for + string to be interpreted literally.""" + return s.replace("$", "$$") + + +def EscapeCppDefine(s): + """Escapes a CPP define so that it will reach the compiler unaltered.""" + s = EscapeShellArgument(s) + s = EscapeMakeVariableExpansion(s) + # '#' characters must be escaped even embedded in a string, else Make will + # treat it as the start of a comment. + return s.replace("#", r"\#") + + +def QuoteIfNecessary(string): + """TODO: Should this ideally be replaced with one or more of the above + functions?""" + if '"' in string: + string = '"' + string.replace('"', '\\"') + '"' + return string + + +def StringToMakefileVariable(string): + """Convert a string to a value that is acceptable as a make variable name.""" + return re.sub("[^a-zA-Z0-9_]", "_", string) + + +srcdir_prefix = "" + + +def Sourceify(path): + """Convert a path to its source directory form.""" + if "$(" in path: + return path + if os.path.isabs(path): + return path + return srcdir_prefix + path + + +def QuoteSpaces(s, quote=r"\ "): + return s.replace(" ", quote) + + +def SourceifyAndQuoteSpaces(path): + """Convert a path to its source directory form and quote spaces.""" + return QuoteSpaces(Sourceify(path)) + + +# Map from qualified target to path to output. +target_outputs = {} +# Map from qualified target to any linkable output. A subset +# of target_outputs. E.g. when mybinary depends on liba, we want to +# include liba in the linker line; when otherbinary depends on +# mybinary, we just want to build mybinary first. +target_link_deps = {} + + +class MakefileWriter: + """MakefileWriter packages up the writing of one target-specific foobar.mk. + + Its only real entry point is Write(), and is mostly used for namespacing. + """ + + def __init__(self, generator_flags, flavor): + self.generator_flags = generator_flags + self.flavor = flavor + + self.suffix_rules_srcdir = {} + self.suffix_rules_objdir1 = {} + self.suffix_rules_objdir2 = {} + + # Generate suffix rules for all compilable extensions. + for ext in COMPILABLE_EXTENSIONS.keys(): + # Suffix rules for source folder. + self.suffix_rules_srcdir.update( + { + ext: ( + """\ +$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(srcdir)/%%%s FORCE_DO_CMD +\t@$(call do_cmd,%s,1) +""" + % (ext, COMPILABLE_EXTENSIONS[ext]) + ) + } + ) + + # Suffix rules for generated source files. + self.suffix_rules_objdir1.update( + { + ext: ( + """\ +$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj).$(TOOLSET)/%%%s FORCE_DO_CMD +\t@$(call do_cmd,%s,1) +""" + % (ext, COMPILABLE_EXTENSIONS[ext]) + ) + } + ) + self.suffix_rules_objdir2.update( + { + ext: ( + """\ +$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD +\t@$(call do_cmd,%s,1) +""" + % (ext, COMPILABLE_EXTENSIONS[ext]) + ) + } + ) + + def Write( + self, qualified_target, base_path, output_filename, spec, configs, part_of_all + ): + """The main entry point: writes a .mk file for a single target. + + Arguments: + qualified_target: target we're generating + base_path: path relative to source root we're building in, used to resolve + target-relative paths + output_filename: output .mk file name to write + spec, configs: gyp info + part_of_all: flag indicating this target is part of 'all' + """ + gyp.common.EnsureDirExists(output_filename) + + self.fp = open(output_filename, "w") + + self.fp.write(header) + + self.qualified_target = qualified_target + self.path = base_path + self.target = spec["target_name"] + self.type = spec["type"] + self.toolset = spec["toolset"] + + self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) + if self.flavor == "mac": + self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) + else: + self.xcode_settings = None + + deps, link_deps = self.ComputeDeps(spec) + + # Some of the generation below can add extra output, sources, or + # link dependencies. All of the out params of the functions that + # follow use names like extra_foo. + extra_outputs = [] + extra_sources = [] + extra_link_deps = [] + extra_mac_bundle_resources = [] + mac_bundle_deps = [] + + if self.is_mac_bundle: + self.output = self.ComputeMacBundleOutput(spec) + self.output_binary = self.ComputeMacBundleBinaryOutput(spec) + else: + self.output = self.output_binary = self.ComputeOutput(spec) + + self.is_standalone_static_library = bool( + spec.get("standalone_static_library", 0) + ) + self._INSTALLABLE_TARGETS = ("executable", "loadable_module", "shared_library") + if self.is_standalone_static_library or self.type in self._INSTALLABLE_TARGETS: + self.alias = os.path.basename(self.output) + install_path = self._InstallableTargetInstallPath() + else: + self.alias = self.output + install_path = self.output + + self.WriteLn("TOOLSET := " + self.toolset) + self.WriteLn("TARGET := " + self.target) + + # Actions must come first, since they can generate more OBJs for use below. + if "actions" in spec: + self.WriteActions( + spec["actions"], + extra_sources, + extra_outputs, + extra_mac_bundle_resources, + part_of_all, + ) + + # Rules must be early like actions. + if "rules" in spec: + self.WriteRules( + spec["rules"], + extra_sources, + extra_outputs, + extra_mac_bundle_resources, + part_of_all, + ) + + if "copies" in spec: + self.WriteCopies(spec["copies"], extra_outputs, part_of_all) + + # Bundle resources. + if self.is_mac_bundle: + all_mac_bundle_resources = ( + spec.get("mac_bundle_resources", []) + extra_mac_bundle_resources + ) + self.WriteMacBundleResources(all_mac_bundle_resources, mac_bundle_deps) + self.WriteMacInfoPlist(mac_bundle_deps) + + # Sources. + all_sources = spec.get("sources", []) + extra_sources + if all_sources: + self.WriteSources( + configs, + deps, + all_sources, + extra_outputs, + extra_link_deps, + part_of_all, + gyp.xcode_emulation.MacPrefixHeader( + self.xcode_settings, + lambda p: Sourceify(self.Absolutify(p)), + self.Pchify, + ), + ) + sources = [x for x in all_sources if Compilable(x)] + if sources: + self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT1) + extensions = {os.path.splitext(s)[1] for s in sources} + for ext in extensions: + if ext in self.suffix_rules_srcdir: + self.WriteLn(self.suffix_rules_srcdir[ext]) + self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT2) + for ext in extensions: + if ext in self.suffix_rules_objdir1: + self.WriteLn(self.suffix_rules_objdir1[ext]) + for ext in extensions: + if ext in self.suffix_rules_objdir2: + self.WriteLn(self.suffix_rules_objdir2[ext]) + self.WriteLn("# End of this set of suffix rules") + + # Add dependency from bundle to bundle binary. + if self.is_mac_bundle: + mac_bundle_deps.append(self.output_binary) + + self.WriteTarget( + spec, + configs, + deps, + extra_link_deps + link_deps, + mac_bundle_deps, + extra_outputs, + part_of_all, + ) + + # Update global list of target outputs, used in dependency tracking. + target_outputs[qualified_target] = install_path + + # Update global list of link dependencies. + if self.type in ("static_library", "shared_library"): + target_link_deps[qualified_target] = self.output_binary + + # Currently any versions have the same effect, but in future the behavior + # could be different. + if self.generator_flags.get("android_ndk_version", None): + self.WriteAndroidNdkModuleRule(self.target, all_sources, link_deps) + + self.fp.close() + + def WriteSubMake(self, output_filename, makefile_path, targets, build_dir): + """Write a "sub-project" Makefile. + + This is a small, wrapper Makefile that calls the top-level Makefile to build + the targets from a single gyp file (i.e. a sub-project). + + Arguments: + output_filename: sub-project Makefile name to write + makefile_path: path to the top-level Makefile + targets: list of "all" targets for this sub-project + build_dir: build output directory, relative to the sub-project + """ + gyp.common.EnsureDirExists(output_filename) + self.fp = open(output_filename, "w") + self.fp.write(header) + # For consistency with other builders, put sub-project build output in the + # sub-project dir (see test/subdirectory/gyptest-subdir-all.py). + self.WriteLn( + "export builddir_name ?= %s" + % os.path.join(os.path.dirname(output_filename), build_dir) + ) + self.WriteLn(".PHONY: all") + self.WriteLn("all:") + if makefile_path: + makefile_path = " -C " + makefile_path + self.WriteLn("\t$(MAKE){} {}".format(makefile_path, " ".join(targets))) + self.fp.close() + + def WriteActions( + self, + actions, + extra_sources, + extra_outputs, + extra_mac_bundle_resources, + part_of_all, + ): + """Write Makefile code for any 'actions' from the gyp input. + + extra_sources: a list that will be filled in with newly generated source + files, if any + extra_outputs: a list that will be filled in with any outputs of these + actions (used to make other pieces dependent on these + actions) + part_of_all: flag indicating this target is part of 'all' + """ + env = self.GetSortedXcodeEnv() + for action in actions: + name = StringToMakefileVariable( + "{}_{}".format(self.qualified_target, action["action_name"]) + ) + self.WriteLn('### Rules for action "%s":' % action["action_name"]) + inputs = action["inputs"] + outputs = action["outputs"] + + # Build up a list of outputs. + # Collect the output dirs we'll need. + dirs = set() + for out in outputs: + dir = os.path.split(out)[0] + if dir: + dirs.add(dir) + if int(action.get("process_outputs_as_sources", False)): + extra_sources += outputs + if int(action.get("process_outputs_as_mac_bundle_resources", False)): + extra_mac_bundle_resources += outputs + + # Write the actual command. + action_commands = action["action"] + if self.flavor == "mac": + action_commands = [ + gyp.xcode_emulation.ExpandEnvVars(command, env) + for command in action_commands + ] + command = gyp.common.EncodePOSIXShellList(action_commands) + if "message" in action: + self.WriteLn( + "quiet_cmd_{} = ACTION {} $@".format(name, action["message"]) + ) + else: + self.WriteLn(f"quiet_cmd_{name} = ACTION {name} $@") + if len(dirs) > 0: + command = "mkdir -p %s" % " ".join(dirs) + "; " + command + + cd_action = "cd %s; " % Sourceify(self.path or ".") + + # command and cd_action get written to a toplevel variable called + # cmd_foo. Toplevel variables can't handle things that change per + # makefile like $(TARGET), so hardcode the target. + command = command.replace("$(TARGET)", self.target) + cd_action = cd_action.replace("$(TARGET)", self.target) + + # Set LD_LIBRARY_PATH in case the action runs an executable from this + # build which links to shared libs from this build. + # actions run on the host, so they should in theory only use host + # libraries, but until everything is made cross-compile safe, also use + # target libraries. + # TODO(piman): when everything is cross-compile safe, remove lib.target + if self.flavor == "zos" or self.flavor == "aix": + self.WriteLn( + "cmd_%s = LIBPATH=$(builddir)/lib.host:" + "$(builddir)/lib.target:$$LIBPATH; " + "export LIBPATH; " + "%s%s" % (name, cd_action, command) + ) + else: + self.WriteLn( + "cmd_%s = LD_LIBRARY_PATH=$(builddir)/lib.host:" + "$(builddir)/lib.target:$$LD_LIBRARY_PATH; " + "export LD_LIBRARY_PATH; " + "%s%s" % (name, cd_action, command) + ) + self.WriteLn() + outputs = [self.Absolutify(o) for o in outputs] + # The makefile rules are all relative to the top dir, but the gyp actions + # are defined relative to their containing dir. This replaces the obj + # variable for the action rule with an absolute version so that the output + # goes in the right place. + # Only write the 'obj' and 'builddir' rules for the "primary" output (:1); + # it's superfluous for the "extra outputs", and this avoids accidentally + # writing duplicate dummy rules for those outputs. + # Same for environment. + self.WriteLn("%s: obj := $(abs_obj)" % QuoteSpaces(outputs[0])) + self.WriteLn("%s: builddir := $(abs_builddir)" % QuoteSpaces(outputs[0])) + self.WriteSortedXcodeEnv(outputs[0], self.GetSortedXcodeEnv()) + + for input in inputs: + assert " " not in input, ( + "Spaces in action input filenames not supported (%s)" % input + ) + for output in outputs: + assert " " not in output, ( + "Spaces in action output filenames not supported (%s)" % output + ) + + # See the comment in WriteCopies about expanding env vars. + outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs] + inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs] + + self.WriteDoCmd( + outputs, + [Sourceify(self.Absolutify(i)) for i in inputs], + part_of_all=part_of_all, + command=name, + ) + + # Stuff the outputs in a variable so we can refer to them later. + outputs_variable = "action_%s_outputs" % name + self.WriteLn("{} := {}".format(outputs_variable, " ".join(outputs))) + extra_outputs.append("$(%s)" % outputs_variable) + self.WriteLn() + + self.WriteLn() + + def WriteRules( + self, + rules, + extra_sources, + extra_outputs, + extra_mac_bundle_resources, + part_of_all, + ): + """Write Makefile code for any 'rules' from the gyp input. + + extra_sources: a list that will be filled in with newly generated source + files, if any + extra_outputs: a list that will be filled in with any outputs of these + rules (used to make other pieces dependent on these rules) + part_of_all: flag indicating this target is part of 'all' + """ + env = self.GetSortedXcodeEnv() + for rule in rules: + name = StringToMakefileVariable( + "{}_{}".format(self.qualified_target, rule["rule_name"]) + ) + count = 0 + self.WriteLn("### Generated for rule %s:" % name) + + all_outputs = [] + + for rule_source in rule.get("rule_sources", []): + dirs = set() + (rule_source_dirname, rule_source_basename) = os.path.split(rule_source) + (rule_source_root, rule_source_ext) = os.path.splitext( + rule_source_basename + ) + + outputs = [ + self.ExpandInputRoot(out, rule_source_root, rule_source_dirname) + for out in rule["outputs"] + ] + + for out in outputs: + dir = os.path.dirname(out) + if dir: + dirs.add(dir) + if int(rule.get("process_outputs_as_sources", False)): + extra_sources += outputs + if int(rule.get("process_outputs_as_mac_bundle_resources", False)): + extra_mac_bundle_resources += outputs + inputs = [ + Sourceify(self.Absolutify(i)) + for i in [rule_source] + rule.get("inputs", []) + ] + actions = ["$(call do_cmd,%s_%d)" % (name, count)] + + if name == "resources_grit": + # HACK: This is ugly. Grit intentionally doesn't touch the + # timestamp of its output file when the file doesn't change, + # which is fine in hash-based dependency systems like scons + # and forge, but not kosher in the make world. After some + # discussion, hacking around it here seems like the least + # amount of pain. + actions += ["@touch --no-create $@"] + + # See the comment in WriteCopies about expanding env vars. + outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs] + inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs] + + outputs = [self.Absolutify(o) for o in outputs] + all_outputs += outputs + # Only write the 'obj' and 'builddir' rules for the "primary" output + # (:1); it's superfluous for the "extra outputs", and this avoids + # accidentally writing duplicate dummy rules for those outputs. + self.WriteLn("%s: obj := $(abs_obj)" % outputs[0]) + self.WriteLn("%s: builddir := $(abs_builddir)" % outputs[0]) + self.WriteMakeRule( + outputs, inputs, actions, command="%s_%d" % (name, count) + ) + # Spaces in rule filenames are not supported, but rule variables have + # spaces in them (e.g. RULE_INPUT_PATH expands to '$(abspath $<)'). + # The spaces within the variables are valid, so remove the variables + # before checking. + variables_with_spaces = re.compile(r"\$\([^ ]* \$<\)") + for output in outputs: + output = re.sub(variables_with_spaces, "", output) + assert " " not in output, ( + "Spaces in rule filenames not yet supported (%s)" % output + ) + self.WriteLn("all_deps += %s" % " ".join(outputs)) + + action = [ + self.ExpandInputRoot(ac, rule_source_root, rule_source_dirname) + for ac in rule["action"] + ] + mkdirs = "" + if len(dirs) > 0: + mkdirs = "mkdir -p %s; " % " ".join(dirs) + cd_action = "cd %s; " % Sourceify(self.path or ".") + + # action, cd_action, and mkdirs get written to a toplevel variable + # called cmd_foo. Toplevel variables can't handle things that change + # per makefile like $(TARGET), so hardcode the target. + if self.flavor == "mac": + action = [ + gyp.xcode_emulation.ExpandEnvVars(command, env) + for command in action + ] + action = gyp.common.EncodePOSIXShellList(action) + action = action.replace("$(TARGET)", self.target) + cd_action = cd_action.replace("$(TARGET)", self.target) + mkdirs = mkdirs.replace("$(TARGET)", self.target) + + # Set LD_LIBRARY_PATH in case the rule runs an executable from this + # build which links to shared libs from this build. + # rules run on the host, so they should in theory only use host + # libraries, but until everything is made cross-compile safe, also use + # target libraries. + # TODO(piman): when everything is cross-compile safe, remove lib.target + self.WriteLn( + "cmd_%(name)s_%(count)d = LD_LIBRARY_PATH=" + "$(builddir)/lib.host:$(builddir)/lib.target:$$LD_LIBRARY_PATH; " + "export LD_LIBRARY_PATH; " + "%(cd_action)s%(mkdirs)s%(action)s" + % { + "action": action, + "cd_action": cd_action, + "count": count, + "mkdirs": mkdirs, + "name": name, + } + ) + self.WriteLn( + "quiet_cmd_%(name)s_%(count)d = RULE %(name)s_%(count)d $@" + % {"count": count, "name": name} + ) + self.WriteLn() + count += 1 + + outputs_variable = "rule_%s_outputs" % name + self.WriteList(all_outputs, outputs_variable) + extra_outputs.append("$(%s)" % outputs_variable) + + self.WriteLn("### Finished generating for rule: %s" % name) + self.WriteLn() + self.WriteLn("### Finished generating for all rules") + self.WriteLn("") + + def WriteCopies(self, copies, extra_outputs, part_of_all): + """Write Makefile code for any 'copies' from the gyp input. + + extra_outputs: a list that will be filled in with any outputs of this action + (used to make other pieces dependent on this action) + part_of_all: flag indicating this target is part of 'all' + """ + self.WriteLn("### Generated for copy rule.") + + variable = StringToMakefileVariable(self.qualified_target + "_copies") + outputs = [] + for copy in copies: + for path in copy["files"]: + # Absolutify() may call normpath, and will strip trailing slashes. + path = Sourceify(self.Absolutify(path)) + filename = os.path.split(path)[1] + output = Sourceify( + self.Absolutify(os.path.join(copy["destination"], filename)) + ) + + # If the output path has variables in it, which happens in practice for + # 'copies', writing the environment as target-local doesn't work, + # because the variables are already needed for the target name. + # Copying the environment variables into global make variables doesn't + # work either, because then the .d files will potentially contain spaces + # after variable expansion, and .d file handling cannot handle spaces. + # As a workaround, manually expand variables at gyp time. Since 'copies' + # can't run scripts, there's no need to write the env then. + # WriteDoCmd() will escape spaces for .d files. + env = self.GetSortedXcodeEnv() + output = gyp.xcode_emulation.ExpandEnvVars(output, env) + path = gyp.xcode_emulation.ExpandEnvVars(path, env) + self.WriteDoCmd([output], [path], "copy", part_of_all) + outputs.append(output) + self.WriteLn( + "{} = {}".format(variable, " ".join(QuoteSpaces(o) for o in outputs)) + ) + extra_outputs.append("$(%s)" % variable) + self.WriteLn() + + def WriteMacBundleResources(self, resources, bundle_deps): + """Writes Makefile code for 'mac_bundle_resources'.""" + self.WriteLn("### Generated for mac_bundle_resources") + + for output, res in gyp.xcode_emulation.GetMacBundleResources( + generator_default_variables["PRODUCT_DIR"], + self.xcode_settings, + [Sourceify(self.Absolutify(r)) for r in resources], + ): + _, ext = os.path.splitext(output) + if ext != ".xcassets": + # Make does not supports '.xcassets' emulation. + self.WriteDoCmd( + [output], [res], "mac_tool,,,copy-bundle-resource", part_of_all=True + ) + bundle_deps.append(output) + + def WriteMacInfoPlist(self, bundle_deps): + """Write Makefile code for bundle Info.plist files.""" + info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist( + generator_default_variables["PRODUCT_DIR"], + self.xcode_settings, + lambda p: Sourceify(self.Absolutify(p)), + ) + if not info_plist: + return + if defines: + # Create an intermediate file to store preprocessed results. + intermediate_plist = "$(obj).$(TOOLSET)/$(TARGET)/" + os.path.basename( + info_plist + ) + self.WriteList( + defines, + intermediate_plist + ": INFOPLIST_DEFINES", + "-D", + quoter=EscapeCppDefine, + ) + self.WriteMakeRule( + [intermediate_plist], + [info_plist], + [ + "$(call do_cmd,infoplist)", + # "Convert" the plist so that any weird whitespace changes from the + # preprocessor do not affect the XML parser in mac_tool. + "@plutil -convert xml1 $@ $@", + ], + ) + info_plist = intermediate_plist + # plists can contain envvars and substitute them into the file. + self.WriteSortedXcodeEnv( + out, self.GetSortedXcodeEnv(additional_settings=extra_env) + ) + self.WriteDoCmd( + [out], [info_plist], "mac_tool,,,copy-info-plist", part_of_all=True + ) + bundle_deps.append(out) + + def WriteSources( + self, + configs, + deps, + sources, + extra_outputs, + extra_link_deps, + part_of_all, + precompiled_header, + ): + """Write Makefile code for any 'sources' from the gyp input. + These are source files necessary to build the current target. + + configs, deps, sources: input from gyp. + extra_outputs: a list of extra outputs this action should be dependent on; + used to serialize action/rules before compilation + extra_link_deps: a list that will be filled in with any outputs of + compilation (to be used in link lines) + part_of_all: flag indicating this target is part of 'all' + """ + + # Write configuration-specific variables for CFLAGS, etc. + for configname in sorted(configs.keys()): + config = configs[configname] + self.WriteList( + config.get("defines"), + "DEFS_%s" % configname, + prefix="-D", + quoter=EscapeCppDefine, + ) + + if self.flavor == "mac": + cflags = self.xcode_settings.GetCflags( + configname, arch=config.get("xcode_configuration_platform") + ) + cflags_c = self.xcode_settings.GetCflagsC(configname) + cflags_cc = self.xcode_settings.GetCflagsCC(configname) + cflags_objc = self.xcode_settings.GetCflagsObjC(configname) + cflags_objcc = self.xcode_settings.GetCflagsObjCC(configname) + else: + cflags = config.get("cflags") + cflags_c = config.get("cflags_c") + cflags_cc = config.get("cflags_cc") + + self.WriteLn("# Flags passed to all source files.") + self.WriteList(cflags, "CFLAGS_%s" % configname) + self.WriteLn("# Flags passed to only C files.") + self.WriteList(cflags_c, "CFLAGS_C_%s" % configname) + self.WriteLn("# Flags passed to only C++ files.") + self.WriteList(cflags_cc, "CFLAGS_CC_%s" % configname) + if self.flavor == "mac": + self.WriteLn("# Flags passed to only ObjC files.") + self.WriteList(cflags_objc, "CFLAGS_OBJC_%s" % configname) + self.WriteLn("# Flags passed to only ObjC++ files.") + self.WriteList(cflags_objcc, "CFLAGS_OBJCC_%s" % configname) + includes = config.get("include_dirs") + if includes: + includes = [Sourceify(self.Absolutify(i)) for i in includes] + self.WriteList(includes, "INCS_%s" % configname, prefix="-I") + + compilable = list(filter(Compilable, sources)) + objs = [self.Objectify(self.Absolutify(Target(c))) for c in compilable] + self.WriteList(objs, "OBJS") + + for obj in objs: + assert " " not in obj, "Spaces in object filenames not supported (%s)" % obj + self.WriteLn( + "# Add to the list of files we specially track " "dependencies for." + ) + self.WriteLn("all_deps += $(OBJS)") + self.WriteLn() + + # Make sure our dependencies are built first. + if deps: + self.WriteMakeRule( + ["$(OBJS)"], + deps, + comment="Make sure our dependencies are built " "before any of us.", + order_only=True, + ) + + # Make sure the actions and rules run first. + # If they generate any extra headers etc., the per-.o file dep tracking + # will catch the proper rebuilds, so order only is still ok here. + if extra_outputs: + self.WriteMakeRule( + ["$(OBJS)"], + extra_outputs, + comment="Make sure our actions/rules run " "before any of us.", + order_only=True, + ) + + pchdeps = precompiled_header.GetObjDependencies(compilable, objs) + if pchdeps: + self.WriteLn("# Dependencies from obj files to their precompiled headers") + for source, obj, gch in pchdeps: + self.WriteLn(f"{obj}: {gch}") + self.WriteLn("# End precompiled header dependencies") + + if objs: + extra_link_deps.append("$(OBJS)") + self.WriteLn( + """\ +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual.""" + ) + self.WriteLn("$(OBJS): TOOLSET := $(TOOLSET)") + self.WriteLn( + "$(OBJS): GYP_CFLAGS := " + "$(DEFS_$(BUILDTYPE)) " + "$(INCS_$(BUILDTYPE)) " + "%s " % precompiled_header.GetInclude("c") + "$(CFLAGS_$(BUILDTYPE)) " + "$(CFLAGS_C_$(BUILDTYPE))" + ) + self.WriteLn( + "$(OBJS): GYP_CXXFLAGS := " + "$(DEFS_$(BUILDTYPE)) " + "$(INCS_$(BUILDTYPE)) " + "%s " % precompiled_header.GetInclude("cc") + "$(CFLAGS_$(BUILDTYPE)) " + "$(CFLAGS_CC_$(BUILDTYPE))" + ) + if self.flavor == "mac": + self.WriteLn( + "$(OBJS): GYP_OBJCFLAGS := " + "$(DEFS_$(BUILDTYPE)) " + "$(INCS_$(BUILDTYPE)) " + "%s " % precompiled_header.GetInclude("m") + + "$(CFLAGS_$(BUILDTYPE)) " + "$(CFLAGS_C_$(BUILDTYPE)) " + "$(CFLAGS_OBJC_$(BUILDTYPE))" + ) + self.WriteLn( + "$(OBJS): GYP_OBJCXXFLAGS := " + "$(DEFS_$(BUILDTYPE)) " + "$(INCS_$(BUILDTYPE)) " + "%s " % precompiled_header.GetInclude("mm") + + "$(CFLAGS_$(BUILDTYPE)) " + "$(CFLAGS_CC_$(BUILDTYPE)) " + "$(CFLAGS_OBJCC_$(BUILDTYPE))" + ) + + self.WritePchTargets(precompiled_header.GetPchBuildCommands()) + + # If there are any object files in our input file list, link them into our + # output. + extra_link_deps += [source for source in sources if Linkable(source)] + + self.WriteLn() + + def WritePchTargets(self, pch_commands): + """Writes make rules to compile prefix headers.""" + if not pch_commands: + return + + for gch, lang_flag, lang, input in pch_commands: + extra_flags = { + "c": "$(CFLAGS_C_$(BUILDTYPE))", + "cc": "$(CFLAGS_CC_$(BUILDTYPE))", + "m": "$(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))", + "mm": "$(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE))", + }[lang] + var_name = { + "c": "GYP_PCH_CFLAGS", + "cc": "GYP_PCH_CXXFLAGS", + "m": "GYP_PCH_OBJCFLAGS", + "mm": "GYP_PCH_OBJCXXFLAGS", + }[lang] + self.WriteLn( + f"{gch}: {var_name} := {lang_flag} " + "$(DEFS_$(BUILDTYPE)) " + "$(INCS_$(BUILDTYPE)) " + "$(CFLAGS_$(BUILDTYPE)) " + extra_flags + ) + + self.WriteLn(f"{gch}: {input} FORCE_DO_CMD") + self.WriteLn("\t@$(call do_cmd,pch_%s,1)" % lang) + self.WriteLn("") + assert " " not in gch, "Spaces in gch filenames not supported (%s)" % gch + self.WriteLn("all_deps += %s" % gch) + self.WriteLn("") + + def ComputeOutputBasename(self, spec): + """Return the 'output basename' of a gyp spec. + + E.g., the loadable module 'foobar' in directory 'baz' will produce + 'libfoobar.so' + """ + assert not self.is_mac_bundle + + if self.flavor == "mac" and self.type in ( + "static_library", + "executable", + "shared_library", + "loadable_module", + ): + return self.xcode_settings.GetExecutablePath() + + target = spec["target_name"] + target_prefix = "" + target_ext = "" + if self.type == "static_library": + if target[:3] == "lib": + target = target[3:] + target_prefix = "lib" + target_ext = ".a" + elif self.type in ("loadable_module", "shared_library"): + if target[:3] == "lib": + target = target[3:] + target_prefix = "lib" + if self.flavor == "aix": + target_ext = ".a" + elif self.flavor == "zos": + target_ext = ".x" + else: + target_ext = ".so" + elif self.type == "none": + target = "%s.stamp" % target + elif self.type != "executable": + print( + "ERROR: What output file should be generated?", + "type", + self.type, + "target", + target, + ) + + target_prefix = spec.get("product_prefix", target_prefix) + target = spec.get("product_name", target) + product_ext = spec.get("product_extension") + if product_ext: + target_ext = "." + product_ext + + return target_prefix + target + target_ext + + def _InstallImmediately(self): + return ( + self.toolset == "target" + and self.flavor == "mac" + and self.type + in ("static_library", "executable", "shared_library", "loadable_module") + ) + + def ComputeOutput(self, spec): + """Return the 'output' (full output path) of a gyp spec. + + E.g., the loadable module 'foobar' in directory 'baz' will produce + '$(obj)/baz/libfoobar.so' + """ + assert not self.is_mac_bundle + + path = os.path.join("$(obj)." + self.toolset, self.path) + if self.type == "executable" or self._InstallImmediately(): + path = "$(builddir)" + path = spec.get("product_dir", path) + return os.path.join(path, self.ComputeOutputBasename(spec)) + + def ComputeMacBundleOutput(self, spec): + """Return the 'output' (full output path) to a bundle output directory.""" + assert self.is_mac_bundle + path = generator_default_variables["PRODUCT_DIR"] + return os.path.join(path, self.xcode_settings.GetWrapperName()) + + def ComputeMacBundleBinaryOutput(self, spec): + """Return the 'output' (full output path) to the binary in a bundle.""" + path = generator_default_variables["PRODUCT_DIR"] + return os.path.join(path, self.xcode_settings.GetExecutablePath()) + + def ComputeDeps(self, spec): + """Compute the dependencies of a gyp spec. + + Returns a tuple (deps, link_deps), where each is a list of + filenames that will need to be put in front of make for either + building (deps) or linking (link_deps). + """ + deps = [] + link_deps = [] + if "dependencies" in spec: + deps.extend( + [ + target_outputs[dep] + for dep in spec["dependencies"] + if target_outputs[dep] + ] + ) + for dep in spec["dependencies"]: + if dep in target_link_deps: + link_deps.append(target_link_deps[dep]) + deps.extend(link_deps) + # TODO: It seems we need to transitively link in libraries (e.g. -lfoo)? + # This hack makes it work: + # link_deps.extend(spec.get('libraries', [])) + return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps)) + + def GetSharedObjectFromSidedeck(self, sidedeck): + """Return the shared object files based on sidedeck""" + return re.sub(r"\.x$", ".so", sidedeck) + + def GetUnversionedSidedeckFromSidedeck(self, sidedeck): + """Return the shared object files based on sidedeck""" + return re.sub(r"\.\d+\.x$", ".x", sidedeck) + + def WriteDependencyOnExtraOutputs(self, target, extra_outputs): + self.WriteMakeRule( + [self.output_binary], + extra_outputs, + comment="Build our special outputs first.", + order_only=True, + ) + + def WriteTarget( + self, spec, configs, deps, link_deps, bundle_deps, extra_outputs, part_of_all + ): + """Write Makefile code to produce the final target of the gyp spec. + + spec, configs: input from gyp. + deps, link_deps: dependency lists; see ComputeDeps() + extra_outputs: any extra outputs that our target should depend on + part_of_all: flag indicating this target is part of 'all' + """ + + self.WriteLn("### Rules for final target.") + + if extra_outputs: + self.WriteDependencyOnExtraOutputs(self.output_binary, extra_outputs) + self.WriteMakeRule( + extra_outputs, + deps, + comment=("Preserve order dependency of " "special output on deps."), + order_only=True, + ) + + target_postbuilds = {} + if self.type != "none": + for configname in sorted(configs.keys()): + config = configs[configname] + if self.flavor == "mac": + ldflags = self.xcode_settings.GetLdflags( + configname, + generator_default_variables["PRODUCT_DIR"], + lambda p: Sourceify(self.Absolutify(p)), + arch=config.get("xcode_configuration_platform"), + ) + + # TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on. + gyp_to_build = gyp.common.InvertRelativePath(self.path) + target_postbuild = self.xcode_settings.AddImplicitPostbuilds( + configname, + QuoteSpaces( + os.path.normpath(os.path.join(gyp_to_build, self.output)) + ), + QuoteSpaces( + os.path.normpath( + os.path.join(gyp_to_build, self.output_binary) + ) + ), + ) + if target_postbuild: + target_postbuilds[configname] = target_postbuild + else: + ldflags = config.get("ldflags", []) + # Compute an rpath for this output if needed. + if any(dep.endswith(".so") or ".so." in dep for dep in deps): + # We want to get the literal string "$ORIGIN" + # into the link command, so we need lots of escaping. + ldflags.append(r"-Wl,-rpath=\$$ORIGIN/") + ldflags.append(r"-Wl,-rpath-link=\$(builddir)/") + library_dirs = config.get("library_dirs", []) + ldflags += [("-L%s" % library_dir) for library_dir in library_dirs] + self.WriteList(ldflags, "LDFLAGS_%s" % configname) + if self.flavor == "mac": + self.WriteList( + self.xcode_settings.GetLibtoolflags(configname), + "LIBTOOLFLAGS_%s" % configname, + ) + libraries = spec.get("libraries") + if libraries: + # Remove duplicate entries + libraries = gyp.common.uniquer(libraries) + if self.flavor == "mac": + libraries = self.xcode_settings.AdjustLibraries(libraries) + self.WriteList(libraries, "LIBS") + self.WriteLn( + "%s: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))" + % QuoteSpaces(self.output_binary) + ) + self.WriteLn("%s: LIBS := $(LIBS)" % QuoteSpaces(self.output_binary)) + + if self.flavor == "mac": + self.WriteLn( + "%s: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))" + % QuoteSpaces(self.output_binary) + ) + + # Postbuild actions. Like actions, but implicitly depend on the target's + # output. + postbuilds = [] + if self.flavor == "mac": + if target_postbuilds: + postbuilds.append("$(TARGET_POSTBUILDS_$(BUILDTYPE))") + postbuilds.extend(gyp.xcode_emulation.GetSpecPostbuildCommands(spec)) + + if postbuilds: + # Envvars may be referenced by TARGET_POSTBUILDS_$(BUILDTYPE), + # so we must output its definition first, since we declare variables + # using ":=". + self.WriteSortedXcodeEnv(self.output, self.GetSortedXcodePostbuildEnv()) + + for configname in target_postbuilds: + self.WriteLn( + "%s: TARGET_POSTBUILDS_%s := %s" + % ( + QuoteSpaces(self.output), + configname, + gyp.common.EncodePOSIXShellList(target_postbuilds[configname]), + ) + ) + + # Postbuilds expect to be run in the gyp file's directory, so insert an + # implicit postbuild to cd to there. + postbuilds.insert(0, gyp.common.EncodePOSIXShellList(["cd", self.path])) + for i, postbuild in enumerate(postbuilds): + if not postbuild.startswith("$"): + postbuilds[i] = EscapeShellArgument(postbuild) + self.WriteLn("%s: builddir := $(abs_builddir)" % QuoteSpaces(self.output)) + self.WriteLn( + "%s: POSTBUILDS := %s" + % (QuoteSpaces(self.output), " ".join(postbuilds)) + ) + + # A bundle directory depends on its dependencies such as bundle resources + # and bundle binary. When all dependencies have been built, the bundle + # needs to be packaged. + if self.is_mac_bundle: + # If the framework doesn't contain a binary, then nothing depends + # on the actions -- make the framework depend on them directly too. + self.WriteDependencyOnExtraOutputs(self.output, extra_outputs) + + # Bundle dependencies. Note that the code below adds actions to this + # target, so if you move these two lines, move the lines below as well. + self.WriteList([QuoteSpaces(dep) for dep in bundle_deps], "BUNDLE_DEPS") + self.WriteLn("%s: $(BUNDLE_DEPS)" % QuoteSpaces(self.output)) + + # After the framework is built, package it. Needs to happen before + # postbuilds, since postbuilds depend on this. + if self.type in ("shared_library", "loadable_module"): + self.WriteLn( + "\t@$(call do_cmd,mac_package_framework,,,%s)" + % self.xcode_settings.GetFrameworkVersion() + ) + + # Bundle postbuilds can depend on the whole bundle, so run them after + # the bundle is packaged, not already after the bundle binary is done. + if postbuilds: + self.WriteLn("\t@$(call do_postbuilds)") + postbuilds = [] # Don't write postbuilds for target's output. + + # Needed by test/mac/gyptest-rebuild.py. + self.WriteLn("\t@true # No-op, used by tests") + + # Since this target depends on binary and resources which are in + # nested subfolders, the framework directory will be older than + # its dependencies usually. To prevent this rule from executing + # on every build (expensive, especially with postbuilds), expliclity + # update the time on the framework directory. + self.WriteLn("\t@touch -c %s" % QuoteSpaces(self.output)) + + if postbuilds: + assert not self.is_mac_bundle, ( + "Postbuilds for bundles should be done " + "on the bundle, not the binary (target '%s')" % self.target + ) + assert "product_dir" not in spec, ( + "Postbuilds do not work with " "custom product_dir" + ) + + if self.type == "executable": + self.WriteLn( + "%s: LD_INPUTS := %s" + % ( + QuoteSpaces(self.output_binary), + " ".join(QuoteSpaces(dep) for dep in link_deps), + ) + ) + if self.toolset == "host" and self.flavor == "android": + self.WriteDoCmd( + [self.output_binary], + link_deps, + "link_host", + part_of_all, + postbuilds=postbuilds, + ) + else: + self.WriteDoCmd( + [self.output_binary], + link_deps, + "link", + part_of_all, + postbuilds=postbuilds, + ) + + elif self.type == "static_library": + for link_dep in link_deps: + assert " " not in link_dep, ( + "Spaces in alink input filenames not supported (%s)" % link_dep + ) + if ( + self.flavor not in ("mac", "openbsd", "netbsd", "win") + and not self.is_standalone_static_library + ): + if self.flavor in ("linux", "android"): + self.WriteMakeRule( + [self.output_binary], + link_deps, + actions=["$(call create_thin_archive,$@,$^)"], + ) + else: + self.WriteDoCmd( + [self.output_binary], + link_deps, + "alink_thin", + part_of_all, + postbuilds=postbuilds, + ) + else: + if self.flavor in ("linux", "android"): + self.WriteMakeRule( + [self.output_binary], + link_deps, + actions=["$(call create_archive,$@,$^)"], + ) + else: + self.WriteDoCmd( + [self.output_binary], + link_deps, + "alink", + part_of_all, + postbuilds=postbuilds, + ) + elif self.type == "shared_library": + self.WriteLn( + "%s: LD_INPUTS := %s" + % ( + QuoteSpaces(self.output_binary), + " ".join(QuoteSpaces(dep) for dep in link_deps), + ) + ) + self.WriteDoCmd( + [self.output_binary], + link_deps, + "solink", + part_of_all, + postbuilds=postbuilds, + ) + # z/OS has a .so target as well as a sidedeck .x target + if self.flavor == "zos": + self.WriteLn( + "%s: %s" + % ( + QuoteSpaces( + self.GetSharedObjectFromSidedeck(self.output_binary) + ), + QuoteSpaces(self.output_binary), + ) + ) + elif self.type == "loadable_module": + for link_dep in link_deps: + assert " " not in link_dep, ( + "Spaces in module input filenames not supported (%s)" % link_dep + ) + if self.toolset == "host" and self.flavor == "android": + self.WriteDoCmd( + [self.output_binary], + link_deps, + "solink_module_host", + part_of_all, + postbuilds=postbuilds, + ) + else: + self.WriteDoCmd( + [self.output_binary], + link_deps, + "solink_module", + part_of_all, + postbuilds=postbuilds, + ) + elif self.type == "none": + # Write a stamp line. + self.WriteDoCmd( + [self.output_binary], deps, "touch", part_of_all, postbuilds=postbuilds + ) + else: + print("WARNING: no output for", self.type, self.target) + + # Add an alias for each target (if there are any outputs). + # Installable target aliases are created below. + if (self.output and self.output != self.target) and ( + self.type not in self._INSTALLABLE_TARGETS + ): + self.WriteMakeRule( + [self.target], [self.output], comment="Add target alias", phony=True + ) + if part_of_all: + self.WriteMakeRule( + ["all"], + [self.target], + comment='Add target alias to "all" target.', + phony=True, + ) + + # Add special-case rules for our installable targets. + # 1) They need to install to the build dir or "product" dir. + # 2) They get shortcuts for building (e.g. "make chrome"). + # 3) They are part of "make all". + if self.type in self._INSTALLABLE_TARGETS or self.is_standalone_static_library: + if self.type == "shared_library": + file_desc = "shared library" + elif self.type == "static_library": + file_desc = "static library" + else: + file_desc = "executable" + install_path = self._InstallableTargetInstallPath() + installable_deps = [] + if self.flavor != "zos": + installable_deps.append(self.output) + if ( + self.flavor == "mac" + and "product_dir" not in spec + and self.toolset == "target" + ): + # On macOS, products are created in install_path immediately. + assert install_path == self.output, f"{install_path} != {self.output}" + + # Point the target alias to the final binary output. + self.WriteMakeRule( + [self.target], [install_path], comment="Add target alias", phony=True + ) + if install_path != self.output: + assert not self.is_mac_bundle # See comment a few lines above. + self.WriteDoCmd( + [install_path], + [self.output], + "copy", + comment="Copy this to the %s output path." % file_desc, + part_of_all=part_of_all, + ) + if self.flavor != "zos": + installable_deps.append(install_path) + if self.flavor == "zos" and self.type == "shared_library": + # lib.target/libnode.so has a dependency on $(obj).target/libnode.so + self.WriteDoCmd( + [self.GetSharedObjectFromSidedeck(install_path)], + [self.GetSharedObjectFromSidedeck(self.output)], + "copy", + comment="Copy this to the %s output path." % file_desc, + part_of_all=part_of_all, + ) + # Create a symlink of libnode.x to libnode.version.x + self.WriteDoCmd( + [self.GetUnversionedSidedeckFromSidedeck(install_path)], + [install_path], + "symlink", + comment="Symlnk this to the %s output path." % file_desc, + part_of_all=part_of_all, + ) + # Place libnode.version.so and libnode.x symlink in lib.target dir + installable_deps.append(self.GetSharedObjectFromSidedeck(install_path)) + installable_deps.append( + self.GetUnversionedSidedeckFromSidedeck(install_path) + ) + if self.output != self.alias and self.alias != self.target: + self.WriteMakeRule( + [self.alias], + installable_deps, + comment="Short alias for building this %s." % file_desc, + phony=True, + ) + if self.flavor == "zos" and self.type == "shared_library": + # Make sure that .x symlink target is run + self.WriteMakeRule( + ["all"], + [ + self.GetUnversionedSidedeckFromSidedeck(install_path), + self.GetSharedObjectFromSidedeck(install_path), + ], + comment='Add %s to "all" target.' % file_desc, + phony=True, + ) + elif part_of_all: + self.WriteMakeRule( + ["all"], + [install_path], + comment='Add %s to "all" target.' % file_desc, + phony=True, + ) + + def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessary): + """Write a variable definition that is a list of values. + + E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out + foo = blaha blahb + but in a pretty-printed style. + """ + values = "" + if value_list: + value_list = [quoter(prefix + value) for value in value_list] + values = " \\\n\t" + " \\\n\t".join(value_list) + self.fp.write(f"{variable} :={values}\n\n") + + def WriteDoCmd( + self, outputs, inputs, command, part_of_all, comment=None, postbuilds=False + ): + """Write a Makefile rule that uses do_cmd. + + This makes the outputs dependent on the command line that was run, + as well as support the V= make command line flag. + """ + suffix = "" + if postbuilds: + assert "," not in command + suffix = ",,1" # Tell do_cmd to honor $POSTBUILDS + self.WriteMakeRule( + outputs, + inputs, + actions=[f"$(call do_cmd,{command}{suffix})"], + comment=comment, + command=command, + force=True, + ) + # Add our outputs to the list of targets we read depfiles from. + # all_deps is only used for deps file reading, and for deps files we replace + # spaces with ? because escaping doesn't work with make's $(sort) and + # other functions. + outputs = [QuoteSpaces(o, SPACE_REPLACEMENT) for o in outputs] + self.WriteLn("all_deps += %s" % " ".join(outputs)) + + def WriteMakeRule( + self, + outputs, + inputs, + actions=None, + comment=None, + order_only=False, + force=False, + phony=False, + command=None, + ): + """Write a Makefile rule, with some extra tricks. + + outputs: a list of outputs for the rule (note: this is not directly + supported by make; see comments below) + inputs: a list of inputs for the rule + actions: a list of shell commands to run for the rule + comment: a comment to put in the Makefile above the rule (also useful + for making this Python script's code self-documenting) + order_only: if true, makes the dependency order-only + force: if true, include FORCE_DO_CMD as an order-only dep + phony: if true, the rule does not actually generate the named output, the + output is just a name to run the rule + command: (optional) command name to generate unambiguous labels + """ + outputs = [QuoteSpaces(o) for o in outputs] + inputs = [QuoteSpaces(i) for i in inputs] + + if comment: + self.WriteLn("# " + comment) + if phony: + self.WriteLn(".PHONY: " + " ".join(outputs)) + if actions: + self.WriteLn("%s: TOOLSET := $(TOOLSET)" % outputs[0]) + force_append = " FORCE_DO_CMD" if force else "" + + if order_only: + # Order only rule: Just write a simple rule. + # TODO(evanm): just make order_only a list of deps instead of this hack. + self.WriteLn( + "{}: | {}{}".format(" ".join(outputs), " ".join(inputs), force_append) + ) + elif len(outputs) == 1: + # Regular rule, one output: Just write a simple rule. + self.WriteLn("{}: {}{}".format(outputs[0], " ".join(inputs), force_append)) + else: + # Regular rule, more than one output: Multiple outputs are tricky in + # make. We will write three rules: + # - All outputs depend on an intermediate file. + # - Make .INTERMEDIATE depend on the intermediate. + # - The intermediate file depends on the inputs and executes the + # actual command. + # - The intermediate recipe will 'touch' the intermediate file. + # - The multi-output rule will have an do-nothing recipe. + + # Hash the target name to avoid generating overlong filenames. + cmddigest = hashlib.sha1( + (command or self.target).encode("utf-8") + ).hexdigest() + intermediate = "%s.intermediate" % cmddigest + self.WriteLn("{}: {}".format(" ".join(outputs), intermediate)) + self.WriteLn("\t%s" % "@:") + self.WriteLn("{}: {}".format(".INTERMEDIATE", intermediate)) + self.WriteLn( + "{}: {}{}".format(intermediate, " ".join(inputs), force_append) + ) + actions.insert(0, "$(call do_cmd,touch)") + + if actions: + for action in actions: + self.WriteLn("\t%s" % action) + self.WriteLn() + + def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps): + """Write a set of LOCAL_XXX definitions for Android NDK. + + These variable definitions will be used by Android NDK but do nothing for + non-Android applications. + + Arguments: + module_name: Android NDK module name, which must be unique among all + module names. + all_sources: A list of source files (will be filtered by Compilable). + link_deps: A list of link dependencies, which must be sorted in + the order from dependencies to dependents. + """ + if self.type not in ("executable", "shared_library", "static_library"): + return + + self.WriteLn("# Variable definitions for Android applications") + self.WriteLn("include $(CLEAR_VARS)") + self.WriteLn("LOCAL_MODULE := " + module_name) + self.WriteLn( + "LOCAL_CFLAGS := $(CFLAGS_$(BUILDTYPE)) " + "$(DEFS_$(BUILDTYPE)) " + # LOCAL_CFLAGS is applied to both of C and C++. There is + # no way to specify $(CFLAGS_C_$(BUILDTYPE)) only for C + # sources. + "$(CFLAGS_C_$(BUILDTYPE)) " + # $(INCS_$(BUILDTYPE)) includes the prefix '-I' while + # LOCAL_C_INCLUDES does not expect it. So put it in + # LOCAL_CFLAGS. + "$(INCS_$(BUILDTYPE))" + ) + # LOCAL_CXXFLAGS is obsolete and LOCAL_CPPFLAGS is preferred. + self.WriteLn("LOCAL_CPPFLAGS := $(CFLAGS_CC_$(BUILDTYPE))") + self.WriteLn("LOCAL_C_INCLUDES :=") + self.WriteLn("LOCAL_LDLIBS := $(LDFLAGS_$(BUILDTYPE)) $(LIBS)") + + # Detect the C++ extension. + cpp_ext = {".cc": 0, ".cpp": 0, ".cxx": 0} + default_cpp_ext = ".cpp" + for filename in all_sources: + ext = os.path.splitext(filename)[1] + if ext in cpp_ext: + cpp_ext[ext] += 1 + if cpp_ext[ext] > cpp_ext[default_cpp_ext]: + default_cpp_ext = ext + self.WriteLn("LOCAL_CPP_EXTENSION := " + default_cpp_ext) + + self.WriteList( + list(map(self.Absolutify, filter(Compilable, all_sources))), + "LOCAL_SRC_FILES", + ) + + # Filter out those which do not match prefix and suffix and produce + # the resulting list without prefix and suffix. + def DepsToModules(deps, prefix, suffix): + modules = [] + for filepath in deps: + filename = os.path.basename(filepath) + if filename.startswith(prefix) and filename.endswith(suffix): + modules.append(filename[len(prefix) : -len(suffix)]) + return modules + + # Retrieve the default value of 'SHARED_LIB_SUFFIX' + params = {"flavor": "linux"} + default_variables = {} + CalculateVariables(default_variables, params) + + self.WriteList( + DepsToModules( + link_deps, + generator_default_variables["SHARED_LIB_PREFIX"], + default_variables["SHARED_LIB_SUFFIX"], + ), + "LOCAL_SHARED_LIBRARIES", + ) + self.WriteList( + DepsToModules( + link_deps, + generator_default_variables["STATIC_LIB_PREFIX"], + generator_default_variables["STATIC_LIB_SUFFIX"], + ), + "LOCAL_STATIC_LIBRARIES", + ) + + if self.type == "executable": + self.WriteLn("include $(BUILD_EXECUTABLE)") + elif self.type == "shared_library": + self.WriteLn("include $(BUILD_SHARED_LIBRARY)") + elif self.type == "static_library": + self.WriteLn("include $(BUILD_STATIC_LIBRARY)") + self.WriteLn() + + def WriteLn(self, text=""): + self.fp.write(text + "\n") + + def GetSortedXcodeEnv(self, additional_settings=None): + return gyp.xcode_emulation.GetSortedXcodeEnv( + self.xcode_settings, + "$(abs_builddir)", + os.path.join("$(abs_srcdir)", self.path), + "$(BUILDTYPE)", + additional_settings, + ) + + def GetSortedXcodePostbuildEnv(self): + # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack. + # TODO(thakis): It would be nice to have some general mechanism instead. + strip_save_file = self.xcode_settings.GetPerTargetSetting( + "CHROMIUM_STRIP_SAVE_FILE", "" + ) + # Even if strip_save_file is empty, explicitly write it. Else a postbuild + # might pick up an export from an earlier target. + return self.GetSortedXcodeEnv( + additional_settings={"CHROMIUM_STRIP_SAVE_FILE": strip_save_file} + ) + + def WriteSortedXcodeEnv(self, target, env): + for k, v in env: + # For + # foo := a\ b + # the escaped space does the right thing. For + # export foo := a\ b + # it does not -- the backslash is written to the env as literal character. + # So don't escape spaces in |env[k]|. + self.WriteLn(f"{QuoteSpaces(target)}: export {k} := {v}") + + def Objectify(self, path): + """Convert a path to its output directory form.""" + if "$(" in path: + path = path.replace("$(obj)/", "$(obj).%s/$(TARGET)/" % self.toolset) + if "$(obj)" not in path: + path = f"$(obj).{self.toolset}/$(TARGET)/{path}" + return path + + def Pchify(self, path, lang): + """Convert a prefix header path to its output directory form.""" + path = self.Absolutify(path) + if "$(" in path: + path = path.replace( + "$(obj)/", f"$(obj).{self.toolset}/$(TARGET)/pch-{lang}" + ) + return path + return f"$(obj).{self.toolset}/$(TARGET)/pch-{lang}/{path}" + + def Absolutify(self, path): + """Convert a subdirectory-relative path into a base-relative path. + Skips over paths that contain variables.""" + if "$(" in path: + # Don't call normpath in this case, as it might collapse the + # path too aggressively if it features '..'. However it's still + # important to strip trailing slashes. + return path.rstrip("/") + return os.path.normpath(os.path.join(self.path, path)) + + def ExpandInputRoot(self, template, expansion, dirname): + if "%(INPUT_ROOT)s" not in template and "%(INPUT_DIRNAME)s" not in template: + return template + path = template % { + "INPUT_ROOT": expansion, + "INPUT_DIRNAME": dirname, + } + return path + + def _InstallableTargetInstallPath(self): + """Returns the location of the final output for an installable target.""" + # Functionality removed for all platforms to match Xcode and hoist + # shared libraries into PRODUCT_DIR for users: + # Xcode puts shared_library results into PRODUCT_DIR, and some gyp files + # rely on this. Emulate this behavior for mac. + # if self.type == "shared_library" and ( + # self.flavor != "mac" or self.toolset != "target" + # ): + # # Install all shared libs into a common directory (per toolset) for + # # convenient access with LD_LIBRARY_PATH. + # return "$(builddir)/lib.%s/%s" % (self.toolset, self.alias) + if self.flavor == "zos" and self.type == "shared_library": + return "$(builddir)/lib.%s/%s" % (self.toolset, self.alias) + + return "$(builddir)/" + self.alias + + +def WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files): + """Write the target to regenerate the Makefile.""" + options = params["options"] + build_files_args = [ + gyp.common.RelativePath(filename, options.toplevel_dir) + for filename in params["build_files_arg"] + ] + + gyp_binary = gyp.common.FixIfRelativePath( + params["gyp_binary"], options.toplevel_dir + ) + if not gyp_binary.startswith(os.sep): + gyp_binary = os.path.join(".", gyp_binary) + + root_makefile.write( + "quiet_cmd_regen_makefile = ACTION Regenerating $@\n" + "cmd_regen_makefile = cd $(srcdir); %(cmd)s\n" + "%(makefile_name)s: %(deps)s\n" + "\t$(call do_cmd,regen_makefile)\n\n" + % { + "makefile_name": makefile_name, + "deps": " ".join(SourceifyAndQuoteSpaces(bf) for bf in build_files), + "cmd": gyp.common.EncodePOSIXShellList( + [gyp_binary, "-fmake"] + gyp.RegenerateFlags(options) + build_files_args + ), + } + ) + + +def PerformBuild(data, configurations, params): + options = params["options"] + for config in configurations: + arguments = ["make"] + if options.toplevel_dir and options.toplevel_dir != ".": + arguments += "-C", options.toplevel_dir + arguments.append("BUILDTYPE=" + config) + print(f"Building [{config}]: {arguments}") + subprocess.check_call(arguments) + + +def GenerateOutput(target_list, target_dicts, data, params): + options = params["options"] + flavor = gyp.common.GetFlavor(params) + generator_flags = params.get("generator_flags", {}) + builddir_name = generator_flags.get("output_dir", "out") + android_ndk_version = generator_flags.get("android_ndk_version", None) + default_target = generator_flags.get("default_target", "all") + + def CalculateMakefilePath(build_file, base_name): + """Determine where to write a Makefile for a given gyp file.""" + # Paths in gyp files are relative to the .gyp file, but we want + # paths relative to the source root for the master makefile. Grab + # the path of the .gyp file as the base to relativize against. + # E.g. "foo/bar" when we're constructing targets for "foo/bar/baz.gyp". + base_path = gyp.common.RelativePath(os.path.dirname(build_file), options.depth) + # We write the file in the base_path directory. + output_file = os.path.join(options.depth, base_path, base_name) + if options.generator_output: + output_file = os.path.join( + options.depth, options.generator_output, base_path, base_name + ) + base_path = gyp.common.RelativePath( + os.path.dirname(build_file), options.toplevel_dir + ) + return base_path, output_file + + # TODO: search for the first non-'Default' target. This can go + # away when we add verification that all targets have the + # necessary configurations. + default_configuration = None + toolsets = {target_dicts[target]["toolset"] for target in target_list} + for target in target_list: + spec = target_dicts[target] + if spec["default_configuration"] != "Default": + default_configuration = spec["default_configuration"] + break + if not default_configuration: + default_configuration = "Default" + + srcdir = "." + makefile_name = "Makefile" + options.suffix + makefile_path = os.path.join(options.toplevel_dir, makefile_name) + if options.generator_output: + global srcdir_prefix + makefile_path = os.path.join( + options.toplevel_dir, options.generator_output, makefile_name + ) + srcdir = gyp.common.RelativePath(srcdir, options.generator_output) + srcdir_prefix = "$(srcdir)/" + + flock_command = "flock" + copy_archive_arguments = "-af" + makedep_arguments = "-MMD" + header_params = { + "default_target": default_target, + "builddir": builddir_name, + "default_configuration": default_configuration, + "flock": flock_command, + "flock_index": 1, + "link_commands": LINK_COMMANDS_LINUX, + "extra_commands": "", + "srcdir": srcdir, + "copy_archive_args": copy_archive_arguments, + "makedep_args": makedep_arguments, + "CC.target": GetEnvironFallback(("CC_target", "CC"), "$(CC)"), + "AR.target": GetEnvironFallback(("AR_target", "AR"), "$(AR)"), + "CXX.target": GetEnvironFallback(("CXX_target", "CXX"), "$(CXX)"), + "LINK.target": GetEnvironFallback(("LINK_target", "LINK"), "$(LINK)"), + "PLI.target": GetEnvironFallback(("PLI_target", "PLI"), "pli"), + "CC.host": GetEnvironFallback(("CC_host", "CC"), "gcc"), + "AR.host": GetEnvironFallback(("AR_host", "AR"), "ar"), + "CXX.host": GetEnvironFallback(("CXX_host", "CXX"), "g++"), + "LINK.host": GetEnvironFallback(("LINK_host", "LINK"), "$(CXX.host)"), + "PLI.host": GetEnvironFallback(("PLI_host", "PLI"), "pli"), + } + if flavor == "mac": + flock_command = "./gyp-mac-tool flock" + header_params.update( + { + "flock": flock_command, + "flock_index": 2, + "link_commands": LINK_COMMANDS_MAC, + "extra_commands": SHARED_HEADER_MAC_COMMANDS, + } + ) + elif flavor == "android": + header_params.update({"link_commands": LINK_COMMANDS_ANDROID}) + elif flavor == "zos": + copy_archive_arguments = "-fPR" + CC_target = GetEnvironFallback(("CC_target", "CC"), "njsc") + makedep_arguments = "-MMD" + if CC_target == "clang": + CC_host = GetEnvironFallback(("CC_host", "CC"), "clang") + CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "clang++") + CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "clang++") + elif CC_target == "ibm-clang64": + CC_host = GetEnvironFallback(("CC_host", "CC"), "ibm-clang64") + CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "ibm-clang++64") + CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "ibm-clang++64") + elif CC_target == "ibm-clang": + CC_host = GetEnvironFallback(("CC_host", "CC"), "ibm-clang") + CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "ibm-clang++") + CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "ibm-clang++") + else: + # Node.js versions prior to v18: + makedep_arguments = "-qmakedep=gcc" + CC_host = GetEnvironFallback(("CC_host", "CC"), "njsc") + CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "njsc++") + CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "njsc++") + header_params.update( + { + "copy_archive_args": copy_archive_arguments, + "makedep_args": makedep_arguments, + "link_commands": LINK_COMMANDS_OS390, + "extra_commands": SHARED_HEADER_OS390_COMMANDS, + "CC.target": CC_target, + "CXX.target": CXX_target, + "CC.host": CC_host, + "CXX.host": CXX_host, + } + ) + elif flavor == "solaris": + copy_archive_arguments = "-pPRf@" + header_params.update( + { + "copy_archive_args": copy_archive_arguments, + "flock": "./gyp-flock-tool flock", + "flock_index": 2, + } + ) + elif flavor == "freebsd": + # Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific. + header_params.update({"flock": "lockf"}) + elif flavor == "openbsd": + copy_archive_arguments = "-pPRf" + header_params.update({"copy_archive_args": copy_archive_arguments}) + elif flavor == "aix": + copy_archive_arguments = "-pPRf" + header_params.update( + { + "copy_archive_args": copy_archive_arguments, + "link_commands": LINK_COMMANDS_AIX, + "flock": "./gyp-flock-tool flock", + "flock_index": 2, + } + ) + elif flavor == "os400": + copy_archive_arguments = "-pPRf" + header_params.update( + { + "copy_archive_args": copy_archive_arguments, + "link_commands": LINK_COMMANDS_OS400, + "flock": "./gyp-flock-tool flock", + "flock_index": 2, + } + ) + + build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) + make_global_settings_array = data[build_file].get("make_global_settings", []) + wrappers = {} + for key, value in make_global_settings_array: + if key.endswith("_wrapper"): + wrappers[key[: -len("_wrapper")]] = "$(abspath %s)" % value + make_global_settings = "" + for key, value in make_global_settings_array: + if re.match(".*_wrapper", key): + continue + if value[0] != "$": + value = "$(abspath %s)" % value + wrapper = wrappers.get(key) + if wrapper: + value = f"{wrapper} {value}" + del wrappers[key] + if key in ("CC", "CC.host", "CXX", "CXX.host"): + make_global_settings += ( + "ifneq (,$(filter $(origin %s), undefined default))\n" % key + ) + # Let gyp-time envvars win over global settings. + env_key = key.replace(".", "_") # CC.host -> CC_host + if env_key in os.environ: + value = os.environ[env_key] + make_global_settings += f" {key} = {value}\n" + make_global_settings += "endif\n" + else: + make_global_settings += f"{key} ?= {value}\n" + # TODO(ukai): define cmd when only wrapper is specified in + # make_global_settings. + + header_params["make_global_settings"] = make_global_settings + + gyp.common.EnsureDirExists(makefile_path) + root_makefile = open(makefile_path, "w") + root_makefile.write(SHARED_HEADER % header_params) + # Currently any versions have the same effect, but in future the behavior + # could be different. + if android_ndk_version: + root_makefile.write( + "# Define LOCAL_PATH for build of Android applications.\n" + "LOCAL_PATH := $(call my-dir)\n" + "\n" + ) + for toolset in toolsets: + root_makefile.write("TOOLSET := %s\n" % toolset) + WriteRootHeaderSuffixRules(root_makefile) + + # Put build-time support tools next to the root Makefile. + dest_path = os.path.dirname(makefile_path) + gyp.common.CopyTool(flavor, dest_path) + + # Find the list of targets that derive from the gyp file(s) being built. + needed_targets = set() + for build_file in params["build_files"]: + for target in gyp.common.AllTargets(target_list, target_dicts, build_file): + needed_targets.add(target) + + build_files = set() + include_list = set() + for qualified_target in target_list: + build_file, target, toolset = gyp.common.ParseQualifiedTarget(qualified_target) + + this_make_global_settings = data[build_file].get("make_global_settings", []) + assert make_global_settings_array == this_make_global_settings, ( + "make_global_settings needs to be the same for all targets " + f"{this_make_global_settings} vs. {make_global_settings}" + ) + + build_files.add(gyp.common.RelativePath(build_file, options.toplevel_dir)) + included_files = data[build_file]["included_files"] + for included_file in included_files: + # The included_files entries are relative to the dir of the build file + # that included them, so we have to undo that and then make them relative + # to the root dir. + relative_include_file = gyp.common.RelativePath( + gyp.common.UnrelativePath(included_file, build_file), + options.toplevel_dir, + ) + abs_include_file = os.path.abspath(relative_include_file) + # If the include file is from the ~/.gyp dir, we should use absolute path + # so that relocating the src dir doesn't break the path. + if params["home_dot_gyp"] and abs_include_file.startswith( + params["home_dot_gyp"] + ): + build_files.add(abs_include_file) + else: + build_files.add(relative_include_file) + + base_path, output_file = CalculateMakefilePath( + build_file, target + "." + toolset + options.suffix + ".mk" + ) + + spec = target_dicts[qualified_target] + configs = spec["configurations"] + + if flavor == "mac": + gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec) + + writer = MakefileWriter(generator_flags, flavor) + writer.Write( + qualified_target, + base_path, + output_file, + spec, + configs, + part_of_all=qualified_target in needed_targets, + ) + + # Our root_makefile lives at the source root. Compute the relative path + # from there to the output_file for including. + mkfile_rel_path = gyp.common.RelativePath( + output_file, os.path.dirname(makefile_path) + ) + include_list.add(mkfile_rel_path) + + # Write out per-gyp (sub-project) Makefiles. + depth_rel_path = gyp.common.RelativePath(options.depth, os.getcwd()) + for build_file in build_files: + # The paths in build_files were relativized above, so undo that before + # testing against the non-relativized items in target_list and before + # calculating the Makefile path. + build_file = os.path.join(depth_rel_path, build_file) + gyp_targets = [ + target_dicts[qualified_target]["target_name"] + for qualified_target in target_list + if qualified_target.startswith(build_file) + and qualified_target in needed_targets + ] + # Only generate Makefiles for gyp files with targets. + if not gyp_targets: + continue + base_path, output_file = CalculateMakefilePath( + build_file, os.path.splitext(os.path.basename(build_file))[0] + ".Makefile" + ) + makefile_rel_path = gyp.common.RelativePath( + os.path.dirname(makefile_path), os.path.dirname(output_file) + ) + writer.WriteSubMake(output_file, makefile_rel_path, gyp_targets, builddir_name) + + # Write out the sorted list of includes. + root_makefile.write("\n") + for include_file in sorted(include_list): + # We wrap each .mk include in an if statement so users can tell make to + # not load a file by setting NO_LOAD. The below make code says, only + # load the .mk file if the .mk filename doesn't start with a token in + # NO_LOAD. + root_makefile.write( + "ifeq ($(strip $(foreach prefix,$(NO_LOAD),\\\n" + " $(findstring $(join ^,$(prefix)),\\\n" + " $(join ^," + include_file + ")))),)\n" + ) + root_makefile.write(" include " + include_file + "\n") + root_makefile.write("endif\n") + root_makefile.write("\n") + + if not generator_flags.get("standalone") and generator_flags.get( + "auto_regeneration", True + ): + WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) + + root_makefile.write(SHARED_FOOTER) + + root_makefile.close() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py new file mode 100644 index 0000000000000..fd95005784798 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py @@ -0,0 +1,3981 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +import ntpath +import os +import posixpath +import re +import subprocess +import sys + +from collections import OrderedDict + +import gyp.common +import gyp.easy_xml as easy_xml +import gyp.generator.ninja as ninja_generator +import gyp.MSVSNew as MSVSNew +import gyp.MSVSProject as MSVSProject +import gyp.MSVSSettings as MSVSSettings +import gyp.MSVSToolFile as MSVSToolFile +import gyp.MSVSUserFile as MSVSUserFile +import gyp.MSVSUtil as MSVSUtil +import gyp.MSVSVersion as MSVSVersion +from gyp.common import GypError +from gyp.common import OrderedSet + + +# Regular expression for validating Visual Studio GUIDs. If the GUID +# contains lowercase hex letters, MSVS will be fine. However, +# IncrediBuild BuildConsole will parse the solution file, but then +# silently skip building the target causing hard to track down errors. +# Note that this only happens with the BuildConsole, and does not occur +# if IncrediBuild is executed from inside Visual Studio. This regex +# validates that the string looks like a GUID with all uppercase hex +# letters. +VALID_MSVS_GUID_CHARS = re.compile(r"^[A-F0-9\-]+$") + +generator_supports_multiple_toolsets = gyp.common.CrossCompileRequested() + +generator_default_variables = { + "DRIVER_PREFIX": "", + "DRIVER_SUFFIX": ".sys", + "EXECUTABLE_PREFIX": "", + "EXECUTABLE_SUFFIX": ".exe", + "STATIC_LIB_PREFIX": "", + "SHARED_LIB_PREFIX": "", + "STATIC_LIB_SUFFIX": ".lib", + "SHARED_LIB_SUFFIX": ".dll", + "INTERMEDIATE_DIR": "$(IntDir)", + "SHARED_INTERMEDIATE_DIR": "$(OutDir)/obj/global_intermediate", + "OS": "win", + "PRODUCT_DIR": "$(OutDir)", + "LIB_DIR": "$(OutDir)lib", + "RULE_INPUT_ROOT": "$(InputName)", + "RULE_INPUT_DIRNAME": "$(InputDir)", + "RULE_INPUT_EXT": "$(InputExt)", + "RULE_INPUT_NAME": "$(InputFileName)", + "RULE_INPUT_PATH": "$(InputPath)", + "CONFIGURATION_NAME": "$(ConfigurationName)", +} + + +# The msvs specific sections that hold paths +generator_additional_path_sections = [ + "msvs_cygwin_dirs", + "msvs_props", +] + + +generator_additional_non_configuration_keys = [ + "msvs_cygwin_dirs", + "msvs_cygwin_shell", + "msvs_large_pdb", + "msvs_shard", + "msvs_external_builder", + "msvs_external_builder_out_dir", + "msvs_external_builder_build_cmd", + "msvs_external_builder_clean_cmd", + "msvs_external_builder_clcompile_cmd", + "msvs_enable_winrt", + "msvs_requires_importlibrary", + "msvs_enable_winphone", + "msvs_application_type_revision", + "msvs_target_platform_version", + "msvs_target_platform_minversion", +] + +generator_filelist_paths = None + +# List of precompiled header related keys. +precomp_keys = [ + "msvs_precompiled_header", + "msvs_precompiled_source", +] + + +cached_username = None + + +cached_domain = None + + +# TODO(gspencer): Switch the os.environ calls to be +# win32api.GetDomainName() and win32api.GetUserName() once the +# python version in depot_tools has been updated to work on Vista +# 64-bit. +def _GetDomainAndUserName(): + if sys.platform not in ("win32", "cygwin"): + return ("DOMAIN", "USERNAME") + global cached_username + global cached_domain + if not cached_domain or not cached_username: + domain = os.environ.get("USERDOMAIN") + username = os.environ.get("USERNAME") + if not domain or not username: + call = subprocess.Popen( + ["net", "config", "Workstation"], stdout=subprocess.PIPE + ) + config = call.communicate()[0].decode("utf-8") + username_re = re.compile(r"^User name\s+(\S+)", re.MULTILINE) + username_match = username_re.search(config) + if username_match: + username = username_match.group(1) + domain_re = re.compile(r"^Logon domain\s+(\S+)", re.MULTILINE) + domain_match = domain_re.search(config) + if domain_match: + domain = domain_match.group(1) + cached_domain = domain + cached_username = username + return (cached_domain, cached_username) + + +fixpath_prefix = None + + +def _NormalizedSource(source): + """Normalize the path. + + But not if that gets rid of a variable, as this may expand to something + larger than one directory. + + Arguments: + source: The path to be normalize.d + + Returns: + The normalized path. + """ + normalized = os.path.normpath(source) + if source.count("$") == normalized.count("$"): + source = normalized + return source + + +def _FixPath(path, separator="\\"): + """Convert paths to a form that will make sense in a vcproj file. + + Arguments: + path: The path to convert, may contain / etc. + Returns: + The path with all slashes made into backslashes. + """ + if ( + fixpath_prefix + and path + and not os.path.isabs(path) + and not path[0] == "$" + and not _IsWindowsAbsPath(path) + ): + path = os.path.join(fixpath_prefix, path) + if separator == "\\": + path = path.replace("/", "\\") + path = _NormalizedSource(path) + if separator == "/": + path = path.replace("\\", "/") + if path and path[-1] == separator: + path = path[:-1] + return path + + +def _IsWindowsAbsPath(path): + """ + On Cygwin systems Python needs a little help determining if a path + is an absolute Windows path or not, so that + it does not treat those as relative, which results in bad paths like: + '..\\C:\\\\some_source_code_file.cc' + """ + return path.startswith("c:") or path.startswith("C:") + + +def _FixPaths(paths, separator="\\"): + """Fix each of the paths of the list.""" + return [_FixPath(i, separator) for i in paths] + + +def _ConvertSourcesToFilterHierarchy( + sources, prefix=None, excluded=None, list_excluded=True, msvs_version=None +): + """Converts a list split source file paths into a vcproj folder hierarchy. + + Arguments: + sources: A list of source file paths split. + prefix: A list of source file path layers meant to apply to each of sources. + excluded: A set of excluded files. + msvs_version: A MSVSVersion object. + + Returns: + A hierarchy of filenames and MSVSProject.Filter objects that matches the + layout of the source tree. + For example: + _ConvertSourcesToFilterHierarchy([['a', 'bob1.c'], ['b', 'bob2.c']], + prefix=['joe']) + --> + [MSVSProject.Filter('a', contents=['joe\\a\\bob1.c']), + MSVSProject.Filter('b', contents=['joe\\b\\bob2.c'])] + """ + if not prefix: + prefix = [] + result = [] + excluded_result = [] + folders = OrderedDict() + # Gather files into the final result, excluded, or folders. + for s in sources: + if len(s) == 1: + filename = _NormalizedSource("\\".join(prefix + s)) + if filename in excluded: + excluded_result.append(filename) + else: + result.append(filename) + elif msvs_version and not msvs_version.UsesVcxproj(): + # For MSVS 2008 and earlier, we need to process all files before walking + # the sub folders. + if not folders.get(s[0]): + folders[s[0]] = [] + folders[s[0]].append(s[1:]) + else: + contents = _ConvertSourcesToFilterHierarchy( + [s[1:]], + prefix + [s[0]], + excluded=excluded, + list_excluded=list_excluded, + msvs_version=msvs_version, + ) + contents = MSVSProject.Filter(s[0], contents=contents) + result.append(contents) + # Add a folder for excluded files. + if excluded_result and list_excluded: + excluded_folder = MSVSProject.Filter( + "_excluded_files", contents=excluded_result + ) + result.append(excluded_folder) + + if msvs_version and msvs_version.UsesVcxproj(): + return result + + # Populate all the folders. + for f in folders: + contents = _ConvertSourcesToFilterHierarchy( + folders[f], + prefix=prefix + [f], + excluded=excluded, + list_excluded=list_excluded, + msvs_version=msvs_version, + ) + contents = MSVSProject.Filter(f, contents=contents) + result.append(contents) + return result + + +def _ToolAppend(tools, tool_name, setting, value, only_if_unset=False): + if not value: + return + _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset) + + +def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False): + # TODO(bradnelson): ugly hack, fix this more generally!!! + if "Directories" in setting or "Dependencies" in setting: + if type(value) == str: + value = value.replace("/", "\\") + else: + value = [i.replace("/", "\\") for i in value] + if not tools.get(tool_name): + tools[tool_name] = dict() + tool = tools[tool_name] + if "CompileAsWinRT" == setting: + return + if tool.get(setting): + if only_if_unset: + return + if type(tool[setting]) == list and type(value) == list: + tool[setting] += value + else: + raise TypeError( + 'Appending "%s" to a non-list setting "%s" for tool "%s" is ' + "not allowed, previous value: %s" + % (value, setting, tool_name, str(tool[setting])) + ) + else: + tool[setting] = value + + +def _ConfigTargetVersion(config_data): + return config_data.get("msvs_target_version", "Windows7") + + +def _ConfigPlatform(config_data): + return config_data.get("msvs_configuration_platform", "Win32") + + +def _ConfigBaseName(config_name, platform_name): + if config_name.endswith("_" + platform_name): + return config_name[0 : -len(platform_name) - 1] + else: + return config_name + + +def _ConfigFullName(config_name, config_data): + platform_name = _ConfigPlatform(config_data) + return f"{_ConfigBaseName(config_name, platform_name)}|{platform_name}" + + +def _ConfigWindowsTargetPlatformVersion(config_data, version): + target_ver = config_data.get("msvs_windows_target_platform_version") + if target_ver and re.match(r"^\d+", target_ver): + return target_ver + config_ver = config_data.get("msvs_windows_sdk_version") + vers = [config_ver] if config_ver else version.compatible_sdks + for ver in vers: + for key in [ + r"HKLM\Software\Microsoft\Microsoft SDKs\Windows\%s", + r"HKLM\Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows\%s", + ]: + sdk_dir = MSVSVersion._RegistryGetValue(key % ver, "InstallationFolder") + if not sdk_dir: + continue + version = MSVSVersion._RegistryGetValue(key % ver, "ProductVersion") or "" + # Find a matching entry in sdk_dir\include. + expected_sdk_dir = r"%s\include" % sdk_dir + names = sorted( + ( + x + for x in ( + os.listdir(expected_sdk_dir) + if os.path.isdir(expected_sdk_dir) + else [] + ) + if x.startswith(version) + ), + reverse=True, + ) + if names: + return names[0] + else: + print( + "Warning: No include files found for detected " + "Windows SDK version %s" % (version), + file=sys.stdout, + ) + + +def _BuildCommandLineForRuleRaw( + spec, cmd, cygwin_shell, has_input_path, quote_cmd, do_setup_env +): + + if [x for x in cmd if "$(InputDir)" in x]: + input_dir_preamble = ( + "set INPUTDIR=$(InputDir)\n" + "if NOT DEFINED INPUTDIR set INPUTDIR=.\\\n" + "set INPUTDIR=%INPUTDIR:~0,-1%\n" + ) + else: + input_dir_preamble = "" + + if cygwin_shell: + # Find path to cygwin. + cygwin_dir = _FixPath(spec.get("msvs_cygwin_dirs", ["."])[0]) + # Prepare command. + direct_cmd = cmd + direct_cmd = [ + i.replace("$(IntDir)", '`cygpath -m "${INTDIR}"`') for i in direct_cmd + ] + direct_cmd = [ + i.replace("$(OutDir)", '`cygpath -m "${OUTDIR}"`') for i in direct_cmd + ] + direct_cmd = [ + i.replace("$(InputDir)", '`cygpath -m "${INPUTDIR}"`') for i in direct_cmd + ] + if has_input_path: + direct_cmd = [ + i.replace("$(InputPath)", '`cygpath -m "${INPUTPATH}"`') + for i in direct_cmd + ] + direct_cmd = ['\\"%s\\"' % i.replace('"', '\\\\\\"') for i in direct_cmd] + # direct_cmd = gyp.common.EncodePOSIXShellList(direct_cmd) + direct_cmd = " ".join(direct_cmd) + # TODO(quote): regularize quoting path names throughout the module + cmd = "" + if do_setup_env: + cmd += 'call "$(ProjectDir)%(cygwin_dir)s\\setup_env.bat" && ' + cmd += "set CYGWIN=nontsec&& " + if direct_cmd.find("NUMBER_OF_PROCESSORS") >= 0: + cmd += "set /a NUMBER_OF_PROCESSORS_PLUS_1=%%NUMBER_OF_PROCESSORS%%+1&& " + if direct_cmd.find("INTDIR") >= 0: + cmd += "set INTDIR=$(IntDir)&& " + if direct_cmd.find("OUTDIR") >= 0: + cmd += "set OUTDIR=$(OutDir)&& " + if has_input_path and direct_cmd.find("INPUTPATH") >= 0: + cmd += "set INPUTPATH=$(InputPath) && " + cmd += 'bash -c "%(cmd)s"' + cmd = cmd % {"cygwin_dir": cygwin_dir, "cmd": direct_cmd} + return input_dir_preamble + cmd + else: + # Convert cat --> type to mimic unix. + if cmd[0] == "cat": + command = ["type"] + else: + command = [cmd[0].replace("/", "\\")] + # Add call before command to ensure that commands can be tied together one + # after the other without aborting in Incredibuild, since IB makes a bat + # file out of the raw command string, and some commands (like python) are + # actually batch files themselves. + command.insert(0, "call") + # Fix the paths + # TODO(quote): This is a really ugly heuristic, and will miss path fixing + # for arguments like "--arg=path", arg=path, or "/opt:path". + # If the argument starts with a slash or dash, or contains an equal sign, + # it's probably a command line switch. + # Return the path with forward slashes because the command using it might + # not support backslashes. + arguments = [ + i if (i[:1] in "/-" or "=" in i) else _FixPath(i, "/") + for i in cmd[1:] + ] + arguments = [i.replace("$(InputDir)", "%INPUTDIR%") for i in arguments] + arguments = [MSVSSettings.FixVCMacroSlashes(i) for i in arguments] + if quote_cmd: + # Support a mode for using cmd directly. + # Convert any paths to native form (first element is used directly). + # TODO(quote): regularize quoting path names throughout the module + arguments = ['"%s"' % i for i in arguments] + # Collapse into a single command. + return input_dir_preamble + " ".join(command + arguments) + + +def _BuildCommandLineForRule(spec, rule, has_input_path, do_setup_env): + # Currently this weird argument munging is used to duplicate the way a + # python script would need to be run as part of the chrome tree. + # Eventually we should add some sort of rule_default option to set this + # per project. For now the behavior chrome needs is the default. + mcs = rule.get("msvs_cygwin_shell") + if mcs is None: + mcs = int(spec.get("msvs_cygwin_shell", 1)) + elif isinstance(mcs, str): + mcs = int(mcs) + quote_cmd = int(rule.get("msvs_quote_cmd", 1)) + return _BuildCommandLineForRuleRaw( + spec, rule["action"], mcs, has_input_path, quote_cmd, do_setup_env=do_setup_env + ) + + +def _AddActionStep(actions_dict, inputs, outputs, description, command): + """Merge action into an existing list of actions. + + Care must be taken so that actions which have overlapping inputs either don't + get assigned to the same input, or get collapsed into one. + + Arguments: + actions_dict: dictionary keyed on input name, which maps to a list of + dicts describing the actions attached to that input file. + inputs: list of inputs + outputs: list of outputs + description: description of the action + command: command line to execute + """ + # Require there to be at least one input (call sites will ensure this). + assert inputs + + action = { + "inputs": inputs, + "outputs": outputs, + "description": description, + "command": command, + } + + # Pick where to stick this action. + # While less than optimal in terms of build time, attach them to the first + # input for now. + chosen_input = inputs[0] + + # Add it there. + if chosen_input not in actions_dict: + actions_dict[chosen_input] = [] + actions_dict[chosen_input].append(action) + + +def _AddCustomBuildToolForMSVS( + p, spec, primary_input, inputs, outputs, description, cmd +): + """Add a custom build tool to execute something. + + Arguments: + p: the target project + spec: the target project dict + primary_input: input file to attach the build tool to + inputs: list of inputs + outputs: list of outputs + description: description of the action + cmd: command line to execute + """ + inputs = _FixPaths(inputs) + outputs = _FixPaths(outputs) + tool = MSVSProject.Tool( + "VCCustomBuildTool", + { + "Description": description, + "AdditionalDependencies": ";".join(inputs), + "Outputs": ";".join(outputs), + "CommandLine": cmd, + }, + ) + # Add to the properties of primary input for each config. + for config_name, c_data in spec["configurations"].items(): + p.AddFileConfig( + _FixPath(primary_input), _ConfigFullName(config_name, c_data), tools=[tool] + ) + + +def _AddAccumulatedActionsToMSVS(p, spec, actions_dict): + """Add actions accumulated into an actions_dict, merging as needed. + + Arguments: + p: the target project + spec: the target project dict + actions_dict: dictionary keyed on input name, which maps to a list of + dicts describing the actions attached to that input file. + """ + for primary_input in actions_dict: + inputs = OrderedSet() + outputs = OrderedSet() + descriptions = [] + commands = [] + for action in actions_dict[primary_input]: + inputs.update(OrderedSet(action["inputs"])) + outputs.update(OrderedSet(action["outputs"])) + descriptions.append(action["description"]) + commands.append(action["command"]) + # Add the custom build step for one input file. + description = ", and also ".join(descriptions) + command = "\r\n".join(commands) + _AddCustomBuildToolForMSVS( + p, + spec, + primary_input=primary_input, + inputs=inputs, + outputs=outputs, + description=description, + cmd=command, + ) + + +def _RuleExpandPath(path, input_file): + """Given the input file to which a rule applied, string substitute a path. + + Arguments: + path: a path to string expand + input_file: the file to which the rule applied. + Returns: + The string substituted path. + """ + path = path.replace( + "$(InputName)", os.path.splitext(os.path.split(input_file)[1])[0] + ) + path = path.replace("$(InputDir)", os.path.dirname(input_file)) + path = path.replace( + "$(InputExt)", os.path.splitext(os.path.split(input_file)[1])[1] + ) + path = path.replace("$(InputFileName)", os.path.split(input_file)[1]) + path = path.replace("$(InputPath)", input_file) + return path + + +def _FindRuleTriggerFiles(rule, sources): + """Find the list of files which a particular rule applies to. + + Arguments: + rule: the rule in question + sources: the set of all known source files for this project + Returns: + The list of sources that trigger a particular rule. + """ + return rule.get("rule_sources", []) + + +def _RuleInputsAndOutputs(rule, trigger_file): + """Find the inputs and outputs generated by a rule. + + Arguments: + rule: the rule in question. + trigger_file: the main trigger for this rule. + Returns: + The pair of (inputs, outputs) involved in this rule. + """ + raw_inputs = _FixPaths(rule.get("inputs", [])) + raw_outputs = _FixPaths(rule.get("outputs", [])) + inputs = OrderedSet() + outputs = OrderedSet() + inputs.add(trigger_file) + for i in raw_inputs: + inputs.add(_RuleExpandPath(i, trigger_file)) + for o in raw_outputs: + outputs.add(_RuleExpandPath(o, trigger_file)) + return (inputs, outputs) + + +def _GenerateNativeRulesForMSVS(p, rules, output_dir, spec, options): + """Generate a native rules file. + + Arguments: + p: the target project + rules: the set of rules to include + output_dir: the directory in which the project/gyp resides + spec: the project dict + options: global generator options + """ + rules_filename = "{}{}.rules".format(spec["target_name"], options.suffix) + rules_file = MSVSToolFile.Writer( + os.path.join(output_dir, rules_filename), spec["target_name"] + ) + # Add each rule. + for r in rules: + rule_name = r["rule_name"] + rule_ext = r["extension"] + inputs = _FixPaths(r.get("inputs", [])) + outputs = _FixPaths(r.get("outputs", [])) + # Skip a rule with no action and no inputs. + if "action" not in r and not r.get("rule_sources", []): + continue + cmd = _BuildCommandLineForRule(spec, r, has_input_path=True, do_setup_env=True) + rules_file.AddCustomBuildRule( + name=rule_name, + description=r.get("message", rule_name), + extensions=[rule_ext], + additional_dependencies=inputs, + outputs=outputs, + cmd=cmd, + ) + # Write out rules file. + rules_file.WriteIfChanged() + + # Add rules file to project. + p.AddToolFile(rules_filename) + + +def _Cygwinify(path): + path = path.replace("$(OutDir)", "$(OutDirCygwin)") + path = path.replace("$(IntDir)", "$(IntDirCygwin)") + return path + + +def _GenerateExternalRules(rules, output_dir, spec, sources, options, actions_to_add): + """Generate an external makefile to do a set of rules. + + Arguments: + rules: the list of rules to include + output_dir: path containing project and gyp files + spec: project specification data + sources: set of sources known + options: global generator options + actions_to_add: The list of actions we will add to. + """ + filename = "{}_rules{}.mk".format(spec["target_name"], options.suffix) + mk_file = gyp.common.WriteOnDiff(os.path.join(output_dir, filename)) + # Find cygwin style versions of some paths. + mk_file.write('OutDirCygwin:=$(shell cygpath -u "$(OutDir)")\n') + mk_file.write('IntDirCygwin:=$(shell cygpath -u "$(IntDir)")\n') + # Gather stuff needed to emit all: target. + all_inputs = OrderedSet() + all_outputs = OrderedSet() + all_output_dirs = OrderedSet() + first_outputs = [] + for rule in rules: + trigger_files = _FindRuleTriggerFiles(rule, sources) + for tf in trigger_files: + inputs, outputs = _RuleInputsAndOutputs(rule, tf) + all_inputs.update(OrderedSet(inputs)) + all_outputs.update(OrderedSet(outputs)) + # Only use one target from each rule as the dependency for + # 'all' so we don't try to build each rule multiple times. + first_outputs.append(list(outputs)[0]) + # Get the unique output directories for this rule. + output_dirs = [os.path.split(i)[0] for i in outputs] + for od in output_dirs: + all_output_dirs.add(od) + first_outputs_cyg = [_Cygwinify(i) for i in first_outputs] + # Write out all: target, including mkdir for each output directory. + mk_file.write("all: %s\n" % " ".join(first_outputs_cyg)) + for od in all_output_dirs: + if od: + mk_file.write('\tmkdir -p `cygpath -u "%s"`\n' % od) + mk_file.write("\n") + # Define how each output is generated. + for rule in rules: + trigger_files = _FindRuleTriggerFiles(rule, sources) + for tf in trigger_files: + # Get all the inputs and outputs for this rule for this trigger file. + inputs, outputs = _RuleInputsAndOutputs(rule, tf) + inputs = [_Cygwinify(i) for i in inputs] + outputs = [_Cygwinify(i) for i in outputs] + # Prepare the command line for this rule. + cmd = [_RuleExpandPath(c, tf) for c in rule["action"]] + cmd = ['"%s"' % i for i in cmd] + cmd = " ".join(cmd) + # Add it to the makefile. + mk_file.write("{}: {}\n".format(" ".join(outputs), " ".join(inputs))) + mk_file.write("\t%s\n\n" % cmd) + # Close up the file. + mk_file.close() + + # Add makefile to list of sources. + sources.add(filename) + # Add a build action to call makefile. + cmd = [ + "make", + "OutDir=$(OutDir)", + "IntDir=$(IntDir)", + "-j", + "${NUMBER_OF_PROCESSORS_PLUS_1}", + "-f", + filename, + ] + cmd = _BuildCommandLineForRuleRaw(spec, cmd, True, False, True, True) + # Insert makefile as 0'th input, so it gets the action attached there, + # as this is easier to understand from in the IDE. + all_inputs = list(all_inputs) + all_inputs.insert(0, filename) + _AddActionStep( + actions_to_add, + inputs=_FixPaths(all_inputs), + outputs=_FixPaths(all_outputs), + description="Running external rules for %s" % spec["target_name"], + command=cmd, + ) + + +def _EscapeEnvironmentVariableExpansion(s): + """Escapes % characters. + + Escapes any % characters so that Windows-style environment variable + expansions will leave them alone. + See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile + to understand why we have to do this. + + Args: + s: The string to be escaped. + + Returns: + The escaped string. + """ # noqa: E731,E123,E501 + s = s.replace("%", "%%") + return s + + +quote_replacer_regex = re.compile(r'(\\*)"') + + +def _EscapeCommandLineArgumentForMSVS(s): + """Escapes a Windows command-line argument. + + So that the Win32 CommandLineToArgv function will turn the escaped result back + into the original string. + See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx + ("Parsing C++ Command-Line Arguments") to understand why we have to do + this. + + Args: + s: the string to be escaped. + Returns: + the escaped string. + """ + + def _Replace(match): + # For a literal quote, CommandLineToArgv requires an odd number of + # backslashes preceding it, and it produces half as many literal backslashes + # (rounded down). So we need to produce 2n+1 backslashes. + return 2 * match.group(1) + '\\"' + + # Escape all quotes so that they are interpreted literally. + s = quote_replacer_regex.sub(_Replace, s) + # Now add unescaped quotes so that any whitespace is interpreted literally. + s = '"' + s + '"' + return s + + +delimiters_replacer_regex = re.compile(r"(\\*)([,;]+)") + + +def _EscapeVCProjCommandLineArgListItem(s): + """Escapes command line arguments for MSVS. + + The VCProj format stores string lists in a single string using commas and + semi-colons as separators, which must be quoted if they are to be + interpreted literally. However, command-line arguments may already have + quotes, and the VCProj parser is ignorant of the backslash escaping + convention used by CommandLineToArgv, so the command-line quotes and the + VCProj quotes may not be the same quotes. So to store a general + command-line argument in a VCProj list, we need to parse the existing + quoting according to VCProj's convention and quote any delimiters that are + not already quoted by that convention. The quotes that we add will also be + seen by CommandLineToArgv, so if backslashes precede them then we also have + to escape those backslashes according to the CommandLineToArgv + convention. + + Args: + s: the string to be escaped. + Returns: + the escaped string. + """ + + def _Replace(match): + # For a non-literal quote, CommandLineToArgv requires an even number of + # backslashes preceding it, and it produces half as many literal + # backslashes. So we need to produce 2n backslashes. + return 2 * match.group(1) + '"' + match.group(2) + '"' + + segments = s.split('"') + # The unquoted segments are at the even-numbered indices. + for i in range(0, len(segments), 2): + segments[i] = delimiters_replacer_regex.sub(_Replace, segments[i]) + # Concatenate back into a single string + s = '"'.join(segments) + if len(segments) % 2 == 0: + # String ends while still quoted according to VCProj's convention. This + # means the delimiter and the next list item that follow this one in the + # .vcproj file will be misinterpreted as part of this item. There is nothing + # we can do about this. Adding an extra quote would correct the problem in + # the VCProj but cause the same problem on the final command-line. Moving + # the item to the end of the list does works, but that's only possible if + # there's only one such item. Let's just warn the user. + print( + "Warning: MSVS may misinterpret the odd number of " + "quotes in " + s, + file=sys.stderr, + ) + return s + + +def _EscapeCppDefineForMSVS(s): + """Escapes a CPP define so that it will reach the compiler unaltered.""" + s = _EscapeEnvironmentVariableExpansion(s) + s = _EscapeCommandLineArgumentForMSVS(s) + s = _EscapeVCProjCommandLineArgListItem(s) + # cl.exe replaces literal # characters with = in preprocessor definitions for + # some reason. Octal-encode to work around that. + s = s.replace("#", "\\%03o" % ord("#")) + return s + + +quote_replacer_regex2 = re.compile(r'(\\+)"') + + +def _EscapeCommandLineArgumentForMSBuild(s): + """Escapes a Windows command-line argument for use by MSBuild.""" + + def _Replace(match): + return (len(match.group(1)) / 2 * 4) * "\\" + '\\"' + + # Escape all quotes so that they are interpreted literally. + s = quote_replacer_regex2.sub(_Replace, s) + return s + + +def _EscapeMSBuildSpecialCharacters(s): + escape_dictionary = { + "%": "%25", + "$": "%24", + "@": "%40", + "'": "%27", + ";": "%3B", + "?": "%3F", + "*": "%2A", + } + result = "".join([escape_dictionary.get(c, c) for c in s]) + return result + + +def _EscapeCppDefineForMSBuild(s): + """Escapes a CPP define so that it will reach the compiler unaltered.""" + s = _EscapeEnvironmentVariableExpansion(s) + s = _EscapeCommandLineArgumentForMSBuild(s) + s = _EscapeMSBuildSpecialCharacters(s) + # cl.exe replaces literal # characters with = in preprocessor definitions for + # some reason. Octal-encode to work around that. + s = s.replace("#", "\\%03o" % ord("#")) + return s + + +def _GenerateRulesForMSVS( + p, output_dir, options, spec, sources, excluded_sources, actions_to_add +): + """Generate all the rules for a particular project. + + Arguments: + p: the project + output_dir: directory to emit rules to + options: global options passed to the generator + spec: the specification for this project + sources: the set of all known source files in this project + excluded_sources: the set of sources excluded from normal processing + actions_to_add: deferred list of actions to add in + """ + rules = spec.get("rules", []) + rules_native = [r for r in rules if not int(r.get("msvs_external_rule", 0))] + rules_external = [r for r in rules if int(r.get("msvs_external_rule", 0))] + + # Handle rules that use a native rules file. + if rules_native: + _GenerateNativeRulesForMSVS(p, rules_native, output_dir, spec, options) + + # Handle external rules (non-native rules). + if rules_external: + _GenerateExternalRules( + rules_external, output_dir, spec, sources, options, actions_to_add + ) + _AdjustSourcesForRules(rules, sources, excluded_sources, False) + + +def _AdjustSourcesForRules(rules, sources, excluded_sources, is_msbuild): + # Add outputs generated by each rule (if applicable). + for rule in rules: + # Add in the outputs from this rule. + trigger_files = _FindRuleTriggerFiles(rule, sources) + for trigger_file in trigger_files: + # Remove trigger_file from excluded_sources to let the rule be triggered + # (e.g. rule trigger ax_enums.idl is added to excluded_sources + # because it's also in an action's inputs in the same project) + excluded_sources.discard(_FixPath(trigger_file)) + # Done if not processing outputs as sources. + if int(rule.get("process_outputs_as_sources", False)): + inputs, outputs = _RuleInputsAndOutputs(rule, trigger_file) + inputs = OrderedSet(_FixPaths(inputs)) + outputs = OrderedSet(_FixPaths(outputs)) + inputs.remove(_FixPath(trigger_file)) + sources.update(inputs) + if not is_msbuild: + excluded_sources.update(inputs) + sources.update(outputs) + + +def _FilterActionsFromExcluded(excluded_sources, actions_to_add): + """Take inputs with actions attached out of the list of exclusions. + + Arguments: + excluded_sources: list of source files not to be built. + actions_to_add: dict of actions keyed on source file they're attached to. + Returns: + excluded_sources with files that have actions attached removed. + """ + must_keep = OrderedSet(_FixPaths(actions_to_add.keys())) + return [s for s in excluded_sources if s not in must_keep] + + +def _GetDefaultConfiguration(spec): + return spec["configurations"][spec["default_configuration"]] + + +def _GetGuidOfProject(proj_path, spec): + """Get the guid for the project. + + Arguments: + proj_path: Path of the vcproj or vcxproj file to generate. + spec: The target dictionary containing the properties of the target. + Returns: + the guid. + Raises: + ValueError: if the specified GUID is invalid. + """ + # Pluck out the default configuration. + default_config = _GetDefaultConfiguration(spec) + # Decide the guid of the project. + guid = default_config.get("msvs_guid") + if guid: + if VALID_MSVS_GUID_CHARS.match(guid) is None: + raise ValueError( + 'Invalid MSVS guid: "%s". Must match regex: "%s".' + % (guid, VALID_MSVS_GUID_CHARS.pattern) + ) + guid = "{%s}" % guid + guid = guid or MSVSNew.MakeGuid(proj_path) + return guid + + +def _GetMsbuildToolsetOfProject(proj_path, spec, version): + """Get the platform toolset for the project. + + Arguments: + proj_path: Path of the vcproj or vcxproj file to generate. + spec: The target dictionary containing the properties of the target. + version: The MSVSVersion object. + Returns: + the platform toolset string or None. + """ + # Pluck out the default configuration. + default_config = _GetDefaultConfiguration(spec) + toolset = default_config.get("msbuild_toolset") + if not toolset and version.DefaultToolset(): + toolset = version.DefaultToolset() + if spec["type"] == "windows_driver": + toolset = "WindowsKernelModeDriver10.0" + return toolset + + +def _GenerateProject(project, options, version, generator_flags, spec): + """Generates a vcproj file. + + Arguments: + project: the MSVSProject object. + options: global generator options. + version: the MSVSVersion object. + generator_flags: dict of generator-specific flags. + Returns: + A list of source files that cannot be found on disk. + """ + default_config = _GetDefaultConfiguration(project.spec) + + # Skip emitting anything if told to with msvs_existing_vcproj option. + if default_config.get("msvs_existing_vcproj"): + return [] + + if version.UsesVcxproj(): + return _GenerateMSBuildProject(project, options, version, generator_flags, spec) + else: + return _GenerateMSVSProject(project, options, version, generator_flags) + + +def _GenerateMSVSProject(project, options, version, generator_flags): + """Generates a .vcproj file. It may create .rules and .user files too. + + Arguments: + project: The project object we will generate the file for. + options: Global options passed to the generator. + version: The VisualStudioVersion object. + generator_flags: dict of generator-specific flags. + """ + spec = project.spec + gyp.common.EnsureDirExists(project.path) + + platforms = _GetUniquePlatforms(spec) + p = MSVSProject.Writer( + project.path, version, spec["target_name"], project.guid, platforms + ) + + # Get directory project file is in. + project_dir = os.path.split(project.path)[0] + gyp_path = _NormalizedSource(project.build_file) + relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir) + + config_type = _GetMSVSConfigurationType(spec, project.build_file) + for config_name, config in spec["configurations"].items(): + _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config) + + # Prepare list of sources and excluded sources. + gyp_file = os.path.split(project.build_file)[1] + sources, excluded_sources = _PrepareListOfSources(spec, generator_flags, gyp_file) + + # Add rules. + actions_to_add = {} + _GenerateRulesForMSVS( + p, project_dir, options, spec, sources, excluded_sources, actions_to_add + ) + list_excluded = generator_flags.get("msvs_list_excluded_files", True) + sources, excluded_sources, excluded_idl = _AdjustSourcesAndConvertToFilterHierarchy( + spec, options, project_dir, sources, excluded_sources, list_excluded, version + ) + + # Add in files. + missing_sources = _VerifySourcesExist(sources, project_dir) + p.AddFiles(sources) + + _AddToolFilesToMSVS(p, spec) + _HandlePreCompiledHeaders(p, sources, spec) + _AddActions(actions_to_add, spec, relative_path_of_gyp_file) + _AddCopies(actions_to_add, spec) + _WriteMSVSUserFile(project.path, version, spec) + + # NOTE: this stanza must appear after all actions have been decided. + # Don't excluded sources with actions attached, or they won't run. + excluded_sources = _FilterActionsFromExcluded(excluded_sources, actions_to_add) + _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl, list_excluded) + _AddAccumulatedActionsToMSVS(p, spec, actions_to_add) + + # Write it out. + p.WriteIfChanged() + + return missing_sources + + +def _GetUniquePlatforms(spec): + """Returns the list of unique platforms for this spec, e.g ['win32', ...]. + + Arguments: + spec: The target dictionary containing the properties of the target. + Returns: + The MSVSUserFile object created. + """ + # Gather list of unique platforms. + platforms = OrderedSet() + for configuration in spec["configurations"]: + platforms.add(_ConfigPlatform(spec["configurations"][configuration])) + platforms = list(platforms) + return platforms + + +def _CreateMSVSUserFile(proj_path, version, spec): + """Generates a .user file for the user running this Gyp program. + + Arguments: + proj_path: The path of the project file being created. The .user file + shares the same path (with an appropriate suffix). + version: The VisualStudioVersion object. + spec: The target dictionary containing the properties of the target. + Returns: + The MSVSUserFile object created. + """ + (domain, username) = _GetDomainAndUserName() + vcuser_filename = ".".join([proj_path, domain, username, "user"]) + user_file = MSVSUserFile.Writer(vcuser_filename, version, spec["target_name"]) + return user_file + + +def _GetMSVSConfigurationType(spec, build_file): + """Returns the configuration type for this project. + + It's a number defined by Microsoft. May raise an exception. + + Args: + spec: The target dictionary containing the properties of the target. + build_file: The path of the gyp file. + Returns: + An integer, the configuration type. + """ + try: + config_type = { + "executable": "1", # .exe + "shared_library": "2", # .dll + "loadable_module": "2", # .dll + "static_library": "4", # .lib + "windows_driver": "5", # .sys + "none": "10", # Utility type + }[spec["type"]] + except KeyError: + if spec.get("type"): + raise GypError( + "Target type %s is not a valid target type for " + "target %s in %s." % (spec["type"], spec["target_name"], build_file) + ) + else: + raise GypError( + "Missing type field for target %s in %s." + % (spec["target_name"], build_file) + ) + return config_type + + +def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config): + """Adds a configuration to the MSVS project. + + Many settings in a vcproj file are specific to a configuration. This + function the main part of the vcproj file that's configuration specific. + + Arguments: + p: The target project being generated. + spec: The target dictionary containing the properties of the target. + config_type: The configuration type, a number as defined by Microsoft. + config_name: The name of the configuration. + config: The dictionary that defines the special processing to be done + for this configuration. + """ + # Get the information for this configuration + include_dirs, midl_include_dirs, resource_include_dirs = _GetIncludeDirs(config) + libraries = _GetLibraries(spec) + library_dirs = _GetLibraryDirs(config) + out_file, vc_tool, _ = _GetOutputFilePathAndTool(spec, msbuild=False) + defines = _GetDefines(config) + defines = [_EscapeCppDefineForMSVS(d) for d in defines] + disabled_warnings = _GetDisabledWarnings(config) + prebuild = config.get("msvs_prebuild") + postbuild = config.get("msvs_postbuild") + def_file = _GetModuleDefinition(spec) + precompiled_header = config.get("msvs_precompiled_header") + + # Prepare the list of tools as a dictionary. + tools = dict() + # Add in user specified msvs_settings. + msvs_settings = config.get("msvs_settings", {}) + MSVSSettings.ValidateMSVSSettings(msvs_settings) + + # Prevent default library inheritance from the environment. + _ToolAppend(tools, "VCLinkerTool", "AdditionalDependencies", ["$(NOINHERIT)"]) + + for tool in msvs_settings: + settings = config["msvs_settings"][tool] + for setting in settings: + _ToolAppend(tools, tool, setting, settings[setting]) + # Add the information to the appropriate tool + _ToolAppend(tools, "VCCLCompilerTool", "AdditionalIncludeDirectories", include_dirs) + _ToolAppend(tools, "VCMIDLTool", "AdditionalIncludeDirectories", midl_include_dirs) + _ToolAppend( + tools, + "VCResourceCompilerTool", + "AdditionalIncludeDirectories", + resource_include_dirs, + ) + # Add in libraries. + _ToolAppend(tools, "VCLinkerTool", "AdditionalDependencies", libraries) + _ToolAppend(tools, "VCLinkerTool", "AdditionalLibraryDirectories", library_dirs) + if out_file: + _ToolAppend(tools, vc_tool, "OutputFile", out_file, only_if_unset=True) + # Add defines. + _ToolAppend(tools, "VCCLCompilerTool", "PreprocessorDefinitions", defines) + _ToolAppend(tools, "VCResourceCompilerTool", "PreprocessorDefinitions", defines) + # Change program database directory to prevent collisions. + _ToolAppend( + tools, + "VCCLCompilerTool", + "ProgramDataBaseFileName", + "$(IntDir)$(ProjectName)\\vc80.pdb", + only_if_unset=True, + ) + # Add disabled warnings. + _ToolAppend(tools, "VCCLCompilerTool", "DisableSpecificWarnings", disabled_warnings) + # Add Pre-build. + _ToolAppend(tools, "VCPreBuildEventTool", "CommandLine", prebuild) + # Add Post-build. + _ToolAppend(tools, "VCPostBuildEventTool", "CommandLine", postbuild) + # Turn on precompiled headers if appropriate. + if precompiled_header: + precompiled_header = os.path.split(precompiled_header)[1] + _ToolAppend(tools, "VCCLCompilerTool", "UsePrecompiledHeader", "2") + _ToolAppend( + tools, "VCCLCompilerTool", "PrecompiledHeaderThrough", precompiled_header + ) + _ToolAppend(tools, "VCCLCompilerTool", "ForcedIncludeFiles", precompiled_header) + # Loadable modules don't generate import libraries; + # tell dependent projects to not expect one. + if spec["type"] == "loadable_module": + _ToolAppend(tools, "VCLinkerTool", "IgnoreImportLibrary", "true") + # Set the module definition file if any. + if def_file: + _ToolAppend(tools, "VCLinkerTool", "ModuleDefinitionFile", def_file) + + _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name) + + +def _GetIncludeDirs(config): + """Returns the list of directories to be used for #include directives. + + Arguments: + config: The dictionary that defines the special processing to be done + for this configuration. + Returns: + The list of directory paths. + """ + # TODO(bradnelson): include_dirs should really be flexible enough not to + # require this sort of thing. + include_dirs = config.get("include_dirs", []) + config.get( + "msvs_system_include_dirs", [] + ) + midl_include_dirs = config.get("midl_include_dirs", []) + config.get( + "msvs_system_include_dirs", [] + ) + resource_include_dirs = config.get("resource_include_dirs", include_dirs) + include_dirs = _FixPaths(include_dirs) + midl_include_dirs = _FixPaths(midl_include_dirs) + resource_include_dirs = _FixPaths(resource_include_dirs) + return include_dirs, midl_include_dirs, resource_include_dirs + + +def _GetLibraryDirs(config): + """Returns the list of directories to be used for library search paths. + + Arguments: + config: The dictionary that defines the special processing to be done + for this configuration. + Returns: + The list of directory paths. + """ + + library_dirs = config.get("library_dirs", []) + library_dirs = _FixPaths(library_dirs) + return library_dirs + + +def _GetLibraries(spec): + """Returns the list of libraries for this configuration. + + Arguments: + spec: The target dictionary containing the properties of the target. + Returns: + The list of directory paths. + """ + libraries = spec.get("libraries", []) + # Strip out -l, as it is not used on windows (but is needed so we can pass + # in libraries that are assumed to be in the default library path). + # Also remove duplicate entries, leaving only the last duplicate, while + # preserving order. + found = OrderedSet() + unique_libraries_list = [] + for entry in reversed(libraries): + library = re.sub(r"^\-l", "", entry) + if not os.path.splitext(library)[1]: + library += ".lib" + if library not in found: + found.add(library) + unique_libraries_list.append(library) + unique_libraries_list.reverse() + return unique_libraries_list + + +def _GetOutputFilePathAndTool(spec, msbuild): + """Returns the path and tool to use for this target. + + Figures out the path of the file this spec will create and the name of + the VC tool that will create it. + + Arguments: + spec: The target dictionary containing the properties of the target. + Returns: + A triple of (file path, name of the vc tool, name of the msbuild tool) + """ + # Select a name for the output file. + out_file = "" + vc_tool = "" + msbuild_tool = "" + output_file_map = { + "executable": ("VCLinkerTool", "Link", "$(OutDir)", ".exe"), + "shared_library": ("VCLinkerTool", "Link", "$(OutDir)", ".dll"), + "loadable_module": ("VCLinkerTool", "Link", "$(OutDir)", ".dll"), + "windows_driver": ("VCLinkerTool", "Link", "$(OutDir)", ".sys"), + "static_library": ("VCLibrarianTool", "Lib", "$(OutDir)lib\\", ".lib"), + } + output_file_props = output_file_map.get(spec["type"]) + if output_file_props and int(spec.get("msvs_auto_output_file", 1)): + vc_tool, msbuild_tool, out_dir, suffix = output_file_props + if spec.get("standalone_static_library", 0): + out_dir = "$(OutDir)" + out_dir = spec.get("product_dir", out_dir) + product_extension = spec.get("product_extension") + if product_extension: + suffix = "." + product_extension + elif msbuild: + suffix = "$(TargetExt)" + prefix = spec.get("product_prefix", "") + product_name = spec.get("product_name", "$(ProjectName)") + out_file = ntpath.join(out_dir, prefix + product_name + suffix) + return out_file, vc_tool, msbuild_tool + + +def _GetOutputTargetExt(spec): + """Returns the extension for this target, including the dot + + If product_extension is specified, set target_extension to this to avoid + MSB8012, returns None otherwise. Ignores any target_extension settings in + the input files. + + Arguments: + spec: The target dictionary containing the properties of the target. + Returns: + A string with the extension, or None + """ + target_extension = spec.get("product_extension") + if target_extension: + return "." + target_extension + return None + + +def _GetDefines(config): + """Returns the list of preprocessor definitions for this configuration. + + Arguments: + config: The dictionary that defines the special processing to be done + for this configuration. + Returns: + The list of preprocessor definitions. + """ + defines = [] + for d in config.get("defines", []): + if type(d) == list: + fd = "=".join([str(dpart) for dpart in d]) + else: + fd = str(d) + defines.append(fd) + return defines + + +def _GetDisabledWarnings(config): + return [str(i) for i in config.get("msvs_disabled_warnings", [])] + + +def _GetModuleDefinition(spec): + def_file = "" + if spec["type"] in [ + "shared_library", + "loadable_module", + "executable", + "windows_driver", + ]: + def_files = [s for s in spec.get("sources", []) if s.endswith(".def")] + if len(def_files) == 1: + def_file = _FixPath(def_files[0]) + elif def_files: + raise ValueError( + "Multiple module definition files in one target, target %s lists " + "multiple .def files: %s" % (spec["target_name"], " ".join(def_files)) + ) + return def_file + + +def _ConvertToolsToExpectedForm(tools): + """Convert tools to a form expected by Visual Studio. + + Arguments: + tools: A dictionary of settings; the tool name is the key. + Returns: + A list of Tool objects. + """ + tool_list = [] + for tool, settings in tools.items(): + # Collapse settings with lists. + settings_fixed = {} + for setting, value in settings.items(): + if type(value) == list: + if ( + tool == "VCLinkerTool" and setting == "AdditionalDependencies" + ) or setting == "AdditionalOptions": + settings_fixed[setting] = " ".join(value) + else: + settings_fixed[setting] = ";".join(value) + else: + settings_fixed[setting] = value + # Add in this tool. + tool_list.append(MSVSProject.Tool(tool, settings_fixed)) + return tool_list + + +def _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name): + """Add to the project file the configuration specified by config. + + Arguments: + p: The target project being generated. + spec: the target project dict. + tools: A dictionary of settings; the tool name is the key. + config: The dictionary that defines the special processing to be done + for this configuration. + config_type: The configuration type, a number as defined by Microsoft. + config_name: The name of the configuration. + """ + attributes = _GetMSVSAttributes(spec, config, config_type) + # Add in this configuration. + tool_list = _ConvertToolsToExpectedForm(tools) + p.AddConfig(_ConfigFullName(config_name, config), attrs=attributes, tools=tool_list) + + +def _GetMSVSAttributes(spec, config, config_type): + # Prepare configuration attributes. + prepared_attrs = {} + source_attrs = config.get("msvs_configuration_attributes", {}) + for a in source_attrs: + prepared_attrs[a] = source_attrs[a] + # Add props files. + vsprops_dirs = config.get("msvs_props", []) + vsprops_dirs = _FixPaths(vsprops_dirs) + if vsprops_dirs: + prepared_attrs["InheritedPropertySheets"] = ";".join(vsprops_dirs) + # Set configuration type. + prepared_attrs["ConfigurationType"] = config_type + output_dir = prepared_attrs.get( + "OutputDirectory", "$(SolutionDir)$(ConfigurationName)" + ) + prepared_attrs["OutputDirectory"] = _FixPath(output_dir) + "\\" + if "IntermediateDirectory" not in prepared_attrs: + intermediate = "$(ConfigurationName)\\obj\\$(ProjectName)" + prepared_attrs["IntermediateDirectory"] = _FixPath(intermediate) + "\\" + else: + intermediate = _FixPath(prepared_attrs["IntermediateDirectory"]) + "\\" + intermediate = MSVSSettings.FixVCMacroSlashes(intermediate) + prepared_attrs["IntermediateDirectory"] = intermediate + return prepared_attrs + + +def _AddNormalizedSources(sources_set, sources_array): + sources_set.update(_NormalizedSource(s) for s in sources_array) + + +def _PrepareListOfSources(spec, generator_flags, gyp_file): + """Prepare list of sources and excluded sources. + + Besides the sources specified directly in the spec, adds the gyp file so + that a change to it will cause a re-compile. Also adds appropriate sources + for actions and copies. Assumes later stage will un-exclude files which + have custom build steps attached. + + Arguments: + spec: The target dictionary containing the properties of the target. + gyp_file: The name of the gyp file. + Returns: + A pair of (list of sources, list of excluded sources). + The sources will be relative to the gyp file. + """ + sources = OrderedSet() + _AddNormalizedSources(sources, spec.get("sources", [])) + excluded_sources = OrderedSet() + # Add in the gyp file. + if not generator_flags.get("standalone"): + sources.add(gyp_file) + + # Add in 'action' inputs and outputs. + for a in spec.get("actions", []): + inputs = a["inputs"] + inputs = [_NormalizedSource(i) for i in inputs] + # Add all inputs to sources and excluded sources. + inputs = OrderedSet(inputs) + sources.update(inputs) + if not spec.get("msvs_external_builder"): + excluded_sources.update(inputs) + if int(a.get("process_outputs_as_sources", False)): + _AddNormalizedSources(sources, a.get("outputs", [])) + # Add in 'copies' inputs and outputs. + for cpy in spec.get("copies", []): + _AddNormalizedSources(sources, cpy.get("files", [])) + return (sources, excluded_sources) + + +def _AdjustSourcesAndConvertToFilterHierarchy( + spec, options, gyp_dir, sources, excluded_sources, list_excluded, version +): + """Adjusts the list of sources and excluded sources. + + Also converts the sets to lists. + + Arguments: + spec: The target dictionary containing the properties of the target. + options: Global generator options. + gyp_dir: The path to the gyp file being processed. + sources: A set of sources to be included for this project. + excluded_sources: A set of sources to be excluded for this project. + version: A MSVSVersion object. + Returns: + A trio of (list of sources, list of excluded sources, + path of excluded IDL file) + """ + # Exclude excluded sources coming into the generator. + excluded_sources.update(OrderedSet(spec.get("sources_excluded", []))) + # Add excluded sources into sources for good measure. + sources.update(excluded_sources) + # Convert to proper windows form. + # NOTE: sources goes from being a set to a list here. + # NOTE: excluded_sources goes from being a set to a list here. + sources = _FixPaths(sources) + # Convert to proper windows form. + excluded_sources = _FixPaths(excluded_sources) + + excluded_idl = _IdlFilesHandledNonNatively(spec, sources) + + precompiled_related = _GetPrecompileRelatedFiles(spec) + # Find the excluded ones, minus the precompiled header related ones. + fully_excluded = [i for i in excluded_sources if i not in precompiled_related] + + # Convert to folders and the right slashes. + sources = [i.split("\\") for i in sources] + sources = _ConvertSourcesToFilterHierarchy( + sources, + excluded=fully_excluded, + list_excluded=list_excluded, + msvs_version=version, + ) + + # Prune filters with a single child to flatten ugly directory structures + # such as ../../src/modules/module1 etc. + if version.UsesVcxproj(): + while ( + all([isinstance(s, MSVSProject.Filter) for s in sources]) + and len({s.name for s in sources}) == 1 + ): + assert all([len(s.contents) == 1 for s in sources]) + sources = [s.contents[0] for s in sources] + else: + while len(sources) == 1 and isinstance(sources[0], MSVSProject.Filter): + sources = sources[0].contents + + return sources, excluded_sources, excluded_idl + + +def _IdlFilesHandledNonNatively(spec, sources): + # If any non-native rules use 'idl' as an extension exclude idl files. + # Gather a list here to use later. + using_idl = False + for rule in spec.get("rules", []): + if rule["extension"] == "idl" and int(rule.get("msvs_external_rule", 0)): + using_idl = True + break + if using_idl: + excluded_idl = [i for i in sources if i.endswith(".idl")] + else: + excluded_idl = [] + return excluded_idl + + +def _GetPrecompileRelatedFiles(spec): + # Gather a list of precompiled header related sources. + precompiled_related = [] + for _, config in spec["configurations"].items(): + for k in precomp_keys: + f = config.get(k) + if f: + precompiled_related.append(_FixPath(f)) + return precompiled_related + + +def _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl, list_excluded): + exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl) + for file_name, excluded_configs in exclusions.items(): + if not list_excluded and len(excluded_configs) == len(spec["configurations"]): + # If we're not listing excluded files, then they won't appear in the + # project, so don't try to configure them to be excluded. + pass + else: + for config_name, config in excluded_configs: + p.AddFileConfig( + file_name, + _ConfigFullName(config_name, config), + {"ExcludedFromBuild": "true"}, + ) + + +def _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl): + exclusions = {} + # Exclude excluded sources from being built. + for f in excluded_sources: + excluded_configs = [] + for config_name, config in spec["configurations"].items(): + precomped = [_FixPath(config.get(i, "")) for i in precomp_keys] + # Don't do this for ones that are precompiled header related. + if f not in precomped: + excluded_configs.append((config_name, config)) + exclusions[f] = excluded_configs + # If any non-native rules use 'idl' as an extension exclude idl files. + # Exclude them now. + for f in excluded_idl: + excluded_configs = [] + for config_name, config in spec["configurations"].items(): + excluded_configs.append((config_name, config)) + exclusions[f] = excluded_configs + return exclusions + + +def _AddToolFilesToMSVS(p, spec): + # Add in tool files (rules). + tool_files = OrderedSet() + for _, config in spec["configurations"].items(): + for f in config.get("msvs_tool_files", []): + tool_files.add(f) + for f in tool_files: + p.AddToolFile(f) + + +def _HandlePreCompiledHeaders(p, sources, spec): + # Pre-compiled header source stubs need a different compiler flag + # (generate precompiled header) and any source file not of the same + # kind (i.e. C vs. C++) as the precompiled header source stub needs + # to have use of precompiled headers disabled. + extensions_excluded_from_precompile = [] + for config_name, config in spec["configurations"].items(): + source = config.get("msvs_precompiled_source") + if source: + source = _FixPath(source) + # UsePrecompiledHeader=1 for if using precompiled headers. + tool = MSVSProject.Tool("VCCLCompilerTool", {"UsePrecompiledHeader": "1"}) + p.AddFileConfig( + source, _ConfigFullName(config_name, config), {}, tools=[tool] + ) + basename, extension = os.path.splitext(source) + if extension == ".c": + extensions_excluded_from_precompile = [".cc", ".cpp", ".cxx"] + else: + extensions_excluded_from_precompile = [".c"] + + def DisableForSourceTree(source_tree): + for source in source_tree: + if isinstance(source, MSVSProject.Filter): + DisableForSourceTree(source.contents) + else: + basename, extension = os.path.splitext(source) + if extension in extensions_excluded_from_precompile: + for config_name, config in spec["configurations"].items(): + tool = MSVSProject.Tool( + "VCCLCompilerTool", + { + "UsePrecompiledHeader": "0", + "ForcedIncludeFiles": "$(NOINHERIT)", + }, + ) + p.AddFileConfig( + _FixPath(source), + _ConfigFullName(config_name, config), + {}, + tools=[tool], + ) + + # Do nothing if there was no precompiled source. + if extensions_excluded_from_precompile: + DisableForSourceTree(sources) + + +def _AddActions(actions_to_add, spec, relative_path_of_gyp_file): + # Add actions. + actions = spec.get("actions", []) + # Don't setup_env every time. When all the actions are run together in one + # batch file in VS, the PATH will grow too long. + # Membership in this set means that the cygwin environment has been set up, + # and does not need to be set up again. + have_setup_env = set() + for a in actions: + # Attach actions to the gyp file if nothing else is there. + inputs = a.get("inputs") or [relative_path_of_gyp_file] + attached_to = inputs[0] + need_setup_env = attached_to not in have_setup_env + cmd = _BuildCommandLineForRule( + spec, a, has_input_path=False, do_setup_env=need_setup_env + ) + have_setup_env.add(attached_to) + # Add the action. + _AddActionStep( + actions_to_add, + inputs=inputs, + outputs=a.get("outputs", []), + description=a.get("message", a["action_name"]), + command=cmd, + ) + + +def _WriteMSVSUserFile(project_path, version, spec): + # Add run_as and test targets. + if "run_as" in spec: + run_as = spec["run_as"] + action = run_as.get("action", []) + environment = run_as.get("environment", []) + working_directory = run_as.get("working_directory", ".") + elif int(spec.get("test", 0)): + action = ["$(TargetPath)", "--gtest_print_time"] + environment = [] + working_directory = "." + else: + return # Nothing to add + # Write out the user file. + user_file = _CreateMSVSUserFile(project_path, version, spec) + for config_name, c_data in spec["configurations"].items(): + user_file.AddDebugSettings( + _ConfigFullName(config_name, c_data), action, environment, working_directory + ) + user_file.WriteIfChanged() + + +def _AddCopies(actions_to_add, spec): + copies = _GetCopies(spec) + for inputs, outputs, cmd, description in copies: + _AddActionStep( + actions_to_add, + inputs=inputs, + outputs=outputs, + description=description, + command=cmd, + ) + + +def _GetCopies(spec): + copies = [] + # Add copies. + for cpy in spec.get("copies", []): + for src in cpy.get("files", []): + dst = os.path.join(cpy["destination"], os.path.basename(src)) + # _AddCustomBuildToolForMSVS() will call _FixPath() on the inputs and + # outputs, so do the same for our generated command line. + if src.endswith("/"): + src_bare = src[:-1] + base_dir = posixpath.split(src_bare)[0] + outer_dir = posixpath.split(src_bare)[1] + fixed_dst = _FixPath(dst) + full_dst = f'"{fixed_dst}\\{outer_dir}\\"' + cmd = 'mkdir {} 2>nul & cd "{}" && xcopy /e /f /y "{}" {}'.format( + full_dst, + _FixPath(base_dir), + outer_dir, + full_dst, + ) + copies.append( + ( + [src], + ["dummy_copies", dst], + cmd, + f"Copying {src} to {fixed_dst}", + ) + ) + else: + fix_dst = _FixPath(cpy["destination"]) + cmd = 'mkdir "{}" 2>nul & set ERRORLEVEL=0 & copy /Y "{}" "{}"'.format( + fix_dst, + _FixPath(src), + _FixPath(dst), + ) + copies.append(([src], [dst], cmd, f"Copying {src} to {fix_dst}")) + return copies + + +def _GetPathDict(root, path): + # |path| will eventually be empty (in the recursive calls) if it was initially + # relative; otherwise it will eventually end up as '\', 'D:\', etc. + if not path or path.endswith(os.sep): + return root + parent, folder = os.path.split(path) + parent_dict = _GetPathDict(root, parent) + if folder not in parent_dict: + parent_dict[folder] = dict() + return parent_dict[folder] + + +def _DictsToFolders(base_path, bucket, flat): + # Convert to folders recursively. + children = [] + for folder, contents in bucket.items(): + if type(contents) == dict: + folder_children = _DictsToFolders( + os.path.join(base_path, folder), contents, flat + ) + if flat: + children += folder_children + else: + folder_children = MSVSNew.MSVSFolder( + os.path.join(base_path, folder), + name="(" + folder + ")", + entries=folder_children, + ) + children.append(folder_children) + else: + children.append(contents) + return children + + +def _CollapseSingles(parent, node): + # Recursively explorer the tree of dicts looking for projects which are + # the sole item in a folder which has the same name as the project. Bring + # such projects up one level. + if type(node) == dict and len(node) == 1 and next(iter(node)) == parent + ".vcproj": + return node[next(iter(node))] + if type(node) != dict: + return node + for child in node: + node[child] = _CollapseSingles(child, node[child]) + return node + + +def _GatherSolutionFolders(sln_projects, project_objects, flat): + root = {} + # Convert into a tree of dicts on path. + for p in sln_projects: + gyp_file, target = gyp.common.ParseQualifiedTarget(p)[0:2] + if p.endswith("#host"): + target += "_host" + gyp_dir = os.path.dirname(gyp_file) + path_dict = _GetPathDict(root, gyp_dir) + path_dict[target + ".vcproj"] = project_objects[p] + # Walk down from the top until we hit a folder that has more than one entry. + # In practice, this strips the top-level "src/" dir from the hierarchy in + # the solution. + while len(root) == 1 and type(root[next(iter(root))]) == dict: + root = root[next(iter(root))] + # Collapse singles. + root = _CollapseSingles("", root) + # Merge buckets until everything is a root entry. + return _DictsToFolders("", root, flat) + + +def _GetPathOfProject(qualified_target, spec, options, msvs_version): + default_config = _GetDefaultConfiguration(spec) + proj_filename = default_config.get("msvs_existing_vcproj") + if not proj_filename: + proj_filename = spec["target_name"] + if spec["toolset"] == "host": + proj_filename += "_host" + proj_filename = proj_filename + options.suffix + msvs_version.ProjectExtension() + + build_file = gyp.common.BuildFile(qualified_target) + proj_path = os.path.join(os.path.dirname(build_file), proj_filename) + fix_prefix = None + if options.generator_output: + project_dir_path = os.path.dirname(os.path.abspath(proj_path)) + proj_path = os.path.join(options.generator_output, proj_path) + fix_prefix = gyp.common.RelativePath( + project_dir_path, os.path.dirname(proj_path) + ) + return proj_path, fix_prefix + + +def _GetPlatformOverridesOfProject(spec): + # Prepare a dict indicating which project configurations are used for which + # solution configurations for this target. + config_platform_overrides = {} + for config_name, c in spec["configurations"].items(): + config_fullname = _ConfigFullName(config_name, c) + platform = c.get("msvs_target_platform", _ConfigPlatform(c)) + fixed_config_fullname = "{}|{}".format( + _ConfigBaseName(config_name, _ConfigPlatform(c)), + platform, + ) + if spec["toolset"] == "host" and generator_supports_multiple_toolsets: + fixed_config_fullname = f"{config_name}|x64" + config_platform_overrides[config_fullname] = fixed_config_fullname + return config_platform_overrides + + +def _CreateProjectObjects(target_list, target_dicts, options, msvs_version): + """Create a MSVSProject object for the targets found in target list. + + Arguments: + target_list: the list of targets to generate project objects for. + target_dicts: the dictionary of specifications. + options: global generator options. + msvs_version: the MSVSVersion object. + Returns: + A set of created projects, keyed by target. + """ + global fixpath_prefix + # Generate each project. + projects = {} + for qualified_target in target_list: + spec = target_dicts[qualified_target] + proj_path, fixpath_prefix = _GetPathOfProject( + qualified_target, spec, options, msvs_version + ) + guid = _GetGuidOfProject(proj_path, spec) + overrides = _GetPlatformOverridesOfProject(spec) + build_file = gyp.common.BuildFile(qualified_target) + # Create object for this project. + target_name = spec["target_name"] + if spec["toolset"] == "host": + target_name += "_host" + obj = MSVSNew.MSVSProject( + proj_path, + name=target_name, + guid=guid, + spec=spec, + build_file=build_file, + config_platform_overrides=overrides, + fixpath_prefix=fixpath_prefix, + ) + # Set project toolset if any (MS build only) + if msvs_version.UsesVcxproj(): + obj.set_msbuild_toolset( + _GetMsbuildToolsetOfProject(proj_path, spec, msvs_version) + ) + projects[qualified_target] = obj + # Set all the dependencies, but not if we are using an external builder like + # ninja + for project in projects.values(): + if not project.spec.get("msvs_external_builder"): + deps = project.spec.get("dependencies", []) + deps = [projects[d] for d in deps] + project.set_dependencies(deps) + return projects + + +def _InitNinjaFlavor(params, target_list, target_dicts): + """Initialize targets for the ninja flavor. + + This sets up the necessary variables in the targets to generate msvs projects + that use ninja as an external builder. The variables in the spec are only set + if they have not been set. This allows individual specs to override the + default values initialized here. + Arguments: + params: Params provided to the generator. + target_list: List of target pairs: 'base/base.gyp:base'. + target_dicts: Dict of target properties keyed on target pair. + """ + for qualified_target in target_list: + spec = target_dicts[qualified_target] + if spec.get("msvs_external_builder"): + # The spec explicitly defined an external builder, so don't change it. + continue + + path_to_ninja = spec.get("msvs_path_to_ninja", "ninja.exe") + + spec["msvs_external_builder"] = "ninja" + if not spec.get("msvs_external_builder_out_dir"): + gyp_file, _, _ = gyp.common.ParseQualifiedTarget(qualified_target) + gyp_dir = os.path.dirname(gyp_file) + configuration = "$(Configuration)" + if params.get("target_arch") == "x64": + configuration += "_x64" + if params.get("target_arch") == "arm64": + configuration += "_arm64" + spec["msvs_external_builder_out_dir"] = os.path.join( + gyp.common.RelativePath(params["options"].toplevel_dir, gyp_dir), + ninja_generator.ComputeOutputDir(params), + configuration, + ) + if not spec.get("msvs_external_builder_build_cmd"): + spec["msvs_external_builder_build_cmd"] = [ + path_to_ninja, + "-C", + "$(OutDir)", + "$(ProjectName)", + ] + if not spec.get("msvs_external_builder_clean_cmd"): + spec["msvs_external_builder_clean_cmd"] = [ + path_to_ninja, + "-C", + "$(OutDir)", + "-tclean", + "$(ProjectName)", + ] + + +def CalculateVariables(default_variables, params): + """Generated variables that require params to be known.""" + + generator_flags = params.get("generator_flags", {}) + + # Select project file format version (if unset, default to auto detecting). + msvs_version = MSVSVersion.SelectVisualStudioVersion( + generator_flags.get("msvs_version", "auto") + ) + # Stash msvs_version for later (so we don't have to probe the system twice). + params["msvs_version"] = msvs_version + + # Set a variable so conditions can be based on msvs_version. + default_variables["MSVS_VERSION"] = msvs_version.ShortName() + + # To determine processor word size on Windows, in addition to checking + # PROCESSOR_ARCHITECTURE (which reflects the word size of the current + # process), it is also necessary to check PROCESSOR_ARCITEW6432 (which + # contains the actual word size of the system when running thru WOW64). + if ( + os.environ.get("PROCESSOR_ARCHITECTURE", "").find("64") >= 0 + or os.environ.get("PROCESSOR_ARCHITEW6432", "").find("64") >= 0 + ): + default_variables["MSVS_OS_BITS"] = 64 + else: + default_variables["MSVS_OS_BITS"] = 32 + + if gyp.common.GetFlavor(params) == "ninja": + default_variables["SHARED_INTERMEDIATE_DIR"] = "$(OutDir)gen" + + +def PerformBuild(data, configurations, params): + options = params["options"] + msvs_version = params["msvs_version"] + devenv = os.path.join(msvs_version.path, "Common7", "IDE", "devenv.com") + + for build_file, build_file_dict in data.items(): + (build_file_root, build_file_ext) = os.path.splitext(build_file) + if build_file_ext != ".gyp": + continue + sln_path = build_file_root + options.suffix + ".sln" + if options.generator_output: + sln_path = os.path.join(options.generator_output, sln_path) + + for config in configurations: + arguments = [devenv, sln_path, "/Build", config] + print(f"Building [{config}]: {arguments}") + subprocess.check_call(arguments) + + +def CalculateGeneratorInputInfo(params): + if params.get("flavor") == "ninja": + toplevel = params["options"].toplevel_dir + qualified_out_dir = os.path.normpath( + os.path.join( + toplevel, + ninja_generator.ComputeOutputDir(params), + "gypfiles-msvs-ninja", + ) + ) + + global generator_filelist_paths + generator_filelist_paths = { + "toplevel": toplevel, + "qualified_out_dir": qualified_out_dir, + } + + +def GenerateOutput(target_list, target_dicts, data, params): + """Generate .sln and .vcproj files. + + This is the entry point for this generator. + Arguments: + target_list: List of target pairs: 'base/base.gyp:base'. + target_dicts: Dict of target properties keyed on target pair. + data: Dictionary containing per .gyp data. + """ + global fixpath_prefix + + options = params["options"] + + # Get the project file format version back out of where we stashed it in + # GeneratorCalculatedVariables. + msvs_version = params["msvs_version"] + + generator_flags = params.get("generator_flags", {}) + + # Optionally shard targets marked with 'msvs_shard': SHARD_COUNT. + (target_list, target_dicts) = MSVSUtil.ShardTargets(target_list, target_dicts) + + # Optionally use the large PDB workaround for targets marked with + # 'msvs_large_pdb': 1. + (target_list, target_dicts) = MSVSUtil.InsertLargePdbShims( + target_list, target_dicts, generator_default_variables + ) + + # Optionally configure each spec to use ninja as the external builder. + if params.get("flavor") == "ninja": + _InitNinjaFlavor(params, target_list, target_dicts) + + # Prepare the set of configurations. + configs = set() + for qualified_target in target_list: + spec = target_dicts[qualified_target] + for config_name, config in spec["configurations"].items(): + config_name = _ConfigFullName(config_name, config) + configs.add(config_name) + if config_name == "Release|arm64": + configs.add("Release|x64") + configs = list(configs) + + # Figure out all the projects that will be generated and their guids + project_objects = _CreateProjectObjects( + target_list, target_dicts, options, msvs_version + ) + + # Generate each project. + missing_sources = [] + for project in project_objects.values(): + fixpath_prefix = project.fixpath_prefix + missing_sources.extend( + _GenerateProject(project, options, msvs_version, generator_flags, spec) + ) + fixpath_prefix = None + + for build_file in data: + # Validate build_file extension + target_only_configs = configs + if generator_supports_multiple_toolsets: + target_only_configs = [i for i in configs if i.endswith("arm64")] + if not build_file.endswith(".gyp"): + continue + sln_path = os.path.splitext(build_file)[0] + options.suffix + ".sln" + if options.generator_output: + sln_path = os.path.join(options.generator_output, sln_path) + # Get projects in the solution, and their dependents. + sln_projects = gyp.common.BuildFileTargets(target_list, build_file) + sln_projects += gyp.common.DeepDependencyTargets(target_dicts, sln_projects) + # Create folder hierarchy. + root_entries = _GatherSolutionFolders( + sln_projects, project_objects, flat=msvs_version.FlatSolution() + ) + # Create solution. + sln = MSVSNew.MSVSSolution( + sln_path, + entries=root_entries, + variants=target_only_configs, + websiteProperties=False, + version=msvs_version, + ) + sln.Write() + + if missing_sources: + error_message = "Missing input files:\n" + "\n".join(set(missing_sources)) + if generator_flags.get("msvs_error_on_missing_sources", False): + raise GypError(error_message) + else: + print("Warning: " + error_message, file=sys.stdout) + + +def _GenerateMSBuildFiltersFile( + filters_path, + source_files, + rule_dependencies, + extension_to_rule_name, + platforms, + toolset, +): + """Generate the filters file. + + This file is used by Visual Studio to organize the presentation of source + files into folders. + + Arguments: + filters_path: The path of the file to be created. + source_files: The hierarchical structure of all the sources. + extension_to_rule_name: A dictionary mapping file extensions to rules. + """ + filter_group = [] + source_group = [] + _AppendFiltersForMSBuild( + "", + source_files, + rule_dependencies, + extension_to_rule_name, + platforms, + toolset, + filter_group, + source_group, + ) + if filter_group: + content = [ + "Project", + { + "ToolsVersion": "4.0", + "xmlns": "http://schemas.microsoft.com/developer/msbuild/2003", + }, + ["ItemGroup"] + filter_group, + ["ItemGroup"] + source_group, + ] + easy_xml.WriteXmlIfChanged(content, filters_path, pretty=True, win32=True) + elif os.path.exists(filters_path): + # We don't need this filter anymore. Delete the old filter file. + os.unlink(filters_path) + + +def _AppendFiltersForMSBuild( + parent_filter_name, + sources, + rule_dependencies, + extension_to_rule_name, + platforms, + toolset, + filter_group, + source_group, +): + """Creates the list of filters and sources to be added in the filter file. + + Args: + parent_filter_name: The name of the filter under which the sources are + found. + sources: The hierarchy of filters and sources to process. + extension_to_rule_name: A dictionary mapping file extensions to rules. + filter_group: The list to which filter entries will be appended. + source_group: The list to which source entries will be appended. + """ + for source in sources: + if isinstance(source, MSVSProject.Filter): + # We have a sub-filter. Create the name of that sub-filter. + if not parent_filter_name: + filter_name = source.name + else: + filter_name = f"{parent_filter_name}\\{source.name}" + # Add the filter to the group. + filter_group.append( + [ + "Filter", + {"Include": filter_name}, + ["UniqueIdentifier", MSVSNew.MakeGuid(source.name)], + ] + ) + # Recurse and add its dependents. + _AppendFiltersForMSBuild( + filter_name, + source.contents, + rule_dependencies, + extension_to_rule_name, + platforms, + toolset, + filter_group, + source_group, + ) + else: + # It's a source. Create a source entry. + _, element = _MapFileToMsBuildSourceType( + source, rule_dependencies, extension_to_rule_name, platforms, toolset + ) + source_entry = [element, {"Include": source}] + # Specify the filter it is part of, if any. + if parent_filter_name: + source_entry.append(["Filter", parent_filter_name]) + source_group.append(source_entry) + + +def _MapFileToMsBuildSourceType( + source, rule_dependencies, extension_to_rule_name, platforms, toolset +): + """Returns the group and element type of the source file. + + Arguments: + source: The source file name. + extension_to_rule_name: A dictionary mapping file extensions to rules. + + Returns: + A pair of (group this file should be part of, the label of element) + """ + _, ext = os.path.splitext(source) + ext = ext.lower() + if ext in extension_to_rule_name: + group = "rule" + element = extension_to_rule_name[ext] + elif ext in [".cc", ".cpp", ".c", ".cxx", ".mm"]: + group = "compile" + element = "ClCompile" + elif ext in [".h", ".hxx"]: + group = "include" + element = "ClInclude" + elif ext == ".rc": + group = "resource" + element = "ResourceCompile" + elif ext in [".s", ".asm"]: + group = "masm" + element = "MASM" + if "arm64" in platforms and toolset == "target": + element = "MARMASM" + elif ext == ".idl": + group = "midl" + element = "Midl" + elif source in rule_dependencies: + group = "rule_dependency" + element = "CustomBuild" + else: + group = "none" + element = "None" + return (group, element) + + +def _GenerateRulesForMSBuild( + output_dir, + options, + spec, + sources, + excluded_sources, + props_files_of_rules, + targets_files_of_rules, + actions_to_add, + rule_dependencies, + extension_to_rule_name, +): + # MSBuild rules are implemented using three files: an XML file, a .targets + # file and a .props file. + # For more details see: + # https://devblogs.microsoft.com/cppblog/quick-help-on-vs2010-custom-build-rule/ + rules = spec.get("rules", []) + rules_native = [r for r in rules if not int(r.get("msvs_external_rule", 0))] + rules_external = [r for r in rules if int(r.get("msvs_external_rule", 0))] + + msbuild_rules = [] + for rule in rules_native: + # Skip a rule with no action and no inputs. + if "action" not in rule and not rule.get("rule_sources", []): + continue + msbuild_rule = MSBuildRule(rule, spec) + msbuild_rules.append(msbuild_rule) + rule_dependencies.update(msbuild_rule.additional_dependencies.split(";")) + extension_to_rule_name[msbuild_rule.extension] = msbuild_rule.rule_name + if msbuild_rules: + base = spec["target_name"] + options.suffix + props_name = base + ".props" + targets_name = base + ".targets" + xml_name = base + ".xml" + + props_files_of_rules.add(props_name) + targets_files_of_rules.add(targets_name) + + props_path = os.path.join(output_dir, props_name) + targets_path = os.path.join(output_dir, targets_name) + xml_path = os.path.join(output_dir, xml_name) + + _GenerateMSBuildRulePropsFile(props_path, msbuild_rules) + _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules) + _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules) + + if rules_external: + _GenerateExternalRules( + rules_external, output_dir, spec, sources, options, actions_to_add + ) + _AdjustSourcesForRules(rules, sources, excluded_sources, True) + + +class MSBuildRule: + """Used to store information used to generate an MSBuild rule. + + Attributes: + rule_name: The rule name, sanitized to use in XML. + target_name: The name of the target. + after_targets: The name of the AfterTargets element. + before_targets: The name of the BeforeTargets element. + depends_on: The name of the DependsOn element. + compute_output: The name of the ComputeOutput element. + dirs_to_make: The name of the DirsToMake element. + inputs: The name of the _inputs element. + tlog: The name of the _tlog element. + extension: The extension this rule applies to. + description: The message displayed when this rule is invoked. + additional_dependencies: A string listing additional dependencies. + outputs: The outputs of this rule. + command: The command used to run the rule. + """ + + def __init__(self, rule, spec): + self.display_name = rule["rule_name"] + # Assure that the rule name is only characters and numbers + self.rule_name = re.sub(r"\W", "_", self.display_name) + # Create the various element names, following the example set by the + # Visual Studio 2008 to 2010 conversion. I don't know if VS2010 + # is sensitive to the exact names. + self.target_name = "_" + self.rule_name + self.after_targets = self.rule_name + "AfterTargets" + self.before_targets = self.rule_name + "BeforeTargets" + self.depends_on = self.rule_name + "DependsOn" + self.compute_output = "Compute%sOutput" % self.rule_name + self.dirs_to_make = self.rule_name + "DirsToMake" + self.inputs = self.rule_name + "_inputs" + self.tlog = self.rule_name + "_tlog" + self.extension = rule["extension"] + if not self.extension.startswith("."): + self.extension = "." + self.extension + + self.description = MSVSSettings.ConvertVCMacrosToMSBuild( + rule.get("message", self.rule_name) + ) + old_additional_dependencies = _FixPaths(rule.get("inputs", [])) + self.additional_dependencies = ";".join( + [ + MSVSSettings.ConvertVCMacrosToMSBuild(i) + for i in old_additional_dependencies + ] + ) + old_outputs = _FixPaths(rule.get("outputs", [])) + self.outputs = ";".join( + [MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in old_outputs] + ) + old_command = _BuildCommandLineForRule( + spec, rule, has_input_path=True, do_setup_env=True + ) + self.command = MSVSSettings.ConvertVCMacrosToMSBuild(old_command) + + +def _GenerateMSBuildRulePropsFile(props_path, msbuild_rules): + """Generate the .props file.""" + content = [ + "Project", + {"xmlns": "http://schemas.microsoft.com/developer/msbuild/2003"}, + ] + for rule in msbuild_rules: + content.extend( + [ + [ + "PropertyGroup", + { + "Condition": "'$(%s)' == '' and '$(%s)' == '' and " + "'$(ConfigurationType)' != 'Makefile'" + % (rule.before_targets, rule.after_targets) + }, + [rule.before_targets, "Midl"], + [rule.after_targets, "CustomBuild"], + ], + [ + "PropertyGroup", + [ + rule.depends_on, + {"Condition": "'$(ConfigurationType)' != 'Makefile'"}, + "_SelectedFiles;$(%s)" % rule.depends_on, + ], + ], + [ + "ItemDefinitionGroup", + [ + rule.rule_name, + ["CommandLineTemplate", rule.command], + ["Outputs", rule.outputs], + ["ExecutionDescription", rule.description], + ["AdditionalDependencies", rule.additional_dependencies], + ], + ], + ] + ) + easy_xml.WriteXmlIfChanged(content, props_path, pretty=True, win32=True) + + +def _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules): + """Generate the .targets file.""" + content = [ + "Project", + {"xmlns": "http://schemas.microsoft.com/developer/msbuild/2003"}, + ] + item_group = [ + "ItemGroup", + [ + "PropertyPageSchema", + {"Include": "$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml"}, + ], + ] + for rule in msbuild_rules: + item_group.append( + [ + "AvailableItemName", + {"Include": rule.rule_name}, + ["Targets", rule.target_name], + ] + ) + content.append(item_group) + + for rule in msbuild_rules: + content.append( + [ + "UsingTask", + { + "TaskName": rule.rule_name, + "TaskFactory": "XamlTaskFactory", + "AssemblyName": "Microsoft.Build.Tasks.v4.0", + }, + ["Task", "$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml"], + ] + ) + for rule in msbuild_rules: + rule_name = rule.rule_name + target_outputs = "%%(%s.Outputs)" % rule_name + target_inputs = ( + "%%(%s.Identity);%%(%s.AdditionalDependencies);" "$(MSBuildProjectFile)" + ) % (rule_name, rule_name) + rule_inputs = "%%(%s.Identity)" % rule_name + extension_condition = ( + "'%(Extension)'=='.obj' or " + "'%(Extension)'=='.res' or " + "'%(Extension)'=='.rsc' or " + "'%(Extension)'=='.lib'" + ) + remove_section = [ + "ItemGroup", + {"Condition": "'@(SelectedFiles)' != ''"}, + [ + rule_name, + { + "Remove": "@(%s)" % rule_name, + "Condition": "'%(Identity)' != '@(SelectedFiles)'", + }, + ], + ] + inputs_section = [ + "ItemGroup", + [rule.inputs, {"Include": "%%(%s.AdditionalDependencies)" % rule_name}], + ] + logging_section = [ + "ItemGroup", + [ + rule.tlog, + { + "Include": "%%(%s.Outputs)" % rule_name, + "Condition": ( + "'%%(%s.Outputs)' != '' and " + "'%%(%s.ExcludedFromBuild)' != 'true'" % (rule_name, rule_name) + ), + }, + ["Source", "@(%s, '|')" % rule_name], + ["Inputs", "@(%s -> '%%(Fullpath)', ';')" % rule.inputs], + ], + ] + message_section = [ + "Message", + {"Importance": "High", "Text": "%%(%s.ExecutionDescription)" % rule_name}, + ] + write_tlog_section = [ + "WriteLinesToFile", + { + "Condition": "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " + "'true'" % (rule.tlog, rule.tlog), + "File": "$(IntDir)$(ProjectName).write.1.tlog", + "Lines": "^%%(%s.Source);@(%s->'%%(Fullpath)')" + % (rule.tlog, rule.tlog), + }, + ] + read_tlog_section = [ + "WriteLinesToFile", + { + "Condition": "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " + "'true'" % (rule.tlog, rule.tlog), + "File": "$(IntDir)$(ProjectName).read.1.tlog", + "Lines": f"^%({rule.tlog}.Source);%({rule.tlog}.Inputs)", + }, + ] + command_and_input_section = [ + rule_name, + { + "Condition": "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " + "'true'" % (rule_name, rule_name), + "EchoOff": "true", + "StandardOutputImportance": "High", + "StandardErrorImportance": "High", + "CommandLineTemplate": "%%(%s.CommandLineTemplate)" % rule_name, + "AdditionalOptions": "%%(%s.AdditionalOptions)" % rule_name, + "Inputs": rule_inputs, + }, + ] + content.extend( + [ + [ + "Target", + { + "Name": rule.target_name, + "BeforeTargets": "$(%s)" % rule.before_targets, + "AfterTargets": "$(%s)" % rule.after_targets, + "Condition": "'@(%s)' != ''" % rule_name, + "DependsOnTargets": "$(%s);%s" + % (rule.depends_on, rule.compute_output), + "Outputs": target_outputs, + "Inputs": target_inputs, + }, + remove_section, + inputs_section, + logging_section, + message_section, + write_tlog_section, + read_tlog_section, + command_and_input_section, + ], + [ + "PropertyGroup", + [ + "ComputeLinkInputsTargets", + "$(ComputeLinkInputsTargets);", + "%s;" % rule.compute_output, + ], + [ + "ComputeLibInputsTargets", + "$(ComputeLibInputsTargets);", + "%s;" % rule.compute_output, + ], + ], + [ + "Target", + { + "Name": rule.compute_output, + "Condition": "'@(%s)' != ''" % rule_name, + }, + [ + "ItemGroup", + [ + rule.dirs_to_make, + { + "Condition": "'@(%s)' != '' and " + "'%%(%s.ExcludedFromBuild)' != 'true'" + % (rule_name, rule_name), + "Include": "%%(%s.Outputs)" % rule_name, + }, + ], + [ + "Link", + { + "Include": "%%(%s.Identity)" % rule.dirs_to_make, + "Condition": extension_condition, + }, + ], + [ + "Lib", + { + "Include": "%%(%s.Identity)" % rule.dirs_to_make, + "Condition": extension_condition, + }, + ], + [ + "ImpLib", + { + "Include": "%%(%s.Identity)" % rule.dirs_to_make, + "Condition": extension_condition, + }, + ], + ], + [ + "MakeDir", + { + "Directories": ( + "@(%s->'%%(RootDir)%%(Directory)')" % rule.dirs_to_make + ) + }, + ], + ], + ] + ) + easy_xml.WriteXmlIfChanged(content, targets_path, pretty=True, win32=True) + + +def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules): + # Generate the .xml file + content = [ + "ProjectSchemaDefinitions", + { + "xmlns": ( + "clr-namespace:Microsoft.Build.Framework.XamlTypes;" + "assembly=Microsoft.Build.Framework" + ), + "xmlns:x": "http://schemas.microsoft.com/winfx/2006/xaml", + "xmlns:sys": "clr-namespace:System;assembly=mscorlib", + "xmlns:transformCallback": "Microsoft.Cpp.Dev10.ConvertPropertyCallback", + }, + ] + for rule in msbuild_rules: + content.extend( + [ + [ + "Rule", + { + "Name": rule.rule_name, + "PageTemplate": "tool", + "DisplayName": rule.display_name, + "Order": "200", + }, + [ + "Rule.DataSource", + [ + "DataSource", + {"Persistence": "ProjectFile", "ItemType": rule.rule_name}, + ], + ], + [ + "Rule.Categories", + [ + "Category", + {"Name": "General"}, + ["Category.DisplayName", ["sys:String", "General"]], + ], + [ + "Category", + {"Name": "Command Line", "Subtype": "CommandLine"}, + ["Category.DisplayName", ["sys:String", "Command Line"]], + ], + ], + [ + "StringListProperty", + { + "Name": "Inputs", + "Category": "Command Line", + "IsRequired": "true", + "Switch": " ", + }, + [ + "StringListProperty.DataSource", + [ + "DataSource", + { + "Persistence": "ProjectFile", + "ItemType": rule.rule_name, + "SourceType": "Item", + }, + ], + ], + ], + [ + "StringProperty", + { + "Name": "CommandLineTemplate", + "DisplayName": "Command Line", + "Visible": "False", + "IncludeInCommandLine": "False", + }, + ], + [ + "DynamicEnumProperty", + { + "Name": rule.before_targets, + "Category": "General", + "EnumProvider": "Targets", + "IncludeInCommandLine": "False", + }, + [ + "DynamicEnumProperty.DisplayName", + ["sys:String", "Execute Before"], + ], + [ + "DynamicEnumProperty.Description", + [ + "sys:String", + "Specifies the targets for the build customization" + " to run before.", + ], + ], + [ + "DynamicEnumProperty.ProviderSettings", + [ + "NameValuePair", + { + "Name": "Exclude", + "Value": "^%s|^Compute" % rule.before_targets, + }, + ], + ], + [ + "DynamicEnumProperty.DataSource", + [ + "DataSource", + { + "Persistence": "ProjectFile", + "HasConfigurationCondition": "true", + }, + ], + ], + ], + [ + "DynamicEnumProperty", + { + "Name": rule.after_targets, + "Category": "General", + "EnumProvider": "Targets", + "IncludeInCommandLine": "False", + }, + [ + "DynamicEnumProperty.DisplayName", + ["sys:String", "Execute After"], + ], + [ + "DynamicEnumProperty.Description", + [ + "sys:String", + ( + "Specifies the targets for the build customization" + " to run after." + ), + ], + ], + [ + "DynamicEnumProperty.ProviderSettings", + [ + "NameValuePair", + { + "Name": "Exclude", + "Value": "^%s|^Compute" % rule.after_targets, + }, + ], + ], + [ + "DynamicEnumProperty.DataSource", + [ + "DataSource", + { + "Persistence": "ProjectFile", + "ItemType": "", + "HasConfigurationCondition": "true", + }, + ], + ], + ], + [ + "StringListProperty", + { + "Name": "Outputs", + "DisplayName": "Outputs", + "Visible": "False", + "IncludeInCommandLine": "False", + }, + ], + [ + "StringProperty", + { + "Name": "ExecutionDescription", + "DisplayName": "Execution Description", + "Visible": "False", + "IncludeInCommandLine": "False", + }, + ], + [ + "StringListProperty", + { + "Name": "AdditionalDependencies", + "DisplayName": "Additional Dependencies", + "IncludeInCommandLine": "False", + "Visible": "false", + }, + ], + [ + "StringProperty", + { + "Subtype": "AdditionalOptions", + "Name": "AdditionalOptions", + "Category": "Command Line", + }, + [ + "StringProperty.DisplayName", + ["sys:String", "Additional Options"], + ], + [ + "StringProperty.Description", + ["sys:String", "Additional Options"], + ], + ], + ], + [ + "ItemType", + {"Name": rule.rule_name, "DisplayName": rule.display_name}, + ], + [ + "FileExtension", + {"Name": "*" + rule.extension, "ContentType": rule.rule_name}, + ], + [ + "ContentType", + { + "Name": rule.rule_name, + "DisplayName": "", + "ItemType": rule.rule_name, + }, + ], + ] + ) + easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True) + + +def _GetConfigurationAndPlatform(name, settings, spec): + configuration = name.rsplit("_", 1)[0] + platform = settings.get("msvs_configuration_platform", "Win32") + if spec["toolset"] == "host" and platform == "arm64": + platform = "x64" # Host-only tools are always built for x64 + return (configuration, platform) + + +def _GetConfigurationCondition(name, settings, spec): + return r"'$(Configuration)|$(Platform)'=='%s|%s'" % _GetConfigurationAndPlatform( + name, settings, spec + ) + + +def _GetMSBuildProjectConfigurations(configurations, spec): + group = ["ItemGroup", {"Label": "ProjectConfigurations"}] + for (name, settings) in sorted(configurations.items()): + configuration, platform = _GetConfigurationAndPlatform(name, settings, spec) + designation = f"{configuration}|{platform}" + group.append( + [ + "ProjectConfiguration", + {"Include": designation}, + ["Configuration", configuration], + ["Platform", platform], + ] + ) + return [group] + + +def _GetMSBuildGlobalProperties(spec, version, guid, gyp_file_name): + namespace = os.path.splitext(gyp_file_name)[0] + properties = [ + [ + "PropertyGroup", + {"Label": "Globals"}, + ["ProjectGuid", guid], + ["Keyword", "Win32Proj"], + ["RootNamespace", namespace], + ["IgnoreWarnCompileDuplicatedFilename", "true"], + ] + ] + + if ( + os.environ.get("PROCESSOR_ARCHITECTURE") == "AMD64" + or os.environ.get("PROCESSOR_ARCHITEW6432") == "AMD64" + ): + properties[0].append(["PreferredToolArchitecture", "x64"]) + + if spec.get("msvs_target_platform_version"): + target_platform_version = spec.get("msvs_target_platform_version") + properties[0].append(["WindowsTargetPlatformVersion", target_platform_version]) + if spec.get("msvs_target_platform_minversion"): + target_platform_minversion = spec.get("msvs_target_platform_minversion") + properties[0].append( + ["WindowsTargetPlatformMinVersion", target_platform_minversion] + ) + else: + properties[0].append( + ["WindowsTargetPlatformMinVersion", target_platform_version] + ) + + if spec.get("msvs_enable_winrt"): + properties[0].append(["DefaultLanguage", "en-US"]) + properties[0].append(["AppContainerApplication", "true"]) + if spec.get("msvs_application_type_revision"): + app_type_revision = spec.get("msvs_application_type_revision") + properties[0].append(["ApplicationTypeRevision", app_type_revision]) + else: + properties[0].append(["ApplicationTypeRevision", "8.1"]) + if spec.get("msvs_enable_winphone"): + properties[0].append(["ApplicationType", "Windows Phone"]) + else: + properties[0].append(["ApplicationType", "Windows Store"]) + + platform_name = None + msvs_windows_sdk_version = None + for configuration in spec["configurations"].values(): + platform_name = platform_name or _ConfigPlatform(configuration) + msvs_windows_sdk_version = ( + msvs_windows_sdk_version + or _ConfigWindowsTargetPlatformVersion(configuration, version) + ) + if platform_name and msvs_windows_sdk_version: + break + if msvs_windows_sdk_version: + properties[0].append( + ["WindowsTargetPlatformVersion", str(msvs_windows_sdk_version)] + ) + elif version.compatible_sdks: + raise GypError( + "%s requires any SDK of %s version, but none were found" + % (version.description, version.compatible_sdks) + ) + + if platform_name == "ARM": + properties[0].append(["WindowsSDKDesktopARMSupport", "true"]) + + return properties + + +def _GetMSBuildConfigurationDetails(spec, build_file): + properties = {} + for name, settings in spec["configurations"].items(): + msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file) + condition = _GetConfigurationCondition(name, settings, spec) + character_set = msbuild_attributes.get("CharacterSet") + config_type = msbuild_attributes.get("ConfigurationType") + _AddConditionalProperty(properties, condition, "ConfigurationType", config_type) + if config_type == "Driver": + _AddConditionalProperty(properties, condition, "DriverType", "WDM") + _AddConditionalProperty( + properties, condition, "TargetVersion", _ConfigTargetVersion(settings) + ) + if character_set: + if "msvs_enable_winrt" not in spec: + _AddConditionalProperty( + properties, condition, "CharacterSet", character_set + ) + return _GetMSBuildPropertyGroup(spec, "Configuration", properties) + + +def _GetMSBuildLocalProperties(msbuild_toolset): + # Currently the only local property we support is PlatformToolset + properties = {} + if msbuild_toolset: + properties = [ + [ + "PropertyGroup", + {"Label": "Locals"}, + ["PlatformToolset", msbuild_toolset], + ] + ] + return properties + + +def _GetMSBuildPropertySheets(configurations, spec): + user_props = r"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" + additional_props = {} + props_specified = False + for name, settings in sorted(configurations.items()): + configuration = _GetConfigurationCondition(name, settings, spec) + if "msbuild_props" in settings: + additional_props[configuration] = _FixPaths(settings["msbuild_props"]) + props_specified = True + else: + additional_props[configuration] = "" + + if not props_specified: + return [ + [ + "ImportGroup", + {"Label": "PropertySheets"}, + [ + "Import", + { + "Project": user_props, + "Condition": "exists('%s')" % user_props, + "Label": "LocalAppDataPlatform", + }, + ], + ] + ] + else: + sheets = [] + for condition, props in additional_props.items(): + import_group = [ + "ImportGroup", + {"Label": "PropertySheets", "Condition": condition}, + [ + "Import", + { + "Project": user_props, + "Condition": "exists('%s')" % user_props, + "Label": "LocalAppDataPlatform", + }, + ], + ] + for props_file in props: + import_group.append(["Import", {"Project": props_file}]) + sheets.append(import_group) + return sheets + + +def _ConvertMSVSBuildAttributes(spec, config, build_file): + config_type = _GetMSVSConfigurationType(spec, build_file) + msvs_attributes = _GetMSVSAttributes(spec, config, config_type) + msbuild_attributes = {} + for a in msvs_attributes: + if a in ["IntermediateDirectory", "OutputDirectory"]: + directory = MSVSSettings.ConvertVCMacrosToMSBuild(msvs_attributes[a]) + if not directory.endswith("\\"): + directory += "\\" + msbuild_attributes[a] = directory + elif a == "CharacterSet": + msbuild_attributes[a] = _ConvertMSVSCharacterSet(msvs_attributes[a]) + elif a == "ConfigurationType": + msbuild_attributes[a] = _ConvertMSVSConfigurationType(msvs_attributes[a]) + else: + print("Warning: Do not know how to convert MSVS attribute " + a) + return msbuild_attributes + + +def _ConvertMSVSCharacterSet(char_set): + if char_set.isdigit(): + char_set = {"0": "MultiByte", "1": "Unicode", "2": "MultiByte"}[char_set] + return char_set + + +def _ConvertMSVSConfigurationType(config_type): + if config_type.isdigit(): + config_type = { + "1": "Application", + "2": "DynamicLibrary", + "4": "StaticLibrary", + "5": "Driver", + "10": "Utility", + }[config_type] + return config_type + + +def _GetMSBuildAttributes(spec, config, build_file): + if "msbuild_configuration_attributes" not in config: + msbuild_attributes = _ConvertMSVSBuildAttributes(spec, config, build_file) + + else: + config_type = _GetMSVSConfigurationType(spec, build_file) + config_type = _ConvertMSVSConfigurationType(config_type) + msbuild_attributes = config.get("msbuild_configuration_attributes", {}) + msbuild_attributes.setdefault("ConfigurationType", config_type) + output_dir = msbuild_attributes.get( + "OutputDirectory", "$(SolutionDir)$(Configuration)" + ) + msbuild_attributes["OutputDirectory"] = _FixPath(output_dir) + "\\" + if "IntermediateDirectory" not in msbuild_attributes: + intermediate = _FixPath("$(Configuration)") + "\\" + msbuild_attributes["IntermediateDirectory"] = intermediate + if "CharacterSet" in msbuild_attributes: + msbuild_attributes["CharacterSet"] = _ConvertMSVSCharacterSet( + msbuild_attributes["CharacterSet"] + ) + if "TargetName" not in msbuild_attributes: + prefix = spec.get("product_prefix", "") + product_name = spec.get("product_name", "$(ProjectName)") + target_name = prefix + product_name + msbuild_attributes["TargetName"] = target_name + if "TargetExt" not in msbuild_attributes and "product_extension" in spec: + ext = spec.get("product_extension") + msbuild_attributes["TargetExt"] = "." + ext + + if spec.get("msvs_external_builder"): + external_out_dir = spec.get("msvs_external_builder_out_dir", ".") + msbuild_attributes["OutputDirectory"] = _FixPath(external_out_dir) + "\\" + + # Make sure that 'TargetPath' matches 'Lib.OutputFile' or 'Link.OutputFile' + # (depending on the tool used) to avoid MSB8012 warning. + msbuild_tool_map = { + "executable": "Link", + "shared_library": "Link", + "loadable_module": "Link", + "windows_driver": "Link", + "static_library": "Lib", + } + msbuild_tool = msbuild_tool_map.get(spec["type"]) + if msbuild_tool: + msbuild_settings = config["finalized_msbuild_settings"] + out_file = msbuild_settings[msbuild_tool].get("OutputFile") + if out_file: + msbuild_attributes["TargetPath"] = _FixPath(out_file) + target_ext = msbuild_settings[msbuild_tool].get("TargetExt") + if target_ext: + msbuild_attributes["TargetExt"] = target_ext + + return msbuild_attributes + + +def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file): + # TODO(jeanluc) We could optimize out the following and do it only if + # there are actions. + # TODO(jeanluc) Handle the equivalent of setting 'CYGWIN=nontsec'. + new_paths = [] + cygwin_dirs = spec.get("msvs_cygwin_dirs", ["."])[0] + if cygwin_dirs: + cyg_path = "$(MSBuildProjectDirectory)\\%s\\bin\\" % _FixPath(cygwin_dirs) + new_paths.append(cyg_path) + # TODO(jeanluc) Change the convention to have both a cygwin_dir and a + # python_dir. + python_path = cyg_path.replace("cygwin\\bin", "python_26") + new_paths.append(python_path) + if new_paths: + new_paths = "$(ExecutablePath);" + ";".join(new_paths) + + properties = {} + for (name, configuration) in sorted(configurations.items()): + condition = _GetConfigurationCondition(name, configuration, spec) + attributes = _GetMSBuildAttributes(spec, configuration, build_file) + msbuild_settings = configuration["finalized_msbuild_settings"] + _AddConditionalProperty( + properties, condition, "IntDir", attributes["IntermediateDirectory"] + ) + _AddConditionalProperty( + properties, condition, "OutDir", attributes["OutputDirectory"] + ) + _AddConditionalProperty( + properties, condition, "TargetName", attributes["TargetName"] + ) + if "TargetExt" in attributes: + _AddConditionalProperty( + properties, condition, "TargetExt", attributes["TargetExt"] + ) + + if attributes.get("TargetPath"): + _AddConditionalProperty( + properties, condition, "TargetPath", attributes["TargetPath"] + ) + if attributes.get("TargetExt"): + _AddConditionalProperty( + properties, condition, "TargetExt", attributes["TargetExt"] + ) + + if new_paths: + _AddConditionalProperty(properties, condition, "ExecutablePath", new_paths) + tool_settings = msbuild_settings.get("", {}) + for name, value in sorted(tool_settings.items()): + formatted_value = _GetValueFormattedForMSBuild("", name, value) + _AddConditionalProperty(properties, condition, name, formatted_value) + return _GetMSBuildPropertyGroup(spec, None, properties) + + +def _AddConditionalProperty(properties, condition, name, value): + """Adds a property / conditional value pair to a dictionary. + + Arguments: + properties: The dictionary to be modified. The key is the name of the + property. The value is itself a dictionary; its key is the value and + the value a list of condition for which this value is true. + condition: The condition under which the named property has the value. + name: The name of the property. + value: The value of the property. + """ + if name not in properties: + properties[name] = {} + values = properties[name] + if value not in values: + values[value] = [] + conditions = values[value] + conditions.append(condition) + + +# Regex for msvs variable references ( i.e. $(FOO) ). +MSVS_VARIABLE_REFERENCE = re.compile(r"\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)") + + +def _GetMSBuildPropertyGroup(spec, label, properties): + """Returns a PropertyGroup definition for the specified properties. + + Arguments: + spec: The target project dict. + label: An optional label for the PropertyGroup. + properties: The dictionary to be converted. The key is the name of the + property. The value is itself a dictionary; its key is the value and + the value a list of condition for which this value is true. + """ + group = ["PropertyGroup"] + if label: + group.append({"Label": label}) + num_configurations = len(spec["configurations"]) + + def GetEdges(node): + # Use a definition of edges such that user_of_variable -> used_varible. + # This happens to be easier in this case, since a variable's + # definition contains all variables it references in a single string. + edges = set() + for value in sorted(properties[node].keys()): + # Add to edges all $(...) references to variables. + # + # Variable references that refer to names not in properties are excluded + # These can exist for instance to refer built in definitions like + # $(SolutionDir). + # + # Self references are ignored. Self reference is used in a few places to + # append to the default value. I.e. PATH=$(PATH);other_path + edges.update( + { + v + for v in MSVS_VARIABLE_REFERENCE.findall(value) + if v in properties and v != node + } + ) + return edges + + properties_ordered = gyp.common.TopologicallySorted(properties.keys(), GetEdges) + # Walk properties in the reverse of a topological sort on + # user_of_variable -> used_variable as this ensures variables are + # defined before they are used. + # NOTE: reverse(topsort(DAG)) = topsort(reverse_edges(DAG)) + for name in reversed(properties_ordered): + values = properties[name] + for value, conditions in sorted(values.items()): + if len(conditions) == num_configurations: + # If the value is the same all configurations, + # just add one unconditional entry. + group.append([name, value]) + else: + for condition in conditions: + group.append([name, {"Condition": condition}, value]) + return [group] + + +def _GetMSBuildToolSettingsSections(spec, configurations): + groups = [] + for (name, configuration) in sorted(configurations.items()): + msbuild_settings = configuration["finalized_msbuild_settings"] + group = [ + "ItemDefinitionGroup", + {"Condition": _GetConfigurationCondition(name, configuration, spec)}, + ] + for tool_name, tool_settings in sorted(msbuild_settings.items()): + # Skip the tool named '' which is a holder of global settings handled + # by _GetMSBuildConfigurationGlobalProperties. + if tool_name: + if tool_settings: + tool = [tool_name] + for name, value in sorted(tool_settings.items()): + formatted_value = _GetValueFormattedForMSBuild( + tool_name, name, value + ) + tool.append([name, formatted_value]) + group.append(tool) + groups.append(group) + return groups + + +def _FinalizeMSBuildSettings(spec, configuration): + if "msbuild_settings" in configuration: + converted = False + msbuild_settings = configuration["msbuild_settings"] + MSVSSettings.ValidateMSBuildSettings(msbuild_settings) + else: + converted = True + msvs_settings = configuration.get("msvs_settings", {}) + msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(msvs_settings) + include_dirs, midl_include_dirs, resource_include_dirs = _GetIncludeDirs( + configuration + ) + libraries = _GetLibraries(spec) + library_dirs = _GetLibraryDirs(configuration) + out_file, _, msbuild_tool = _GetOutputFilePathAndTool(spec, msbuild=True) + target_ext = _GetOutputTargetExt(spec) + defines = _GetDefines(configuration) + if converted: + # Visual Studio 2010 has TR1 + defines = [d for d in defines if d != "_HAS_TR1=0"] + # Warn of ignored settings + ignored_settings = ["msvs_tool_files"] + for ignored_setting in ignored_settings: + value = configuration.get(ignored_setting) + if value: + print( + "Warning: The automatic conversion to MSBuild does not handle " + "%s. Ignoring setting of %s" % (ignored_setting, str(value)) + ) + + defines = [_EscapeCppDefineForMSBuild(d) for d in defines] + disabled_warnings = _GetDisabledWarnings(configuration) + prebuild = configuration.get("msvs_prebuild") + postbuild = configuration.get("msvs_postbuild") + def_file = _GetModuleDefinition(spec) + precompiled_header = configuration.get("msvs_precompiled_header") + + # Add the information to the appropriate tool + # TODO(jeanluc) We could optimize and generate these settings only if + # the corresponding files are found, e.g. don't generate ResourceCompile + # if you don't have any resources. + _ToolAppend( + msbuild_settings, "ClCompile", "AdditionalIncludeDirectories", include_dirs + ) + _ToolAppend( + msbuild_settings, "Midl", "AdditionalIncludeDirectories", midl_include_dirs + ) + _ToolAppend( + msbuild_settings, + "ResourceCompile", + "AdditionalIncludeDirectories", + resource_include_dirs, + ) + # Add in libraries, note that even for empty libraries, we want this + # set, to prevent inheriting default libraries from the environment. + _ToolSetOrAppend(msbuild_settings, "Link", "AdditionalDependencies", libraries) + _ToolAppend(msbuild_settings, "Link", "AdditionalLibraryDirectories", library_dirs) + if out_file: + _ToolAppend( + msbuild_settings, msbuild_tool, "OutputFile", out_file, only_if_unset=True + ) + if target_ext: + _ToolAppend( + msbuild_settings, msbuild_tool, "TargetExt", target_ext, only_if_unset=True + ) + # Add defines. + _ToolAppend(msbuild_settings, "ClCompile", "PreprocessorDefinitions", defines) + _ToolAppend(msbuild_settings, "ResourceCompile", "PreprocessorDefinitions", defines) + # Add disabled warnings. + _ToolAppend( + msbuild_settings, "ClCompile", "DisableSpecificWarnings", disabled_warnings + ) + # Turn on precompiled headers if appropriate. + if precompiled_header: + precompiled_header = os.path.split(precompiled_header)[1] + _ToolAppend(msbuild_settings, "ClCompile", "PrecompiledHeader", "Use") + _ToolAppend( + msbuild_settings, "ClCompile", "PrecompiledHeaderFile", precompiled_header + ) + _ToolAppend( + msbuild_settings, "ClCompile", "ForcedIncludeFiles", [precompiled_header] + ) + else: + _ToolAppend(msbuild_settings, "ClCompile", "PrecompiledHeader", "NotUsing") + # Turn off WinRT compilation + _ToolAppend(msbuild_settings, "ClCompile", "CompileAsWinRT", "false") + # Turn on import libraries if appropriate + if spec.get("msvs_requires_importlibrary"): + _ToolAppend(msbuild_settings, "", "IgnoreImportLibrary", "false") + # Loadable modules don't generate import libraries; + # tell dependent projects to not expect one. + if spec["type"] == "loadable_module": + _ToolAppend(msbuild_settings, "", "IgnoreImportLibrary", "true") + # Set the module definition file if any. + if def_file: + _ToolAppend(msbuild_settings, "Link", "ModuleDefinitionFile", def_file) + configuration["finalized_msbuild_settings"] = msbuild_settings + if prebuild: + _ToolAppend(msbuild_settings, "PreBuildEvent", "Command", prebuild) + if postbuild: + _ToolAppend(msbuild_settings, "PostBuildEvent", "Command", postbuild) + + +def _GetValueFormattedForMSBuild(tool_name, name, value): + if type(value) == list: + # For some settings, VS2010 does not automatically extends the settings + # TODO(jeanluc) Is this what we want? + if name in [ + "AdditionalIncludeDirectories", + "AdditionalLibraryDirectories", + "AdditionalOptions", + "DelayLoadDLLs", + "DisableSpecificWarnings", + "PreprocessorDefinitions", + ]: + value.append("%%(%s)" % name) + # For most tools, entries in a list should be separated with ';' but some + # settings use a space. Check for those first. + exceptions = { + "ClCompile": ["AdditionalOptions"], + "Link": ["AdditionalOptions"], + "Lib": ["AdditionalOptions"], + } + if tool_name in exceptions and name in exceptions[tool_name]: + char = " " + else: + char = ";" + formatted_value = char.join( + [MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in value] + ) + else: + formatted_value = MSVSSettings.ConvertVCMacrosToMSBuild(value) + return formatted_value + + +def _VerifySourcesExist(sources, root_dir): + """Verifies that all source files exist on disk. + + Checks that all regular source files, i.e. not created at run time, + exist on disk. Missing files cause needless recompilation but no otherwise + visible errors. + + Arguments: + sources: A recursive list of Filter/file names. + root_dir: The root directory for the relative path names. + Returns: + A list of source files that cannot be found on disk. + """ + missing_sources = [] + for source in sources: + if isinstance(source, MSVSProject.Filter): + missing_sources.extend(_VerifySourcesExist(source.contents, root_dir)) + else: + if "$" not in source: + full_path = os.path.join(root_dir, source) + if not os.path.exists(full_path): + missing_sources.append(full_path) + return missing_sources + + +def _GetMSBuildSources( + spec, + sources, + exclusions, + rule_dependencies, + extension_to_rule_name, + actions_spec, + sources_handled_by_action, + list_excluded, +): + groups = [ + "none", + "masm", + "midl", + "include", + "compile", + "resource", + "rule", + "rule_dependency", + ] + grouped_sources = {} + for g in groups: + grouped_sources[g] = [] + + _AddSources2( + spec, + sources, + exclusions, + grouped_sources, + rule_dependencies, + extension_to_rule_name, + sources_handled_by_action, + list_excluded, + ) + sources = [] + for g in groups: + if grouped_sources[g]: + sources.append(["ItemGroup"] + grouped_sources[g]) + if actions_spec: + sources.append(["ItemGroup"] + actions_spec) + return sources + + +def _AddSources2( + spec, + sources, + exclusions, + grouped_sources, + rule_dependencies, + extension_to_rule_name, + sources_handled_by_action, + list_excluded, +): + extensions_excluded_from_precompile = [] + for source in sources: + if isinstance(source, MSVSProject.Filter): + _AddSources2( + spec, + source.contents, + exclusions, + grouped_sources, + rule_dependencies, + extension_to_rule_name, + sources_handled_by_action, + list_excluded, + ) + else: + if source not in sources_handled_by_action: + detail = [] + excluded_configurations = exclusions.get(source, []) + if len(excluded_configurations) == len(spec["configurations"]): + detail.append(["ExcludedFromBuild", "true"]) + else: + for config_name, configuration in sorted(excluded_configurations): + condition = _GetConfigurationCondition( + config_name, configuration + ) + detail.append( + ["ExcludedFromBuild", {"Condition": condition}, "true"] + ) + # Add precompile if needed + for config_name, configuration in spec["configurations"].items(): + precompiled_source = configuration.get( + "msvs_precompiled_source", "" + ) + if precompiled_source != "": + precompiled_source = _FixPath(precompiled_source) + if not extensions_excluded_from_precompile: + # If the precompiled header is generated by a C source, + # we must not try to use it for C++ sources, + # and vice versa. + basename, extension = os.path.splitext(precompiled_source) + if extension == ".c": + extensions_excluded_from_precompile = [ + ".cc", + ".cpp", + ".cxx", + ] + else: + extensions_excluded_from_precompile = [".c"] + + if precompiled_source == source: + condition = _GetConfigurationCondition( + config_name, configuration, spec + ) + detail.append( + ["PrecompiledHeader", {"Condition": condition}, "Create"] + ) + else: + # Turn off precompiled header usage for source files of a + # different type than the file that generated the + # precompiled header. + for extension in extensions_excluded_from_precompile: + if source.endswith(extension): + detail.append(["PrecompiledHeader", ""]) + detail.append(["ForcedIncludeFiles", ""]) + + group, element = _MapFileToMsBuildSourceType( + source, + rule_dependencies, + extension_to_rule_name, + _GetUniquePlatforms(spec), + spec["toolset"], + ) + if group == "compile" and not os.path.isabs(source): + # Add an value to support duplicate source + # file basenames, except for absolute paths to avoid paths + # with more than 260 characters. + file_name = os.path.splitext(source)[0] + ".obj" + if file_name.startswith("..\\"): + file_name = re.sub(r"^(\.\.\\)+", "", file_name) + elif file_name.startswith("$("): + file_name = re.sub(r"^\$\([^)]+\)\\", "", file_name) + detail.append(["ObjectFileName", "$(IntDir)\\" + file_name]) + grouped_sources[group].append([element, {"Include": source}] + detail) + + +def _GetMSBuildProjectReferences(project): + references = [] + if project.dependencies: + group = ["ItemGroup"] + added_dependency_set = set() + for dependency in project.dependencies: + dependency_spec = dependency.spec + should_skip_dep = False + if project.spec["toolset"] == "target": + if dependency_spec["toolset"] == "host": + if dependency_spec["type"] == "static_library": + should_skip_dep = True + if dependency.name.startswith("run_"): + should_skip_dep = False + if should_skip_dep: + continue + + canonical_name = dependency.name.replace("_host", "") + added_dependency_set.add(canonical_name) + guid = dependency.guid + project_dir = os.path.split(project.path)[0] + relative_path = gyp.common.RelativePath(dependency.path, project_dir) + project_ref = [ + "ProjectReference", + {"Include": relative_path}, + ["Project", guid], + ["ReferenceOutputAssembly", "false"], + ] + for config in dependency.spec.get("configurations", {}).values(): + if config.get("msvs_use_library_dependency_inputs", 0): + project_ref.append(["UseLibraryDependencyInputs", "true"]) + break + # If it's disabled in any config, turn it off in the reference. + if config.get("msvs_2010_disable_uldi_when_referenced", 0): + project_ref.append(["UseLibraryDependencyInputs", "false"]) + break + group.append(project_ref) + references.append(group) + return references + + +def _GenerateMSBuildProject(project, options, version, generator_flags, spec): + spec = project.spec + configurations = spec["configurations"] + toolset = spec["toolset"] + project_dir, project_file_name = os.path.split(project.path) + gyp.common.EnsureDirExists(project.path) + # Prepare list of sources and excluded sources. + + gyp_file = os.path.split(project.build_file)[1] + sources, excluded_sources = _PrepareListOfSources(spec, generator_flags, gyp_file) + # Add rules. + actions_to_add = {} + props_files_of_rules = set() + targets_files_of_rules = set() + rule_dependencies = set() + extension_to_rule_name = {} + list_excluded = generator_flags.get("msvs_list_excluded_files", True) + platforms = _GetUniquePlatforms(spec) + + # Don't generate rules if we are using an external builder like ninja. + if not spec.get("msvs_external_builder"): + _GenerateRulesForMSBuild( + project_dir, + options, + spec, + sources, + excluded_sources, + props_files_of_rules, + targets_files_of_rules, + actions_to_add, + rule_dependencies, + extension_to_rule_name, + ) + else: + rules = spec.get("rules", []) + _AdjustSourcesForRules(rules, sources, excluded_sources, True) + + sources, excluded_sources, excluded_idl = _AdjustSourcesAndConvertToFilterHierarchy( + spec, options, project_dir, sources, excluded_sources, list_excluded, version + ) + + # Don't add actions if we are using an external builder like ninja. + if not spec.get("msvs_external_builder"): + _AddActions(actions_to_add, spec, project.build_file) + _AddCopies(actions_to_add, spec) + + # NOTE: this stanza must appear after all actions have been decided. + # Don't excluded sources with actions attached, or they won't run. + excluded_sources = _FilterActionsFromExcluded(excluded_sources, actions_to_add) + + exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl) + actions_spec, sources_handled_by_action = _GenerateActionsForMSBuild( + spec, actions_to_add + ) + + _GenerateMSBuildFiltersFile( + project.path + ".filters", + sources, + rule_dependencies, + extension_to_rule_name, + platforms, + toolset, + ) + missing_sources = _VerifySourcesExist(sources, project_dir) + + for configuration in configurations.values(): + _FinalizeMSBuildSettings(spec, configuration) + + # Add attributes to root element + + import_default_section = [ + ["Import", {"Project": r"$(VCTargetsPath)\Microsoft.Cpp.Default.props"}] + ] + import_cpp_props_section = [ + ["Import", {"Project": r"$(VCTargetsPath)\Microsoft.Cpp.props"}] + ] + import_cpp_targets_section = [ + ["Import", {"Project": r"$(VCTargetsPath)\Microsoft.Cpp.targets"}] + ] + import_masm_props_section = [ + ["Import", {"Project": r"$(VCTargetsPath)\BuildCustomizations\masm.props"}] + ] + import_masm_targets_section = [ + ["Import", {"Project": r"$(VCTargetsPath)\BuildCustomizations\masm.targets"}] + ] + import_marmasm_props_section = [ + ["Import", {"Project": r"$(VCTargetsPath)\BuildCustomizations\marmasm.props"}] + ] + import_marmasm_targets_section = [ + ["Import", {"Project": r"$(VCTargetsPath)\BuildCustomizations\marmasm.targets"}] + ] + macro_section = [["PropertyGroup", {"Label": "UserMacros"}]] + + content = [ + "Project", + { + "xmlns": "http://schemas.microsoft.com/developer/msbuild/2003", + "ToolsVersion": version.ProjectVersion(), + "DefaultTargets": "Build", + }, + ] + + content += _GetMSBuildProjectConfigurations(configurations, spec) + content += _GetMSBuildGlobalProperties( + spec, version, project.guid, project_file_name + ) + content += import_default_section + content += _GetMSBuildConfigurationDetails(spec, project.build_file) + if spec.get("msvs_enable_winphone"): + content += _GetMSBuildLocalProperties("v120_wp81") + else: + content += _GetMSBuildLocalProperties(project.msbuild_toolset) + content += import_cpp_props_section + content += import_masm_props_section + if "arm64" in platforms and toolset == "target": + content += import_marmasm_props_section + content += _GetMSBuildExtensions(props_files_of_rules) + content += _GetMSBuildPropertySheets(configurations, spec) + content += macro_section + content += _GetMSBuildConfigurationGlobalProperties( + spec, configurations, project.build_file + ) + content += _GetMSBuildToolSettingsSections(spec, configurations) + content += _GetMSBuildSources( + spec, + sources, + exclusions, + rule_dependencies, + extension_to_rule_name, + actions_spec, + sources_handled_by_action, + list_excluded, + ) + content += _GetMSBuildProjectReferences(project) + content += import_cpp_targets_section + content += import_masm_targets_section + if "arm64" in platforms and toolset == "target": + content += import_marmasm_targets_section + content += _GetMSBuildExtensionTargets(targets_files_of_rules) + + if spec.get("msvs_external_builder"): + content += _GetMSBuildExternalBuilderTargets(spec) + + # TODO(jeanluc) File a bug to get rid of runas. We had in MSVS: + # has_run_as = _WriteMSVSUserFile(project.path, version, spec) + + easy_xml.WriteXmlIfChanged(content, project.path, pretty=True, win32=True) + + return missing_sources + + +def _GetMSBuildExternalBuilderTargets(spec): + """Return a list of MSBuild targets for external builders. + + The "Build" and "Clean" targets are always generated. If the spec contains + 'msvs_external_builder_clcompile_cmd', then the "ClCompile" target will also + be generated, to support building selected C/C++ files. + + Arguments: + spec: The gyp target spec. + Returns: + List of MSBuild 'Target' specs. + """ + build_cmd = _BuildCommandLineForRuleRaw( + spec, spec["msvs_external_builder_build_cmd"], False, False, False, False + ) + build_target = ["Target", {"Name": "Build"}] + build_target.append(["Exec", {"Command": build_cmd}]) + + clean_cmd = _BuildCommandLineForRuleRaw( + spec, spec["msvs_external_builder_clean_cmd"], False, False, False, False + ) + clean_target = ["Target", {"Name": "Clean"}] + clean_target.append(["Exec", {"Command": clean_cmd}]) + + targets = [build_target, clean_target] + + if spec.get("msvs_external_builder_clcompile_cmd"): + clcompile_cmd = _BuildCommandLineForRuleRaw( + spec, + spec["msvs_external_builder_clcompile_cmd"], + False, + False, + False, + False, + ) + clcompile_target = ["Target", {"Name": "ClCompile"}] + clcompile_target.append(["Exec", {"Command": clcompile_cmd}]) + targets.append(clcompile_target) + + return targets + + +def _GetMSBuildExtensions(props_files_of_rules): + extensions = ["ImportGroup", {"Label": "ExtensionSettings"}] + for props_file in props_files_of_rules: + extensions.append(["Import", {"Project": props_file}]) + return [extensions] + + +def _GetMSBuildExtensionTargets(targets_files_of_rules): + targets_node = ["ImportGroup", {"Label": "ExtensionTargets"}] + for targets_file in sorted(targets_files_of_rules): + targets_node.append(["Import", {"Project": targets_file}]) + return [targets_node] + + +def _GenerateActionsForMSBuild(spec, actions_to_add): + """Add actions accumulated into an actions_to_add, merging as needed. + + Arguments: + spec: the target project dict + actions_to_add: dictionary keyed on input name, which maps to a list of + dicts describing the actions attached to that input file. + + Returns: + A pair of (action specification, the sources handled by this action). + """ + sources_handled_by_action = OrderedSet() + actions_spec = [] + for primary_input, actions in actions_to_add.items(): + if generator_supports_multiple_toolsets: + primary_input = primary_input.replace(".exe", "_host.exe") + inputs = OrderedSet() + outputs = OrderedSet() + descriptions = [] + commands = [] + for action in actions: + + def fixup_host_exe(i): + if "$(OutDir)" in i: + i = i.replace(".exe", "_host.exe") + return i + + if generator_supports_multiple_toolsets: + action["inputs"] = [fixup_host_exe(i) for i in action["inputs"]] + inputs.update(OrderedSet(action["inputs"])) + outputs.update(OrderedSet(action["outputs"])) + descriptions.append(action["description"]) + cmd = action["command"] + if generator_supports_multiple_toolsets: + cmd = cmd.replace(".exe", "_host.exe") + # For most actions, add 'call' so that actions that invoke batch files + # return and continue executing. msbuild_use_call provides a way to + # disable this but I have not seen any adverse effect from doing that + # for everything. + if action.get("msbuild_use_call", True): + cmd = "call " + cmd + commands.append(cmd) + # Add the custom build action for one input file. + description = ", and also ".join(descriptions) + + # We can't join the commands simply with && because the command line will + # get too long. See also _AddActions: cygwin's setup_env mustn't be called + # for every invocation or the command that sets the PATH will grow too + # long. + command = "\r\n".join( + [c + "\r\nif %errorlevel% neq 0 exit /b %errorlevel%" for c in commands] + ) + _AddMSBuildAction( + spec, + primary_input, + inputs, + outputs, + command, + description, + sources_handled_by_action, + actions_spec, + ) + return actions_spec, sources_handled_by_action + + +def _AddMSBuildAction( + spec, + primary_input, + inputs, + outputs, + cmd, + description, + sources_handled_by_action, + actions_spec, +): + command = MSVSSettings.ConvertVCMacrosToMSBuild(cmd) + primary_input = _FixPath(primary_input) + inputs_array = _FixPaths(inputs) + outputs_array = _FixPaths(outputs) + additional_inputs = ";".join([i for i in inputs_array if i != primary_input]) + outputs = ";".join(outputs_array) + sources_handled_by_action.add(primary_input) + action_spec = ["CustomBuild", {"Include": primary_input}] + action_spec.extend( + # TODO(jeanluc) 'Document' for all or just if as_sources? + [ + ["FileType", "Document"], + ["Command", command], + ["Message", description], + ["Outputs", outputs], + ] + ) + if additional_inputs: + action_spec.append(["AdditionalInputs", additional_inputs]) + actions_spec.append(action_spec) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py new file mode 100755 index 0000000000000..e80b57f06a130 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Unit tests for the msvs.py file. """ + +import gyp.generator.msvs as msvs +import unittest + +from io import StringIO + + +class TestSequenceFunctions(unittest.TestCase): + def setUp(self): + self.stderr = StringIO() + + def test_GetLibraries(self): + self.assertEqual(msvs._GetLibraries({}), []) + self.assertEqual(msvs._GetLibraries({"libraries": []}), []) + self.assertEqual( + msvs._GetLibraries({"other": "foo", "libraries": ["a.lib"]}), ["a.lib"] + ) + self.assertEqual(msvs._GetLibraries({"libraries": ["-la"]}), ["a.lib"]) + self.assertEqual( + msvs._GetLibraries( + { + "libraries": [ + "a.lib", + "b.lib", + "c.lib", + "-lb.lib", + "-lb.lib", + "d.lib", + "a.lib", + ] + } + ), + ["c.lib", "b.lib", "d.lib", "a.lib"], + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py new file mode 100644 index 0000000000000..ca04ee13a1c1b --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py @@ -0,0 +1,2936 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +import collections +import copy +import hashlib +import json +import multiprocessing +import os.path +import re +import signal +import subprocess +import sys +import gyp +import gyp.common +import gyp.msvs_emulation +import gyp.MSVSUtil as MSVSUtil +import gyp.xcode_emulation + +from io import StringIO + +from gyp.common import GetEnvironFallback +import gyp.ninja_syntax as ninja_syntax + +generator_default_variables = { + "EXECUTABLE_PREFIX": "", + "EXECUTABLE_SUFFIX": "", + "STATIC_LIB_PREFIX": "lib", + "STATIC_LIB_SUFFIX": ".a", + "SHARED_LIB_PREFIX": "lib", + # Gyp expects the following variables to be expandable by the build + # system to the appropriate locations. Ninja prefers paths to be + # known at gyp time. To resolve this, introduce special + # variables starting with $! and $| (which begin with a $ so gyp knows it + # should be treated specially, but is otherwise an invalid + # ninja/shell variable) that are passed to gyp here but expanded + # before writing out into the target .ninja files; see + # ExpandSpecial. + # $! is used for variables that represent a path and that can only appear at + # the start of a string, while $| is used for variables that can appear + # anywhere in a string. + "INTERMEDIATE_DIR": "$!INTERMEDIATE_DIR", + "SHARED_INTERMEDIATE_DIR": "$!PRODUCT_DIR/gen", + "PRODUCT_DIR": "$!PRODUCT_DIR", + "CONFIGURATION_NAME": "$|CONFIGURATION_NAME", + # Special variables that may be used by gyp 'rule' targets. + # We generate definitions for these variables on the fly when processing a + # rule. + "RULE_INPUT_ROOT": "${root}", + "RULE_INPUT_DIRNAME": "${dirname}", + "RULE_INPUT_PATH": "${source}", + "RULE_INPUT_EXT": "${ext}", + "RULE_INPUT_NAME": "${name}", +} + +# Placates pylint. +generator_additional_non_configuration_keys = [] +generator_additional_path_sections = [] +generator_extra_sources_for_rules = [] +generator_filelist_paths = None + +generator_supports_multiple_toolsets = gyp.common.CrossCompileRequested() + + +def StripPrefix(arg, prefix): + if arg.startswith(prefix): + return arg[len(prefix) :] + return arg + + +def QuoteShellArgument(arg, flavor): + """Quote a string such that it will be interpreted as a single argument + by the shell.""" + # Rather than attempting to enumerate the bad shell characters, just + # allow common OK ones and quote anything else. + if re.match(r"^[a-zA-Z0-9_=.\\/-]+$", arg): + return arg # No quoting necessary. + if flavor == "win": + return gyp.msvs_emulation.QuoteForRspFile(arg) + return "'" + arg.replace("'", "'" + '"\'"' + "'") + "'" + + +def Define(d, flavor): + """Takes a preprocessor define and returns a -D parameter that's ninja- and + shell-escaped.""" + if flavor == "win": + # cl.exe replaces literal # characters with = in preprocessor definitions for + # some reason. Octal-encode to work around that. + d = d.replace("#", "\\%03o" % ord("#")) + return QuoteShellArgument(ninja_syntax.escape("-D" + d), flavor) + + +def AddArch(output, arch): + """Adds an arch string to an output path.""" + output, extension = os.path.splitext(output) + return f"{output}.{arch}{extension}" + + +class Target: + """Target represents the paths used within a single gyp target. + + Conceptually, building a single target A is a series of steps: + + 1) actions/rules/copies generates source/resources/etc. + 2) compiles generates .o files + 3) link generates a binary (library/executable) + 4) bundle merges the above in a mac bundle + + (Any of these steps can be optional.) + + From a build ordering perspective, a dependent target B could just + depend on the last output of this series of steps. + + But some dependent commands sometimes need to reach inside the box. + For example, when linking B it needs to get the path to the static + library generated by A. + + This object stores those paths. To keep things simple, member + variables only store concrete paths to single files, while methods + compute derived values like "the last output of the target". + """ + + def __init__(self, type): + # Gyp type ("static_library", etc.) of this target. + self.type = type + # File representing whether any input dependencies necessary for + # dependent actions have completed. + self.preaction_stamp = None + # File representing whether any input dependencies necessary for + # dependent compiles have completed. + self.precompile_stamp = None + # File representing the completion of actions/rules/copies, if any. + self.actions_stamp = None + # Path to the output of the link step, if any. + self.binary = None + # Path to the file representing the completion of building the bundle, + # if any. + self.bundle = None + # On Windows, incremental linking requires linking against all the .objs + # that compose a .lib (rather than the .lib itself). That list is stored + # here. In this case, we also need to save the compile_deps for the target, + # so that the target that directly depends on the .objs can also depend + # on those. + self.component_objs = None + self.compile_deps = None + # Windows only. The import .lib is the output of a build step, but + # because dependents only link against the lib (not both the lib and the + # dll) we keep track of the import library here. + self.import_lib = None + # Track if this target contains any C++ files, to decide if gcc or g++ + # should be used for linking. + self.uses_cpp = False + + def Linkable(self): + """Return true if this is a target that can be linked against.""" + return self.type in ("static_library", "shared_library") + + def UsesToc(self, flavor): + """Return true if the target should produce a restat rule based on a TOC + file.""" + # For bundles, the .TOC should be produced for the binary, not for + # FinalOutput(). But the naive approach would put the TOC file into the + # bundle, so don't do this for bundles for now. + if flavor == "win" or self.bundle: + return False + return self.type in ("shared_library", "loadable_module") + + def PreActionInput(self, flavor): + """Return the path, if any, that should be used as a dependency of + any dependent action step.""" + if self.UsesToc(flavor): + return self.FinalOutput() + ".TOC" + return self.FinalOutput() or self.preaction_stamp + + def PreCompileInput(self): + """Return the path, if any, that should be used as a dependency of + any dependent compile step.""" + return self.actions_stamp or self.precompile_stamp + + def FinalOutput(self): + """Return the last output of the target, which depends on all prior + steps.""" + return self.bundle or self.binary or self.actions_stamp + + +# A small discourse on paths as used within the Ninja build: +# All files we produce (both at gyp and at build time) appear in the +# build directory (e.g. out/Debug). +# +# Paths within a given .gyp file are always relative to the directory +# containing the .gyp file. Call these "gyp paths". This includes +# sources as well as the starting directory a given gyp rule/action +# expects to be run from. We call the path from the source root to +# the gyp file the "base directory" within the per-.gyp-file +# NinjaWriter code. +# +# All paths as written into the .ninja files are relative to the build +# directory. Call these paths "ninja paths". +# +# We translate between these two notions of paths with two helper +# functions: +# +# - GypPathToNinja translates a gyp path (i.e. relative to the .gyp file) +# into the equivalent ninja path. +# +# - GypPathToUniqueOutput translates a gyp path into a ninja path to write +# an output file; the result can be namespaced such that it is unique +# to the input file name as well as the output target name. + + +class NinjaWriter: + def __init__( + self, + hash_for_rules, + target_outputs, + base_dir, + build_dir, + output_file, + toplevel_build, + output_file_name, + flavor, + toplevel_dir=None, + ): + """ + base_dir: path from source root to directory containing this gyp file, + by gyp semantics, all input paths are relative to this + build_dir: path from source root to build output + toplevel_dir: path to the toplevel directory + """ + + self.hash_for_rules = hash_for_rules + self.target_outputs = target_outputs + self.base_dir = base_dir + self.build_dir = build_dir + self.ninja = ninja_syntax.Writer(output_file) + self.toplevel_build = toplevel_build + self.output_file_name = output_file_name + + self.flavor = flavor + self.abs_build_dir = None + if toplevel_dir is not None: + self.abs_build_dir = os.path.abspath(os.path.join(toplevel_dir, build_dir)) + self.obj_ext = ".obj" if flavor == "win" else ".o" + if flavor == "win": + # See docstring of msvs_emulation.GenerateEnvironmentFiles(). + self.win_env = {} + for arch in ("x86", "x64"): + self.win_env[arch] = "environment." + arch + + # Relative path from build output dir to base dir. + build_to_top = gyp.common.InvertRelativePath(build_dir, toplevel_dir) + self.build_to_base = os.path.join(build_to_top, base_dir) + # Relative path from base dir to build dir. + base_to_top = gyp.common.InvertRelativePath(base_dir, toplevel_dir) + self.base_to_build = os.path.join(base_to_top, build_dir) + + def ExpandSpecial(self, path, product_dir=None): + """Expand specials like $!PRODUCT_DIR in |path|. + + If |product_dir| is None, assumes the cwd is already the product + dir. Otherwise, |product_dir| is the relative path to the product + dir. + """ + + PRODUCT_DIR = "$!PRODUCT_DIR" + if PRODUCT_DIR in path: + if product_dir: + path = path.replace(PRODUCT_DIR, product_dir) + else: + path = path.replace(PRODUCT_DIR + "/", "") + path = path.replace(PRODUCT_DIR + "\\", "") + path = path.replace(PRODUCT_DIR, ".") + + INTERMEDIATE_DIR = "$!INTERMEDIATE_DIR" + if INTERMEDIATE_DIR in path: + int_dir = self.GypPathToUniqueOutput("gen") + # GypPathToUniqueOutput generates a path relative to the product dir, + # so insert product_dir in front if it is provided. + path = path.replace( + INTERMEDIATE_DIR, os.path.join(product_dir or "", int_dir) + ) + + CONFIGURATION_NAME = "$|CONFIGURATION_NAME" + path = path.replace(CONFIGURATION_NAME, self.config_name) + + return path + + def ExpandRuleVariables(self, path, root, dirname, source, ext, name): + if self.flavor == "win": + path = self.msvs_settings.ConvertVSMacros(path, config=self.config_name) + path = path.replace(generator_default_variables["RULE_INPUT_ROOT"], root) + path = path.replace(generator_default_variables["RULE_INPUT_DIRNAME"], dirname) + path = path.replace(generator_default_variables["RULE_INPUT_PATH"], source) + path = path.replace(generator_default_variables["RULE_INPUT_EXT"], ext) + path = path.replace(generator_default_variables["RULE_INPUT_NAME"], name) + return path + + def GypPathToNinja(self, path, env=None): + """Translate a gyp path to a ninja path, optionally expanding environment + variable references in |path| with |env|. + + See the above discourse on path conversions.""" + if env: + if self.flavor == "mac": + path = gyp.xcode_emulation.ExpandEnvVars(path, env) + elif self.flavor == "win": + path = gyp.msvs_emulation.ExpandMacros(path, env) + if path.startswith("$!"): + expanded = self.ExpandSpecial(path) + if self.flavor == "win": + expanded = os.path.normpath(expanded) + return expanded + if "$|" in path: + path = self.ExpandSpecial(path) + assert "$" not in path, path + return os.path.normpath(os.path.join(self.build_to_base, path)) + + def GypPathToUniqueOutput(self, path, qualified=True): + """Translate a gyp path to a ninja path for writing output. + + If qualified is True, qualify the resulting filename with the name + of the target. This is necessary when e.g. compiling the same + path twice for two separate output targets. + + See the above discourse on path conversions.""" + + path = self.ExpandSpecial(path) + assert not path.startswith("$"), path + + # Translate the path following this scheme: + # Input: foo/bar.gyp, target targ, references baz/out.o + # Output: obj/foo/baz/targ.out.o (if qualified) + # obj/foo/baz/out.o (otherwise) + # (and obj.host instead of obj for cross-compiles) + # + # Why this scheme and not some other one? + # 1) for a given input, you can compute all derived outputs by matching + # its path, even if the input is brought via a gyp file with '..'. + # 2) simple files like libraries and stamps have a simple filename. + + obj = "obj" + if self.toolset != "target": + obj += "." + self.toolset + + path_dir, path_basename = os.path.split(path) + assert not os.path.isabs(path_dir), ( + "'%s' can not be absolute path (see crbug.com/462153)." % path_dir + ) + + if qualified: + path_basename = self.name + "." + path_basename + return os.path.normpath( + os.path.join(obj, self.base_dir, path_dir, path_basename) + ) + + def WriteCollapsedDependencies(self, name, targets, order_only=None): + """Given a list of targets, return a path for a single file + representing the result of building all the targets or None. + + Uses a stamp file if necessary.""" + + assert targets == [item for item in targets if item], targets + if len(targets) == 0: + assert not order_only + return None + if len(targets) > 1 or order_only: + stamp = self.GypPathToUniqueOutput(name + ".stamp") + targets = self.ninja.build(stamp, "stamp", targets, order_only=order_only) + self.ninja.newline() + return targets[0] + + def _SubninjaNameForArch(self, arch): + output_file_base = os.path.splitext(self.output_file_name)[0] + return f"{output_file_base}.{arch}.ninja" + + def WriteSpec(self, spec, config_name, generator_flags): + """The main entry point for NinjaWriter: write the build rules for a spec. + + Returns a Target object, which represents the output paths for this spec. + Returns None if there are no outputs (e.g. a settings-only 'none' type + target).""" + + self.config_name = config_name + self.name = spec["target_name"] + self.toolset = spec["toolset"] + config = spec["configurations"][config_name] + self.target = Target(spec["type"]) + self.is_standalone_static_library = bool( + spec.get("standalone_static_library", 0) + ) + + self.target_rpath = generator_flags.get("target_rpath", r"\$$ORIGIN/lib/") + + self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) + self.xcode_settings = self.msvs_settings = None + if self.flavor == "mac": + self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) + mac_toolchain_dir = generator_flags.get("mac_toolchain_dir", None) + if mac_toolchain_dir: + self.xcode_settings.mac_toolchain_dir = mac_toolchain_dir + + if self.flavor == "win": + self.msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, generator_flags) + arch = self.msvs_settings.GetArch(config_name) + self.ninja.variable("arch", self.win_env[arch]) + self.ninja.variable("cc", "$cl_" + arch) + self.ninja.variable("cxx", "$cl_" + arch) + self.ninja.variable("cc_host", "$cl_" + arch) + self.ninja.variable("cxx_host", "$cl_" + arch) + self.ninja.variable("asm", "$ml_" + arch) + + if self.flavor == "mac": + self.archs = self.xcode_settings.GetActiveArchs(config_name) + if len(self.archs) > 1: + self.arch_subninjas = { + arch: ninja_syntax.Writer( + OpenOutput( + os.path.join( + self.toplevel_build, self._SubninjaNameForArch(arch) + ), + "w", + ) + ) + for arch in self.archs + } + + # Compute predepends for all rules. + # actions_depends is the dependencies this target depends on before running + # any of its action/rule/copy steps. + # compile_depends is the dependencies this target depends on before running + # any of its compile steps. + actions_depends = [] + compile_depends = [] + # TODO(evan): it is rather confusing which things are lists and which + # are strings. Fix these. + if "dependencies" in spec: + for dep in spec["dependencies"]: + if dep in self.target_outputs: + target = self.target_outputs[dep] + actions_depends.append(target.PreActionInput(self.flavor)) + compile_depends.append(target.PreCompileInput()) + if target.uses_cpp: + self.target.uses_cpp = True + actions_depends = [item for item in actions_depends if item] + compile_depends = [item for item in compile_depends if item] + actions_depends = self.WriteCollapsedDependencies( + "actions_depends", actions_depends + ) + compile_depends = self.WriteCollapsedDependencies( + "compile_depends", compile_depends + ) + self.target.preaction_stamp = actions_depends + self.target.precompile_stamp = compile_depends + + # Write out actions, rules, and copies. These must happen before we + # compile any sources, so compute a list of predependencies for sources + # while we do it. + extra_sources = [] + mac_bundle_depends = [] + self.target.actions_stamp = self.WriteActionsRulesCopies( + spec, extra_sources, actions_depends, mac_bundle_depends + ) + + # If we have actions/rules/copies, we depend directly on those, but + # otherwise we depend on dependent target's actions/rules/copies etc. + # We never need to explicitly depend on previous target's link steps, + # because no compile ever depends on them. + compile_depends_stamp = self.target.actions_stamp or compile_depends + + # Write out the compilation steps, if any. + link_deps = [] + try: + sources = extra_sources + spec.get("sources", []) + except TypeError: + print("extra_sources: ", str(extra_sources)) + print('spec.get("sources"): ', str(spec.get("sources"))) + raise + if sources: + if self.flavor == "mac" and len(self.archs) > 1: + # Write subninja file containing compile and link commands scoped to + # a single arch if a fat binary is being built. + for arch in self.archs: + self.ninja.subninja(self._SubninjaNameForArch(arch)) + + pch = None + if self.flavor == "win": + gyp.msvs_emulation.VerifyMissingSources( + sources, self.abs_build_dir, generator_flags, self.GypPathToNinja + ) + pch = gyp.msvs_emulation.PrecompiledHeader( + self.msvs_settings, + config_name, + self.GypPathToNinja, + self.GypPathToUniqueOutput, + self.obj_ext, + ) + else: + pch = gyp.xcode_emulation.MacPrefixHeader( + self.xcode_settings, + self.GypPathToNinja, + lambda path, lang: self.GypPathToUniqueOutput(path + "-" + lang), + ) + link_deps = self.WriteSources( + self.ninja, + config_name, + config, + sources, + compile_depends_stamp, + pch, + spec, + ) + # Some actions/rules output 'sources' that are already object files. + obj_outputs = [f for f in sources if f.endswith(self.obj_ext)] + if obj_outputs: + if self.flavor != "mac" or len(self.archs) == 1: + link_deps += [self.GypPathToNinja(o) for o in obj_outputs] + else: + print( + "Warning: Actions/rules writing object files don't work with " + "multiarch targets, dropping. (target %s)" % spec["target_name"] + ) + elif self.flavor == "mac" and len(self.archs) > 1: + link_deps = collections.defaultdict(list) + + compile_deps = self.target.actions_stamp or actions_depends + if self.flavor == "win" and self.target.type == "static_library": + self.target.component_objs = link_deps + self.target.compile_deps = compile_deps + + # Write out a link step, if needed. + output = None + is_empty_bundle = not link_deps and not mac_bundle_depends + if link_deps or self.target.actions_stamp or actions_depends: + output = self.WriteTarget( + spec, config_name, config, link_deps, compile_deps + ) + if self.is_mac_bundle: + mac_bundle_depends.append(output) + + # Bundle all of the above together, if needed. + if self.is_mac_bundle: + output = self.WriteMacBundle(spec, mac_bundle_depends, is_empty_bundle) + + if not output: + return None + + assert self.target.FinalOutput(), output + return self.target + + def _WinIdlRule(self, source, prebuild, outputs): + """Handle the implicit VS .idl rule for one source file. Fills |outputs| + with files that are generated.""" + outdir, output, vars, flags = self.msvs_settings.GetIdlBuildData( + source, self.config_name + ) + outdir = self.GypPathToNinja(outdir) + + def fix_path(path, rel=None): + path = os.path.join(outdir, path) + dirname, basename = os.path.split(source) + root, ext = os.path.splitext(basename) + path = self.ExpandRuleVariables(path, root, dirname, source, ext, basename) + if rel: + path = os.path.relpath(path, rel) + return path + + vars = [(name, fix_path(value, outdir)) for name, value in vars] + output = [fix_path(p) for p in output] + vars.append(("outdir", outdir)) + vars.append(("idlflags", flags)) + input = self.GypPathToNinja(source) + self.ninja.build(output, "idl", input, variables=vars, order_only=prebuild) + outputs.extend(output) + + def WriteWinIdlFiles(self, spec, prebuild): + """Writes rules to match MSVS's implicit idl handling.""" + assert self.flavor == "win" + if self.msvs_settings.HasExplicitIdlRulesOrActions(spec): + return [] + outputs = [] + for source in filter(lambda x: x.endswith(".idl"), spec["sources"]): + self._WinIdlRule(source, prebuild, outputs) + return outputs + + def WriteActionsRulesCopies( + self, spec, extra_sources, prebuild, mac_bundle_depends + ): + """Write out the Actions, Rules, and Copies steps. Return a path + representing the outputs of these steps.""" + outputs = [] + if self.is_mac_bundle: + mac_bundle_resources = spec.get("mac_bundle_resources", [])[:] + else: + mac_bundle_resources = [] + extra_mac_bundle_resources = [] + + if "actions" in spec: + outputs += self.WriteActions( + spec["actions"], extra_sources, prebuild, extra_mac_bundle_resources + ) + if "rules" in spec: + outputs += self.WriteRules( + spec["rules"], + extra_sources, + prebuild, + mac_bundle_resources, + extra_mac_bundle_resources, + ) + if "copies" in spec: + outputs += self.WriteCopies(spec["copies"], prebuild, mac_bundle_depends) + + if "sources" in spec and self.flavor == "win": + outputs += self.WriteWinIdlFiles(spec, prebuild) + + if self.xcode_settings and self.xcode_settings.IsIosFramework(): + self.WriteiOSFrameworkHeaders(spec, outputs, prebuild) + + stamp = self.WriteCollapsedDependencies("actions_rules_copies", outputs) + + if self.is_mac_bundle: + xcassets = self.WriteMacBundleResources( + extra_mac_bundle_resources + mac_bundle_resources, mac_bundle_depends + ) + partial_info_plist = self.WriteMacXCassets(xcassets, mac_bundle_depends) + self.WriteMacInfoPlist(partial_info_plist, mac_bundle_depends) + + return stamp + + def GenerateDescription(self, verb, message, fallback): + """Generate and return a description of a build step. + + |verb| is the short summary, e.g. ACTION or RULE. + |message| is a hand-written description, or None if not available. + |fallback| is the gyp-level name of the step, usable as a fallback. + """ + if self.toolset != "target": + verb += "(%s)" % self.toolset + if message: + return f"{verb} {self.ExpandSpecial(message)}" + else: + return f"{verb} {self.name}: {fallback}" + + def WriteActions( + self, actions, extra_sources, prebuild, extra_mac_bundle_resources + ): + # Actions cd into the base directory. + env = self.GetToolchainEnv() + all_outputs = [] + for action in actions: + # First write out a rule for the action. + name = "{}_{}".format(action["action_name"], self.hash_for_rules) + description = self.GenerateDescription( + "ACTION", action.get("message", None), name + ) + win_shell_flags = ( + self.msvs_settings.GetRuleShellFlags(action) + if self.flavor == "win" + else None + ) + args = action["action"] + depfile = action.get("depfile", None) + if depfile: + depfile = self.ExpandSpecial(depfile, self.base_to_build) + pool = "console" if int(action.get("ninja_use_console", 0)) else None + rule_name, _ = self.WriteNewNinjaRule( + name, args, description, win_shell_flags, env, pool, depfile=depfile + ) + + inputs = [self.GypPathToNinja(i, env) for i in action["inputs"]] + if int(action.get("process_outputs_as_sources", False)): + extra_sources += action["outputs"] + if int(action.get("process_outputs_as_mac_bundle_resources", False)): + extra_mac_bundle_resources += action["outputs"] + outputs = [self.GypPathToNinja(o, env) for o in action["outputs"]] + + # Then write out an edge using the rule. + self.ninja.build(outputs, rule_name, inputs, order_only=prebuild) + all_outputs += outputs + + self.ninja.newline() + + return all_outputs + + def WriteRules( + self, + rules, + extra_sources, + prebuild, + mac_bundle_resources, + extra_mac_bundle_resources, + ): + env = self.GetToolchainEnv() + all_outputs = [] + for rule in rules: + # Skip a rule with no action and no inputs. + if "action" not in rule and not rule.get("rule_sources", []): + continue + + # First write out a rule for the rule action. + name = "{}_{}".format(rule["rule_name"], self.hash_for_rules) + + args = rule["action"] + description = self.GenerateDescription( + "RULE", + rule.get("message", None), + ("%s " + generator_default_variables["RULE_INPUT_PATH"]) % name, + ) + win_shell_flags = ( + self.msvs_settings.GetRuleShellFlags(rule) + if self.flavor == "win" + else None + ) + pool = "console" if int(rule.get("ninja_use_console", 0)) else None + rule_name, args = self.WriteNewNinjaRule( + name, args, description, win_shell_flags, env, pool + ) + + # TODO: if the command references the outputs directly, we should + # simplify it to just use $out. + + # Rules can potentially make use of some special variables which + # must vary per source file. + # Compute the list of variables we'll need to provide. + special_locals = ("source", "root", "dirname", "ext", "name") + needed_variables = {"source"} + for argument in args: + for var in special_locals: + if "${%s}" % var in argument: + needed_variables.add(var) + needed_variables = sorted(needed_variables) + + def cygwin_munge(path): + # pylint: disable=cell-var-from-loop + if win_shell_flags and win_shell_flags.cygwin: + return path.replace("\\", "/") + return path + + inputs = [self.GypPathToNinja(i, env) for i in rule.get("inputs", [])] + + # If there are n source files matching the rule, and m additional rule + # inputs, then adding 'inputs' to each build edge written below will + # write m * n inputs. Collapsing reduces this to m + n. + sources = rule.get("rule_sources", []) + num_inputs = len(inputs) + if prebuild: + num_inputs += 1 + if num_inputs > 2 and len(sources) > 2: + inputs = [ + self.WriteCollapsedDependencies( + rule["rule_name"], inputs, order_only=prebuild + ) + ] + prebuild = [] + + # For each source file, write an edge that generates all the outputs. + for source in sources: + source = os.path.normpath(source) + dirname, basename = os.path.split(source) + root, ext = os.path.splitext(basename) + + # Gather the list of inputs and outputs, expanding $vars if possible. + outputs = [ + self.ExpandRuleVariables(o, root, dirname, source, ext, basename) + for o in rule["outputs"] + ] + + if int(rule.get("process_outputs_as_sources", False)): + extra_sources += outputs + + was_mac_bundle_resource = source in mac_bundle_resources + if was_mac_bundle_resource or int( + rule.get("process_outputs_as_mac_bundle_resources", False) + ): + extra_mac_bundle_resources += outputs + # Note: This is n_resources * n_outputs_in_rule. + # Put to-be-removed items in a set and + # remove them all in a single pass + # if this becomes a performance issue. + if was_mac_bundle_resource: + mac_bundle_resources.remove(source) + + extra_bindings = [] + for var in needed_variables: + if var == "root": + extra_bindings.append(("root", cygwin_munge(root))) + elif var == "dirname": + # '$dirname' is a parameter to the rule action, which means + # it shouldn't be converted to a Ninja path. But we don't + # want $!PRODUCT_DIR in there either. + dirname_expanded = self.ExpandSpecial( + dirname, self.base_to_build + ) + extra_bindings.append( + ("dirname", cygwin_munge(dirname_expanded)) + ) + elif var == "source": + # '$source' is a parameter to the rule action, which means + # it shouldn't be converted to a Ninja path. But we don't + # want $!PRODUCT_DIR in there either. + source_expanded = self.ExpandSpecial(source, self.base_to_build) + extra_bindings.append(("source", cygwin_munge(source_expanded))) + elif var == "ext": + extra_bindings.append(("ext", ext)) + elif var == "name": + extra_bindings.append(("name", cygwin_munge(basename))) + else: + assert var is None, repr(var) + + outputs = [self.GypPathToNinja(o, env) for o in outputs] + if self.flavor == "win": + # WriteNewNinjaRule uses unique_name to create a rsp file on win. + extra_bindings.append( + ("unique_name", hashlib.md5(outputs[0]).hexdigest()) + ) + + self.ninja.build( + outputs, + rule_name, + self.GypPathToNinja(source), + implicit=inputs, + order_only=prebuild, + variables=extra_bindings, + ) + + all_outputs.extend(outputs) + + return all_outputs + + def WriteCopies(self, copies, prebuild, mac_bundle_depends): + outputs = [] + if self.xcode_settings: + extra_env = self.xcode_settings.GetPerTargetSettings() + env = self.GetToolchainEnv(additional_settings=extra_env) + else: + env = self.GetToolchainEnv() + for to_copy in copies: + for path in to_copy["files"]: + # Normalize the path so trailing slashes don't confuse us. + path = os.path.normpath(path) + basename = os.path.split(path)[1] + src = self.GypPathToNinja(path, env) + dst = self.GypPathToNinja( + os.path.join(to_copy["destination"], basename), env + ) + outputs += self.ninja.build(dst, "copy", src, order_only=prebuild) + if self.is_mac_bundle: + # gyp has mac_bundle_resources to copy things into a bundle's + # Resources folder, but there's no built-in way to copy files + # to other places in the bundle. + # Hence, some targets use copies for this. + # Check if this file is copied into the current bundle, + # and if so add it to the bundle depends so + # that dependent targets get rebuilt if the copy input changes. + if dst.startswith( + self.xcode_settings.GetBundleContentsFolderPath() + ): + mac_bundle_depends.append(dst) + + return outputs + + def WriteiOSFrameworkHeaders(self, spec, outputs, prebuild): + """Prebuild steps to generate hmap files and copy headers to destination.""" + framework = self.ComputeMacBundleOutput() + all_sources = spec["sources"] + copy_headers = spec["mac_framework_headers"] + output = self.GypPathToUniqueOutput("headers.hmap") + self.xcode_settings.header_map_path = output + all_headers = map( + self.GypPathToNinja, filter(lambda x: x.endswith(".h"), all_sources) + ) + variables = [ + ("framework", framework), + ("copy_headers", map(self.GypPathToNinja, copy_headers)), + ] + outputs.extend( + self.ninja.build( + output, + "compile_ios_framework_headers", + all_headers, + variables=variables, + order_only=prebuild, + ) + ) + + def WriteMacBundleResources(self, resources, bundle_depends): + """Writes ninja edges for 'mac_bundle_resources'.""" + xcassets = [] + + extra_env = self.xcode_settings.GetPerTargetSettings() + env = self.GetSortedXcodeEnv(additional_settings=extra_env) + env = self.ComputeExportEnvString(env) + isBinary = self.xcode_settings.IsBinaryOutputFormat(self.config_name) + + for output, res in gyp.xcode_emulation.GetMacBundleResources( + generator_default_variables["PRODUCT_DIR"], + self.xcode_settings, + map(self.GypPathToNinja, resources), + ): + output = self.ExpandSpecial(output) + if os.path.splitext(output)[-1] != ".xcassets": + self.ninja.build( + output, + "mac_tool", + res, + variables=[ + ("mactool_cmd", "copy-bundle-resource"), + ("env", env), + ("binary", isBinary), + ], + ) + bundle_depends.append(output) + else: + xcassets.append(res) + return xcassets + + def WriteMacXCassets(self, xcassets, bundle_depends): + """Writes ninja edges for 'mac_bundle_resources' .xcassets files. + + This add an invocation of 'actool' via the 'mac_tool.py' helper script. + It assumes that the assets catalogs define at least one imageset and + thus an Assets.car file will be generated in the application resources + directory. If this is not the case, then the build will probably be done + at each invocation of ninja.""" + if not xcassets: + return + + extra_arguments = {} + settings_to_arg = { + "XCASSETS_APP_ICON": "app-icon", + "XCASSETS_LAUNCH_IMAGE": "launch-image", + } + settings = self.xcode_settings.xcode_settings[self.config_name] + for settings_key, arg_name in settings_to_arg.items(): + value = settings.get(settings_key) + if value: + extra_arguments[arg_name] = value + + partial_info_plist = None + if extra_arguments: + partial_info_plist = self.GypPathToUniqueOutput( + "assetcatalog_generated_info.plist" + ) + extra_arguments["output-partial-info-plist"] = partial_info_plist + + outputs = [] + outputs.append( + os.path.join(self.xcode_settings.GetBundleResourceFolder(), "Assets.car") + ) + if partial_info_plist: + outputs.append(partial_info_plist) + + keys = QuoteShellArgument(json.dumps(extra_arguments), self.flavor) + extra_env = self.xcode_settings.GetPerTargetSettings() + env = self.GetSortedXcodeEnv(additional_settings=extra_env) + env = self.ComputeExportEnvString(env) + + bundle_depends.extend( + self.ninja.build( + outputs, + "compile_xcassets", + xcassets, + variables=[("env", env), ("keys", keys)], + ) + ) + return partial_info_plist + + def WriteMacInfoPlist(self, partial_info_plist, bundle_depends): + """Write build rules for bundle Info.plist files.""" + info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist( + generator_default_variables["PRODUCT_DIR"], + self.xcode_settings, + self.GypPathToNinja, + ) + if not info_plist: + return + out = self.ExpandSpecial(out) + if defines: + # Create an intermediate file to store preprocessed results. + intermediate_plist = self.GypPathToUniqueOutput( + os.path.basename(info_plist) + ) + defines = " ".join([Define(d, self.flavor) for d in defines]) + info_plist = self.ninja.build( + intermediate_plist, + "preprocess_infoplist", + info_plist, + variables=[("defines", defines)], + ) + + env = self.GetSortedXcodeEnv(additional_settings=extra_env) + env = self.ComputeExportEnvString(env) + + if partial_info_plist: + intermediate_plist = self.GypPathToUniqueOutput("merged_info.plist") + info_plist = self.ninja.build( + intermediate_plist, "merge_infoplist", [partial_info_plist, info_plist] + ) + + keys = self.xcode_settings.GetExtraPlistItems(self.config_name) + keys = QuoteShellArgument(json.dumps(keys), self.flavor) + isBinary = self.xcode_settings.IsBinaryOutputFormat(self.config_name) + self.ninja.build( + out, + "copy_infoplist", + info_plist, + variables=[("env", env), ("keys", keys), ("binary", isBinary)], + ) + bundle_depends.append(out) + + def WriteSources( + self, + ninja_file, + config_name, + config, + sources, + predepends, + precompiled_header, + spec, + ): + """Write build rules to compile all of |sources|.""" + if self.toolset == "host": + self.ninja.variable("ar", "$ar_host") + self.ninja.variable("cc", "$cc_host") + self.ninja.variable("cxx", "$cxx_host") + self.ninja.variable("ld", "$ld_host") + self.ninja.variable("ldxx", "$ldxx_host") + self.ninja.variable("nm", "$nm_host") + self.ninja.variable("readelf", "$readelf_host") + + if self.flavor != "mac" or len(self.archs) == 1: + return self.WriteSourcesForArch( + self.ninja, + config_name, + config, + sources, + predepends, + precompiled_header, + spec, + ) + else: + return { + arch: self.WriteSourcesForArch( + self.arch_subninjas[arch], + config_name, + config, + sources, + predepends, + precompiled_header, + spec, + arch=arch, + ) + for arch in self.archs + } + + def WriteSourcesForArch( + self, + ninja_file, + config_name, + config, + sources, + predepends, + precompiled_header, + spec, + arch=None, + ): + """Write build rules to compile all of |sources|.""" + + extra_defines = [] + if self.flavor == "mac": + cflags = self.xcode_settings.GetCflags(config_name, arch=arch) + cflags_c = self.xcode_settings.GetCflagsC(config_name) + cflags_cc = self.xcode_settings.GetCflagsCC(config_name) + cflags_objc = ["$cflags_c"] + self.xcode_settings.GetCflagsObjC(config_name) + cflags_objcc = ["$cflags_cc"] + self.xcode_settings.GetCflagsObjCC( + config_name + ) + elif self.flavor == "win": + asmflags = self.msvs_settings.GetAsmflags(config_name) + cflags = self.msvs_settings.GetCflags(config_name) + cflags_c = self.msvs_settings.GetCflagsC(config_name) + cflags_cc = self.msvs_settings.GetCflagsCC(config_name) + extra_defines = self.msvs_settings.GetComputedDefines(config_name) + # See comment at cc_command for why there's two .pdb files. + pdbpath_c = pdbpath_cc = self.msvs_settings.GetCompilerPdbName( + config_name, self.ExpandSpecial + ) + if not pdbpath_c: + obj = "obj" + if self.toolset != "target": + obj += "." + self.toolset + pdbpath = os.path.normpath(os.path.join(obj, self.base_dir, self.name)) + pdbpath_c = pdbpath + ".c.pdb" + pdbpath_cc = pdbpath + ".cc.pdb" + self.WriteVariableList(ninja_file, "pdbname_c", [pdbpath_c]) + self.WriteVariableList(ninja_file, "pdbname_cc", [pdbpath_cc]) + self.WriteVariableList(ninja_file, "pchprefix", [self.name]) + else: + cflags = config.get("cflags", []) + cflags_c = config.get("cflags_c", []) + cflags_cc = config.get("cflags_cc", []) + + # Respect environment variables related to build, but target-specific + # flags can still override them. + if self.toolset == "target": + cflags_c = ( + os.environ.get("CPPFLAGS", "").split() + + os.environ.get("CFLAGS", "").split() + + cflags_c + ) + cflags_cc = ( + os.environ.get("CPPFLAGS", "").split() + + os.environ.get("CXXFLAGS", "").split() + + cflags_cc + ) + elif self.toolset == "host": + cflags_c = ( + os.environ.get("CPPFLAGS_host", "").split() + + os.environ.get("CFLAGS_host", "").split() + + cflags_c + ) + cflags_cc = ( + os.environ.get("CPPFLAGS_host", "").split() + + os.environ.get("CXXFLAGS_host", "").split() + + cflags_cc + ) + + defines = config.get("defines", []) + extra_defines + self.WriteVariableList( + ninja_file, "defines", [Define(d, self.flavor) for d in defines] + ) + if self.flavor == "win": + self.WriteVariableList( + ninja_file, "asmflags", map(self.ExpandSpecial, asmflags) + ) + self.WriteVariableList( + ninja_file, + "rcflags", + [ + QuoteShellArgument(self.ExpandSpecial(f), self.flavor) + for f in self.msvs_settings.GetRcflags( + config_name, self.GypPathToNinja + ) + ], + ) + + include_dirs = config.get("include_dirs", []) + + env = self.GetToolchainEnv() + if self.flavor == "win": + include_dirs = self.msvs_settings.AdjustIncludeDirs( + include_dirs, config_name + ) + self.WriteVariableList( + ninja_file, + "includes", + [ + QuoteShellArgument("-I" + self.GypPathToNinja(i, env), self.flavor) + for i in include_dirs + ], + ) + + if self.flavor == "win": + midl_include_dirs = config.get("midl_include_dirs", []) + midl_include_dirs = self.msvs_settings.AdjustMidlIncludeDirs( + midl_include_dirs, config_name + ) + self.WriteVariableList( + ninja_file, + "midl_includes", + [ + QuoteShellArgument("-I" + self.GypPathToNinja(i, env), self.flavor) + for i in midl_include_dirs + ], + ) + + pch_commands = precompiled_header.GetPchBuildCommands(arch) + if self.flavor == "mac": + # Most targets use no precompiled headers, so only write these if needed. + for ext, var in [ + ("c", "cflags_pch_c"), + ("cc", "cflags_pch_cc"), + ("m", "cflags_pch_objc"), + ("mm", "cflags_pch_objcc"), + ]: + include = precompiled_header.GetInclude(ext, arch) + if include: + ninja_file.variable(var, include) + + arflags = config.get("arflags", []) + + self.WriteVariableList(ninja_file, "cflags", map(self.ExpandSpecial, cflags)) + self.WriteVariableList( + ninja_file, "cflags_c", map(self.ExpandSpecial, cflags_c) + ) + self.WriteVariableList( + ninja_file, "cflags_cc", map(self.ExpandSpecial, cflags_cc) + ) + if self.flavor == "mac": + self.WriteVariableList( + ninja_file, "cflags_objc", map(self.ExpandSpecial, cflags_objc) + ) + self.WriteVariableList( + ninja_file, "cflags_objcc", map(self.ExpandSpecial, cflags_objcc) + ) + self.WriteVariableList(ninja_file, "arflags", map(self.ExpandSpecial, arflags)) + ninja_file.newline() + outputs = [] + has_rc_source = False + for source in sources: + filename, ext = os.path.splitext(source) + ext = ext[1:] + obj_ext = self.obj_ext + if ext in ("cc", "cpp", "cxx"): + command = "cxx" + self.target.uses_cpp = True + elif ext == "c" or (ext == "S" and self.flavor != "win"): + command = "cc" + elif ext == "s" and self.flavor != "win": # Doesn't generate .o.d files. + command = "cc_s" + elif ( + self.flavor == "win" + and ext in ("asm", "S") + and not self.msvs_settings.HasExplicitAsmRules(spec) + ): + command = "asm" + # Add the _asm suffix as msvs is capable of handling .cc and + # .asm files of the same name without collision. + obj_ext = "_asm.obj" + elif self.flavor == "mac" and ext == "m": + command = "objc" + elif self.flavor == "mac" and ext == "mm": + command = "objcxx" + self.target.uses_cpp = True + elif self.flavor == "win" and ext == "rc": + command = "rc" + obj_ext = ".res" + has_rc_source = True + else: + # Ignore unhandled extensions. + continue + input = self.GypPathToNinja(source) + output = self.GypPathToUniqueOutput(filename + obj_ext) + if arch is not None: + output = AddArch(output, arch) + implicit = precompiled_header.GetObjDependencies([input], [output], arch) + variables = [] + if self.flavor == "win": + variables, output, implicit = precompiled_header.GetFlagsModifications( + input, + output, + implicit, + command, + cflags_c, + cflags_cc, + self.ExpandSpecial, + ) + ninja_file.build( + output, + command, + input, + implicit=[gch for _, _, gch in implicit], + order_only=predepends, + variables=variables, + ) + outputs.append(output) + + if has_rc_source: + resource_include_dirs = config.get("resource_include_dirs", include_dirs) + self.WriteVariableList( + ninja_file, + "resource_includes", + [ + QuoteShellArgument("-I" + self.GypPathToNinja(i, env), self.flavor) + for i in resource_include_dirs + ], + ) + + self.WritePchTargets(ninja_file, pch_commands) + + ninja_file.newline() + return outputs + + def WritePchTargets(self, ninja_file, pch_commands): + """Writes ninja rules to compile prefix headers.""" + if not pch_commands: + return + + for gch, lang_flag, lang, input in pch_commands: + var_name = { + "c": "cflags_pch_c", + "cc": "cflags_pch_cc", + "m": "cflags_pch_objc", + "mm": "cflags_pch_objcc", + }[lang] + + map = { + "c": "cc", + "cc": "cxx", + "m": "objc", + "mm": "objcxx", + } + cmd = map.get(lang) + ninja_file.build(gch, cmd, input, variables=[(var_name, lang_flag)]) + + def WriteLink(self, spec, config_name, config, link_deps, compile_deps): + """Write out a link step. Fills out target.binary. """ + if self.flavor != "mac" or len(self.archs) == 1: + return self.WriteLinkForArch( + self.ninja, spec, config_name, config, link_deps, compile_deps + ) + else: + output = self.ComputeOutput(spec) + inputs = [ + self.WriteLinkForArch( + self.arch_subninjas[arch], + spec, + config_name, + config, + link_deps[arch], + compile_deps, + arch=arch, + ) + for arch in self.archs + ] + extra_bindings = [] + build_output = output + if not self.is_mac_bundle: + self.AppendPostbuildVariable(extra_bindings, spec, output, output) + + # TODO(yyanagisawa): more work needed to fix: + # https://code.google.com/p/gyp/issues/detail?id=411 + if ( + spec["type"] in ("shared_library", "loadable_module") + and not self.is_mac_bundle + ): + extra_bindings.append(("lib", output)) + self.ninja.build( + [output, output + ".TOC"], + "solipo", + inputs, + variables=extra_bindings, + ) + else: + self.ninja.build(build_output, "lipo", inputs, variables=extra_bindings) + return output + + def WriteLinkForArch( + self, ninja_file, spec, config_name, config, link_deps, compile_deps, arch=None + ): + """Write out a link step. Fills out target.binary. """ + command = { + "executable": "link", + "loadable_module": "solink_module", + "shared_library": "solink", + }[spec["type"]] + command_suffix = "" + + implicit_deps = set() + solibs = set() + order_deps = set() + + if compile_deps: + # Normally, the compiles of the target already depend on compile_deps, + # but a shared_library target might have no sources and only link together + # a few static_library deps, so the link step also needs to depend + # on compile_deps to make sure actions in the shared_library target + # get run before the link. + order_deps.add(compile_deps) + + if "dependencies" in spec: + # Two kinds of dependencies: + # - Linkable dependencies (like a .a or a .so): add them to the link line. + # - Non-linkable dependencies (like a rule that generates a file + # and writes a stamp file): add them to implicit_deps + extra_link_deps = set() + for dep in spec["dependencies"]: + target = self.target_outputs.get(dep) + if not target: + continue + linkable = target.Linkable() + if linkable: + new_deps = [] + if ( + self.flavor == "win" + and target.component_objs + and self.msvs_settings.IsUseLibraryDependencyInputs(config_name) + ): + new_deps = target.component_objs + if target.compile_deps: + order_deps.add(target.compile_deps) + elif self.flavor == "win" and target.import_lib: + new_deps = [target.import_lib] + elif target.UsesToc(self.flavor): + solibs.add(target.binary) + implicit_deps.add(target.binary + ".TOC") + else: + new_deps = [target.binary] + for new_dep in new_deps: + if new_dep not in extra_link_deps: + extra_link_deps.add(new_dep) + link_deps.append(new_dep) + + final_output = target.FinalOutput() + if not linkable or final_output != target.binary: + implicit_deps.add(final_output) + + extra_bindings = [] + if self.target.uses_cpp and self.flavor != "win": + extra_bindings.append(("ld", "$ldxx")) + + output = self.ComputeOutput(spec, arch) + if arch is None and not self.is_mac_bundle: + self.AppendPostbuildVariable(extra_bindings, spec, output, output) + + is_executable = spec["type"] == "executable" + # The ldflags config key is not used on mac or win. On those platforms + # linker flags are set via xcode_settings and msvs_settings, respectively. + if self.toolset == "target": + env_ldflags = os.environ.get("LDFLAGS", "").split() + elif self.toolset == "host": + env_ldflags = os.environ.get("LDFLAGS_host", "").split() + + if self.flavor == "mac": + ldflags = self.xcode_settings.GetLdflags( + config_name, + self.ExpandSpecial(generator_default_variables["PRODUCT_DIR"]), + self.GypPathToNinja, + arch, + ) + ldflags = env_ldflags + ldflags + elif self.flavor == "win": + manifest_base_name = self.GypPathToUniqueOutput( + self.ComputeOutputFileName(spec) + ) + ( + ldflags, + intermediate_manifest, + manifest_files, + ) = self.msvs_settings.GetLdflags( + config_name, + self.GypPathToNinja, + self.ExpandSpecial, + manifest_base_name, + output, + is_executable, + self.toplevel_build, + ) + ldflags = env_ldflags + ldflags + self.WriteVariableList(ninja_file, "manifests", manifest_files) + implicit_deps = implicit_deps.union(manifest_files) + if intermediate_manifest: + self.WriteVariableList( + ninja_file, "intermediatemanifest", [intermediate_manifest] + ) + command_suffix = _GetWinLinkRuleNameSuffix( + self.msvs_settings.IsEmbedManifest(config_name) + ) + def_file = self.msvs_settings.GetDefFile(self.GypPathToNinja) + if def_file: + implicit_deps.add(def_file) + else: + # Respect environment variables related to build, but target-specific + # flags can still override them. + ldflags = env_ldflags + config.get("ldflags", []) + if is_executable and len(solibs): + rpath = "lib/" + if self.toolset != "target": + rpath += self.toolset + ldflags.append(r"-Wl,-rpath=\$$ORIGIN/%s" % rpath) + else: + ldflags.append("-Wl,-rpath=%s" % self.target_rpath) + ldflags.append("-Wl,-rpath-link=%s" % rpath) + self.WriteVariableList(ninja_file, "ldflags", map(self.ExpandSpecial, ldflags)) + + library_dirs = config.get("library_dirs", []) + if self.flavor == "win": + library_dirs = [ + self.msvs_settings.ConvertVSMacros(library_dir, config_name) + for library_dir in library_dirs + ] + library_dirs = [ + "/LIBPATH:" + + QuoteShellArgument(self.GypPathToNinja(library_dir), self.flavor) + for library_dir in library_dirs + ] + else: + library_dirs = [ + QuoteShellArgument("-L" + self.GypPathToNinja(library_dir), self.flavor) + for library_dir in library_dirs + ] + + libraries = gyp.common.uniquer( + map(self.ExpandSpecial, spec.get("libraries", [])) + ) + if self.flavor == "mac": + libraries = self.xcode_settings.AdjustLibraries(libraries, config_name) + elif self.flavor == "win": + libraries = self.msvs_settings.AdjustLibraries(libraries) + + self.WriteVariableList(ninja_file, "libs", library_dirs + libraries) + + linked_binary = output + + if command in ("solink", "solink_module"): + extra_bindings.append(("soname", os.path.split(output)[1])) + extra_bindings.append(("lib", gyp.common.EncodePOSIXShellArgument(output))) + if self.flavor != "win": + link_file_list = output + if self.is_mac_bundle: + # 'Dependency Framework.framework/Versions/A/Dependency Framework' + # -> 'Dependency Framework.framework.rsp' + link_file_list = self.xcode_settings.GetWrapperName() + if arch: + link_file_list += "." + arch + link_file_list += ".rsp" + # If an rspfile contains spaces, ninja surrounds the filename with + # quotes around it and then passes it to open(), creating a file with + # quotes in its name (and when looking for the rsp file, the name + # makes it through bash which strips the quotes) :-/ + link_file_list = link_file_list.replace(" ", "_") + extra_bindings.append( + ( + "link_file_list", + gyp.common.EncodePOSIXShellArgument(link_file_list), + ) + ) + if self.flavor == "win": + extra_bindings.append(("binary", output)) + if ( + "/NOENTRY" not in ldflags + and not self.msvs_settings.GetNoImportLibrary(config_name) + ): + self.target.import_lib = output + ".lib" + extra_bindings.append( + ("implibflag", "/IMPLIB:%s" % self.target.import_lib) + ) + pdbname = self.msvs_settings.GetPDBName( + config_name, self.ExpandSpecial, output + ".pdb" + ) + output = [output, self.target.import_lib] + if pdbname: + output.append(pdbname) + elif not self.is_mac_bundle: + output = [output, output + ".TOC"] + else: + command = command + "_notoc" + elif self.flavor == "win": + extra_bindings.append(("binary", output)) + pdbname = self.msvs_settings.GetPDBName( + config_name, self.ExpandSpecial, output + ".pdb" + ) + if pdbname: + output = [output, pdbname] + + if len(solibs): + extra_bindings.append( + ("solibs", gyp.common.EncodePOSIXShellList(sorted(solibs))) + ) + + ninja_file.build( + output, + command + command_suffix, + link_deps, + implicit=sorted(implicit_deps), + order_only=list(order_deps), + variables=extra_bindings, + ) + return linked_binary + + def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): + extra_link_deps = any( + self.target_outputs.get(dep).Linkable() + for dep in spec.get("dependencies", []) + if dep in self.target_outputs + ) + if spec["type"] == "none" or (not link_deps and not extra_link_deps): + # TODO(evan): don't call this function for 'none' target types, as + # it doesn't do anything, and we fake out a 'binary' with a stamp file. + self.target.binary = compile_deps + self.target.type = "none" + elif spec["type"] == "static_library": + self.target.binary = self.ComputeOutput(spec) + if ( + self.flavor not in ("ios", "mac", "netbsd", "openbsd", "win") + and not self.is_standalone_static_library + ): + self.ninja.build( + self.target.binary, "alink_thin", link_deps, order_only=compile_deps + ) + else: + variables = [] + if self.xcode_settings: + libtool_flags = self.xcode_settings.GetLibtoolflags(config_name) + if libtool_flags: + variables.append(("libtool_flags", libtool_flags)) + if self.msvs_settings: + libflags = self.msvs_settings.GetLibFlags( + config_name, self.GypPathToNinja + ) + variables.append(("libflags", libflags)) + + if self.flavor != "mac" or len(self.archs) == 1: + self.AppendPostbuildVariable( + variables, spec, self.target.binary, self.target.binary + ) + self.ninja.build( + self.target.binary, + "alink", + link_deps, + order_only=compile_deps, + variables=variables, + ) + else: + inputs = [] + for arch in self.archs: + output = self.ComputeOutput(spec, arch) + self.arch_subninjas[arch].build( + output, + "alink", + link_deps[arch], + order_only=compile_deps, + variables=variables, + ) + inputs.append(output) + # TODO: It's not clear if + # libtool_flags should be passed to the alink + # call that combines single-arch .a files into a fat .a file. + self.AppendPostbuildVariable( + variables, spec, self.target.binary, self.target.binary + ) + self.ninja.build( + self.target.binary, + "alink", + inputs, + # FIXME: test proving order_only=compile_deps isn't + # needed. + variables=variables, + ) + else: + self.target.binary = self.WriteLink( + spec, config_name, config, link_deps, compile_deps + ) + return self.target.binary + + def WriteMacBundle(self, spec, mac_bundle_depends, is_empty): + assert self.is_mac_bundle + package_framework = spec["type"] in ("shared_library", "loadable_module") + output = self.ComputeMacBundleOutput() + if is_empty: + output += ".stamp" + variables = [] + self.AppendPostbuildVariable( + variables, + spec, + output, + self.target.binary, + is_command_start=not package_framework, + ) + if package_framework and not is_empty: + if spec["type"] == "shared_library" and self.xcode_settings.isIOS: + self.ninja.build( + output, + "package_ios_framework", + mac_bundle_depends, + variables=variables, + ) + else: + variables.append(("version", self.xcode_settings.GetFrameworkVersion())) + self.ninja.build( + output, "package_framework", mac_bundle_depends, variables=variables + ) + else: + self.ninja.build(output, "stamp", mac_bundle_depends, variables=variables) + self.target.bundle = output + return output + + def GetToolchainEnv(self, additional_settings=None): + """Returns the variables toolchain would set for build steps.""" + env = self.GetSortedXcodeEnv(additional_settings=additional_settings) + if self.flavor == "win": + env = self.GetMsvsToolchainEnv(additional_settings=additional_settings) + return env + + def GetMsvsToolchainEnv(self, additional_settings=None): + """Returns the variables Visual Studio would set for build steps.""" + return self.msvs_settings.GetVSMacroEnv( + "$!PRODUCT_DIR", config=self.config_name + ) + + def GetSortedXcodeEnv(self, additional_settings=None): + """Returns the variables Xcode would set for build steps.""" + assert self.abs_build_dir + abs_build_dir = self.abs_build_dir + return gyp.xcode_emulation.GetSortedXcodeEnv( + self.xcode_settings, + abs_build_dir, + os.path.join(abs_build_dir, self.build_to_base), + self.config_name, + additional_settings, + ) + + def GetSortedXcodePostbuildEnv(self): + """Returns the variables Xcode would set for postbuild steps.""" + postbuild_settings = {} + # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack. + # TODO(thakis): It would be nice to have some general mechanism instead. + strip_save_file = self.xcode_settings.GetPerTargetSetting( + "CHROMIUM_STRIP_SAVE_FILE" + ) + if strip_save_file: + postbuild_settings["CHROMIUM_STRIP_SAVE_FILE"] = strip_save_file + return self.GetSortedXcodeEnv(additional_settings=postbuild_settings) + + def AppendPostbuildVariable( + self, variables, spec, output, binary, is_command_start=False + ): + """Adds a 'postbuild' variable if there is a postbuild for |output|.""" + postbuild = self.GetPostbuildCommand(spec, output, binary, is_command_start) + if postbuild: + variables.append(("postbuilds", postbuild)) + + def GetPostbuildCommand(self, spec, output, output_binary, is_command_start): + """Returns a shell command that runs all the postbuilds, and removes + |output| if any of them fails. If |is_command_start| is False, then the + returned string will start with ' && '.""" + if not self.xcode_settings or spec["type"] == "none" or not output: + return "" + output = QuoteShellArgument(output, self.flavor) + postbuilds = gyp.xcode_emulation.GetSpecPostbuildCommands(spec, quiet=True) + if output_binary is not None: + postbuilds = self.xcode_settings.AddImplicitPostbuilds( + self.config_name, + os.path.normpath(os.path.join(self.base_to_build, output)), + QuoteShellArgument( + os.path.normpath(os.path.join(self.base_to_build, output_binary)), + self.flavor, + ), + postbuilds, + quiet=True, + ) + + if not postbuilds: + return "" + # Postbuilds expect to be run in the gyp file's directory, so insert an + # implicit postbuild to cd to there. + postbuilds.insert( + 0, gyp.common.EncodePOSIXShellList(["cd", self.build_to_base]) + ) + env = self.ComputeExportEnvString(self.GetSortedXcodePostbuildEnv()) + # G will be non-null if any postbuild fails. Run all postbuilds in a + # subshell. + commands = ( + env + + " (" + + " && ".join([ninja_syntax.escape(command) for command in postbuilds]) + ) + command_string = ( + commands + + "); G=$$?; " + # Remove the final output if any postbuild failed. + "((exit $$G) || rm -rf %s) " % output + + "&& exit $$G)" + ) + if is_command_start: + return "(" + command_string + " && " + else: + return "$ && (" + command_string + + def ComputeExportEnvString(self, env): + """Given an environment, returns a string looking like + 'export FOO=foo; export BAR="${FOO} bar;' + that exports |env| to the shell.""" + export_str = [] + for k, v in env: + export_str.append( + "export %s=%s;" + % (k, ninja_syntax.escape(gyp.common.EncodePOSIXShellArgument(v))) + ) + return " ".join(export_str) + + def ComputeMacBundleOutput(self): + """Return the 'output' (full output path) to a bundle output directory.""" + assert self.is_mac_bundle + path = generator_default_variables["PRODUCT_DIR"] + return self.ExpandSpecial( + os.path.join(path, self.xcode_settings.GetWrapperName()) + ) + + def ComputeOutputFileName(self, spec, type=None): + """Compute the filename of the final output for the current target.""" + if not type: + type = spec["type"] + + default_variables = copy.copy(generator_default_variables) + CalculateVariables(default_variables, {"flavor": self.flavor}) + + # Compute filename prefix: the product prefix, or a default for + # the product type. + DEFAULT_PREFIX = { + "loadable_module": default_variables["SHARED_LIB_PREFIX"], + "shared_library": default_variables["SHARED_LIB_PREFIX"], + "static_library": default_variables["STATIC_LIB_PREFIX"], + "executable": default_variables["EXECUTABLE_PREFIX"], + } + prefix = spec.get("product_prefix", DEFAULT_PREFIX.get(type, "")) + + # Compute filename extension: the product extension, or a default + # for the product type. + DEFAULT_EXTENSION = { + "loadable_module": default_variables["SHARED_LIB_SUFFIX"], + "shared_library": default_variables["SHARED_LIB_SUFFIX"], + "static_library": default_variables["STATIC_LIB_SUFFIX"], + "executable": default_variables["EXECUTABLE_SUFFIX"], + } + extension = spec.get("product_extension") + if extension: + extension = "." + extension + else: + extension = DEFAULT_EXTENSION.get(type, "") + + if "product_name" in spec: + # If we were given an explicit name, use that. + target = spec["product_name"] + else: + # Otherwise, derive a name from the target name. + target = spec["target_name"] + if prefix == "lib": + # Snip out an extra 'lib' from libs if appropriate. + target = StripPrefix(target, "lib") + + if type in ( + "static_library", + "loadable_module", + "shared_library", + "executable", + ): + return f"{prefix}{target}{extension}" + elif type == "none": + return "%s.stamp" % target + else: + raise Exception("Unhandled output type %s" % type) + + def ComputeOutput(self, spec, arch=None): + """Compute the path for the final output of the spec.""" + type = spec["type"] + + if self.flavor == "win": + override = self.msvs_settings.GetOutputName( + self.config_name, self.ExpandSpecial + ) + if override: + return override + + if ( + arch is None + and self.flavor == "mac" + and type + in ("static_library", "executable", "shared_library", "loadable_module") + ): + filename = self.xcode_settings.GetExecutablePath() + else: + filename = self.ComputeOutputFileName(spec, type) + + if arch is None and "product_dir" in spec: + path = os.path.join(spec["product_dir"], filename) + return self.ExpandSpecial(path) + + # Some products go into the output root, libraries go into shared library + # dir, and everything else goes into the normal place. + type_in_output_root = ["executable", "loadable_module"] + if self.flavor == "mac" and self.toolset == "target": + type_in_output_root += ["shared_library", "static_library"] + elif self.flavor == "win" and self.toolset == "target": + type_in_output_root += ["shared_library"] + + if arch is not None: + # Make sure partial executables don't end up in a bundle or the regular + # output directory. + archdir = "arch" + if self.toolset != "target": + archdir = os.path.join("arch", "%s" % self.toolset) + return os.path.join(archdir, AddArch(filename, arch)) + elif type in type_in_output_root or self.is_standalone_static_library: + return filename + elif type == "shared_library": + libdir = "lib" + if self.toolset != "target": + libdir = os.path.join("lib", "%s" % self.toolset) + return os.path.join(libdir, filename) + else: + return self.GypPathToUniqueOutput(filename, qualified=False) + + def WriteVariableList(self, ninja_file, var, values): + assert not isinstance(values, str) + if values is None: + values = [] + ninja_file.variable(var, " ".join(values)) + + def WriteNewNinjaRule( + self, name, args, description, win_shell_flags, env, pool, depfile=None + ): + """Write out a new ninja "rule" statement for a given command. + + Returns the name of the new rule, and a copy of |args| with variables + expanded.""" + + if self.flavor == "win": + args = [ + self.msvs_settings.ConvertVSMacros( + arg, self.base_to_build, config=self.config_name + ) + for arg in args + ] + description = self.msvs_settings.ConvertVSMacros( + description, config=self.config_name + ) + elif self.flavor == "mac": + # |env| is an empty list on non-mac. + args = [gyp.xcode_emulation.ExpandEnvVars(arg, env) for arg in args] + description = gyp.xcode_emulation.ExpandEnvVars(description, env) + + # TODO: we shouldn't need to qualify names; we do it because + # currently the ninja rule namespace is global, but it really + # should be scoped to the subninja. + rule_name = self.name + if self.toolset == "target": + rule_name += "." + self.toolset + rule_name += "." + name + rule_name = re.sub("[^a-zA-Z0-9_]", "_", rule_name) + + # Remove variable references, but not if they refer to the magic rule + # variables. This is not quite right, as it also protects these for + # actions, not just for rules where they are valid. Good enough. + protect = ["${root}", "${dirname}", "${source}", "${ext}", "${name}"] + protect = "(?!" + "|".join(map(re.escape, protect)) + ")" + description = re.sub(protect + r"\$", "_", description) + + # gyp dictates that commands are run from the base directory. + # cd into the directory before running, and adjust paths in + # the arguments to point to the proper locations. + rspfile = None + rspfile_content = None + args = [self.ExpandSpecial(arg, self.base_to_build) for arg in args] + if self.flavor == "win": + rspfile = rule_name + ".$unique_name.rsp" + # The cygwin case handles this inside the bash sub-shell. + run_in = "" if win_shell_flags.cygwin else " " + self.build_to_base + if win_shell_flags.cygwin: + rspfile_content = self.msvs_settings.BuildCygwinBashCommandLine( + args, self.build_to_base + ) + else: + rspfile_content = gyp.msvs_emulation.EncodeRspFileList( + args, win_shell_flags.quote) + command = ( + "%s gyp-win-tool action-wrapper $arch " % sys.executable + + rspfile + + run_in + ) + else: + env = self.ComputeExportEnvString(env) + command = gyp.common.EncodePOSIXShellList(args) + command = "cd %s; " % self.build_to_base + env + command + + # GYP rules/actions express being no-ops by not touching their outputs. + # Avoid executing downstream dependencies in this case by specifying + # restat=1 to ninja. + self.ninja.rule( + rule_name, + command, + description, + depfile=depfile, + restat=True, + pool=pool, + rspfile=rspfile, + rspfile_content=rspfile_content, + ) + self.ninja.newline() + + return rule_name, args + + +def CalculateVariables(default_variables, params): + """Calculate additional variables for use in the build (called by gyp).""" + global generator_additional_non_configuration_keys + global generator_additional_path_sections + flavor = gyp.common.GetFlavor(params) + if flavor == "mac": + default_variables.setdefault("OS", "mac") + default_variables.setdefault("SHARED_LIB_SUFFIX", ".dylib") + default_variables.setdefault( + "SHARED_LIB_DIR", generator_default_variables["PRODUCT_DIR"] + ) + default_variables.setdefault( + "LIB_DIR", generator_default_variables["PRODUCT_DIR"] + ) + + # Copy additional generator configuration data from Xcode, which is shared + # by the Mac Ninja generator. + import gyp.generator.xcode as xcode_generator + + generator_additional_non_configuration_keys = getattr( + xcode_generator, "generator_additional_non_configuration_keys", [] + ) + generator_additional_path_sections = getattr( + xcode_generator, "generator_additional_path_sections", [] + ) + global generator_extra_sources_for_rules + generator_extra_sources_for_rules = getattr( + xcode_generator, "generator_extra_sources_for_rules", [] + ) + elif flavor == "win": + exts = gyp.MSVSUtil.TARGET_TYPE_EXT + default_variables.setdefault("OS", "win") + default_variables["EXECUTABLE_SUFFIX"] = "." + exts["executable"] + default_variables["STATIC_LIB_PREFIX"] = "" + default_variables["STATIC_LIB_SUFFIX"] = "." + exts["static_library"] + default_variables["SHARED_LIB_PREFIX"] = "" + default_variables["SHARED_LIB_SUFFIX"] = "." + exts["shared_library"] + + # Copy additional generator configuration data from VS, which is shared + # by the Windows Ninja generator. + import gyp.generator.msvs as msvs_generator + + generator_additional_non_configuration_keys = getattr( + msvs_generator, "generator_additional_non_configuration_keys", [] + ) + generator_additional_path_sections = getattr( + msvs_generator, "generator_additional_path_sections", [] + ) + + gyp.msvs_emulation.CalculateCommonVariables(default_variables, params) + else: + operating_system = flavor + if flavor == "android": + operating_system = "linux" # Keep this legacy behavior for now. + default_variables.setdefault("OS", operating_system) + default_variables.setdefault("SHARED_LIB_SUFFIX", ".so") + default_variables.setdefault( + "SHARED_LIB_DIR", os.path.join("$!PRODUCT_DIR", "lib") + ) + default_variables.setdefault("LIB_DIR", os.path.join("$!PRODUCT_DIR", "obj")) + + +def ComputeOutputDir(params): + """Returns the path from the toplevel_dir to the build output directory.""" + # generator_dir: relative path from pwd to where make puts build files. + # Makes migrating from make to ninja easier, ninja doesn't put anything here. + generator_dir = os.path.relpath(params["options"].generator_output or ".") + + # output_dir: relative path from generator_dir to the build directory. + output_dir = params.get("generator_flags", {}).get("output_dir", "out") + + # Relative path from source root to our output files. e.g. "out" + return os.path.normpath(os.path.join(generator_dir, output_dir)) + + +def CalculateGeneratorInputInfo(params): + """Called by __init__ to initialize generator values based on params.""" + # E.g. "out/gypfiles" + toplevel = params["options"].toplevel_dir + qualified_out_dir = os.path.normpath( + os.path.join(toplevel, ComputeOutputDir(params), "gypfiles") + ) + + global generator_filelist_paths + generator_filelist_paths = { + "toplevel": toplevel, + "qualified_out_dir": qualified_out_dir, + } + + +def OpenOutput(path, mode="w"): + """Open |path| for writing, creating directories if necessary.""" + gyp.common.EnsureDirExists(path) + return open(path, mode) + + +def CommandWithWrapper(cmd, wrappers, prog): + wrapper = wrappers.get(cmd, "") + if wrapper: + return wrapper + " " + prog + return prog + + +def GetDefaultConcurrentLinks(): + """Returns a best-guess for a number of concurrent links.""" + pool_size = int(os.environ.get("GYP_LINK_CONCURRENCY", 0)) + if pool_size: + return pool_size + + if sys.platform in ("win32", "cygwin"): + import ctypes + + class MEMORYSTATUSEX(ctypes.Structure): + _fields_ = [ + ("dwLength", ctypes.c_ulong), + ("dwMemoryLoad", ctypes.c_ulong), + ("ullTotalPhys", ctypes.c_ulonglong), + ("ullAvailPhys", ctypes.c_ulonglong), + ("ullTotalPageFile", ctypes.c_ulonglong), + ("ullAvailPageFile", ctypes.c_ulonglong), + ("ullTotalVirtual", ctypes.c_ulonglong), + ("ullAvailVirtual", ctypes.c_ulonglong), + ("sullAvailExtendedVirtual", ctypes.c_ulonglong), + ] + + stat = MEMORYSTATUSEX() + stat.dwLength = ctypes.sizeof(stat) + ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) + + # VS 2015 uses 20% more working set than VS 2013 and can consume all RAM + # on a 64 GiB machine. + mem_limit = max(1, stat.ullTotalPhys // (5 * (2 ** 30))) # total / 5GiB + hard_cap = max(1, int(os.environ.get("GYP_LINK_CONCURRENCY_MAX", 2 ** 32))) + return min(mem_limit, hard_cap) + elif sys.platform.startswith("linux"): + if os.path.exists("/proc/meminfo"): + with open("/proc/meminfo") as meminfo: + memtotal_re = re.compile(r"^MemTotal:\s*(\d*)\s*kB") + for line in meminfo: + match = memtotal_re.match(line) + if not match: + continue + # Allow 8Gb per link on Linux because Gold is quite memory hungry + return max(1, int(match.group(1)) // (8 * (2 ** 20))) + return 1 + elif sys.platform == "darwin": + try: + avail_bytes = int(subprocess.check_output(["sysctl", "-n", "hw.memsize"])) + # A static library debug build of Chromium's unit_tests takes ~2.7GB, so + # 4GB per ld process allows for some more bloat. + return max(1, avail_bytes // (4 * (2 ** 30))) # total / 4GB + except subprocess.CalledProcessError: + return 1 + else: + # TODO(scottmg): Implement this for other platforms. + return 1 + + +def _GetWinLinkRuleNameSuffix(embed_manifest): + """Returns the suffix used to select an appropriate linking rule depending on + whether the manifest embedding is enabled.""" + return "_embed" if embed_manifest else "" + + +def _AddWinLinkRules(master_ninja, embed_manifest): + """Adds link rules for Windows platform to |master_ninja|.""" + + def FullLinkCommand(ldcmd, out, binary_type): + resource_name = {"exe": "1", "dll": "2"}[binary_type] + return ( + "%(python)s gyp-win-tool link-with-manifests $arch %(embed)s " + '%(out)s "%(ldcmd)s" %(resname)s $mt $rc "$intermediatemanifest" ' + "$manifests" + % { + "python": sys.executable, + "out": out, + "ldcmd": ldcmd, + "resname": resource_name, + "embed": embed_manifest, + } + ) + + rule_name_suffix = _GetWinLinkRuleNameSuffix(embed_manifest) + use_separate_mspdbsrv = int(os.environ.get("GYP_USE_SEPARATE_MSPDBSRV", "0")) != 0 + dlldesc = "LINK%s(DLL) $binary" % rule_name_suffix.upper() + dllcmd = ( + "%s gyp-win-tool link-wrapper $arch %s " + "$ld /nologo $implibflag /DLL /OUT:$binary " + "@$binary.rsp" % (sys.executable, use_separate_mspdbsrv) + ) + dllcmd = FullLinkCommand(dllcmd, "$binary", "dll") + master_ninja.rule( + "solink" + rule_name_suffix, + description=dlldesc, + command=dllcmd, + rspfile="$binary.rsp", + rspfile_content="$libs $in_newline $ldflags", + restat=True, + pool="link_pool", + ) + master_ninja.rule( + "solink_module" + rule_name_suffix, + description=dlldesc, + command=dllcmd, + rspfile="$binary.rsp", + rspfile_content="$libs $in_newline $ldflags", + restat=True, + pool="link_pool", + ) + # Note that ldflags goes at the end so that it has the option of + # overriding default settings earlier in the command line. + exe_cmd = ( + "%s gyp-win-tool link-wrapper $arch %s " + "$ld /nologo /OUT:$binary @$binary.rsp" + % (sys.executable, use_separate_mspdbsrv) + ) + exe_cmd = FullLinkCommand(exe_cmd, "$binary", "exe") + master_ninja.rule( + "link" + rule_name_suffix, + description="LINK%s $binary" % rule_name_suffix.upper(), + command=exe_cmd, + rspfile="$binary.rsp", + rspfile_content="$in_newline $libs $ldflags", + pool="link_pool", + ) + + +def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name): + options = params["options"] + flavor = gyp.common.GetFlavor(params) + generator_flags = params.get("generator_flags", {}) + + # build_dir: relative path from source root to our output files. + # e.g. "out/Debug" + build_dir = os.path.normpath(os.path.join(ComputeOutputDir(params), config_name)) + + toplevel_build = os.path.join(options.toplevel_dir, build_dir) + + master_ninja_file = OpenOutput(os.path.join(toplevel_build, "build.ninja")) + master_ninja = ninja_syntax.Writer(master_ninja_file, width=120) + + # Put build-time support tools in out/{config_name}. + gyp.common.CopyTool(flavor, toplevel_build, generator_flags) + + # Grab make settings for CC/CXX. + # The rules are + # - The priority from low to high is gcc/g++, the 'make_global_settings' in + # gyp, the environment variable. + # - If there is no 'make_global_settings' for CC.host/CXX.host or + # 'CC_host'/'CXX_host' environment variable, cc_host/cxx_host should be set + # to cc/cxx. + if flavor == "win": + ar = "lib.exe" + # cc and cxx must be set to the correct architecture by overriding with one + # of cl_x86 or cl_x64 below. + cc = "UNSET" + cxx = "UNSET" + ld = "link.exe" + ld_host = "$ld" + else: + ar = "ar" + cc = "cc" + cxx = "c++" + ld = "$cc" + ldxx = "$cxx" + ld_host = "$cc_host" + ldxx_host = "$cxx_host" + + ar_host = ar + cc_host = None + cxx_host = None + cc_host_global_setting = None + cxx_host_global_setting = None + clang_cl = None + nm = "nm" + nm_host = "nm" + readelf = "readelf" + readelf_host = "readelf" + + build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) + make_global_settings = data[build_file].get("make_global_settings", []) + build_to_root = gyp.common.InvertRelativePath(build_dir, options.toplevel_dir) + wrappers = {} + for key, value in make_global_settings: + if key == "AR": + ar = os.path.join(build_to_root, value) + if key == "AR.host": + ar_host = os.path.join(build_to_root, value) + if key == "CC": + cc = os.path.join(build_to_root, value) + if cc.endswith("clang-cl"): + clang_cl = cc + if key == "CXX": + cxx = os.path.join(build_to_root, value) + if key == "CC.host": + cc_host = os.path.join(build_to_root, value) + cc_host_global_setting = value + if key == "CXX.host": + cxx_host = os.path.join(build_to_root, value) + cxx_host_global_setting = value + if key == "LD": + ld = os.path.join(build_to_root, value) + if key == "LD.host": + ld_host = os.path.join(build_to_root, value) + if key == "LDXX": + ldxx = os.path.join(build_to_root, value) + if key == "LDXX.host": + ldxx_host = os.path.join(build_to_root, value) + if key == "NM": + nm = os.path.join(build_to_root, value) + if key == "NM.host": + nm_host = os.path.join(build_to_root, value) + if key == "READELF": + readelf = os.path.join(build_to_root, value) + if key == "READELF.host": + readelf_host = os.path.join(build_to_root, value) + if key.endswith("_wrapper"): + wrappers[key[: -len("_wrapper")]] = os.path.join(build_to_root, value) + + # Support wrappers from environment variables too. + for key, value in os.environ.items(): + if key.lower().endswith("_wrapper"): + key_prefix = key[: -len("_wrapper")] + key_prefix = re.sub(r"\.HOST$", ".host", key_prefix) + wrappers[key_prefix] = os.path.join(build_to_root, value) + + mac_toolchain_dir = generator_flags.get("mac_toolchain_dir", None) + if mac_toolchain_dir: + wrappers["LINK"] = "export DEVELOPER_DIR='%s' &&" % mac_toolchain_dir + + if flavor == "win": + configs = [ + target_dicts[qualified_target]["configurations"][config_name] + for qualified_target in target_list + ] + shared_system_includes = None + if not generator_flags.get("ninja_use_custom_environment_files", 0): + shared_system_includes = gyp.msvs_emulation.ExtractSharedMSVSSystemIncludes( + configs, generator_flags + ) + cl_paths = gyp.msvs_emulation.GenerateEnvironmentFiles( + toplevel_build, generator_flags, shared_system_includes, OpenOutput + ) + for arch, path in sorted(cl_paths.items()): + if clang_cl: + # If we have selected clang-cl, use that instead. + path = clang_cl + command = CommandWithWrapper( + "CC", wrappers, QuoteShellArgument(path, "win") + ) + if clang_cl: + # Use clang-cl to cross-compile for x86 or x86_64. + command += " -m32" if arch == "x86" else " -m64" + master_ninja.variable("cl_" + arch, command) + + cc = GetEnvironFallback(["CC_target", "CC"], cc) + master_ninja.variable("cc", CommandWithWrapper("CC", wrappers, cc)) + cxx = GetEnvironFallback(["CXX_target", "CXX"], cxx) + master_ninja.variable("cxx", CommandWithWrapper("CXX", wrappers, cxx)) + + if flavor == "win": + master_ninja.variable("ld", ld) + master_ninja.variable("idl", "midl.exe") + master_ninja.variable("ar", ar) + master_ninja.variable("rc", "rc.exe") + master_ninja.variable("ml_x86", "ml.exe") + master_ninja.variable("ml_x64", "ml64.exe") + master_ninja.variable("mt", "mt.exe") + else: + master_ninja.variable("ld", CommandWithWrapper("LINK", wrappers, ld)) + master_ninja.variable("ldxx", CommandWithWrapper("LINK", wrappers, ldxx)) + master_ninja.variable("ar", GetEnvironFallback(["AR_target", "AR"], ar)) + if flavor != "mac": + # Mac does not use readelf/nm for .TOC generation, so avoiding polluting + # the master ninja with extra unused variables. + master_ninja.variable("nm", GetEnvironFallback(["NM_target", "NM"], nm)) + master_ninja.variable( + "readelf", GetEnvironFallback(["READELF_target", "READELF"], readelf) + ) + + if generator_supports_multiple_toolsets: + if not cc_host: + cc_host = cc + if not cxx_host: + cxx_host = cxx + + master_ninja.variable("ar_host", GetEnvironFallback(["AR_host"], ar_host)) + master_ninja.variable("nm_host", GetEnvironFallback(["NM_host"], nm_host)) + master_ninja.variable( + "readelf_host", GetEnvironFallback(["READELF_host"], readelf_host) + ) + cc_host = GetEnvironFallback(["CC_host"], cc_host) + cxx_host = GetEnvironFallback(["CXX_host"], cxx_host) + + # The environment variable could be used in 'make_global_settings', like + # ['CC.host', '$(CC)'] or ['CXX.host', '$(CXX)'], transform them here. + if "$(CC)" in cc_host and cc_host_global_setting: + cc_host = cc_host_global_setting.replace("$(CC)", cc) + if "$(CXX)" in cxx_host and cxx_host_global_setting: + cxx_host = cxx_host_global_setting.replace("$(CXX)", cxx) + master_ninja.variable( + "cc_host", CommandWithWrapper("CC.host", wrappers, cc_host) + ) + master_ninja.variable( + "cxx_host", CommandWithWrapper("CXX.host", wrappers, cxx_host) + ) + if flavor == "win": + master_ninja.variable("ld_host", ld_host) + else: + master_ninja.variable( + "ld_host", CommandWithWrapper("LINK", wrappers, ld_host) + ) + master_ninja.variable( + "ldxx_host", CommandWithWrapper("LINK", wrappers, ldxx_host) + ) + + master_ninja.newline() + + master_ninja.pool("link_pool", depth=GetDefaultConcurrentLinks()) + master_ninja.newline() + + deps = "msvc" if flavor == "win" else "gcc" + + if flavor != "win": + master_ninja.rule( + "cc", + description="CC $out", + command=( + "$cc -MMD -MF $out.d $defines $includes $cflags $cflags_c " + "$cflags_pch_c -c $in -o $out" + ), + depfile="$out.d", + deps=deps, + ) + master_ninja.rule( + "cc_s", + description="CC $out", + command=( + "$cc $defines $includes $cflags $cflags_c " + "$cflags_pch_c -c $in -o $out" + ), + ) + master_ninja.rule( + "cxx", + description="CXX $out", + command=( + "$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc " + "$cflags_pch_cc -c $in -o $out" + ), + depfile="$out.d", + deps=deps, + ) + else: + # TODO(scottmg) Separate pdb names is a test to see if it works around + # http://crbug.com/142362. It seems there's a race between the creation of + # the .pdb by the precompiled header step for .cc and the compilation of + # .c files. This should be handled by mspdbsrv, but rarely errors out with + # c1xx : fatal error C1033: cannot open program database + # By making the rules target separate pdb files this might be avoided. + cc_command = ( + "ninja -t msvc -e $arch " + "-- " + "$cc /nologo /showIncludes /FC " + "@$out.rsp /c $in /Fo$out /Fd$pdbname_c " + ) + cxx_command = ( + "ninja -t msvc -e $arch " + "-- " + "$cxx /nologo /showIncludes /FC " + "@$out.rsp /c $in /Fo$out /Fd$pdbname_cc " + ) + master_ninja.rule( + "cc", + description="CC $out", + command=cc_command, + rspfile="$out.rsp", + rspfile_content="$defines $includes $cflags $cflags_c", + deps=deps, + ) + master_ninja.rule( + "cxx", + description="CXX $out", + command=cxx_command, + rspfile="$out.rsp", + rspfile_content="$defines $includes $cflags $cflags_cc", + deps=deps, + ) + master_ninja.rule( + "idl", + description="IDL $in", + command=( + "%s gyp-win-tool midl-wrapper $arch $outdir " + "$tlb $h $dlldata $iid $proxy $in " + "$midl_includes $idlflags" % sys.executable + ), + ) + master_ninja.rule( + "rc", + description="RC $in", + # Note: $in must be last otherwise rc.exe complains. + command=( + "%s gyp-win-tool rc-wrapper " + "$arch $rc $defines $resource_includes $rcflags /fo$out $in" + % sys.executable + ), + ) + master_ninja.rule( + "asm", + description="ASM $out", + command=( + "%s gyp-win-tool asm-wrapper " + "$arch $asm $defines $includes $asmflags /c /Fo $out $in" + % sys.executable + ), + ) + + if flavor not in ("ios", "mac", "win"): + master_ninja.rule( + "alink", + description="AR $out", + command="rm -f $out && $ar rcs $arflags $out $in", + ) + master_ninja.rule( + "alink_thin", + description="AR $out", + command="rm -f $out && $ar rcsT $arflags $out $in", + ) + + # This allows targets that only need to depend on $lib's API to declare an + # order-only dependency on $lib.TOC and avoid relinking such downstream + # dependencies when $lib changes only in non-public ways. + # The resulting string leaves an uninterpolated %{suffix} which + # is used in the final substitution below. + mtime_preserving_solink_base = ( + "if [ ! -e $lib -o ! -e $lib.TOC ]; then " + "%(solink)s && %(extract_toc)s > $lib.TOC; else " + "%(solink)s && %(extract_toc)s > $lib.tmp && " + "if ! cmp -s $lib.tmp $lib.TOC; then mv $lib.tmp $lib.TOC ; " + "fi; fi" + % { + "solink": "$ld -shared $ldflags -o $lib -Wl,-soname=$soname %(suffix)s", + "extract_toc": ( + "{ $readelf -d $lib | grep SONAME ; " + "$nm -gD -f p $lib | cut -f1-2 -d' '; }" + ), + } + ) + + master_ninja.rule( + "solink", + description="SOLINK $lib", + restat=True, + command=mtime_preserving_solink_base + % {"suffix": "@$link_file_list"}, # noqa: E501 + rspfile="$link_file_list", + rspfile_content=( + "-Wl,--whole-archive $in $solibs -Wl," "--no-whole-archive $libs" + ), + pool="link_pool", + ) + master_ninja.rule( + "solink_module", + description="SOLINK(module) $lib", + restat=True, + command=mtime_preserving_solink_base % {"suffix": "@$link_file_list"}, + rspfile="$link_file_list", + rspfile_content="-Wl,--start-group $in $solibs $libs -Wl,--end-group", + pool="link_pool", + ) + master_ninja.rule( + "link", + description="LINK $out", + command=( + "$ld $ldflags -o $out " + "-Wl,--start-group $in $solibs $libs -Wl,--end-group" + ), + pool="link_pool", + ) + elif flavor == "win": + master_ninja.rule( + "alink", + description="LIB $out", + command=( + "%s gyp-win-tool link-wrapper $arch False " + "$ar /nologo /ignore:4221 /OUT:$out @$out.rsp" % sys.executable + ), + rspfile="$out.rsp", + rspfile_content="$in_newline $libflags", + ) + _AddWinLinkRules(master_ninja, embed_manifest=True) + _AddWinLinkRules(master_ninja, embed_manifest=False) + else: + master_ninja.rule( + "objc", + description="OBJC $out", + command=( + "$cc -MMD -MF $out.d $defines $includes $cflags $cflags_objc " + "$cflags_pch_objc -c $in -o $out" + ), + depfile="$out.d", + deps=deps, + ) + master_ninja.rule( + "objcxx", + description="OBJCXX $out", + command=( + "$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_objcc " + "$cflags_pch_objcc -c $in -o $out" + ), + depfile="$out.d", + deps=deps, + ) + master_ninja.rule( + "alink", + description="LIBTOOL-STATIC $out, POSTBUILDS", + command="rm -f $out && " + "./gyp-mac-tool filter-libtool libtool $libtool_flags " + "-static -o $out $in" + "$postbuilds", + ) + master_ninja.rule( + "lipo", + description="LIPO $out, POSTBUILDS", + command="rm -f $out && lipo -create $in -output $out$postbuilds", + ) + master_ninja.rule( + "solipo", + description="SOLIPO $out, POSTBUILDS", + command=( + "rm -f $lib $lib.TOC && lipo -create $in -output $lib$postbuilds &&" + "%(extract_toc)s > $lib.TOC" + % { + "extract_toc": "{ otool -l $lib | grep LC_ID_DYLIB -A 5; " + "nm -gP $lib | cut -f1-2 -d' ' | grep -v U$$; true; }" + } + ), + ) + + # Record the public interface of $lib in $lib.TOC. See the corresponding + # comment in the posix section above for details. + solink_base = "$ld %(type)s $ldflags -o $lib %(suffix)s" + mtime_preserving_solink_base = ( + "if [ ! -e $lib -o ! -e $lib.TOC ] || " + # Always force dependent targets to relink if this library + # reexports something. Handling this correctly would require + # recursive TOC dumping but this is rare in practice, so punt. + "otool -l $lib | grep -q LC_REEXPORT_DYLIB ; then " + "%(solink)s && %(extract_toc)s > $lib.TOC; " + "else " + "%(solink)s && %(extract_toc)s > $lib.tmp && " + "if ! cmp -s $lib.tmp $lib.TOC; then " + "mv $lib.tmp $lib.TOC ; " + "fi; " + "fi" + % { + "solink": solink_base, + "extract_toc": "{ otool -l $lib | grep LC_ID_DYLIB -A 5; " + "nm -gP $lib | cut -f1-2 -d' ' | grep -v U$$; true; }", + } + ) + + solink_suffix = "@$link_file_list$postbuilds" + master_ninja.rule( + "solink", + description="SOLINK $lib, POSTBUILDS", + restat=True, + command=mtime_preserving_solink_base + % {"suffix": solink_suffix, "type": "-shared"}, + rspfile="$link_file_list", + rspfile_content="$in $solibs $libs", + pool="link_pool", + ) + master_ninja.rule( + "solink_notoc", + description="SOLINK $lib, POSTBUILDS", + restat=True, + command=solink_base % {"suffix": solink_suffix, "type": "-shared"}, + rspfile="$link_file_list", + rspfile_content="$in $solibs $libs", + pool="link_pool", + ) + + master_ninja.rule( + "solink_module", + description="SOLINK(module) $lib, POSTBUILDS", + restat=True, + command=mtime_preserving_solink_base + % {"suffix": solink_suffix, "type": "-bundle"}, + rspfile="$link_file_list", + rspfile_content="$in $solibs $libs", + pool="link_pool", + ) + master_ninja.rule( + "solink_module_notoc", + description="SOLINK(module) $lib, POSTBUILDS", + restat=True, + command=solink_base % {"suffix": solink_suffix, "type": "-bundle"}, + rspfile="$link_file_list", + rspfile_content="$in $solibs $libs", + pool="link_pool", + ) + + master_ninja.rule( + "link", + description="LINK $out, POSTBUILDS", + command=("$ld $ldflags -o $out " "$in $solibs $libs$postbuilds"), + pool="link_pool", + ) + master_ninja.rule( + "preprocess_infoplist", + description="PREPROCESS INFOPLIST $out", + command=( + "$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && " + "plutil -convert xml1 $out $out" + ), + ) + master_ninja.rule( + "copy_infoplist", + description="COPY INFOPLIST $in", + command="$env ./gyp-mac-tool copy-info-plist $in $out $binary $keys", + ) + master_ninja.rule( + "merge_infoplist", + description="MERGE INFOPLISTS $in", + command="$env ./gyp-mac-tool merge-info-plist $out $in", + ) + master_ninja.rule( + "compile_xcassets", + description="COMPILE XCASSETS $in", + command="$env ./gyp-mac-tool compile-xcassets $keys $in", + ) + master_ninja.rule( + "compile_ios_framework_headers", + description="COMPILE HEADER MAPS AND COPY FRAMEWORK HEADERS $in", + command="$env ./gyp-mac-tool compile-ios-framework-header-map $out " + "$framework $in && $env ./gyp-mac-tool " + "copy-ios-framework-headers $framework $copy_headers", + ) + master_ninja.rule( + "mac_tool", + description="MACTOOL $mactool_cmd $in", + command="$env ./gyp-mac-tool $mactool_cmd $in $out $binary", + ) + master_ninja.rule( + "package_framework", + description="PACKAGE FRAMEWORK $out, POSTBUILDS", + command="./gyp-mac-tool package-framework $out $version$postbuilds " + "&& touch $out", + ) + master_ninja.rule( + "package_ios_framework", + description="PACKAGE IOS FRAMEWORK $out, POSTBUILDS", + command="./gyp-mac-tool package-ios-framework $out $postbuilds " + "&& touch $out", + ) + if flavor == "win": + master_ninja.rule( + "stamp", + description="STAMP $out", + command="%s gyp-win-tool stamp $out" % sys.executable, + ) + else: + master_ninja.rule( + "stamp", description="STAMP $out", command="${postbuilds}touch $out" + ) + if flavor == "win": + master_ninja.rule( + "copy", + description="COPY $in $out", + command="%s gyp-win-tool recursive-mirror $in $out" % sys.executable, + ) + elif flavor == "zos": + master_ninja.rule( + "copy", + description="COPY $in $out", + command="rm -rf $out && cp -fRP $in $out", + ) + else: + master_ninja.rule( + "copy", + description="COPY $in $out", + command="ln -f $in $out 2>/dev/null || (rm -rf $out && cp -af $in $out)", + ) + master_ninja.newline() + + all_targets = set() + for build_file in params["build_files"]: + for target in gyp.common.AllTargets( + target_list, target_dicts, os.path.normpath(build_file) + ): + all_targets.add(target) + all_outputs = set() + + # target_outputs is a map from qualified target name to a Target object. + target_outputs = {} + # target_short_names is a map from target short name to a list of Target + # objects. + target_short_names = {} + + # short name of targets that were skipped because they didn't contain anything + # interesting. + # NOTE: there may be overlap between this an non_empty_target_names. + empty_target_names = set() + + # Set of non-empty short target names. + # NOTE: there may be overlap between this an empty_target_names. + non_empty_target_names = set() + + for qualified_target in target_list: + # qualified_target is like: third_party/icu/icu.gyp:icui18n#target + build_file, name, toolset = gyp.common.ParseQualifiedTarget(qualified_target) + + this_make_global_settings = data[build_file].get("make_global_settings", []) + assert make_global_settings == this_make_global_settings, ( + "make_global_settings needs to be the same for all targets. " + f"{this_make_global_settings} vs. {make_global_settings}" + ) + + spec = target_dicts[qualified_target] + if flavor == "mac": + gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec) + + # If build_file is a symlink, we must not follow it because there's a chance + # it could point to a path above toplevel_dir, and we cannot correctly deal + # with that case at the moment. + build_file = gyp.common.RelativePath(build_file, options.toplevel_dir, False) + + qualified_target_for_hash = gyp.common.QualifiedTarget( + build_file, name, toolset + ) + qualified_target_for_hash = qualified_target_for_hash.encode("utf-8") + hash_for_rules = hashlib.md5(qualified_target_for_hash).hexdigest() + + base_path = os.path.dirname(build_file) + obj = "obj" + if toolset != "target": + obj += "." + toolset + output_file = os.path.join(obj, base_path, name + ".ninja") + + ninja_output = StringIO() + writer = NinjaWriter( + hash_for_rules, + target_outputs, + base_path, + build_dir, + ninja_output, + toplevel_build, + output_file, + flavor, + toplevel_dir=options.toplevel_dir, + ) + + target = writer.WriteSpec(spec, config_name, generator_flags) + + if ninja_output.tell() > 0: + # Only create files for ninja files that actually have contents. + with OpenOutput(os.path.join(toplevel_build, output_file)) as ninja_file: + ninja_file.write(ninja_output.getvalue()) + ninja_output.close() + master_ninja.subninja(output_file) + + if target: + if name != target.FinalOutput() and spec["toolset"] == "target": + target_short_names.setdefault(name, []).append(target) + target_outputs[qualified_target] = target + if qualified_target in all_targets: + all_outputs.add(target.FinalOutput()) + non_empty_target_names.add(name) + else: + empty_target_names.add(name) + + if target_short_names: + # Write a short name to build this target. This benefits both the + # "build chrome" case as well as the gyp tests, which expect to be + # able to run actions and build libraries by their short name. + master_ninja.newline() + master_ninja.comment("Short names for targets.") + for short_name in sorted(target_short_names): + master_ninja.build( + short_name, + "phony", + [x.FinalOutput() for x in target_short_names[short_name]], + ) + + # Write phony targets for any empty targets that weren't written yet. As + # short names are not necessarily unique only do this for short names that + # haven't already been output for another target. + empty_target_names = empty_target_names - non_empty_target_names + if empty_target_names: + master_ninja.newline() + master_ninja.comment("Empty targets (output for completeness).") + for name in sorted(empty_target_names): + master_ninja.build(name, "phony") + + if all_outputs: + master_ninja.newline() + master_ninja.build("all", "phony", sorted(all_outputs)) + master_ninja.default(generator_flags.get("default_target", "all")) + + master_ninja_file.close() + + +def PerformBuild(data, configurations, params): + options = params["options"] + for config in configurations: + builddir = os.path.join(options.toplevel_dir, "out", config) + arguments = ["ninja", "-C", builddir] + print(f"Building [{config}]: {arguments}") + subprocess.check_call(arguments) + + +def CallGenerateOutputForConfig(arglist): + # Ignore the interrupt signal so that the parent process catches it and + # kills all multiprocessing children. + signal.signal(signal.SIGINT, signal.SIG_IGN) + + (target_list, target_dicts, data, params, config_name) = arglist + GenerateOutputForConfig(target_list, target_dicts, data, params, config_name) + + +def GenerateOutput(target_list, target_dicts, data, params): + # Update target_dicts for iOS device builds. + target_dicts = gyp.xcode_emulation.CloneConfigurationForDeviceAndEmulator( + target_dicts + ) + + user_config = params.get("generator_flags", {}).get("config", None) + if gyp.common.GetFlavor(params) == "win": + target_list, target_dicts = MSVSUtil.ShardTargets(target_list, target_dicts) + target_list, target_dicts = MSVSUtil.InsertLargePdbShims( + target_list, target_dicts, generator_default_variables + ) + + if user_config: + GenerateOutputForConfig(target_list, target_dicts, data, params, user_config) + else: + config_names = target_dicts[target_list[0]]["configurations"] + if params["parallel"]: + try: + pool = multiprocessing.Pool(len(config_names)) + arglists = [] + for config_name in config_names: + arglists.append( + (target_list, target_dicts, data, params, config_name) + ) + pool.map(CallGenerateOutputForConfig, arglists) + except KeyboardInterrupt as e: + pool.terminate() + raise e + else: + for config_name in config_names: + GenerateOutputForConfig( + target_list, target_dicts, data, params, config_name + ) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py new file mode 100644 index 0000000000000..7d180685b21cf --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Unit tests for the ninja.py file. """ + +import sys +import unittest + +import gyp.generator.ninja as ninja + + +class TestPrefixesAndSuffixes(unittest.TestCase): + def test_BinaryNamesWindows(self): + # These cannot run on non-Windows as they require a VS installation to + # correctly handle variable expansion. + if sys.platform.startswith("win"): + writer = ninja.NinjaWriter( + "foo", "wee", ".", ".", "build.ninja", ".", "build.ninja", "win" + ) + spec = {"target_name": "wee"} + self.assertTrue( + writer.ComputeOutputFileName(spec, "executable").endswith(".exe") + ) + self.assertTrue( + writer.ComputeOutputFileName(spec, "shared_library").endswith(".dll") + ) + self.assertTrue( + writer.ComputeOutputFileName(spec, "static_library").endswith(".lib") + ) + + def test_BinaryNamesLinux(self): + writer = ninja.NinjaWriter( + "foo", "wee", ".", ".", "build.ninja", ".", "build.ninja", "linux" + ) + spec = {"target_name": "wee"} + self.assertTrue("." not in writer.ComputeOutputFileName(spec, "executable")) + self.assertTrue( + writer.ComputeOutputFileName(spec, "shared_library").startswith("lib") + ) + self.assertTrue( + writer.ComputeOutputFileName(spec, "static_library").startswith("lib") + ) + self.assertTrue( + writer.ComputeOutputFileName(spec, "shared_library").endswith(".so") + ) + self.assertTrue( + writer.ComputeOutputFileName(spec, "static_library").endswith(".a") + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py new file mode 100644 index 0000000000000..2f4d17e514e43 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py @@ -0,0 +1,1394 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +import filecmp +import gyp.common +import gyp.xcodeproj_file +import gyp.xcode_ninja +import errno +import os +import sys +import posixpath +import re +import shutil +import subprocess +import tempfile + + +# Project files generated by this module will use _intermediate_var as a +# custom Xcode setting whose value is a DerivedSources-like directory that's +# project-specific and configuration-specific. The normal choice, +# DERIVED_FILE_DIR, is target-specific, which is thought to be too restrictive +# as it is likely that multiple targets within a single project file will want +# to access the same set of generated files. The other option, +# PROJECT_DERIVED_FILE_DIR, is unsuitable because while it is project-specific, +# it is not configuration-specific. INTERMEDIATE_DIR is defined as +# $(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION). +_intermediate_var = "INTERMEDIATE_DIR" + +# SHARED_INTERMEDIATE_DIR is the same, except that it is shared among all +# targets that share the same BUILT_PRODUCTS_DIR. +_shared_intermediate_var = "SHARED_INTERMEDIATE_DIR" + +_library_search_paths_var = "LIBRARY_SEARCH_PATHS" + +generator_default_variables = { + "EXECUTABLE_PREFIX": "", + "EXECUTABLE_SUFFIX": "", + "STATIC_LIB_PREFIX": "lib", + "SHARED_LIB_PREFIX": "lib", + "STATIC_LIB_SUFFIX": ".a", + "SHARED_LIB_SUFFIX": ".dylib", + # INTERMEDIATE_DIR is a place for targets to build up intermediate products. + # It is specific to each build environment. It is only guaranteed to exist + # and be constant within the context of a project, corresponding to a single + # input file. Some build environments may allow their intermediate directory + # to be shared on a wider scale, but this is not guaranteed. + "INTERMEDIATE_DIR": "$(%s)" % _intermediate_var, + "OS": "mac", + "PRODUCT_DIR": "$(BUILT_PRODUCTS_DIR)", + "LIB_DIR": "$(BUILT_PRODUCTS_DIR)", + "RULE_INPUT_ROOT": "$(INPUT_FILE_BASE)", + "RULE_INPUT_EXT": "$(INPUT_FILE_SUFFIX)", + "RULE_INPUT_NAME": "$(INPUT_FILE_NAME)", + "RULE_INPUT_PATH": "$(INPUT_FILE_PATH)", + "RULE_INPUT_DIRNAME": "$(INPUT_FILE_DIRNAME)", + "SHARED_INTERMEDIATE_DIR": "$(%s)" % _shared_intermediate_var, + "CONFIGURATION_NAME": "$(CONFIGURATION)", +} + +# The Xcode-specific sections that hold paths. +generator_additional_path_sections = [ + "mac_bundle_resources", + "mac_framework_headers", + "mac_framework_private_headers", + # 'mac_framework_dirs', input already handles _dirs endings. +] + +# The Xcode-specific keys that exist on targets and aren't moved down to +# configurations. +generator_additional_non_configuration_keys = [ + "ios_app_extension", + "ios_watch_app", + "ios_watchkit_extension", + "mac_bundle", + "mac_bundle_resources", + "mac_framework_headers", + "mac_framework_private_headers", + "mac_xctest_bundle", + "mac_xcuitest_bundle", + "xcode_create_dependents_test_runner", +] + +# We want to let any rules apply to files that are resources also. +generator_extra_sources_for_rules = [ + "mac_bundle_resources", + "mac_framework_headers", + "mac_framework_private_headers", +] + +generator_filelist_paths = None + +# Xcode's standard set of library directories, which don't need to be duplicated +# in LIBRARY_SEARCH_PATHS. This list is not exhaustive, but that's okay. +xcode_standard_library_dirs = frozenset( + ["$(SDKROOT)/usr/lib", "$(SDKROOT)/usr/local/lib"] +) + + +def CreateXCConfigurationList(configuration_names): + xccl = gyp.xcodeproj_file.XCConfigurationList({"buildConfigurations": []}) + if len(configuration_names) == 0: + configuration_names = ["Default"] + for configuration_name in configuration_names: + xcbc = gyp.xcodeproj_file.XCBuildConfiguration({"name": configuration_name}) + xccl.AppendProperty("buildConfigurations", xcbc) + xccl.SetProperty("defaultConfigurationName", configuration_names[0]) + return xccl + + +class XcodeProject: + def __init__(self, gyp_path, path, build_file_dict): + self.gyp_path = gyp_path + self.path = path + self.project = gyp.xcodeproj_file.PBXProject(path=path) + projectDirPath = gyp.common.RelativePath( + os.path.dirname(os.path.abspath(self.gyp_path)), + os.path.dirname(path) or ".", + ) + self.project.SetProperty("projectDirPath", projectDirPath) + self.project_file = gyp.xcodeproj_file.XCProjectFile( + {"rootObject": self.project} + ) + self.build_file_dict = build_file_dict + + # TODO(mark): add destructor that cleans up self.path if created_dir is + # True and things didn't complete successfully. Or do something even + # better with "try"? + self.created_dir = False + try: + os.makedirs(self.path) + self.created_dir = True + except OSError as e: + if e.errno != errno.EEXIST: + raise + + def Finalize1(self, xcode_targets, serialize_all_tests): + # Collect a list of all of the build configuration names used by the + # various targets in the file. It is very heavily advised to keep each + # target in an entire project (even across multiple project files) using + # the same set of configuration names. + configurations = [] + for xct in self.project.GetProperty("targets"): + xccl = xct.GetProperty("buildConfigurationList") + xcbcs = xccl.GetProperty("buildConfigurations") + for xcbc in xcbcs: + name = xcbc.GetProperty("name") + if name not in configurations: + configurations.append(name) + + # Replace the XCConfigurationList attached to the PBXProject object with + # a new one specifying all of the configuration names used by the various + # targets. + try: + xccl = CreateXCConfigurationList(configurations) + self.project.SetProperty("buildConfigurationList", xccl) + except Exception: + sys.stderr.write("Problem with gyp file %s\n" % self.gyp_path) + raise + + # The need for this setting is explained above where _intermediate_var is + # defined. The comments below about wanting to avoid project-wide build + # settings apply here too, but this needs to be set on a project-wide basis + # so that files relative to the _intermediate_var setting can be displayed + # properly in the Xcode UI. + # + # Note that for configuration-relative files such as anything relative to + # _intermediate_var, for the purposes of UI tree view display, Xcode will + # only resolve the configuration name once, when the project file is + # opened. If the active build configuration is changed, the project file + # must be closed and reopened if it is desired for the tree view to update. + # This is filed as Apple radar 6588391. + xccl.SetBuildSetting( + _intermediate_var, "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)" + ) + xccl.SetBuildSetting( + _shared_intermediate_var, "$(SYMROOT)/DerivedSources/$(CONFIGURATION)" + ) + + # Set user-specified project-wide build settings and config files. This + # is intended to be used very sparingly. Really, almost everything should + # go into target-specific build settings sections. The project-wide + # settings are only intended to be used in cases where Xcode attempts to + # resolve variable references in a project context as opposed to a target + # context, such as when resolving sourceTree references while building up + # the tree tree view for UI display. + # Any values set globally are applied to all configurations, then any + # per-configuration values are applied. + for xck, xcv in self.build_file_dict.get("xcode_settings", {}).items(): + xccl.SetBuildSetting(xck, xcv) + if "xcode_config_file" in self.build_file_dict: + config_ref = self.project.AddOrGetFileInRootGroup( + self.build_file_dict["xcode_config_file"] + ) + xccl.SetBaseConfiguration(config_ref) + build_file_configurations = self.build_file_dict.get("configurations", {}) + if build_file_configurations: + for config_name in configurations: + build_file_configuration_named = build_file_configurations.get( + config_name, {} + ) + if build_file_configuration_named: + xcc = xccl.ConfigurationNamed(config_name) + for xck, xcv in build_file_configuration_named.get( + "xcode_settings", {} + ).items(): + xcc.SetBuildSetting(xck, xcv) + if "xcode_config_file" in build_file_configuration_named: + config_ref = self.project.AddOrGetFileInRootGroup( + build_file_configurations[config_name]["xcode_config_file"] + ) + xcc.SetBaseConfiguration(config_ref) + + # Sort the targets based on how they appeared in the input. + # TODO(mark): Like a lot of other things here, this assumes internal + # knowledge of PBXProject - in this case, of its "targets" property. + + # ordinary_targets are ordinary targets that are already in the project + # file. run_test_targets are the targets that run unittests and should be + # used for the Run All Tests target. support_targets are the action/rule + # targets used by GYP file targets, just kept for the assert check. + ordinary_targets = [] + run_test_targets = [] + support_targets = [] + + # targets is full list of targets in the project. + targets = [] + + # does the it define it's own "all"? + has_custom_all = False + + # targets_for_all is the list of ordinary_targets that should be listed + # in this project's "All" target. It includes each non_runtest_target + # that does not have suppress_wildcard set. + targets_for_all = [] + + for target in self.build_file_dict["targets"]: + target_name = target["target_name"] + toolset = target["toolset"] + qualified_target = gyp.common.QualifiedTarget( + self.gyp_path, target_name, toolset + ) + xcode_target = xcode_targets[qualified_target] + # Make sure that the target being added to the sorted list is already in + # the unsorted list. + assert xcode_target in self.project._properties["targets"] + targets.append(xcode_target) + ordinary_targets.append(xcode_target) + if xcode_target.support_target: + support_targets.append(xcode_target.support_target) + targets.append(xcode_target.support_target) + + if not int(target.get("suppress_wildcard", False)): + targets_for_all.append(xcode_target) + + if target_name.lower() == "all": + has_custom_all = True + + # If this target has a 'run_as' attribute, add its target to the + # targets, and add it to the test targets. + if target.get("run_as"): + # Make a target to run something. It should have one + # dependency, the parent xcode target. + xccl = CreateXCConfigurationList(configurations) + run_target = gyp.xcodeproj_file.PBXAggregateTarget( + { + "name": "Run " + target_name, + "productName": xcode_target.GetProperty("productName"), + "buildConfigurationList": xccl, + }, + parent=self.project, + ) + run_target.AddDependency(xcode_target) + + command = target["run_as"] + script = "" + if command.get("working_directory"): + script = ( + script + + 'cd "%s"\n' + % gyp.xcodeproj_file.ConvertVariablesToShellSyntax( + command.get("working_directory") + ) + ) + + if command.get("environment"): + script = ( + script + + "\n".join( + [ + 'export %s="%s"' + % ( + key, + gyp.xcodeproj_file.ConvertVariablesToShellSyntax( + val + ), + ) + for (key, val) in command.get("environment").items() + ] + ) + + "\n" + ) + + # Some test end up using sockets, files on disk, etc. and can get + # confused if more then one test runs at a time. The generator + # flag 'xcode_serialize_all_test_runs' controls the forcing of all + # tests serially. It defaults to True. To get serial runs this + # little bit of python does the same as the linux flock utility to + # make sure only one runs at a time. + command_prefix = "" + if serialize_all_tests: + command_prefix = """python -c "import fcntl, subprocess, sys +file = open('$TMPDIR/GYP_serialize_test_runs', 'a') +fcntl.flock(file.fileno(), fcntl.LOCK_EX) +sys.exit(subprocess.call(sys.argv[1:]))" """ + + # If we were unable to exec for some reason, we want to exit + # with an error, and fixup variable references to be shell + # syntax instead of xcode syntax. + script = ( + script + + "exec " + + command_prefix + + "%s\nexit 1\n" + % gyp.xcodeproj_file.ConvertVariablesToShellSyntax( + gyp.common.EncodePOSIXShellList(command.get("action")) + ) + ) + + ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase( + {"shellScript": script, "showEnvVarsInLog": 0} + ) + run_target.AppendProperty("buildPhases", ssbp) + + # Add the run target to the project file. + targets.append(run_target) + run_test_targets.append(run_target) + xcode_target.test_runner = run_target + + # Make sure that the list of targets being replaced is the same length as + # the one replacing it, but allow for the added test runner targets. + assert len(self.project._properties["targets"]) == len(ordinary_targets) + len( + support_targets + ) + + self.project._properties["targets"] = targets + + # Get rid of unnecessary levels of depth in groups like the Source group. + self.project.RootGroupsTakeOverOnlyChildren(True) + + # Sort the groups nicely. Do this after sorting the targets, because the + # Products group is sorted based on the order of the targets. + self.project.SortGroups() + + # Create an "All" target if there's more than one target in this project + # file and the project didn't define its own "All" target. Put a generated + # "All" target first so that people opening up the project for the first + # time will build everything by default. + if len(targets_for_all) > 1 and not has_custom_all: + xccl = CreateXCConfigurationList(configurations) + all_target = gyp.xcodeproj_file.PBXAggregateTarget( + {"buildConfigurationList": xccl, "name": "All"}, parent=self.project + ) + + for target in targets_for_all: + all_target.AddDependency(target) + + # TODO(mark): This is evil because it relies on internal knowledge of + # PBXProject._properties. It's important to get the "All" target first, + # though. + self.project._properties["targets"].insert(0, all_target) + + # The same, but for run_test_targets. + if len(run_test_targets) > 1: + xccl = CreateXCConfigurationList(configurations) + run_all_tests_target = gyp.xcodeproj_file.PBXAggregateTarget( + {"buildConfigurationList": xccl, "name": "Run All Tests"}, + parent=self.project, + ) + for run_test_target in run_test_targets: + run_all_tests_target.AddDependency(run_test_target) + + # Insert after the "All" target, which must exist if there is more than + # one run_test_target. + self.project._properties["targets"].insert(1, run_all_tests_target) + + def Finalize2(self, xcode_targets, xcode_target_to_target_dict): + # Finalize2 needs to happen in a separate step because the process of + # updating references to other projects depends on the ordering of targets + # within remote project files. Finalize1 is responsible for sorting duty, + # and once all project files are sorted, Finalize2 can come in and update + # these references. + + # To support making a "test runner" target that will run all the tests + # that are direct dependents of any given target, we look for + # xcode_create_dependents_test_runner being set on an Aggregate target, + # and generate a second target that will run the tests runners found under + # the marked target. + for bf_tgt in self.build_file_dict["targets"]: + if int(bf_tgt.get("xcode_create_dependents_test_runner", 0)): + tgt_name = bf_tgt["target_name"] + toolset = bf_tgt["toolset"] + qualified_target = gyp.common.QualifiedTarget( + self.gyp_path, tgt_name, toolset + ) + xcode_target = xcode_targets[qualified_target] + if isinstance(xcode_target, gyp.xcodeproj_file.PBXAggregateTarget): + # Collect all the run test targets. + all_run_tests = [] + pbxtds = xcode_target.GetProperty("dependencies") + for pbxtd in pbxtds: + pbxcip = pbxtd.GetProperty("targetProxy") + dependency_xct = pbxcip.GetProperty("remoteGlobalIDString") + if hasattr(dependency_xct, "test_runner"): + all_run_tests.append(dependency_xct.test_runner) + + # Directly depend on all the runners as they depend on the target + # that builds them. + if len(all_run_tests) > 0: + run_all_target = gyp.xcodeproj_file.PBXAggregateTarget( + { + "name": "Run %s Tests" % tgt_name, + "productName": tgt_name, + }, + parent=self.project, + ) + for run_test_target in all_run_tests: + run_all_target.AddDependency(run_test_target) + + # Insert the test runner after the related target. + idx = self.project._properties["targets"].index(xcode_target) + self.project._properties["targets"].insert( + idx + 1, run_all_target + ) + + # Update all references to other projects, to make sure that the lists of + # remote products are complete. Otherwise, Xcode will fill them in when + # it opens the project file, which will result in unnecessary diffs. + # TODO(mark): This is evil because it relies on internal knowledge of + # PBXProject._other_pbxprojects. + for other_pbxproject in self.project._other_pbxprojects.keys(): + self.project.AddOrGetProjectReference(other_pbxproject) + + self.project.SortRemoteProductReferences() + + # Give everything an ID. + self.project_file.ComputeIDs() + + # Make sure that no two objects in the project file have the same ID. If + # multiple objects wind up with the same ID, upon loading the file, Xcode + # will only recognize one object (the last one in the file?) and the + # results are unpredictable. + self.project_file.EnsureNoIDCollisions() + + def Write(self): + # Write the project file to a temporary location first. Xcode watches for + # changes to the project file and presents a UI sheet offering to reload + # the project when it does change. However, in some cases, especially when + # multiple projects are open or when Xcode is busy, things don't work so + # seamlessly. Sometimes, Xcode is able to detect that a project file has + # changed but can't unload it because something else is referencing it. + # To mitigate this problem, and to avoid even having Xcode present the UI + # sheet when an open project is rewritten for inconsequential changes, the + # project file is written to a temporary file in the xcodeproj directory + # first. The new temporary file is then compared to the existing project + # file, if any. If they differ, the new file replaces the old; otherwise, + # the new project file is simply deleted. Xcode properly detects a file + # being renamed over an open project file as a change and so it remains + # able to present the "project file changed" sheet under this system. + # Writing to a temporary file first also avoids the possible problem of + # Xcode rereading an incomplete project file. + (output_fd, new_pbxproj_path) = tempfile.mkstemp( + suffix=".tmp", prefix="project.pbxproj.gyp.", dir=self.path + ) + + try: + output_file = os.fdopen(output_fd, "w") + + self.project_file.Print(output_file) + output_file.close() + + pbxproj_path = os.path.join(self.path, "project.pbxproj") + + same = False + try: + same = filecmp.cmp(pbxproj_path, new_pbxproj_path, False) + except OSError as e: + if e.errno != errno.ENOENT: + raise + + if same: + # The new file is identical to the old one, just get rid of the new + # one. + os.unlink(new_pbxproj_path) + else: + # The new file is different from the old one, or there is no old one. + # Rename the new file to the permanent name. + # + # tempfile.mkstemp uses an overly restrictive mode, resulting in a + # file that can only be read by the owner, regardless of the umask. + # There's no reason to not respect the umask here, which means that + # an extra hoop is required to fetch it and reset the new file's mode. + # + # No way to get the umask without setting a new one? Set a safe one + # and then set it back to the old value. + umask = os.umask(0o77) + os.umask(umask) + + os.chmod(new_pbxproj_path, 0o666 & ~umask) + os.rename(new_pbxproj_path, pbxproj_path) + + except Exception: + # Don't leave turds behind. In fact, if this code was responsible for + # creating the xcodeproj directory, get rid of that too. + os.unlink(new_pbxproj_path) + if self.created_dir: + shutil.rmtree(self.path, True) + raise + + +def AddSourceToTarget(source, type, pbxp, xct): + # TODO(mark): Perhaps source_extensions and library_extensions can be made a + # little bit fancier. + source_extensions = ["c", "cc", "cpp", "cxx", "m", "mm", "s", "swift"] + + # .o is conceptually more of a "source" than a "library," but Xcode thinks + # of "sources" as things to compile and "libraries" (or "frameworks") as + # things to link with. Adding an object file to an Xcode target's frameworks + # phase works properly. + library_extensions = ["a", "dylib", "framework", "o"] + + basename = posixpath.basename(source) + (root, ext) = posixpath.splitext(basename) + if ext: + ext = ext[1:].lower() + + if ext in source_extensions and type != "none": + xct.SourcesPhase().AddFile(source) + elif ext in library_extensions and type != "none": + xct.FrameworksPhase().AddFile(source) + else: + # Files that aren't added to a sources or frameworks build phase can still + # go into the project file, just not as part of a build phase. + pbxp.AddOrGetFileInRootGroup(source) + + +def AddResourceToTarget(resource, pbxp, xct): + # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call + # where it's used. + xct.ResourcesPhase().AddFile(resource) + + +def AddHeaderToTarget(header, pbxp, xct, is_public): + # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call + # where it's used. + settings = "{ATTRIBUTES = (%s, ); }" % ("Private", "Public")[is_public] + xct.HeadersPhase().AddFile(header, settings) + + +_xcode_variable_re = re.compile(r"(\$\((.*?)\))") + + +def ExpandXcodeVariables(string, expansions): + """Expands Xcode-style $(VARIABLES) in string per the expansions dict. + + In some rare cases, it is appropriate to expand Xcode variables when a + project file is generated. For any substring $(VAR) in string, if VAR is a + key in the expansions dict, $(VAR) will be replaced with expansions[VAR]. + Any $(VAR) substring in string for which VAR is not a key in the expansions + dict will remain in the returned string. + """ + + matches = _xcode_variable_re.findall(string) + if matches is None: + return string + + matches.reverse() + for match in matches: + (to_replace, variable) = match + if variable not in expansions: + continue + + replacement = expansions[variable] + string = re.sub(re.escape(to_replace), replacement, string) + + return string + + +_xcode_define_re = re.compile(r"([\\\"\' ])") + + +def EscapeXcodeDefine(s): + """We must escape the defines that we give to XCode so that it knows not to + split on spaces and to respect backslash and quote literals. However, we + must not quote the define, or Xcode will incorrectly interpret variables + especially $(inherited).""" + return re.sub(_xcode_define_re, r"\\\1", s) + + +def PerformBuild(data, configurations, params): + options = params["options"] + + for build_file, build_file_dict in data.items(): + (build_file_root, build_file_ext) = os.path.splitext(build_file) + if build_file_ext != ".gyp": + continue + xcodeproj_path = build_file_root + options.suffix + ".xcodeproj" + if options.generator_output: + xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path) + + for config in configurations: + arguments = ["xcodebuild", "-project", xcodeproj_path] + arguments += ["-configuration", config] + print(f"Building [{config}]: {arguments}") + subprocess.check_call(arguments) + + +def CalculateGeneratorInputInfo(params): + toplevel = params["options"].toplevel_dir + if params.get("flavor") == "ninja": + generator_dir = os.path.relpath(params["options"].generator_output or ".") + output_dir = params.get("generator_flags", {}).get("output_dir", "out") + output_dir = os.path.normpath(os.path.join(generator_dir, output_dir)) + qualified_out_dir = os.path.normpath( + os.path.join(toplevel, output_dir, "gypfiles-xcode-ninja") + ) + else: + output_dir = os.path.normpath(os.path.join(toplevel, "xcodebuild")) + qualified_out_dir = os.path.normpath( + os.path.join(toplevel, output_dir, "gypfiles") + ) + + global generator_filelist_paths + generator_filelist_paths = { + "toplevel": toplevel, + "qualified_out_dir": qualified_out_dir, + } + + +def GenerateOutput(target_list, target_dicts, data, params): + # Optionally configure each spec to use ninja as the external builder. + ninja_wrapper = params.get("flavor") == "ninja" + if ninja_wrapper: + (target_list, target_dicts, data) = gyp.xcode_ninja.CreateWrapper( + target_list, target_dicts, data, params + ) + + options = params["options"] + generator_flags = params.get("generator_flags", {}) + parallel_builds = generator_flags.get("xcode_parallel_builds", True) + serialize_all_tests = generator_flags.get("xcode_serialize_all_test_runs", True) + upgrade_check_project_version = generator_flags.get( + "xcode_upgrade_check_project_version", None + ) + + # Format upgrade_check_project_version with leading zeros as needed. + if upgrade_check_project_version: + upgrade_check_project_version = str(upgrade_check_project_version) + while len(upgrade_check_project_version) < 4: + upgrade_check_project_version = "0" + upgrade_check_project_version + + skip_excluded_files = not generator_flags.get("xcode_list_excluded_files", True) + xcode_projects = {} + for build_file, build_file_dict in data.items(): + (build_file_root, build_file_ext) = os.path.splitext(build_file) + if build_file_ext != ".gyp": + continue + xcodeproj_path = build_file_root + options.suffix + ".xcodeproj" + if options.generator_output: + xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path) + xcp = XcodeProject(build_file, xcodeproj_path, build_file_dict) + xcode_projects[build_file] = xcp + pbxp = xcp.project + + # Set project-level attributes from multiple options + project_attributes = {} + if parallel_builds: + project_attributes["BuildIndependentTargetsInParallel"] = "YES" + if upgrade_check_project_version: + project_attributes["LastUpgradeCheck"] = upgrade_check_project_version + project_attributes[ + "LastTestingUpgradeCheck" + ] = upgrade_check_project_version + project_attributes["LastSwiftUpdateCheck"] = upgrade_check_project_version + pbxp.SetProperty("attributes", project_attributes) + + # Add gyp/gypi files to project + if not generator_flags.get("standalone"): + main_group = pbxp.GetProperty("mainGroup") + build_group = gyp.xcodeproj_file.PBXGroup({"name": "Build"}) + main_group.AppendChild(build_group) + for included_file in build_file_dict["included_files"]: + build_group.AddOrGetFileByPath(included_file, False) + + xcode_targets = {} + xcode_target_to_target_dict = {} + for qualified_target in target_list: + [build_file, target_name, toolset] = gyp.common.ParseQualifiedTarget( + qualified_target + ) + + spec = target_dicts[qualified_target] + if spec["toolset"] != "target": + raise Exception( + "Multiple toolsets not supported in xcode build (target %s)" + % qualified_target + ) + configuration_names = [spec["default_configuration"]] + for configuration_name in sorted(spec["configurations"].keys()): + if configuration_name not in configuration_names: + configuration_names.append(configuration_name) + xcp = xcode_projects[build_file] + pbxp = xcp.project + + # Set up the configurations for the target according to the list of names + # supplied. + xccl = CreateXCConfigurationList(configuration_names) + + # Create an XCTarget subclass object for the target. The type with + # "+bundle" appended will be used if the target has "mac_bundle" set. + # loadable_modules not in a mac_bundle are mapped to + # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets + # to create a single-file mh_bundle. + _types = { + "executable": "com.apple.product-type.tool", + "loadable_module": "com.googlecode.gyp.xcode.bundle", + "shared_library": "com.apple.product-type.library.dynamic", + "static_library": "com.apple.product-type.library.static", + "mac_kernel_extension": "com.apple.product-type.kernel-extension", + "executable+bundle": "com.apple.product-type.application", + "loadable_module+bundle": "com.apple.product-type.bundle", + "loadable_module+xctest": "com.apple.product-type.bundle.unit-test", + "loadable_module+xcuitest": "com.apple.product-type.bundle.ui-testing", + "shared_library+bundle": "com.apple.product-type.framework", + "executable+extension+bundle": "com.apple.product-type.app-extension", + "executable+watch+extension+bundle": + "com.apple.product-type.watchkit-extension", + "executable+watch+bundle": "com.apple.product-type.application.watchapp", + "mac_kernel_extension+bundle": "com.apple.product-type.kernel-extension", + } + + target_properties = { + "buildConfigurationList": xccl, + "name": target_name, + } + + type = spec["type"] + is_xctest = int(spec.get("mac_xctest_bundle", 0)) + is_xcuitest = int(spec.get("mac_xcuitest_bundle", 0)) + is_bundle = int(spec.get("mac_bundle", 0)) or is_xctest + is_app_extension = int(spec.get("ios_app_extension", 0)) + is_watchkit_extension = int(spec.get("ios_watchkit_extension", 0)) + is_watch_app = int(spec.get("ios_watch_app", 0)) + if type != "none": + type_bundle_key = type + if is_xcuitest: + type_bundle_key += "+xcuitest" + assert type == "loadable_module", ( + "mac_xcuitest_bundle targets must have type loadable_module " + "(target %s)" % target_name + ) + elif is_xctest: + type_bundle_key += "+xctest" + assert type == "loadable_module", ( + "mac_xctest_bundle targets must have type loadable_module " + "(target %s)" % target_name + ) + elif is_app_extension: + assert is_bundle, ( + "ios_app_extension flag requires mac_bundle " + "(target %s)" % target_name + ) + type_bundle_key += "+extension+bundle" + elif is_watchkit_extension: + assert is_bundle, ( + "ios_watchkit_extension flag requires mac_bundle " + "(target %s)" % target_name + ) + type_bundle_key += "+watch+extension+bundle" + elif is_watch_app: + assert is_bundle, ( + "ios_watch_app flag requires mac_bundle " + "(target %s)" % target_name + ) + type_bundle_key += "+watch+bundle" + elif is_bundle: + type_bundle_key += "+bundle" + + xctarget_type = gyp.xcodeproj_file.PBXNativeTarget + try: + target_properties["productType"] = _types[type_bundle_key] + except KeyError as e: + gyp.common.ExceptionAppend( + e, + "-- unknown product type while " "writing target %s" % target_name, + ) + raise + else: + xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget + assert not is_bundle, ( + 'mac_bundle targets cannot have type none (target "%s")' % target_name + ) + assert not is_xcuitest, ( + 'mac_xcuitest_bundle targets cannot have type none (target "%s")' + % target_name + ) + assert not is_xctest, ( + 'mac_xctest_bundle targets cannot have type none (target "%s")' + % target_name + ) + + target_product_name = spec.get("product_name") + if target_product_name is not None: + target_properties["productName"] = target_product_name + + xct = xctarget_type( + target_properties, + parent=pbxp, + force_outdir=spec.get("product_dir"), + force_prefix=spec.get("product_prefix"), + force_extension=spec.get("product_extension"), + ) + pbxp.AppendProperty("targets", xct) + xcode_targets[qualified_target] = xct + xcode_target_to_target_dict[xct] = spec + + spec_actions = spec.get("actions", []) + spec_rules = spec.get("rules", []) + + # Xcode has some "issues" with checking dependencies for the "Compile + # sources" step with any source files/headers generated by actions/rules. + # To work around this, if a target is building anything directly (not + # type "none"), then a second target is used to run the GYP actions/rules + # and is made a dependency of this target. This way the work is done + # before the dependency checks for what should be recompiled. + support_xct = None + # The Xcode "issues" don't affect xcode-ninja builds, since the dependency + # logic all happens in ninja. Don't bother creating the extra targets in + # that case. + if type != "none" and (spec_actions or spec_rules) and not ninja_wrapper: + support_xccl = CreateXCConfigurationList(configuration_names) + support_target_suffix = generator_flags.get( + "support_target_suffix", " Support" + ) + support_target_properties = { + "buildConfigurationList": support_xccl, + "name": target_name + support_target_suffix, + } + if target_product_name: + support_target_properties["productName"] = ( + target_product_name + " Support" + ) + support_xct = gyp.xcodeproj_file.PBXAggregateTarget( + support_target_properties, parent=pbxp + ) + pbxp.AppendProperty("targets", support_xct) + xct.AddDependency(support_xct) + # Hang the support target off the main target so it can be tested/found + # by the generator during Finalize. + xct.support_target = support_xct + + prebuild_index = 0 + + # Add custom shell script phases for "actions" sections. + for action in spec_actions: + # There's no need to write anything into the script to ensure that the + # output directories already exist, because Xcode will look at the + # declared outputs and automatically ensure that they exist for us. + + # Do we have a message to print when this action runs? + message = action.get("message") + if message: + message = "echo note: " + gyp.common.EncodePOSIXShellArgument(message) + else: + message = "" + + # Turn the list into a string that can be passed to a shell. + action_string = gyp.common.EncodePOSIXShellList(action["action"]) + + # Convert Xcode-type variable references to sh-compatible environment + # variable references. + message_sh = gyp.xcodeproj_file.ConvertVariablesToShellSyntax(message) + action_string_sh = gyp.xcodeproj_file.ConvertVariablesToShellSyntax( + action_string + ) + + script = "" + # Include the optional message + if message_sh: + script += message_sh + "\n" + # Be sure the script runs in exec, and that if exec fails, the script + # exits signalling an error. + script += "exec " + action_string_sh + "\nexit 1\n" + ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase( + { + "inputPaths": action["inputs"], + "name": 'Action "' + action["action_name"] + '"', + "outputPaths": action["outputs"], + "shellScript": script, + "showEnvVarsInLog": 0, + } + ) + + if support_xct: + support_xct.AppendProperty("buildPhases", ssbp) + else: + # TODO(mark): this assumes too much knowledge of the internals of + # xcodeproj_file; some of these smarts should move into xcodeproj_file + # itself. + xct._properties["buildPhases"].insert(prebuild_index, ssbp) + prebuild_index = prebuild_index + 1 + + # TODO(mark): Should verify that at most one of these is specified. + if int(action.get("process_outputs_as_sources", False)): + for output in action["outputs"]: + AddSourceToTarget(output, type, pbxp, xct) + + if int(action.get("process_outputs_as_mac_bundle_resources", False)): + for output in action["outputs"]: + AddResourceToTarget(output, pbxp, xct) + + # tgt_mac_bundle_resources holds the list of bundle resources so + # the rule processing can check against it. + if is_bundle: + tgt_mac_bundle_resources = spec.get("mac_bundle_resources", []) + else: + tgt_mac_bundle_resources = [] + + # Add custom shell script phases driving "make" for "rules" sections. + # + # Xcode's built-in rule support is almost powerful enough to use directly, + # but there are a few significant deficiencies that render them unusable. + # There are workarounds for some of its inadequacies, but in aggregate, + # the workarounds added complexity to the generator, and some workarounds + # actually require input files to be crafted more carefully than I'd like. + # Consequently, until Xcode rules are made more capable, "rules" input + # sections will be handled in Xcode output by shell script build phases + # performed prior to the compilation phase. + # + # The following problems with Xcode rules were found. The numbers are + # Apple radar IDs. I hope that these shortcomings are addressed, I really + # liked having the rules handled directly in Xcode during the period that + # I was prototyping this. + # + # 6588600 Xcode compiles custom script rule outputs too soon, compilation + # fails. This occurs when rule outputs from distinct inputs are + # interdependent. The only workaround is to put rules and their + # inputs in a separate target from the one that compiles the rule + # outputs. This requires input file cooperation and it means that + # process_outputs_as_sources is unusable. + # 6584932 Need to declare that custom rule outputs should be excluded from + # compilation. A possible workaround is to lie to Xcode about a + # rule's output, giving it a dummy file it doesn't know how to + # compile. The rule action script would need to touch the dummy. + # 6584839 I need a way to declare additional inputs to a custom rule. + # A possible workaround is a shell script phase prior to + # compilation that touches a rule's primary input files if any + # would-be additional inputs are newer than the output. Modifying + # the source tree - even just modification times - feels dirty. + # 6564240 Xcode "custom script" build rules always dump all environment + # variables. This is a low-prioroty problem and is not a + # show-stopper. + rules_by_ext = {} + for rule in spec_rules: + rules_by_ext[rule["extension"]] = rule + + # First, some definitions: + # + # A "rule source" is a file that was listed in a target's "sources" + # list and will have a rule applied to it on the basis of matching the + # rule's "extensions" attribute. Rule sources are direct inputs to + # rules. + # + # Rule definitions may specify additional inputs in their "inputs" + # attribute. These additional inputs are used for dependency tracking + # purposes. + # + # A "concrete output" is a rule output with input-dependent variables + # resolved. For example, given a rule with: + # 'extension': 'ext', 'outputs': ['$(INPUT_FILE_BASE).cc'], + # if the target's "sources" list contained "one.ext" and "two.ext", + # the "concrete output" for rule input "two.ext" would be "two.cc". If + # a rule specifies multiple outputs, each input file that the rule is + # applied to will have the same number of concrete outputs. + # + # If any concrete outputs are outdated or missing relative to their + # corresponding rule_source or to any specified additional input, the + # rule action must be performed to generate the concrete outputs. + + # concrete_outputs_by_rule_source will have an item at the same index + # as the rule['rule_sources'] that it corresponds to. Each item is a + # list of all of the concrete outputs for the rule_source. + concrete_outputs_by_rule_source = [] + + # concrete_outputs_all is a flat list of all concrete outputs that this + # rule is able to produce, given the known set of input files + # (rule_sources) that apply to it. + concrete_outputs_all = [] + + # messages & actions are keyed by the same indices as rule['rule_sources'] + # and concrete_outputs_by_rule_source. They contain the message and + # action to perform after resolving input-dependent variables. The + # message is optional, in which case None is stored for each rule source. + messages = [] + actions = [] + + for rule_source in rule.get("rule_sources", []): + rule_source_dirname, rule_source_basename = posixpath.split(rule_source) + (rule_source_root, rule_source_ext) = posixpath.splitext( + rule_source_basename + ) + + # These are the same variable names that Xcode uses for its own native + # rule support. Because Xcode's rule engine is not being used, they + # need to be expanded as they are written to the makefile. + rule_input_dict = { + "INPUT_FILE_BASE": rule_source_root, + "INPUT_FILE_SUFFIX": rule_source_ext, + "INPUT_FILE_NAME": rule_source_basename, + "INPUT_FILE_PATH": rule_source, + "INPUT_FILE_DIRNAME": rule_source_dirname, + } + + concrete_outputs_for_this_rule_source = [] + for output in rule.get("outputs", []): + # Fortunately, Xcode and make both use $(VAR) format for their + # variables, so the expansion is the only transformation necessary. + # Any remaining $(VAR)-type variables in the string can be given + # directly to make, which will pick up the correct settings from + # what Xcode puts into the environment. + concrete_output = ExpandXcodeVariables(output, rule_input_dict) + concrete_outputs_for_this_rule_source.append(concrete_output) + + # Add all concrete outputs to the project. + pbxp.AddOrGetFileInRootGroup(concrete_output) + + concrete_outputs_by_rule_source.append( + concrete_outputs_for_this_rule_source + ) + concrete_outputs_all.extend(concrete_outputs_for_this_rule_source) + + # TODO(mark): Should verify that at most one of these is specified. + if int(rule.get("process_outputs_as_sources", False)): + for output in concrete_outputs_for_this_rule_source: + AddSourceToTarget(output, type, pbxp, xct) + + # If the file came from the mac_bundle_resources list or if the rule + # is marked to process outputs as bundle resource, do so. + was_mac_bundle_resource = rule_source in tgt_mac_bundle_resources + if was_mac_bundle_resource or int( + rule.get("process_outputs_as_mac_bundle_resources", False) + ): + for output in concrete_outputs_for_this_rule_source: + AddResourceToTarget(output, pbxp, xct) + + # Do we have a message to print when this rule runs? + message = rule.get("message") + if message: + message = gyp.common.EncodePOSIXShellArgument(message) + message = ExpandXcodeVariables(message, rule_input_dict) + messages.append(message) + + # Turn the list into a string that can be passed to a shell. + action_string = gyp.common.EncodePOSIXShellList(rule["action"]) + + action = ExpandXcodeVariables(action_string, rule_input_dict) + actions.append(action) + + if len(concrete_outputs_all) > 0: + # TODO(mark): There's a possibility for collision here. Consider + # target "t" rule "A_r" and target "t_A" rule "r". + makefile_name = "%s.make" % re.sub( + "[^a-zA-Z0-9_]", "_", "{}_{}".format(target_name, rule["rule_name"]) + ) + makefile_path = os.path.join( + xcode_projects[build_file].path, makefile_name + ) + # TODO(mark): try/close? Write to a temporary file and swap it only + # if it's got changes? + makefile = open(makefile_path, "w") + + # make will build the first target in the makefile by default. By + # convention, it's called "all". List all (or at least one) + # concrete output for each rule source as a prerequisite of the "all" + # target. + makefile.write("all: \\\n") + for concrete_output_index, concrete_output_by_rule_source in enumerate( + concrete_outputs_by_rule_source + ): + # Only list the first (index [0]) concrete output of each input + # in the "all" target. Otherwise, a parallel make (-j > 1) would + # attempt to process each input multiple times simultaneously. + # Otherwise, "all" could just contain the entire list of + # concrete_outputs_all. + concrete_output = concrete_output_by_rule_source[0] + if ( + concrete_output_index + == len(concrete_outputs_by_rule_source) - 1 + ): + eol = "" + else: + eol = " \\" + makefile.write(f" {concrete_output}{eol}\n") + + for (rule_source, concrete_outputs, message, action) in zip( + rule["rule_sources"], + concrete_outputs_by_rule_source, + messages, + actions, + ): + makefile.write("\n") + + # Add a rule that declares it can build each concrete output of a + # rule source. Collect the names of the directories that are + # required. + concrete_output_dirs = [] + for concrete_output_index, concrete_output in enumerate( + concrete_outputs + ): + if concrete_output_index == 0: + bol = "" + else: + bol = " " + makefile.write(f"{bol}{concrete_output} \\\n") + + concrete_output_dir = posixpath.dirname(concrete_output) + if ( + concrete_output_dir + and concrete_output_dir not in concrete_output_dirs + ): + concrete_output_dirs.append(concrete_output_dir) + + makefile.write(" : \\\n") + + # The prerequisites for this rule are the rule source itself and + # the set of additional rule inputs, if any. + prerequisites = [rule_source] + prerequisites.extend(rule.get("inputs", [])) + for prerequisite_index, prerequisite in enumerate(prerequisites): + if prerequisite_index == len(prerequisites) - 1: + eol = "" + else: + eol = " \\" + makefile.write(f" {prerequisite}{eol}\n") + + # Make sure that output directories exist before executing the rule + # action. + if len(concrete_output_dirs) > 0: + makefile.write( + '\t@mkdir -p "%s"\n' % '" "'.join(concrete_output_dirs) + ) + + # The rule message and action have already had + # the necessary variable substitutions performed. + if message: + # Mark it with note: so Xcode picks it up in build output. + makefile.write("\t@echo note: %s\n" % message) + makefile.write("\t%s\n" % action) + + makefile.close() + + # It might be nice to ensure that needed output directories exist + # here rather than in each target in the Makefile, but that wouldn't + # work if there ever was a concrete output that had an input-dependent + # variable anywhere other than in the leaf position. + + # Don't declare any inputPaths or outputPaths. If they're present, + # Xcode will provide a slight optimization by only running the script + # phase if any output is missing or outdated relative to any input. + # Unfortunately, it will also assume that all outputs are touched by + # the script, and if the outputs serve as files in a compilation + # phase, they will be unconditionally rebuilt. Since make might not + # rebuild everything that could be declared here as an output, this + # extra compilation activity is unnecessary. With inputPaths and + # outputPaths not supplied, make will always be called, but it knows + # enough to not do anything when everything is up-to-date. + + # To help speed things up, pass -j COUNT to make so it does some work + # in parallel. Don't use ncpus because Xcode will build ncpus targets + # in parallel and if each target happens to have a rules step, there + # would be ncpus^2 things going. With a machine that has 2 quad-core + # Xeons, a build can quickly run out of processes based on + # scheduling/other tasks, and randomly failing builds are no good. + script = ( + """JOB_COUNT="$(/usr/sbin/sysctl -n hw.ncpu)" +if [ "${JOB_COUNT}" -gt 4 ]; then + JOB_COUNT=4 +fi +exec xcrun make -f "${PROJECT_FILE_PATH}/%s" -j "${JOB_COUNT}" +exit 1 +""" + % makefile_name + ) + ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase( + { + "name": 'Rule "' + rule["rule_name"] + '"', + "shellScript": script, + "showEnvVarsInLog": 0, + } + ) + + if support_xct: + support_xct.AppendProperty("buildPhases", ssbp) + else: + # TODO(mark): this assumes too much knowledge of the internals of + # xcodeproj_file; some of these smarts should move + # into xcodeproj_file itself. + xct._properties["buildPhases"].insert(prebuild_index, ssbp) + prebuild_index = prebuild_index + 1 + + # Extra rule inputs also go into the project file. Concrete outputs were + # already added when they were computed. + groups = ["inputs", "inputs_excluded"] + if skip_excluded_files: + groups = [x for x in groups if not x.endswith("_excluded")] + for group in groups: + for item in rule.get(group, []): + pbxp.AddOrGetFileInRootGroup(item) + + # Add "sources". + for source in spec.get("sources", []): + (source_root, source_extension) = posixpath.splitext(source) + if source_extension[1:] not in rules_by_ext: + # AddSourceToTarget will add the file to a root group if it's not + # already there. + AddSourceToTarget(source, type, pbxp, xct) + else: + pbxp.AddOrGetFileInRootGroup(source) + + # Add "mac_bundle_resources" and "mac_framework_private_headers" if + # it's a bundle of any type. + if is_bundle: + for resource in tgt_mac_bundle_resources: + (resource_root, resource_extension) = posixpath.splitext(resource) + if resource_extension[1:] not in rules_by_ext: + AddResourceToTarget(resource, pbxp, xct) + else: + pbxp.AddOrGetFileInRootGroup(resource) + + for header in spec.get("mac_framework_private_headers", []): + AddHeaderToTarget(header, pbxp, xct, False) + + # Add "mac_framework_headers". These can be valid for both frameworks + # and static libraries. + if is_bundle or type == "static_library": + for header in spec.get("mac_framework_headers", []): + AddHeaderToTarget(header, pbxp, xct, True) + + # Add "copies". + pbxcp_dict = {} + for copy_group in spec.get("copies", []): + dest = copy_group["destination"] + if dest[0] not in ("/", "$"): + # Relative paths are relative to $(SRCROOT). + dest = "$(SRCROOT)/" + dest + + code_sign = int(copy_group.get("xcode_code_sign", 0)) + settings = (None, "{ATTRIBUTES = (CodeSignOnCopy, ); }")[code_sign] + + # Coalesce multiple "copies" sections in the same target with the same + # "destination" property into the same PBXCopyFilesBuildPhase, otherwise + # they'll wind up with ID collisions. + pbxcp = pbxcp_dict.get(dest, None) + if pbxcp is None: + pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase( + {"name": "Copy to " + copy_group["destination"]}, parent=xct + ) + pbxcp.SetDestination(dest) + + # TODO(mark): The usual comment about this knowing too much about + # gyp.xcodeproj_file internals applies. + xct._properties["buildPhases"].insert(prebuild_index, pbxcp) + + pbxcp_dict[dest] = pbxcp + + for file in copy_group["files"]: + pbxcp.AddFile(file, settings) + + # Excluded files can also go into the project file. + if not skip_excluded_files: + for key in [ + "sources", + "mac_bundle_resources", + "mac_framework_headers", + "mac_framework_private_headers", + ]: + excluded_key = key + "_excluded" + for item in spec.get(excluded_key, []): + pbxp.AddOrGetFileInRootGroup(item) + + # So can "inputs" and "outputs" sections of "actions" groups. + groups = ["inputs", "inputs_excluded", "outputs", "outputs_excluded"] + if skip_excluded_files: + groups = [x for x in groups if not x.endswith("_excluded")] + for action in spec.get("actions", []): + for group in groups: + for item in action.get(group, []): + # Exclude anything in BUILT_PRODUCTS_DIR. They're products, not + # sources. + if not item.startswith("$(BUILT_PRODUCTS_DIR)/"): + pbxp.AddOrGetFileInRootGroup(item) + + for postbuild in spec.get("postbuilds", []): + action_string_sh = gyp.common.EncodePOSIXShellList(postbuild["action"]) + script = "exec " + action_string_sh + "\nexit 1\n" + + # Make the postbuild step depend on the output of ld or ar from this + # target. Apparently putting the script step after the link step isn't + # sufficient to ensure proper ordering in all cases. With an input + # declared but no outputs, the script step should run every time, as + # desired. + ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase( + { + "inputPaths": ["$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)"], + "name": 'Postbuild "' + postbuild["postbuild_name"] + '"', + "shellScript": script, + "showEnvVarsInLog": 0, + } + ) + xct.AppendProperty("buildPhases", ssbp) + + # Add dependencies before libraries, because adding a dependency may imply + # adding a library. It's preferable to keep dependencies listed first + # during a link phase so that they can override symbols that would + # otherwise be provided by libraries, which will usually include system + # libraries. On some systems, ld is finicky and even requires the + # libraries to be ordered in such a way that unresolved symbols in + # earlier-listed libraries may only be resolved by later-listed libraries. + # The Mac linker doesn't work that way, but other platforms do, and so + # their linker invocations need to be constructed in this way. There's + # no compelling reason for Xcode's linker invocations to differ. + + if "dependencies" in spec: + for dependency in spec["dependencies"]: + xct.AddDependency(xcode_targets[dependency]) + # The support project also gets the dependencies (in case they are + # needed for the actions/rules to work). + if support_xct: + support_xct.AddDependency(xcode_targets[dependency]) + + if "libraries" in spec: + for library in spec["libraries"]: + xct.FrameworksPhase().AddFile(library) + # Add the library's directory to LIBRARY_SEARCH_PATHS if necessary. + # I wish Xcode handled this automatically. + library_dir = posixpath.dirname(library) + if library_dir not in xcode_standard_library_dirs and ( + not xct.HasBuildSetting(_library_search_paths_var) + or library_dir not in xct.GetBuildSetting(_library_search_paths_var) + ): + xct.AppendBuildSetting(_library_search_paths_var, library_dir) + + for configuration_name in configuration_names: + configuration = spec["configurations"][configuration_name] + xcbc = xct.ConfigurationNamed(configuration_name) + for include_dir in configuration.get("mac_framework_dirs", []): + xcbc.AppendBuildSetting("FRAMEWORK_SEARCH_PATHS", include_dir) + for include_dir in configuration.get("include_dirs", []): + xcbc.AppendBuildSetting("HEADER_SEARCH_PATHS", include_dir) + for library_dir in configuration.get("library_dirs", []): + if library_dir not in xcode_standard_library_dirs and ( + not xcbc.HasBuildSetting(_library_search_paths_var) + or library_dir + not in xcbc.GetBuildSetting(_library_search_paths_var) + ): + xcbc.AppendBuildSetting(_library_search_paths_var, library_dir) + + if "defines" in configuration: + for define in configuration["defines"]: + set_define = EscapeXcodeDefine(define) + xcbc.AppendBuildSetting("GCC_PREPROCESSOR_DEFINITIONS", set_define) + if "xcode_settings" in configuration: + for xck, xcv in configuration["xcode_settings"].items(): + xcbc.SetBuildSetting(xck, xcv) + if "xcode_config_file" in configuration: + config_ref = pbxp.AddOrGetFileInRootGroup( + configuration["xcode_config_file"] + ) + xcbc.SetBaseConfiguration(config_ref) + + build_files = [] + for build_file, build_file_dict in data.items(): + if build_file.endswith(".gyp"): + build_files.append(build_file) + + for build_file in build_files: + xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) + + for build_file in build_files: + xcode_projects[build_file].Finalize2(xcode_targets, xcode_target_to_target_dict) + + for build_file in build_files: + xcode_projects[build_file].Write() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py new file mode 100644 index 0000000000000..49772d1f4d810 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Unit tests for the xcode.py file. """ + +import gyp.generator.xcode as xcode +import unittest +import sys + + +class TestEscapeXcodeDefine(unittest.TestCase): + if sys.platform == "darwin": + + def test_InheritedRemainsUnescaped(self): + self.assertEqual(xcode.EscapeXcodeDefine("$(inherited)"), "$(inherited)") + + def test_Escaping(self): + self.assertEqual(xcode.EscapeXcodeDefine('a b"c\\'), 'a\\ b\\"c\\\\') + + +if __name__ == "__main__": + unittest.main() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input.py new file mode 100644 index 0000000000000..d9699a0a50218 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input.py @@ -0,0 +1,3130 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +import ast + +import gyp.common +import gyp.simple_copy +import multiprocessing +import os.path +import re +import shlex +import signal +import subprocess +import sys +import threading +import traceback +from distutils.version import StrictVersion +from gyp.common import GypError +from gyp.common import OrderedSet + +# A list of types that are treated as linkable. +linkable_types = [ + "executable", + "shared_library", + "loadable_module", + "mac_kernel_extension", + "windows_driver", +] + +# A list of sections that contain links to other targets. +dependency_sections = ["dependencies", "export_dependent_settings"] + +# base_path_sections is a list of sections defined by GYP that contain +# pathnames. The generators can provide more keys, the two lists are merged +# into path_sections, but you should call IsPathSection instead of using either +# list directly. +base_path_sections = [ + "destination", + "files", + "include_dirs", + "inputs", + "libraries", + "outputs", + "sources", +] +path_sections = set() + +# These per-process dictionaries are used to cache build file data when loading +# in parallel mode. +per_process_data = {} +per_process_aux_data = {} + + +def IsPathSection(section): + # If section ends in one of the '=+?!' characters, it's applied to a section + # without the trailing characters. '/' is notably absent from this list, + # because there's no way for a regular expression to be treated as a path. + while section and section[-1:] in "=+?!": + section = section[:-1] + + if section in path_sections: + return True + + # Sections matching the regexp '_(dir|file|path)s?$' are also + # considered PathSections. Using manual string matching since that + # is much faster than the regexp and this can be called hundreds of + # thousands of times so micro performance matters. + if "_" in section: + tail = section[-6:] + if tail[-1] == "s": + tail = tail[:-1] + if tail[-5:] in ("_file", "_path"): + return True + return tail[-4:] == "_dir" + + return False + + +# base_non_configuration_keys is a list of key names that belong in the target +# itself and should not be propagated into its configurations. It is merged +# with a list that can come from the generator to +# create non_configuration_keys. +base_non_configuration_keys = [ + # Sections that must exist inside targets and not configurations. + "actions", + "configurations", + "copies", + "default_configuration", + "dependencies", + "dependencies_original", + "libraries", + "postbuilds", + "product_dir", + "product_extension", + "product_name", + "product_prefix", + "rules", + "run_as", + "sources", + "standalone_static_library", + "suppress_wildcard", + "target_name", + "toolset", + "toolsets", + "type", + # Sections that can be found inside targets or configurations, but that + # should not be propagated from targets into their configurations. + "variables", +] +non_configuration_keys = [] + +# Keys that do not belong inside a configuration dictionary. +invalid_configuration_keys = [ + "actions", + "all_dependent_settings", + "configurations", + "dependencies", + "direct_dependent_settings", + "libraries", + "link_settings", + "sources", + "standalone_static_library", + "target_name", + "type", +] + +# Controls whether or not the generator supports multiple toolsets. +multiple_toolsets = False + +# Paths for converting filelist paths to output paths: { +# toplevel, +# qualified_output_dir, +# } +generator_filelist_paths = None + + +def GetIncludedBuildFiles(build_file_path, aux_data, included=None): + """Return a list of all build files included into build_file_path. + + The returned list will contain build_file_path as well as all other files + that it included, either directly or indirectly. Note that the list may + contain files that were included into a conditional section that evaluated + to false and was not merged into build_file_path's dict. + + aux_data is a dict containing a key for each build file or included build + file. Those keys provide access to dicts whose "included" keys contain + lists of all other files included by the build file. + + included should be left at its default None value by external callers. It + is used for recursion. + + The returned list will not contain any duplicate entries. Each build file + in the list will be relative to the current directory. + """ + + if included is None: + included = [] + + if build_file_path in included: + return included + + included.append(build_file_path) + + for included_build_file in aux_data[build_file_path].get("included", []): + GetIncludedBuildFiles(included_build_file, aux_data, included) + + return included + + +def CheckedEval(file_contents): + """Return the eval of a gyp file. + The gyp file is restricted to dictionaries and lists only, and + repeated keys are not allowed. + Note that this is slower than eval() is. + """ + + syntax_tree = ast.parse(file_contents) + assert isinstance(syntax_tree, ast.Module) + c1 = syntax_tree.body + assert len(c1) == 1 + c2 = c1[0] + assert isinstance(c2, ast.Expr) + return CheckNode(c2.value, []) + + +def CheckNode(node, keypath): + if isinstance(node, ast.Dict): + dict = {} + for key, value in zip(node.keys, node.values): + assert isinstance(key, ast.Str) + key = key.s + if key in dict: + raise GypError( + "Key '" + + key + + "' repeated at level " + + repr(len(keypath) + 1) + + " with key path '" + + ".".join(keypath) + + "'" + ) + kp = list(keypath) # Make a copy of the list for descending this node. + kp.append(key) + dict[key] = CheckNode(value, kp) + return dict + elif isinstance(node, ast.List): + children = [] + for index, child in enumerate(node.elts): + kp = list(keypath) # Copy list. + kp.append(repr(index)) + children.append(CheckNode(child, kp)) + return children + elif isinstance(node, ast.Str): + return node.s + else: + raise TypeError( + "Unknown AST node at key path '" + ".".join(keypath) + "': " + repr(node) + ) + + +def LoadOneBuildFile(build_file_path, data, aux_data, includes, is_target, check): + if build_file_path in data: + return data[build_file_path] + + if os.path.exists(build_file_path): + build_file_contents = open(build_file_path, encoding='utf-8').read() + else: + raise GypError(f"{build_file_path} not found (cwd: {os.getcwd()})") + + build_file_data = None + try: + if check: + build_file_data = CheckedEval(build_file_contents) + else: + build_file_data = eval(build_file_contents, {"__builtins__": {}}, None) + except SyntaxError as e: + e.filename = build_file_path + raise + except Exception as e: + gyp.common.ExceptionAppend(e, "while reading " + build_file_path) + raise + + if type(build_file_data) is not dict: + raise GypError("%s does not evaluate to a dictionary." % build_file_path) + + data[build_file_path] = build_file_data + aux_data[build_file_path] = {} + + # Scan for includes and merge them in. + if "skip_includes" not in build_file_data or not build_file_data["skip_includes"]: + try: + if is_target: + LoadBuildFileIncludesIntoDict( + build_file_data, build_file_path, data, aux_data, includes, check + ) + else: + LoadBuildFileIncludesIntoDict( + build_file_data, build_file_path, data, aux_data, None, check + ) + except Exception as e: + gyp.common.ExceptionAppend( + e, "while reading includes of " + build_file_path + ) + raise + + return build_file_data + + +def LoadBuildFileIncludesIntoDict( + subdict, subdict_path, data, aux_data, includes, check +): + includes_list = [] + if includes is not None: + includes_list.extend(includes) + if "includes" in subdict: + for include in subdict["includes"]: + # "include" is specified relative to subdict_path, so compute the real + # path to include by appending the provided "include" to the directory + # in which subdict_path resides. + relative_include = os.path.normpath( + os.path.join(os.path.dirname(subdict_path), include) + ) + includes_list.append(relative_include) + # Unhook the includes list, it's no longer needed. + del subdict["includes"] + + # Merge in the included files. + for include in includes_list: + if "included" not in aux_data[subdict_path]: + aux_data[subdict_path]["included"] = [] + aux_data[subdict_path]["included"].append(include) + + gyp.DebugOutput(gyp.DEBUG_INCLUDES, "Loading Included File: '%s'", include) + + MergeDicts( + subdict, + LoadOneBuildFile(include, data, aux_data, None, False, check), + subdict_path, + include, + ) + + # Recurse into subdictionaries. + for k, v in subdict.items(): + if type(v) is dict: + LoadBuildFileIncludesIntoDict(v, subdict_path, data, aux_data, None, check) + elif type(v) is list: + LoadBuildFileIncludesIntoList(v, subdict_path, data, aux_data, check) + + +# This recurses into lists so that it can look for dicts. +def LoadBuildFileIncludesIntoList(sublist, sublist_path, data, aux_data, check): + for item in sublist: + if type(item) is dict: + LoadBuildFileIncludesIntoDict( + item, sublist_path, data, aux_data, None, check + ) + elif type(item) is list: + LoadBuildFileIncludesIntoList(item, sublist_path, data, aux_data, check) + + +# Processes toolsets in all the targets. This recurses into condition entries +# since they can contain toolsets as well. +def ProcessToolsetsInDict(data): + if "targets" in data: + target_list = data["targets"] + new_target_list = [] + for target in target_list: + # If this target already has an explicit 'toolset', and no 'toolsets' + # list, don't modify it further. + if "toolset" in target and "toolsets" not in target: + new_target_list.append(target) + continue + if multiple_toolsets: + toolsets = target.get("toolsets", ["target"]) + else: + toolsets = ["target"] + # Make sure this 'toolsets' definition is only processed once. + if "toolsets" in target: + del target["toolsets"] + if len(toolsets) > 0: + # Optimization: only do copies if more than one toolset is specified. + for build in toolsets[1:]: + new_target = gyp.simple_copy.deepcopy(target) + new_target["toolset"] = build + new_target_list.append(new_target) + target["toolset"] = toolsets[0] + new_target_list.append(target) + data["targets"] = new_target_list + if "conditions" in data: + for condition in data["conditions"]: + if type(condition) is list: + for condition_dict in condition[1:]: + if type(condition_dict) is dict: + ProcessToolsetsInDict(condition_dict) + + +# TODO(mark): I don't love this name. It just means that it's going to load +# a build file that contains targets and is expected to provide a targets dict +# that contains the targets... +def LoadTargetBuildFile( + build_file_path, + data, + aux_data, + variables, + includes, + depth, + check, + load_dependencies, +): + # If depth is set, predefine the DEPTH variable to be a relative path from + # this build file's directory to the directory identified by depth. + if depth: + # TODO(dglazkov) The backslash/forward-slash replacement at the end is a + # temporary measure. This should really be addressed by keeping all paths + # in POSIX until actual project generation. + d = gyp.common.RelativePath(depth, os.path.dirname(build_file_path)) + if d == "": + variables["DEPTH"] = "." + else: + variables["DEPTH"] = d.replace("\\", "/") + + # The 'target_build_files' key is only set when loading target build files in + # the non-parallel code path, where LoadTargetBuildFile is called + # recursively. In the parallel code path, we don't need to check whether the + # |build_file_path| has already been loaded, because the 'scheduled' set in + # ParallelState guarantees that we never load the same |build_file_path| + # twice. + if "target_build_files" in data: + if build_file_path in data["target_build_files"]: + # Already loaded. + return False + data["target_build_files"].add(build_file_path) + + gyp.DebugOutput( + gyp.DEBUG_INCLUDES, "Loading Target Build File '%s'", build_file_path + ) + + build_file_data = LoadOneBuildFile( + build_file_path, data, aux_data, includes, True, check + ) + + # Store DEPTH for later use in generators. + build_file_data["_DEPTH"] = depth + + # Set up the included_files key indicating which .gyp files contributed to + # this target dict. + if "included_files" in build_file_data: + raise GypError(build_file_path + " must not contain included_files key") + + included = GetIncludedBuildFiles(build_file_path, aux_data) + build_file_data["included_files"] = [] + for included_file in included: + # included_file is relative to the current directory, but it needs to + # be made relative to build_file_path's directory. + included_relative = gyp.common.RelativePath( + included_file, os.path.dirname(build_file_path) + ) + build_file_data["included_files"].append(included_relative) + + # Do a first round of toolsets expansion so that conditions can be defined + # per toolset. + ProcessToolsetsInDict(build_file_data) + + # Apply "pre"/"early" variable expansions and condition evaluations. + ProcessVariablesAndConditionsInDict( + build_file_data, PHASE_EARLY, variables, build_file_path + ) + + # Since some toolsets might have been defined conditionally, perform + # a second round of toolsets expansion now. + ProcessToolsetsInDict(build_file_data) + + # Look at each project's target_defaults dict, and merge settings into + # targets. + if "target_defaults" in build_file_data: + if "targets" not in build_file_data: + raise GypError("Unable to find targets in build file %s" % build_file_path) + + index = 0 + while index < len(build_file_data["targets"]): + # This procedure needs to give the impression that target_defaults is + # used as defaults, and the individual targets inherit from that. + # The individual targets need to be merged into the defaults. Make + # a deep copy of the defaults for each target, merge the target dict + # as found in the input file into that copy, and then hook up the + # copy with the target-specific data merged into it as the replacement + # target dict. + old_target_dict = build_file_data["targets"][index] + new_target_dict = gyp.simple_copy.deepcopy( + build_file_data["target_defaults"] + ) + MergeDicts( + new_target_dict, old_target_dict, build_file_path, build_file_path + ) + build_file_data["targets"][index] = new_target_dict + index += 1 + + # No longer needed. + del build_file_data["target_defaults"] + + # Look for dependencies. This means that dependency resolution occurs + # after "pre" conditionals and variable expansion, but before "post" - + # in other words, you can't put a "dependencies" section inside a "post" + # conditional within a target. + + dependencies = [] + if "targets" in build_file_data: + for target_dict in build_file_data["targets"]: + if "dependencies" not in target_dict: + continue + for dependency in target_dict["dependencies"]: + dependencies.append( + gyp.common.ResolveTarget(build_file_path, dependency, None)[0] + ) + + if load_dependencies: + for dependency in dependencies: + try: + LoadTargetBuildFile( + dependency, + data, + aux_data, + variables, + includes, + depth, + check, + load_dependencies, + ) + except Exception as e: + gyp.common.ExceptionAppend( + e, "while loading dependencies of %s" % build_file_path + ) + raise + else: + return (build_file_path, dependencies) + + +def CallLoadTargetBuildFile( + global_flags, + build_file_path, + variables, + includes, + depth, + check, + generator_input_info, +): + """Wrapper around LoadTargetBuildFile for parallel processing. + + This wrapper is used when LoadTargetBuildFile is executed in + a worker process. + """ + + try: + signal.signal(signal.SIGINT, signal.SIG_IGN) + + # Apply globals so that the worker process behaves the same. + for key, value in global_flags.items(): + globals()[key] = value + + SetGeneratorGlobals(generator_input_info) + result = LoadTargetBuildFile( + build_file_path, + per_process_data, + per_process_aux_data, + variables, + includes, + depth, + check, + False, + ) + if not result: + return result + + (build_file_path, dependencies) = result + + # We can safely pop the build_file_data from per_process_data because it + # will never be referenced by this process again, so we don't need to keep + # it in the cache. + build_file_data = per_process_data.pop(build_file_path) + + # This gets serialized and sent back to the main process via a pipe. + # It's handled in LoadTargetBuildFileCallback. + return (build_file_path, build_file_data, dependencies) + except GypError as e: + sys.stderr.write("gyp: %s\n" % e) + return None + except Exception as e: + print("Exception:", e, file=sys.stderr) + print(traceback.format_exc(), file=sys.stderr) + return None + + +class ParallelProcessingError(Exception): + pass + + +class ParallelState: + """Class to keep track of state when processing input files in parallel. + + If build files are loaded in parallel, use this to keep track of + state during farming out and processing parallel jobs. It's stored + in a global so that the callback function can have access to it. + """ + + def __init__(self): + # The multiprocessing pool. + self.pool = None + # The condition variable used to protect this object and notify + # the main loop when there might be more data to process. + self.condition = None + # The "data" dict that was passed to LoadTargetBuildFileParallel + self.data = None + # The number of parallel calls outstanding; decremented when a response + # was received. + self.pending = 0 + # The set of all build files that have been scheduled, so we don't + # schedule the same one twice. + self.scheduled = set() + # A list of dependency build file paths that haven't been scheduled yet. + self.dependencies = [] + # Flag to indicate if there was an error in a child process. + self.error = False + + def LoadTargetBuildFileCallback(self, result): + """Handle the results of running LoadTargetBuildFile in another process. + """ + self.condition.acquire() + if not result: + self.error = True + self.condition.notify() + self.condition.release() + return + (build_file_path0, build_file_data0, dependencies0) = result + self.data[build_file_path0] = build_file_data0 + self.data["target_build_files"].add(build_file_path0) + for new_dependency in dependencies0: + if new_dependency not in self.scheduled: + self.scheduled.add(new_dependency) + self.dependencies.append(new_dependency) + self.pending -= 1 + self.condition.notify() + self.condition.release() + + +def LoadTargetBuildFilesParallel( + build_files, data, variables, includes, depth, check, generator_input_info +): + parallel_state = ParallelState() + parallel_state.condition = threading.Condition() + # Make copies of the build_files argument that we can modify while working. + parallel_state.dependencies = list(build_files) + parallel_state.scheduled = set(build_files) + parallel_state.pending = 0 + parallel_state.data = data + + try: + parallel_state.condition.acquire() + while parallel_state.dependencies or parallel_state.pending: + if parallel_state.error: + break + if not parallel_state.dependencies: + parallel_state.condition.wait() + continue + + dependency = parallel_state.dependencies.pop() + + parallel_state.pending += 1 + global_flags = { + "path_sections": globals()["path_sections"], + "non_configuration_keys": globals()["non_configuration_keys"], + "multiple_toolsets": globals()["multiple_toolsets"], + } + + if not parallel_state.pool: + parallel_state.pool = multiprocessing.Pool(multiprocessing.cpu_count()) + parallel_state.pool.apply_async( + CallLoadTargetBuildFile, + args=( + global_flags, + dependency, + variables, + includes, + depth, + check, + generator_input_info, + ), + callback=parallel_state.LoadTargetBuildFileCallback, + ) + except KeyboardInterrupt as e: + parallel_state.pool.terminate() + raise e + + parallel_state.condition.release() + + parallel_state.pool.close() + parallel_state.pool.join() + parallel_state.pool = None + + if parallel_state.error: + sys.exit(1) + + +# Look for the bracket that matches the first bracket seen in a +# string, and return the start and end as a tuple. For example, if +# the input is something like "<(foo <(bar)) blah", then it would +# return (1, 13), indicating the entire string except for the leading +# "<" and trailing " blah". +LBRACKETS = set("{[(") +BRACKETS = {"}": "{", "]": "[", ")": "("} + + +def FindEnclosingBracketGroup(input_str): + stack = [] + start = -1 + for index, char in enumerate(input_str): + if char in LBRACKETS: + stack.append(char) + if start == -1: + start = index + elif char in BRACKETS: + if not stack: + return (-1, -1) + if stack.pop() != BRACKETS[char]: + return (-1, -1) + if not stack: + return (start, index + 1) + return (-1, -1) + + +def IsStrCanonicalInt(string): + """Returns True if |string| is in its canonical integer form. + + The canonical form is such that str(int(string)) == string. + """ + if type(string) is str: + # This function is called a lot so for maximum performance, avoid + # involving regexps which would otherwise make the code much + # shorter. Regexps would need twice the time of this function. + if string: + if string == "0": + return True + if string[0] == "-": + string = string[1:] + if not string: + return False + if "1" <= string[0] <= "9": + return string.isdigit() + + return False + + +# This matches things like "<(asdf)", "(?P<(?:(?:!?@?)|\|)?)" + r"(?P[-a-zA-Z0-9_.]+)?" + r"\((?P\s*\[?)" + r"(?P.*?)(\]?)\))" +) + +# This matches the same as early_variable_re, but with '>' instead of '<'. +late_variable_re = re.compile( + r"(?P(?P>(?:(?:!?@?)|\|)?)" + r"(?P[-a-zA-Z0-9_.]+)?" + r"\((?P\s*\[?)" + r"(?P.*?)(\]?)\))" +) + +# This matches the same as early_variable_re, but with '^' instead of '<'. +latelate_variable_re = re.compile( + r"(?P(?P[\^](?:(?:!?@?)|\|)?)" + r"(?P[-a-zA-Z0-9_.]+)?" + r"\((?P\s*\[?)" + r"(?P.*?)(\]?)\))" +) + +# Global cache of results from running commands so they don't have to be run +# more then once. +cached_command_results = {} + + +def FixupPlatformCommand(cmd): + if sys.platform == "win32": + if type(cmd) is list: + cmd = [re.sub("^cat ", "type ", cmd[0])] + cmd[1:] + else: + cmd = re.sub("^cat ", "type ", cmd) + return cmd + + +PHASE_EARLY = 0 +PHASE_LATE = 1 +PHASE_LATELATE = 2 + + +def ExpandVariables(input, phase, variables, build_file): + # Look for the pattern that gets expanded into variables + if phase == PHASE_EARLY: + variable_re = early_variable_re + expansion_symbol = "<" + elif phase == PHASE_LATE: + variable_re = late_variable_re + expansion_symbol = ">" + elif phase == PHASE_LATELATE: + variable_re = latelate_variable_re + expansion_symbol = "^" + else: + assert False + + input_str = str(input) + if IsStrCanonicalInt(input_str): + return int(input_str) + + # Do a quick scan to determine if an expensive regex search is warranted. + if expansion_symbol not in input_str: + return input_str + + # Get the entire list of matches as a list of MatchObject instances. + # (using findall here would return strings instead of MatchObjects). + matches = list(variable_re.finditer(input_str)) + if not matches: + return input_str + + output = input_str + # Reverse the list of matches so that replacements are done right-to-left. + # That ensures that earlier replacements won't mess up the string in a + # way that causes later calls to find the earlier substituted text instead + # of what's intended for replacement. + matches.reverse() + for match_group in matches: + match = match_group.groupdict() + gyp.DebugOutput(gyp.DEBUG_VARIABLES, "Matches: %r", match) + # match['replace'] is the substring to look for, match['type'] + # is the character code for the replacement type (< > ! <| >| <@ + # >@ !@), match['is_array'] contains a '[' for command + # arrays, and match['content'] is the name of the variable (< >) + # or command to run (!). match['command_string'] is an optional + # command string. Currently, only 'pymod_do_main' is supported. + + # run_command is true if a ! variant is used. + run_command = "!" in match["type"] + command_string = match["command_string"] + + # file_list is true if a | variant is used. + file_list = "|" in match["type"] + + # Capture these now so we can adjust them later. + replace_start = match_group.start("replace") + replace_end = match_group.end("replace") + + # Find the ending paren, and re-evaluate the contained string. + (c_start, c_end) = FindEnclosingBracketGroup(input_str[replace_start:]) + + # Adjust the replacement range to match the entire command + # found by FindEnclosingBracketGroup (since the variable_re + # probably doesn't match the entire command if it contained + # nested variables). + replace_end = replace_start + c_end + + # Find the "real" replacement, matching the appropriate closing + # paren, and adjust the replacement start and end. + replacement = input_str[replace_start:replace_end] + + # Figure out what the contents of the variable parens are. + contents_start = replace_start + c_start + 1 + contents_end = replace_end - 1 + contents = input_str[contents_start:contents_end] + + # Do filter substitution now for <|(). + # Admittedly, this is different than the evaluation order in other + # contexts. However, since filtration has no chance to run on <|(), + # this seems like the only obvious way to give them access to filters. + if file_list: + processed_variables = gyp.simple_copy.deepcopy(variables) + ProcessListFiltersInDict(contents, processed_variables) + # Recurse to expand variables in the contents + contents = ExpandVariables(contents, phase, processed_variables, build_file) + else: + # Recurse to expand variables in the contents + contents = ExpandVariables(contents, phase, variables, build_file) + + # Strip off leading/trailing whitespace so that variable matches are + # simpler below (and because they are rarely needed). + contents = contents.strip() + + # expand_to_list is true if an @ variant is used. In that case, + # the expansion should result in a list. Note that the caller + # is to be expecting a list in return, and not all callers do + # because not all are working in list context. Also, for list + # expansions, there can be no other text besides the variable + # expansion in the input string. + expand_to_list = "@" in match["type"] and input_str == replacement + + if run_command or file_list: + # Find the build file's directory, so commands can be run or file lists + # generated relative to it. + build_file_dir = os.path.dirname(build_file) + if build_file_dir == "" and not file_list: + # If build_file is just a leaf filename indicating a file in the + # current directory, build_file_dir might be an empty string. Set + # it to None to signal to subprocess.Popen that it should run the + # command in the current directory. + build_file_dir = None + + # Support <|(listfile.txt ...) which generates a file + # containing items from a gyp list, generated at gyp time. + # This works around actions/rules which have more inputs than will + # fit on the command line. + if file_list: + if type(contents) is list: + contents_list = contents + else: + contents_list = contents.split(" ") + replacement = contents_list[0] + if os.path.isabs(replacement): + raise GypError('| cannot handle absolute paths, got "%s"' % replacement) + + if not generator_filelist_paths: + path = os.path.join(build_file_dir, replacement) + else: + if os.path.isabs(build_file_dir): + toplevel = generator_filelist_paths["toplevel"] + rel_build_file_dir = gyp.common.RelativePath( + build_file_dir, toplevel + ) + else: + rel_build_file_dir = build_file_dir + qualified_out_dir = generator_filelist_paths["qualified_out_dir"] + path = os.path.join(qualified_out_dir, rel_build_file_dir, replacement) + gyp.common.EnsureDirExists(path) + + replacement = gyp.common.RelativePath(path, build_file_dir) + f = gyp.common.WriteOnDiff(path) + for i in contents_list[1:]: + f.write("%s\n" % i) + f.close() + + elif run_command: + use_shell = True + if match["is_array"]: + contents = eval(contents) + use_shell = False + + # Check for a cached value to avoid executing commands, or generating + # file lists more than once. The cache key contains the command to be + # run as well as the directory to run it from, to account for commands + # that depend on their current directory. + # TODO(http://code.google.com/p/gyp/issues/detail?id=111): In theory, + # someone could author a set of GYP files where each time the command + # is invoked it produces different output by design. When the need + # arises, the syntax should be extended to support no caching off a + # command's output so it is run every time. + cache_key = (str(contents), build_file_dir) + cached_value = cached_command_results.get(cache_key, None) + if cached_value is None: + gyp.DebugOutput( + gyp.DEBUG_VARIABLES, + "Executing command '%s' in directory '%s'", + contents, + build_file_dir, + ) + + replacement = "" + + if command_string == "pymod_do_main": + # 0: + raise GypError( + "Call to '%s' returned exit status %d while in %s." + % (contents, result.returncode, build_file) + ) + replacement = result.stdout.decode("utf-8").rstrip() + + cached_command_results[cache_key] = replacement + else: + gyp.DebugOutput( + gyp.DEBUG_VARIABLES, + "Had cache value for command '%s' in directory '%s'", + contents, + build_file_dir, + ) + replacement = cached_value + + else: + if contents not in variables: + if contents[-1] in ["!", "/"]: + # In order to allow cross-compiles (nacl) to happen more naturally, + # we will allow references to >(sources/) etc. to resolve to + # and empty list if undefined. This allows actions to: + # 'action!': [ + # '>@(_sources!)', + # ], + # 'action/': [ + # '>@(_sources/)', + # ], + replacement = [] + else: + raise GypError( + "Undefined variable " + contents + " in " + build_file + ) + else: + replacement = variables[contents] + + if isinstance(replacement, bytes) and not isinstance(replacement, str): + replacement = replacement.decode("utf-8") # done on Python 3 only + if type(replacement) is list: + for item in replacement: + if isinstance(item, bytes) and not isinstance(item, str): + item = item.decode("utf-8") # done on Python 3 only + if not contents[-1] == "/" and type(item) not in (str, int): + raise GypError( + "Variable " + + contents + + " must expand to a string or list of strings; " + + "list contains a " + + item.__class__.__name__ + ) + # Run through the list and handle variable expansions in it. Since + # the list is guaranteed not to contain dicts, this won't do anything + # with conditions sections. + ProcessVariablesAndConditionsInList( + replacement, phase, variables, build_file + ) + elif type(replacement) not in (str, int): + raise GypError( + "Variable " + + contents + + " must expand to a string or list of strings; " + + "found a " + + replacement.__class__.__name__ + ) + + if expand_to_list: + # Expanding in list context. It's guaranteed that there's only one + # replacement to do in |input_str| and that it's this replacement. See + # above. + if type(replacement) is list: + # If it's already a list, make a copy. + output = replacement[:] + else: + # Split it the same way sh would split arguments. + output = shlex.split(str(replacement)) + else: + # Expanding in string context. + encoded_replacement = "" + if type(replacement) is list: + # When expanding a list into string context, turn the list items + # into a string in a way that will work with a subprocess call. + # + # TODO(mark): This isn't completely correct. This should + # call a generator-provided function that observes the + # proper list-to-argument quoting rules on a specific + # platform instead of just calling the POSIX encoding + # routine. + encoded_replacement = gyp.common.EncodePOSIXShellList(replacement) + else: + encoded_replacement = replacement + + output = ( + output[:replace_start] + str(encoded_replacement) + output[replace_end:] + ) + # Prepare for the next match iteration. + input_str = output + + if output == input: + gyp.DebugOutput( + gyp.DEBUG_VARIABLES, + "Found only identity matches on %r, avoiding infinite " "recursion.", + output, + ) + else: + # Look for more matches now that we've replaced some, to deal with + # expanding local variables (variables defined in the same + # variables block as this one). + gyp.DebugOutput(gyp.DEBUG_VARIABLES, "Found output %r, recursing.", output) + if type(output) is list: + if output and type(output[0]) is list: + # Leave output alone if it's a list of lists. + # We don't want such lists to be stringified. + pass + else: + new_output = [] + for item in output: + new_output.append( + ExpandVariables(item, phase, variables, build_file) + ) + output = new_output + else: + output = ExpandVariables(output, phase, variables, build_file) + + # Convert all strings that are canonically-represented integers into integers. + if type(output) is list: + for index, outstr in enumerate(output): + if IsStrCanonicalInt(outstr): + output[index] = int(outstr) + elif IsStrCanonicalInt(output): + output = int(output) + + return output + + +# The same condition is often evaluated over and over again so it +# makes sense to cache as much as possible between evaluations. +cached_conditions_asts = {} + + +def EvalCondition(condition, conditions_key, phase, variables, build_file): + """Returns the dict that should be used or None if the result was + that nothing should be used.""" + if type(condition) is not list: + raise GypError(conditions_key + " must be a list") + if len(condition) < 2: + # It's possible that condition[0] won't work in which case this + # attempt will raise its own IndexError. That's probably fine. + raise GypError( + conditions_key + + " " + + condition[0] + + " must be at least length 2, not " + + str(len(condition)) + ) + + i = 0 + result = None + while i < len(condition): + cond_expr = condition[i] + true_dict = condition[i + 1] + if type(true_dict) is not dict: + raise GypError( + "{} {} must be followed by a dictionary, not {}".format( + conditions_key, cond_expr, type(true_dict) + ) + ) + if len(condition) > i + 2 and type(condition[i + 2]) is dict: + false_dict = condition[i + 2] + i = i + 3 + if i != len(condition): + raise GypError( + "{} {} has {} unexpected trailing items".format( + conditions_key, cond_expr, len(condition) - i + ) + ) + else: + false_dict = None + i = i + 2 + if result is None: + result = EvalSingleCondition( + cond_expr, true_dict, false_dict, phase, variables, build_file + ) + + return result + + +def EvalSingleCondition(cond_expr, true_dict, false_dict, phase, variables, build_file): + """Returns true_dict if cond_expr evaluates to true, and false_dict + otherwise.""" + # Do expansions on the condition itself. Since the condition can naturally + # contain variable references without needing to resort to GYP expansion + # syntax, this is of dubious value for variables, but someone might want to + # use a command expansion directly inside a condition. + cond_expr_expanded = ExpandVariables(cond_expr, phase, variables, build_file) + if type(cond_expr_expanded) not in (str, int): + raise ValueError( + "Variable expansion in this context permits str and int " + + "only, found " + + cond_expr_expanded.__class__.__name__ + ) + + try: + if cond_expr_expanded in cached_conditions_asts: + ast_code = cached_conditions_asts[cond_expr_expanded] + else: + ast_code = compile(cond_expr_expanded, "", "eval") + cached_conditions_asts[cond_expr_expanded] = ast_code + env = {"__builtins__": {}, "v": StrictVersion} + if eval(ast_code, env, variables): + return true_dict + return false_dict + except SyntaxError as e: + syntax_error = SyntaxError( + "%s while evaluating condition '%s' in %s " + "at character %d." % (str(e.args[0]), e.text, build_file, e.offset), + e.filename, + e.lineno, + e.offset, + e.text, + ) + raise syntax_error + except NameError as e: + gyp.common.ExceptionAppend( + e, + f"while evaluating condition '{cond_expr_expanded}' in {build_file}", + ) + raise GypError(e) + + +def ProcessConditionsInDict(the_dict, phase, variables, build_file): + # Process a 'conditions' or 'target_conditions' section in the_dict, + # depending on phase. + # early -> conditions + # late -> target_conditions + # latelate -> no conditions + # + # Each item in a conditions list consists of cond_expr, a string expression + # evaluated as the condition, and true_dict, a dict that will be merged into + # the_dict if cond_expr evaluates to true. Optionally, a third item, + # false_dict, may be present. false_dict is merged into the_dict if + # cond_expr evaluates to false. + # + # Any dict merged into the_dict will be recursively processed for nested + # conditionals and other expansions, also according to phase, immediately + # prior to being merged. + + if phase == PHASE_EARLY: + conditions_key = "conditions" + elif phase == PHASE_LATE: + conditions_key = "target_conditions" + elif phase == PHASE_LATELATE: + return + else: + assert False + + if conditions_key not in the_dict: + return + + conditions_list = the_dict[conditions_key] + # Unhook the conditions list, it's no longer needed. + del the_dict[conditions_key] + + for condition in conditions_list: + merge_dict = EvalCondition( + condition, conditions_key, phase, variables, build_file + ) + + if merge_dict is not None: + # Expand variables and nested conditinals in the merge_dict before + # merging it. + ProcessVariablesAndConditionsInDict( + merge_dict, phase, variables, build_file + ) + + MergeDicts(the_dict, merge_dict, build_file, build_file) + + +def LoadAutomaticVariablesFromDict(variables, the_dict): + # Any keys with plain string values in the_dict become automatic variables. + # The variable name is the key name with a "_" character prepended. + for key, value in the_dict.items(): + if type(value) in (str, int, list): + variables["_" + key] = value + + +def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key): + # Any keys in the_dict's "variables" dict, if it has one, becomes a + # variable. The variable name is the key name in the "variables" dict. + # Variables that end with the % character are set only if they are unset in + # the variables dict. the_dict_key is the name of the key that accesses + # the_dict in the_dict's parent dict. If the_dict's parent is not a dict + # (it could be a list or it could be parentless because it is a root dict), + # the_dict_key will be None. + for key, value in the_dict.get("variables", {}).items(): + if type(value) not in (str, int, list): + continue + + if key.endswith("%"): + variable_name = key[:-1] + if variable_name in variables: + # If the variable is already set, don't set it. + continue + if the_dict_key == "variables" and variable_name in the_dict: + # If the variable is set without a % in the_dict, and the_dict is a + # variables dict (making |variables| a variables sub-dict of a + # variables dict), use the_dict's definition. + value = the_dict[variable_name] + else: + variable_name = key + + variables[variable_name] = value + + +def ProcessVariablesAndConditionsInDict( + the_dict, phase, variables_in, build_file, the_dict_key=None +): + """Handle all variable and command expansion and conditional evaluation. + + This function is the public entry point for all variable expansions and + conditional evaluations. The variables_in dictionary will not be modified + by this function. + """ + + # Make a copy of the variables_in dict that can be modified during the + # loading of automatics and the loading of the variables dict. + variables = variables_in.copy() + LoadAutomaticVariablesFromDict(variables, the_dict) + + if "variables" in the_dict: + # Make sure all the local variables are added to the variables + # list before we process them so that you can reference one + # variable from another. They will be fully expanded by recursion + # in ExpandVariables. + for key, value in the_dict["variables"].items(): + variables[key] = value + + # Handle the associated variables dict first, so that any variable + # references within can be resolved prior to using them as variables. + # Pass a copy of the variables dict to avoid having it be tainted. + # Otherwise, it would have extra automatics added for everything that + # should just be an ordinary variable in this scope. + ProcessVariablesAndConditionsInDict( + the_dict["variables"], phase, variables, build_file, "variables" + ) + + LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key) + + for key, value in the_dict.items(): + # Skip "variables", which was already processed if present. + if key != "variables" and type(value) is str: + expanded = ExpandVariables(value, phase, variables, build_file) + if type(expanded) not in (str, int): + raise ValueError( + "Variable expansion in this context permits str and int " + + "only, found " + + expanded.__class__.__name__ + + " for " + + key + ) + the_dict[key] = expanded + + # Variable expansion may have resulted in changes to automatics. Reload. + # TODO(mark): Optimization: only reload if no changes were made. + variables = variables_in.copy() + LoadAutomaticVariablesFromDict(variables, the_dict) + LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key) + + # Process conditions in this dict. This is done after variable expansion + # so that conditions may take advantage of expanded variables. For example, + # if the_dict contains: + # {'type': '<(library_type)', + # 'conditions': [['_type=="static_library"', { ... }]]}, + # _type, as used in the condition, will only be set to the value of + # library_type if variable expansion is performed before condition + # processing. However, condition processing should occur prior to recursion + # so that variables (both automatic and "variables" dict type) may be + # adjusted by conditions sections, merged into the_dict, and have the + # intended impact on contained dicts. + # + # This arrangement means that a "conditions" section containing a "variables" + # section will only have those variables effective in subdicts, not in + # the_dict. The workaround is to put a "conditions" section within a + # "variables" section. For example: + # {'conditions': [['os=="mac"', {'variables': {'define': 'IS_MAC'}}]], + # 'defines': ['<(define)'], + # 'my_subdict': {'defines': ['<(define)']}}, + # will not result in "IS_MAC" being appended to the "defines" list in the + # current scope but would result in it being appended to the "defines" list + # within "my_subdict". By comparison: + # {'variables': {'conditions': [['os=="mac"', {'define': 'IS_MAC'}]]}, + # 'defines': ['<(define)'], + # 'my_subdict': {'defines': ['<(define)']}}, + # will append "IS_MAC" to both "defines" lists. + + # Evaluate conditions sections, allowing variable expansions within them + # as well as nested conditionals. This will process a 'conditions' or + # 'target_conditions' section, perform appropriate merging and recursive + # conditional and variable processing, and then remove the conditions section + # from the_dict if it is present. + ProcessConditionsInDict(the_dict, phase, variables, build_file) + + # Conditional processing may have resulted in changes to automatics or the + # variables dict. Reload. + variables = variables_in.copy() + LoadAutomaticVariablesFromDict(variables, the_dict) + LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key) + + # Recurse into child dicts, or process child lists which may result in + # further recursion into descendant dicts. + for key, value in the_dict.items(): + # Skip "variables" and string values, which were already processed if + # present. + if key == "variables" or type(value) is str: + continue + if type(value) is dict: + # Pass a copy of the variables dict so that subdicts can't influence + # parents. + ProcessVariablesAndConditionsInDict( + value, phase, variables, build_file, key + ) + elif type(value) is list: + # The list itself can't influence the variables dict, and + # ProcessVariablesAndConditionsInList will make copies of the variables + # dict if it needs to pass it to something that can influence it. No + # copy is necessary here. + ProcessVariablesAndConditionsInList(value, phase, variables, build_file) + elif type(value) is not int: + raise TypeError("Unknown type " + value.__class__.__name__ + " for " + key) + + +def ProcessVariablesAndConditionsInList(the_list, phase, variables, build_file): + # Iterate using an index so that new values can be assigned into the_list. + index = 0 + while index < len(the_list): + item = the_list[index] + if type(item) is dict: + # Make a copy of the variables dict so that it won't influence anything + # outside of its own scope. + ProcessVariablesAndConditionsInDict(item, phase, variables, build_file) + elif type(item) is list: + ProcessVariablesAndConditionsInList(item, phase, variables, build_file) + elif type(item) is str: + expanded = ExpandVariables(item, phase, variables, build_file) + if type(expanded) in (str, int): + the_list[index] = expanded + elif type(expanded) is list: + the_list[index : index + 1] = expanded + index += len(expanded) + + # index now identifies the next item to examine. Continue right now + # without falling into the index increment below. + continue + else: + raise ValueError( + "Variable expansion in this context permits strings and " + + "lists only, found " + + expanded.__class__.__name__ + + " at " + + index + ) + elif type(item) is not int: + raise TypeError( + "Unknown type " + item.__class__.__name__ + " at index " + index + ) + index = index + 1 + + +def BuildTargetsDict(data): + """Builds a dict mapping fully-qualified target names to their target dicts. + + |data| is a dict mapping loaded build files by pathname relative to the + current directory. Values in |data| are build file contents. For each + |data| value with a "targets" key, the value of the "targets" key is taken + as a list containing target dicts. Each target's fully-qualified name is + constructed from the pathname of the build file (|data| key) and its + "target_name" property. These fully-qualified names are used as the keys + in the returned dict. These keys provide access to the target dicts, + the dicts in the "targets" lists. + """ + + targets = {} + for build_file in data["target_build_files"]: + for target in data[build_file].get("targets", []): + target_name = gyp.common.QualifiedTarget( + build_file, target["target_name"], target["toolset"] + ) + if target_name in targets: + raise GypError("Duplicate target definitions for " + target_name) + targets[target_name] = target + + return targets + + +def QualifyDependencies(targets): + """Make dependency links fully-qualified relative to the current directory. + + |targets| is a dict mapping fully-qualified target names to their target + dicts. For each target in this dict, keys known to contain dependency + links are examined, and any dependencies referenced will be rewritten + so that they are fully-qualified and relative to the current directory. + All rewritten dependencies are suitable for use as keys to |targets| or a + similar dict. + """ + + all_dependency_sections = [ + dep + op for dep in dependency_sections for op in ("", "!", "/") + ] + + for target, target_dict in targets.items(): + target_build_file = gyp.common.BuildFile(target) + toolset = target_dict["toolset"] + for dependency_key in all_dependency_sections: + dependencies = target_dict.get(dependency_key, []) + for index, dep in enumerate(dependencies): + dep_file, dep_target, dep_toolset = gyp.common.ResolveTarget( + target_build_file, dep, toolset + ) + if not multiple_toolsets: + # Ignore toolset specification in the dependency if it is specified. + dep_toolset = toolset + dependency = gyp.common.QualifiedTarget( + dep_file, dep_target, dep_toolset + ) + dependencies[index] = dependency + + # Make sure anything appearing in a list other than "dependencies" also + # appears in the "dependencies" list. + if ( + dependency_key != "dependencies" + and dependency not in target_dict["dependencies"] + ): + raise GypError( + "Found " + + dependency + + " in " + + dependency_key + + " of " + + target + + ", but not in dependencies" + ) + + +def ExpandWildcardDependencies(targets, data): + """Expands dependencies specified as build_file:*. + + For each target in |targets|, examines sections containing links to other + targets. If any such section contains a link of the form build_file:*, it + is taken as a wildcard link, and is expanded to list each target in + build_file. The |data| dict provides access to build file dicts. + + Any target that does not wish to be included by wildcard can provide an + optional "suppress_wildcard" key in its target dict. When present and + true, a wildcard dependency link will not include such targets. + + All dependency names, including the keys to |targets| and the values in each + dependency list, must be qualified when this function is called. + """ + + for target, target_dict in targets.items(): + target_build_file = gyp.common.BuildFile(target) + for dependency_key in dependency_sections: + dependencies = target_dict.get(dependency_key, []) + + # Loop this way instead of "for dependency in" or "for index in range" + # because the dependencies list will be modified within the loop body. + index = 0 + while index < len(dependencies): + ( + dependency_build_file, + dependency_target, + dependency_toolset, + ) = gyp.common.ParseQualifiedTarget(dependencies[index]) + if dependency_target != "*" and dependency_toolset != "*": + # Not a wildcard. Keep it moving. + index = index + 1 + continue + + if dependency_build_file == target_build_file: + # It's an error for a target to depend on all other targets in + # the same file, because a target cannot depend on itself. + raise GypError( + "Found wildcard in " + + dependency_key + + " of " + + target + + " referring to same build file" + ) + + # Take the wildcard out and adjust the index so that the next + # dependency in the list will be processed the next time through the + # loop. + del dependencies[index] + index = index - 1 + + # Loop through the targets in the other build file, adding them to + # this target's list of dependencies in place of the removed + # wildcard. + dependency_target_dicts = data[dependency_build_file]["targets"] + for dependency_target_dict in dependency_target_dicts: + if int(dependency_target_dict.get("suppress_wildcard", False)): + continue + dependency_target_name = dependency_target_dict["target_name"] + if ( + dependency_target != "*" + and dependency_target != dependency_target_name + ): + continue + dependency_target_toolset = dependency_target_dict["toolset"] + if ( + dependency_toolset != "*" + and dependency_toolset != dependency_target_toolset + ): + continue + dependency = gyp.common.QualifiedTarget( + dependency_build_file, + dependency_target_name, + dependency_target_toolset, + ) + index = index + 1 + dependencies.insert(index, dependency) + + index = index + 1 + + +def Unify(items): + """Removes duplicate elements from items, keeping the first element.""" + seen = {} + return [seen.setdefault(e, e) for e in items if e not in seen] + + +def RemoveDuplicateDependencies(targets): + """Makes sure every dependency appears only once in all targets's dependency + lists.""" + for target_name, target_dict in targets.items(): + for dependency_key in dependency_sections: + dependencies = target_dict.get(dependency_key, []) + if dependencies: + target_dict[dependency_key] = Unify(dependencies) + + +def Filter(items, item): + """Removes item from items.""" + res = {} + return [res.setdefault(e, e) for e in items if e != item] + + +def RemoveSelfDependencies(targets): + """Remove self dependencies from targets that have the prune_self_dependency + variable set.""" + for target_name, target_dict in targets.items(): + for dependency_key in dependency_sections: + dependencies = target_dict.get(dependency_key, []) + if dependencies: + for t in dependencies: + if t == target_name: + if ( + targets[t] + .get("variables", {}) + .get("prune_self_dependency", 0) + ): + target_dict[dependency_key] = Filter( + dependencies, target_name + ) + + +def RemoveLinkDependenciesFromNoneTargets(targets): + """Remove dependencies having the 'link_dependency' attribute from the 'none' + targets.""" + for target_name, target_dict in targets.items(): + for dependency_key in dependency_sections: + dependencies = target_dict.get(dependency_key, []) + if dependencies: + for t in dependencies: + if target_dict.get("type", None) == "none": + if targets[t].get("variables", {}).get("link_dependency", 0): + target_dict[dependency_key] = Filter( + target_dict[dependency_key], t + ) + + +class DependencyGraphNode: + """ + + Attributes: + ref: A reference to an object that this DependencyGraphNode represents. + dependencies: List of DependencyGraphNodes on which this one depends. + dependents: List of DependencyGraphNodes that depend on this one. + """ + + class CircularException(GypError): + pass + + def __init__(self, ref): + self.ref = ref + self.dependencies = [] + self.dependents = [] + + def __repr__(self): + return "" % self.ref + + def FlattenToList(self): + # flat_list is the sorted list of dependencies - actually, the list items + # are the "ref" attributes of DependencyGraphNodes. Every target will + # appear in flat_list after all of its dependencies, and before all of its + # dependents. + flat_list = OrderedSet() + + def ExtractNodeRef(node): + """Extracts the object that the node represents from the given node.""" + return node.ref + + # in_degree_zeros is the list of DependencyGraphNodes that have no + # dependencies not in flat_list. Initially, it is a copy of the children + # of this node, because when the graph was built, nodes with no + # dependencies were made implicit dependents of the root node. + in_degree_zeros = sorted(self.dependents[:], key=ExtractNodeRef) + + while in_degree_zeros: + # Nodes in in_degree_zeros have no dependencies not in flat_list, so they + # can be appended to flat_list. Take these nodes out of in_degree_zeros + # as work progresses, so that the next node to process from the list can + # always be accessed at a consistent position. + node = in_degree_zeros.pop() + flat_list.add(node.ref) + + # Look at dependents of the node just added to flat_list. Some of them + # may now belong in in_degree_zeros. + for node_dependent in sorted(node.dependents, key=ExtractNodeRef): + is_in_degree_zero = True + # TODO: We want to check through the + # node_dependent.dependencies list but if it's long and we + # always start at the beginning, then we get O(n^2) behaviour. + for node_dependent_dependency in sorted( + node_dependent.dependencies, key=ExtractNodeRef + ): + if node_dependent_dependency.ref not in flat_list: + # The dependent one or more dependencies not in flat_list. + # There will be more chances to add it to flat_list + # when examining it again as a dependent of those other + # dependencies, provided that there are no cycles. + is_in_degree_zero = False + break + + if is_in_degree_zero: + # All of the dependent's dependencies are already in flat_list. Add + # it to in_degree_zeros where it will be processed in a future + # iteration of the outer loop. + in_degree_zeros += [node_dependent] + + return list(flat_list) + + def FindCycles(self): + """ + Returns a list of cycles in the graph, where each cycle is its own list. + """ + results = [] + visited = set() + + def Visit(node, path): + for child in node.dependents: + if child in path: + results.append([child] + path[: path.index(child) + 1]) + elif child not in visited: + visited.add(child) + Visit(child, [child] + path) + + visited.add(self) + Visit(self, [self]) + + return results + + def DirectDependencies(self, dependencies=None): + """Returns a list of just direct dependencies.""" + if dependencies is None: + dependencies = [] + + for dependency in self.dependencies: + # Check for None, corresponding to the root node. + if dependency.ref and dependency.ref not in dependencies: + dependencies.append(dependency.ref) + + return dependencies + + def _AddImportedDependencies(self, targets, dependencies=None): + """Given a list of direct dependencies, adds indirect dependencies that + other dependencies have declared to export their settings. + + This method does not operate on self. Rather, it operates on the list + of dependencies in the |dependencies| argument. For each dependency in + that list, if any declares that it exports the settings of one of its + own dependencies, those dependencies whose settings are "passed through" + are added to the list. As new items are added to the list, they too will + be processed, so it is possible to import settings through multiple levels + of dependencies. + + This method is not terribly useful on its own, it depends on being + "primed" with a list of direct dependencies such as one provided by + DirectDependencies. DirectAndImportedDependencies is intended to be the + public entry point. + """ + + if dependencies is None: + dependencies = [] + + index = 0 + while index < len(dependencies): + dependency = dependencies[index] + dependency_dict = targets[dependency] + # Add any dependencies whose settings should be imported to the list + # if not already present. Newly-added items will be checked for + # their own imports when the list iteration reaches them. + # Rather than simply appending new items, insert them after the + # dependency that exported them. This is done to more closely match + # the depth-first method used by DeepDependencies. + add_index = 1 + for imported_dependency in dependency_dict.get( + "export_dependent_settings", [] + ): + if imported_dependency not in dependencies: + dependencies.insert(index + add_index, imported_dependency) + add_index = add_index + 1 + index = index + 1 + + return dependencies + + def DirectAndImportedDependencies(self, targets, dependencies=None): + """Returns a list of a target's direct dependencies and all indirect + dependencies that a dependency has advertised settings should be exported + through the dependency for. + """ + + dependencies = self.DirectDependencies(dependencies) + return self._AddImportedDependencies(targets, dependencies) + + def DeepDependencies(self, dependencies=None): + """Returns an OrderedSet of all of a target's dependencies, recursively.""" + if dependencies is None: + # Using a list to get ordered output and a set to do fast "is it + # already added" checks. + dependencies = OrderedSet() + + for dependency in self.dependencies: + # Check for None, corresponding to the root node. + if dependency.ref is None: + continue + if dependency.ref not in dependencies: + dependency.DeepDependencies(dependencies) + dependencies.add(dependency.ref) + + return dependencies + + def _LinkDependenciesInternal( + self, targets, include_shared_libraries, dependencies=None, initial=True + ): + """Returns an OrderedSet of dependency targets that are linked + into this target. + + This function has a split personality, depending on the setting of + |initial|. Outside callers should always leave |initial| at its default + setting. + + When adding a target to the list of dependencies, this function will + recurse into itself with |initial| set to False, to collect dependencies + that are linked into the linkable target for which the list is being built. + + If |include_shared_libraries| is False, the resulting dependencies will not + include shared_library targets that are linked into this target. + """ + if dependencies is None: + # Using a list to get ordered output and a set to do fast "is it + # already added" checks. + dependencies = OrderedSet() + + # Check for None, corresponding to the root node. + if self.ref is None: + return dependencies + + # It's kind of sucky that |targets| has to be passed into this function, + # but that's presently the easiest way to access the target dicts so that + # this function can find target types. + + if "target_name" not in targets[self.ref]: + raise GypError("Missing 'target_name' field in target.") + + if "type" not in targets[self.ref]: + raise GypError( + "Missing 'type' field in target %s" % targets[self.ref]["target_name"] + ) + + target_type = targets[self.ref]["type"] + + is_linkable = target_type in linkable_types + + if initial and not is_linkable: + # If this is the first target being examined and it's not linkable, + # return an empty list of link dependencies, because the link + # dependencies are intended to apply to the target itself (initial is + # True) and this target won't be linked. + return dependencies + + # Don't traverse 'none' targets if explicitly excluded. + if target_type == "none" and not targets[self.ref].get( + "dependencies_traverse", True + ): + dependencies.add(self.ref) + return dependencies + + # Executables, mac kernel extensions, windows drivers and loadable modules + # are already fully and finally linked. Nothing else can be a link + # dependency of them, there can only be dependencies in the sense that a + # dependent target might run an executable or load the loadable_module. + if not initial and target_type in ( + "executable", + "loadable_module", + "mac_kernel_extension", + "windows_driver", + ): + return dependencies + + # Shared libraries are already fully linked. They should only be included + # in |dependencies| when adjusting static library dependencies (in order to + # link against the shared_library's import lib), but should not be included + # in |dependencies| when propagating link_settings. + # The |include_shared_libraries| flag controls which of these two cases we + # are handling. + if ( + not initial + and target_type == "shared_library" + and not include_shared_libraries + ): + return dependencies + + # The target is linkable, add it to the list of link dependencies. + if self.ref not in dependencies: + dependencies.add(self.ref) + if initial or not is_linkable: + # If this is a subsequent target and it's linkable, don't look any + # further for linkable dependencies, as they'll already be linked into + # this target linkable. Always look at dependencies of the initial + # target, and always look at dependencies of non-linkables. + for dependency in self.dependencies: + dependency._LinkDependenciesInternal( + targets, include_shared_libraries, dependencies, False + ) + + return dependencies + + def DependenciesForLinkSettings(self, targets): + """ + Returns a list of dependency targets whose link_settings should be merged + into this target. + """ + + # TODO(sbaig) Currently, chrome depends on the bug that shared libraries' + # link_settings are propagated. So for now, we will allow it, unless the + # 'allow_sharedlib_linksettings_propagation' flag is explicitly set to + # False. Once chrome is fixed, we can remove this flag. + include_shared_libraries = targets[self.ref].get( + "allow_sharedlib_linksettings_propagation", True + ) + return self._LinkDependenciesInternal(targets, include_shared_libraries) + + def DependenciesToLinkAgainst(self, targets): + """ + Returns a list of dependency targets that are linked into this target. + """ + return self._LinkDependenciesInternal(targets, True) + + +def BuildDependencyList(targets): + # Create a DependencyGraphNode for each target. Put it into a dict for easy + # access. + dependency_nodes = {} + for target, spec in targets.items(): + if target not in dependency_nodes: + dependency_nodes[target] = DependencyGraphNode(target) + + # Set up the dependency links. Targets that have no dependencies are treated + # as dependent on root_node. + root_node = DependencyGraphNode(None) + for target, spec in targets.items(): + target_node = dependency_nodes[target] + dependencies = spec.get("dependencies") + if not dependencies: + target_node.dependencies = [root_node] + root_node.dependents.append(target_node) + else: + for dependency in dependencies: + dependency_node = dependency_nodes.get(dependency) + if not dependency_node: + raise GypError( + "Dependency '%s' not found while " + "trying to load target %s" % (dependency, target) + ) + target_node.dependencies.append(dependency_node) + dependency_node.dependents.append(target_node) + + flat_list = root_node.FlattenToList() + + # If there's anything left unvisited, there must be a circular dependency + # (cycle). + if len(flat_list) != len(targets): + if not root_node.dependents: + # If all targets have dependencies, add the first target as a dependent + # of root_node so that the cycle can be discovered from root_node. + target = next(iter(targets)) + target_node = dependency_nodes[target] + target_node.dependencies.append(root_node) + root_node.dependents.append(target_node) + + cycles = [] + for cycle in root_node.FindCycles(): + paths = [node.ref for node in cycle] + cycles.append("Cycle: %s" % " -> ".join(paths)) + raise DependencyGraphNode.CircularException( + "Cycles in dependency graph detected:\n" + "\n".join(cycles) + ) + + return [dependency_nodes, flat_list] + + +def VerifyNoGYPFileCircularDependencies(targets): + # Create a DependencyGraphNode for each gyp file containing a target. Put + # it into a dict for easy access. + dependency_nodes = {} + for target in targets: + build_file = gyp.common.BuildFile(target) + if build_file not in dependency_nodes: + dependency_nodes[build_file] = DependencyGraphNode(build_file) + + # Set up the dependency links. + for target, spec in targets.items(): + build_file = gyp.common.BuildFile(target) + build_file_node = dependency_nodes[build_file] + target_dependencies = spec.get("dependencies", []) + for dependency in target_dependencies: + try: + dependency_build_file = gyp.common.BuildFile(dependency) + except GypError as e: + gyp.common.ExceptionAppend( + e, "while computing dependencies of .gyp file %s" % build_file + ) + raise + + if dependency_build_file == build_file: + # A .gyp file is allowed to refer back to itself. + continue + dependency_node = dependency_nodes.get(dependency_build_file) + if not dependency_node: + raise GypError("Dependency '%s' not found" % dependency_build_file) + if dependency_node not in build_file_node.dependencies: + build_file_node.dependencies.append(dependency_node) + dependency_node.dependents.append(build_file_node) + + # Files that have no dependencies are treated as dependent on root_node. + root_node = DependencyGraphNode(None) + for build_file_node in dependency_nodes.values(): + if len(build_file_node.dependencies) == 0: + build_file_node.dependencies.append(root_node) + root_node.dependents.append(build_file_node) + + flat_list = root_node.FlattenToList() + + # If there's anything left unvisited, there must be a circular dependency + # (cycle). + if len(flat_list) != len(dependency_nodes): + if not root_node.dependents: + # If all files have dependencies, add the first file as a dependent + # of root_node so that the cycle can be discovered from root_node. + file_node = next(iter(dependency_nodes.values())) + file_node.dependencies.append(root_node) + root_node.dependents.append(file_node) + cycles = [] + for cycle in root_node.FindCycles(): + paths = [node.ref for node in cycle] + cycles.append("Cycle: %s" % " -> ".join(paths)) + raise DependencyGraphNode.CircularException( + "Cycles in .gyp file dependency graph detected:\n" + "\n".join(cycles) + ) + + +def DoDependentSettings(key, flat_list, targets, dependency_nodes): + # key should be one of all_dependent_settings, direct_dependent_settings, + # or link_settings. + + for target in flat_list: + target_dict = targets[target] + build_file = gyp.common.BuildFile(target) + + if key == "all_dependent_settings": + dependencies = dependency_nodes[target].DeepDependencies() + elif key == "direct_dependent_settings": + dependencies = dependency_nodes[target].DirectAndImportedDependencies( + targets + ) + elif key == "link_settings": + dependencies = dependency_nodes[target].DependenciesForLinkSettings(targets) + else: + raise GypError( + "DoDependentSettings doesn't know how to determine " + "dependencies for " + key + ) + + for dependency in dependencies: + dependency_dict = targets[dependency] + if key not in dependency_dict: + continue + dependency_build_file = gyp.common.BuildFile(dependency) + MergeDicts( + target_dict, dependency_dict[key], build_file, dependency_build_file + ) + + +def AdjustStaticLibraryDependencies( + flat_list, targets, dependency_nodes, sort_dependencies +): + # Recompute target "dependencies" properties. For each static library + # target, remove "dependencies" entries referring to other static libraries, + # unless the dependency has the "hard_dependency" attribute set. For each + # linkable target, add a "dependencies" entry referring to all of the + # target's computed list of link dependencies (including static libraries + # if no such entry is already present. + for target in flat_list: + target_dict = targets[target] + target_type = target_dict["type"] + + if target_type == "static_library": + if "dependencies" not in target_dict: + continue + + target_dict["dependencies_original"] = target_dict.get("dependencies", [])[ + : + ] + + # A static library should not depend on another static library unless + # the dependency relationship is "hard," which should only be done when + # a dependent relies on some side effect other than just the build + # product, like a rule or action output. Further, if a target has a + # non-hard dependency, but that dependency exports a hard dependency, + # the non-hard dependency can safely be removed, but the exported hard + # dependency must be added to the target to keep the same dependency + # ordering. + dependencies = dependency_nodes[target].DirectAndImportedDependencies( + targets + ) + index = 0 + while index < len(dependencies): + dependency = dependencies[index] + dependency_dict = targets[dependency] + + # Remove every non-hard static library dependency and remove every + # non-static library dependency that isn't a direct dependency. + if ( + dependency_dict["type"] == "static_library" + and not dependency_dict.get("hard_dependency", False) + ) or ( + dependency_dict["type"] != "static_library" + and dependency not in target_dict["dependencies"] + ): + # Take the dependency out of the list, and don't increment index + # because the next dependency to analyze will shift into the index + # formerly occupied by the one being removed. + del dependencies[index] + else: + index = index + 1 + + # Update the dependencies. If the dependencies list is empty, it's not + # needed, so unhook it. + if len(dependencies) > 0: + target_dict["dependencies"] = dependencies + else: + del target_dict["dependencies"] + + elif target_type in linkable_types: + # Get a list of dependency targets that should be linked into this + # target. Add them to the dependencies list if they're not already + # present. + + link_dependencies = dependency_nodes[target].DependenciesToLinkAgainst( + targets + ) + for dependency in link_dependencies: + if dependency == target: + continue + if "dependencies" not in target_dict: + target_dict["dependencies"] = [] + if dependency not in target_dict["dependencies"]: + target_dict["dependencies"].append(dependency) + # Sort the dependencies list in the order from dependents to dependencies. + # e.g. If A and B depend on C and C depends on D, sort them in A, B, C, D. + # Note: flat_list is already sorted in the order from dependencies to + # dependents. + if sort_dependencies and "dependencies" in target_dict: + target_dict["dependencies"] = [ + dep + for dep in reversed(flat_list) + if dep in target_dict["dependencies"] + ] + + +# Initialize this here to speed up MakePathRelative. +exception_re = re.compile(r"""["']?[-/$<>^]""") + + +def MakePathRelative(to_file, fro_file, item): + # If item is a relative path, it's relative to the build file dict that it's + # coming from. Fix it up to make it relative to the build file dict that + # it's going into. + # Exception: any |item| that begins with these special characters is + # returned without modification. + # / Used when a path is already absolute (shortcut optimization; + # such paths would be returned as absolute anyway) + # $ Used for build environment variables + # - Used for some build environment flags (such as -lapr-1 in a + # "libraries" section) + # < Used for our own variable and command expansions (see ExpandVariables) + # > Used for our own variable and command expansions (see ExpandVariables) + # ^ Used for our own variable and command expansions (see ExpandVariables) + # + # "/' Used when a value is quoted. If these are present, then we + # check the second character instead. + # + if to_file == fro_file or exception_re.match(item): + return item + else: + # TODO(dglazkov) The backslash/forward-slash replacement at the end is a + # temporary measure. This should really be addressed by keeping all paths + # in POSIX until actual project generation. + ret = os.path.normpath( + os.path.join( + gyp.common.RelativePath( + os.path.dirname(fro_file), os.path.dirname(to_file) + ), + item, + ) + ).replace("\\", "/") + if item.endswith("/"): + ret += "/" + return ret + + +def MergeLists(to, fro, to_file, fro_file, is_paths=False, append=True): + # Python documentation recommends objects which do not support hash + # set this value to None. Python library objects follow this rule. + def is_hashable(val): + return val.__hash__ + + # If x is hashable, returns whether x is in s. Else returns whether x is in items. + def is_in_set_or_list(x, s, items): + if is_hashable(x): + return x in s + return x in items + + prepend_index = 0 + + # Make membership testing of hashables in |to| (in particular, strings) + # faster. + hashable_to_set = {x for x in to if is_hashable(x)} + for item in fro: + singleton = False + if type(item) in (str, int): + # The cheap and easy case. + if is_paths: + to_item = MakePathRelative(to_file, fro_file, item) + else: + to_item = item + + if not (type(item) is str and item.startswith("-")): + # Any string that doesn't begin with a "-" is a singleton - it can + # only appear once in a list, to be enforced by the list merge append + # or prepend. + singleton = True + elif type(item) is dict: + # Make a copy of the dictionary, continuing to look for paths to fix. + # The other intelligent aspects of merge processing won't apply because + # item is being merged into an empty dict. + to_item = {} + MergeDicts(to_item, item, to_file, fro_file) + elif type(item) is list: + # Recurse, making a copy of the list. If the list contains any + # descendant dicts, path fixing will occur. Note that here, custom + # values for is_paths and append are dropped; those are only to be + # applied to |to| and |fro|, not sublists of |fro|. append shouldn't + # matter anyway because the new |to_item| list is empty. + to_item = [] + MergeLists(to_item, item, to_file, fro_file) + else: + raise TypeError( + "Attempt to merge list item of unsupported type " + + item.__class__.__name__ + ) + + if append: + # If appending a singleton that's already in the list, don't append. + # This ensures that the earliest occurrence of the item will stay put. + if not singleton or not is_in_set_or_list(to_item, hashable_to_set, to): + to.append(to_item) + if is_hashable(to_item): + hashable_to_set.add(to_item) + else: + # If prepending a singleton that's already in the list, remove the + # existing instance and proceed with the prepend. This ensures that the + # item appears at the earliest possible position in the list. + while singleton and to_item in to: + to.remove(to_item) + + # Don't just insert everything at index 0. That would prepend the new + # items to the list in reverse order, which would be an unwelcome + # surprise. + to.insert(prepend_index, to_item) + if is_hashable(to_item): + hashable_to_set.add(to_item) + prepend_index = prepend_index + 1 + + +def MergeDicts(to, fro, to_file, fro_file): + # I wanted to name the parameter "from" but it's a Python keyword... + for k, v in fro.items(): + # It would be nice to do "if not k in to: to[k] = v" but that wouldn't give + # copy semantics. Something else may want to merge from the |fro| dict + # later, and having the same dict ref pointed to twice in the tree isn't + # what anyone wants considering that the dicts may subsequently be + # modified. + if k in to: + bad_merge = False + if type(v) in (str, int): + if type(to[k]) not in (str, int): + bad_merge = True + elif not isinstance(v, type(to[k])): + bad_merge = True + + if bad_merge: + raise TypeError( + "Attempt to merge dict value of type " + + v.__class__.__name__ + + " into incompatible type " + + to[k].__class__.__name__ + + " for key " + + k + ) + if type(v) in (str, int): + # Overwrite the existing value, if any. Cheap and easy. + is_path = IsPathSection(k) + if is_path: + to[k] = MakePathRelative(to_file, fro_file, v) + else: + to[k] = v + elif type(v) is dict: + # Recurse, guaranteeing copies will be made of objects that require it. + if k not in to: + to[k] = {} + MergeDicts(to[k], v, to_file, fro_file) + elif type(v) is list: + # Lists in dicts can be merged with different policies, depending on + # how the key in the "from" dict (k, the from-key) is written. + # + # If the from-key has ...the to-list will have this action + # this character appended:... applied when receiving the from-list: + # = replace + # + prepend + # ? set, only if to-list does not yet exist + # (none) append + # + # This logic is list-specific, but since it relies on the associated + # dict key, it's checked in this dict-oriented function. + ext = k[-1] + append = True + if ext == "=": + list_base = k[:-1] + lists_incompatible = [list_base, list_base + "?"] + to[list_base] = [] + elif ext == "+": + list_base = k[:-1] + lists_incompatible = [list_base + "=", list_base + "?"] + append = False + elif ext == "?": + list_base = k[:-1] + lists_incompatible = [list_base, list_base + "=", list_base + "+"] + else: + list_base = k + lists_incompatible = [list_base + "=", list_base + "?"] + + # Some combinations of merge policies appearing together are meaningless. + # It's stupid to replace and append simultaneously, for example. Append + # and prepend are the only policies that can coexist. + for list_incompatible in lists_incompatible: + if list_incompatible in fro: + raise GypError( + "Incompatible list policies " + k + " and " + list_incompatible + ) + + if list_base in to: + if ext == "?": + # If the key ends in "?", the list will only be merged if it doesn't + # already exist. + continue + elif type(to[list_base]) is not list: + # This may not have been checked above if merging in a list with an + # extension character. + raise TypeError( + "Attempt to merge dict value of type " + + v.__class__.__name__ + + " into incompatible type " + + to[list_base].__class__.__name__ + + " for key " + + list_base + + "(" + + k + + ")" + ) + else: + to[list_base] = [] + + # Call MergeLists, which will make copies of objects that require it. + # MergeLists can recurse back into MergeDicts, although this will be + # to make copies of dicts (with paths fixed), there will be no + # subsequent dict "merging" once entering a list because lists are + # always replaced, appended to, or prepended to. + is_paths = IsPathSection(list_base) + MergeLists(to[list_base], v, to_file, fro_file, is_paths, append) + else: + raise TypeError( + "Attempt to merge dict value of unsupported type " + + v.__class__.__name__ + + " for key " + + k + ) + + +def MergeConfigWithInheritance( + new_configuration_dict, build_file, target_dict, configuration, visited +): + # Skip if previously visited. + if configuration in visited: + return + + # Look at this configuration. + configuration_dict = target_dict["configurations"][configuration] + + # Merge in parents. + for parent in configuration_dict.get("inherit_from", []): + MergeConfigWithInheritance( + new_configuration_dict, + build_file, + target_dict, + parent, + visited + [configuration], + ) + + # Merge it into the new config. + MergeDicts(new_configuration_dict, configuration_dict, build_file, build_file) + + # Drop abstract. + if "abstract" in new_configuration_dict: + del new_configuration_dict["abstract"] + + +def SetUpConfigurations(target, target_dict): + # key_suffixes is a list of key suffixes that might appear on key names. + # These suffixes are handled in conditional evaluations (for =, +, and ?) + # and rules/exclude processing (for ! and /). Keys with these suffixes + # should be treated the same as keys without. + key_suffixes = ["=", "+", "?", "!", "/"] + + build_file = gyp.common.BuildFile(target) + + # Provide a single configuration by default if none exists. + # TODO(mark): Signal an error if default_configurations exists but + # configurations does not. + if "configurations" not in target_dict: + target_dict["configurations"] = {"Default": {}} + if "default_configuration" not in target_dict: + concrete = [ + i + for (i, config) in target_dict["configurations"].items() + if not config.get("abstract") + ] + target_dict["default_configuration"] = sorted(concrete)[0] + + merged_configurations = {} + configs = target_dict["configurations"] + for (configuration, old_configuration_dict) in configs.items(): + # Skip abstract configurations (saves work only). + if old_configuration_dict.get("abstract"): + continue + # Configurations inherit (most) settings from the enclosing target scope. + # Get the inheritance relationship right by making a copy of the target + # dict. + new_configuration_dict = {} + for (key, target_val) in target_dict.items(): + key_ext = key[-1:] + if key_ext in key_suffixes: + key_base = key[:-1] + else: + key_base = key + if key_base not in non_configuration_keys: + new_configuration_dict[key] = gyp.simple_copy.deepcopy(target_val) + + # Merge in configuration (with all its parents first). + MergeConfigWithInheritance( + new_configuration_dict, build_file, target_dict, configuration, [] + ) + + merged_configurations[configuration] = new_configuration_dict + + # Put the new configurations back into the target dict as a configuration. + for configuration in merged_configurations.keys(): + target_dict["configurations"][configuration] = merged_configurations[ + configuration + ] + + # Now drop all the abstract ones. + configs = target_dict["configurations"] + target_dict["configurations"] = { + k: v for k, v in configs.items() if not v.get("abstract") + } + + # Now that all of the target's configurations have been built, go through + # the target dict's keys and remove everything that's been moved into a + # "configurations" section. + delete_keys = [] + for key in target_dict: + key_ext = key[-1:] + if key_ext in key_suffixes: + key_base = key[:-1] + else: + key_base = key + if key_base not in non_configuration_keys: + delete_keys.append(key) + for key in delete_keys: + del target_dict[key] + + # Check the configurations to see if they contain invalid keys. + for configuration in target_dict["configurations"].keys(): + configuration_dict = target_dict["configurations"][configuration] + for key in configuration_dict.keys(): + if key in invalid_configuration_keys: + raise GypError( + "%s not allowed in the %s configuration, found in " + "target %s" % (key, configuration, target) + ) + + +def ProcessListFiltersInDict(name, the_dict): + """Process regular expression and exclusion-based filters on lists. + + An exclusion list is in a dict key named with a trailing "!", like + "sources!". Every item in such a list is removed from the associated + main list, which in this example, would be "sources". Removed items are + placed into a "sources_excluded" list in the dict. + + Regular expression (regex) filters are contained in dict keys named with a + trailing "/", such as "sources/" to operate on the "sources" list. Regex + filters in a dict take the form: + 'sources/': [ ['exclude', '_(linux|mac|win)\\.cc$'], + ['include', '_mac\\.cc$'] ], + The first filter says to exclude all files ending in _linux.cc, _mac.cc, and + _win.cc. The second filter then includes all files ending in _mac.cc that + are now or were once in the "sources" list. Items matching an "exclude" + filter are subject to the same processing as would occur if they were listed + by name in an exclusion list (ending in "!"). Items matching an "include" + filter are brought back into the main list if previously excluded by an + exclusion list or exclusion regex filter. Subsequent matching "exclude" + patterns can still cause items to be excluded after matching an "include". + """ + + # Look through the dictionary for any lists whose keys end in "!" or "/". + # These are lists that will be treated as exclude lists and regular + # expression-based exclude/include lists. Collect the lists that are + # needed first, looking for the lists that they operate on, and assemble + # then into |lists|. This is done in a separate loop up front, because + # the _included and _excluded keys need to be added to the_dict, and that + # can't be done while iterating through it. + + lists = [] + del_lists = [] + for key, value in the_dict.items(): + operation = key[-1] + if operation != "!" and operation != "/": + continue + + if type(value) is not list: + raise ValueError( + name + " key " + key + " must be list, not " + value.__class__.__name__ + ) + + list_key = key[:-1] + if list_key not in the_dict: + # This happens when there's a list like "sources!" but no corresponding + # "sources" list. Since there's nothing for it to operate on, queue up + # the "sources!" list for deletion now. + del_lists.append(key) + continue + + if type(the_dict[list_key]) is not list: + value = the_dict[list_key] + raise ValueError( + name + + " key " + + list_key + + " must be list, not " + + value.__class__.__name__ + + " when applying " + + {"!": "exclusion", "/": "regex"}[operation] + ) + + if list_key not in lists: + lists.append(list_key) + + # Delete the lists that are known to be unneeded at this point. + for del_list in del_lists: + del the_dict[del_list] + + for list_key in lists: + the_list = the_dict[list_key] + + # Initialize the list_actions list, which is parallel to the_list. Each + # item in list_actions identifies whether the corresponding item in + # the_list should be excluded, unconditionally preserved (included), or + # whether no exclusion or inclusion has been applied. Items for which + # no exclusion or inclusion has been applied (yet) have value -1, items + # excluded have value 0, and items included have value 1. Includes and + # excludes override previous actions. All items in list_actions are + # initialized to -1 because no excludes or includes have been processed + # yet. + list_actions = list((-1,) * len(the_list)) + + exclude_key = list_key + "!" + if exclude_key in the_dict: + for exclude_item in the_dict[exclude_key]: + for index, list_item in enumerate(the_list): + if exclude_item == list_item: + # This item matches the exclude_item, so set its action to 0 + # (exclude). + list_actions[index] = 0 + + # The "whatever!" list is no longer needed, dump it. + del the_dict[exclude_key] + + regex_key = list_key + "/" + if regex_key in the_dict: + for regex_item in the_dict[regex_key]: + [action, pattern] = regex_item + pattern_re = re.compile(pattern) + + if action == "exclude": + # This item matches an exclude regex, set its value to 0 (exclude). + action_value = 0 + elif action == "include": + # This item matches an include regex, set its value to 1 (include). + action_value = 1 + else: + # This is an action that doesn't make any sense. + raise ValueError( + "Unrecognized action " + + action + + " in " + + name + + " key " + + regex_key + ) + + for index, list_item in enumerate(the_list): + if list_actions[index] == action_value: + # Even if the regex matches, nothing will change so continue + # (regex searches are expensive). + continue + if pattern_re.search(list_item): + # Regular expression match. + list_actions[index] = action_value + + # The "whatever/" list is no longer needed, dump it. + del the_dict[regex_key] + + # Add excluded items to the excluded list. + # + # Note that exclude_key ("sources!") is different from excluded_key + # ("sources_excluded"). The exclude_key list is input and it was already + # processed and deleted; the excluded_key list is output and it's about + # to be created. + excluded_key = list_key + "_excluded" + if excluded_key in the_dict: + raise GypError( + name + " key " + excluded_key + " must not be present prior " + " to applying exclusion/regex filters for " + list_key + ) + + excluded_list = [] + + # Go backwards through the list_actions list so that as items are deleted, + # the indices of items that haven't been seen yet don't shift. That means + # that things need to be prepended to excluded_list to maintain them in the + # same order that they existed in the_list. + for index in range(len(list_actions) - 1, -1, -1): + if list_actions[index] == 0: + # Dump anything with action 0 (exclude). Keep anything with action 1 + # (include) or -1 (no include or exclude seen for the item). + excluded_list.insert(0, the_list[index]) + del the_list[index] + + # If anything was excluded, put the excluded list into the_dict at + # excluded_key. + if len(excluded_list) > 0: + the_dict[excluded_key] = excluded_list + + # Now recurse into subdicts and lists that may contain dicts. + for key, value in the_dict.items(): + if type(value) is dict: + ProcessListFiltersInDict(key, value) + elif type(value) is list: + ProcessListFiltersInList(key, value) + + +def ProcessListFiltersInList(name, the_list): + for item in the_list: + if type(item) is dict: + ProcessListFiltersInDict(name, item) + elif type(item) is list: + ProcessListFiltersInList(name, item) + + +def ValidateTargetType(target, target_dict): + """Ensures the 'type' field on the target is one of the known types. + + Arguments: + target: string, name of target. + target_dict: dict, target spec. + + Raises an exception on error. + """ + VALID_TARGET_TYPES = ( + "executable", + "loadable_module", + "static_library", + "shared_library", + "mac_kernel_extension", + "none", + "windows_driver", + ) + target_type = target_dict.get("type", None) + if target_type not in VALID_TARGET_TYPES: + raise GypError( + "Target %s has an invalid target type '%s'. " + "Must be one of %s." % (target, target_type, "/".join(VALID_TARGET_TYPES)) + ) + if ( + target_dict.get("standalone_static_library", 0) + and not target_type == "static_library" + ): + raise GypError( + "Target %s has type %s but standalone_static_library flag is" + " only valid for static_library type." % (target, target_type) + ) + + +def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules): + """Ensures that the rules sections in target_dict are valid and consistent, + and determines which sources they apply to. + + Arguments: + target: string, name of target. + target_dict: dict, target spec containing "rules" and "sources" lists. + extra_sources_for_rules: a list of keys to scan for rule matches in + addition to 'sources'. + """ + + # Dicts to map between values found in rules' 'rule_name' and 'extension' + # keys and the rule dicts themselves. + rule_names = {} + rule_extensions = {} + + rules = target_dict.get("rules", []) + for rule in rules: + # Make sure that there's no conflict among rule names and extensions. + rule_name = rule["rule_name"] + if rule_name in rule_names: + raise GypError( + f"rule {rule_name} exists in duplicate, target {target}" + ) + rule_names[rule_name] = rule + + rule_extension = rule["extension"] + if rule_extension.startswith("."): + rule_extension = rule_extension[1:] + if rule_extension in rule_extensions: + raise GypError( + ( + "extension %s associated with multiple rules, " + + "target %s rules %s and %s" + ) + % ( + rule_extension, + target, + rule_extensions[rule_extension]["rule_name"], + rule_name, + ) + ) + rule_extensions[rule_extension] = rule + + # Make sure rule_sources isn't already there. It's going to be + # created below if needed. + if "rule_sources" in rule: + raise GypError( + "rule_sources must not exist in input, target %s rule %s" + % (target, rule_name) + ) + + rule_sources = [] + source_keys = ["sources"] + source_keys.extend(extra_sources_for_rules) + for source_key in source_keys: + for source in target_dict.get(source_key, []): + (source_root, source_extension) = os.path.splitext(source) + if source_extension.startswith("."): + source_extension = source_extension[1:] + if source_extension == rule_extension: + rule_sources.append(source) + + if len(rule_sources) > 0: + rule["rule_sources"] = rule_sources + + +def ValidateRunAsInTarget(target, target_dict, build_file): + target_name = target_dict.get("target_name") + run_as = target_dict.get("run_as") + if not run_as: + return + if type(run_as) is not dict: + raise GypError( + "The 'run_as' in target %s from file %s should be a " + "dictionary." % (target_name, build_file) + ) + action = run_as.get("action") + if not action: + raise GypError( + "The 'run_as' in target %s from file %s must have an " + "'action' section." % (target_name, build_file) + ) + if type(action) is not list: + raise GypError( + "The 'action' for 'run_as' in target %s from file %s " + "must be a list." % (target_name, build_file) + ) + working_directory = run_as.get("working_directory") + if working_directory and type(working_directory) is not str: + raise GypError( + "The 'working_directory' for 'run_as' in target %s " + "in file %s should be a string." % (target_name, build_file) + ) + environment = run_as.get("environment") + if environment and type(environment) is not dict: + raise GypError( + "The 'environment' for 'run_as' in target %s " + "in file %s should be a dictionary." % (target_name, build_file) + ) + + +def ValidateActionsInTarget(target, target_dict, build_file): + """Validates the inputs to the actions in a target.""" + target_name = target_dict.get("target_name") + actions = target_dict.get("actions", []) + for action in actions: + action_name = action.get("action_name") + if not action_name: + raise GypError( + "Anonymous action in target %s. " + "An action must have an 'action_name' field." % target_name + ) + inputs = action.get("inputs", None) + if inputs is None: + raise GypError("Action in target %s has no inputs." % target_name) + action_command = action.get("action") + if action_command and not action_command[0]: + raise GypError("Empty action as command in target %s." % target_name) + + +def TurnIntIntoStrInDict(the_dict): + """Given dict the_dict, recursively converts all integers into strings. + """ + # Use items instead of iteritems because there's no need to try to look at + # reinserted keys and their associated values. + for k, v in the_dict.items(): + if type(v) is int: + v = str(v) + the_dict[k] = v + elif type(v) is dict: + TurnIntIntoStrInDict(v) + elif type(v) is list: + TurnIntIntoStrInList(v) + + if type(k) is int: + del the_dict[k] + the_dict[str(k)] = v + + +def TurnIntIntoStrInList(the_list): + """Given list the_list, recursively converts all integers into strings. + """ + for index, item in enumerate(the_list): + if type(item) is int: + the_list[index] = str(item) + elif type(item) is dict: + TurnIntIntoStrInDict(item) + elif type(item) is list: + TurnIntIntoStrInList(item) + + +def PruneUnwantedTargets(targets, flat_list, dependency_nodes, root_targets, data): + """Return only the targets that are deep dependencies of |root_targets|.""" + qualified_root_targets = [] + for target in root_targets: + target = target.strip() + qualified_targets = gyp.common.FindQualifiedTargets(target, flat_list) + if not qualified_targets: + raise GypError("Could not find target %s" % target) + qualified_root_targets.extend(qualified_targets) + + wanted_targets = {} + for target in qualified_root_targets: + wanted_targets[target] = targets[target] + for dependency in dependency_nodes[target].DeepDependencies(): + wanted_targets[dependency] = targets[dependency] + + wanted_flat_list = [t for t in flat_list if t in wanted_targets] + + # Prune unwanted targets from each build_file's data dict. + for build_file in data["target_build_files"]: + if "targets" not in data[build_file]: + continue + new_targets = [] + for target in data[build_file]["targets"]: + qualified_name = gyp.common.QualifiedTarget( + build_file, target["target_name"], target["toolset"] + ) + if qualified_name in wanted_targets: + new_targets.append(target) + data[build_file]["targets"] = new_targets + + return wanted_targets, wanted_flat_list + + +def VerifyNoCollidingTargets(targets): + """Verify that no two targets in the same directory share the same name. + + Arguments: + targets: A list of targets in the form 'path/to/file.gyp:target_name'. + """ + # Keep a dict going from 'subdirectory:target_name' to 'foo.gyp'. + used = {} + for target in targets: + # Separate out 'path/to/file.gyp, 'target_name' from + # 'path/to/file.gyp:target_name'. + path, name = target.rsplit(":", 1) + # Separate out 'path/to', 'file.gyp' from 'path/to/file.gyp'. + subdir, gyp = os.path.split(path) + # Use '.' for the current directory '', so that the error messages make + # more sense. + if not subdir: + subdir = "." + # Prepare a key like 'path/to:target_name'. + key = subdir + ":" + name + if key in used: + # Complain if this target is already used. + raise GypError( + 'Duplicate target name "%s" in directory "%s" used both ' + 'in "%s" and "%s".' % (name, subdir, gyp, used[key]) + ) + used[key] = gyp + + +def SetGeneratorGlobals(generator_input_info): + # Set up path_sections and non_configuration_keys with the default data plus + # the generator-specific data. + global path_sections + path_sections = set(base_path_sections) + path_sections.update(generator_input_info["path_sections"]) + + global non_configuration_keys + non_configuration_keys = base_non_configuration_keys[:] + non_configuration_keys.extend(generator_input_info["non_configuration_keys"]) + + global multiple_toolsets + multiple_toolsets = generator_input_info["generator_supports_multiple_toolsets"] + + global generator_filelist_paths + generator_filelist_paths = generator_input_info["generator_filelist_paths"] + + +def Load( + build_files, + variables, + includes, + depth, + generator_input_info, + check, + circular_check, + parallel, + root_targets, +): + SetGeneratorGlobals(generator_input_info) + # A generator can have other lists (in addition to sources) be processed + # for rules. + extra_sources_for_rules = generator_input_info["extra_sources_for_rules"] + + # Load build files. This loads every target-containing build file into + # the |data| dictionary such that the keys to |data| are build file names, + # and the values are the entire build file contents after "early" or "pre" + # processing has been done and includes have been resolved. + # NOTE: data contains both "target" files (.gyp) and "includes" (.gypi), as + # well as meta-data (e.g. 'included_files' key). 'target_build_files' keeps + # track of the keys corresponding to "target" files. + data = {"target_build_files": set()} + # Normalize paths everywhere. This is important because paths will be + # used as keys to the data dict and for references between input files. + build_files = set(map(os.path.normpath, build_files)) + if parallel: + LoadTargetBuildFilesParallel( + build_files, data, variables, includes, depth, check, generator_input_info + ) + else: + aux_data = {} + for build_file in build_files: + try: + LoadTargetBuildFile( + build_file, data, aux_data, variables, includes, depth, check, True + ) + except Exception as e: + gyp.common.ExceptionAppend(e, "while trying to load %s" % build_file) + raise + + # Build a dict to access each target's subdict by qualified name. + targets = BuildTargetsDict(data) + + # Fully qualify all dependency links. + QualifyDependencies(targets) + + # Remove self-dependencies from targets that have 'prune_self_dependencies' + # set to 1. + RemoveSelfDependencies(targets) + + # Expand dependencies specified as build_file:*. + ExpandWildcardDependencies(targets, data) + + # Remove all dependencies marked as 'link_dependency' from the targets of + # type 'none'. + RemoveLinkDependenciesFromNoneTargets(targets) + + # Apply exclude (!) and regex (/) list filters only for dependency_sections. + for target_name, target_dict in targets.items(): + tmp_dict = {} + for key_base in dependency_sections: + for op in ("", "!", "/"): + key = key_base + op + if key in target_dict: + tmp_dict[key] = target_dict[key] + del target_dict[key] + ProcessListFiltersInDict(target_name, tmp_dict) + # Write the results back to |target_dict|. + for key in tmp_dict: + target_dict[key] = tmp_dict[key] + + # Make sure every dependency appears at most once. + RemoveDuplicateDependencies(targets) + + if circular_check: + # Make sure that any targets in a.gyp don't contain dependencies in other + # .gyp files that further depend on a.gyp. + VerifyNoGYPFileCircularDependencies(targets) + + [dependency_nodes, flat_list] = BuildDependencyList(targets) + + if root_targets: + # Remove, from |targets| and |flat_list|, the targets that are not deep + # dependencies of the targets specified in |root_targets|. + targets, flat_list = PruneUnwantedTargets( + targets, flat_list, dependency_nodes, root_targets, data + ) + + # Check that no two targets in the same directory have the same name. + VerifyNoCollidingTargets(flat_list) + + # Handle dependent settings of various types. + for settings_type in [ + "all_dependent_settings", + "direct_dependent_settings", + "link_settings", + ]: + DoDependentSettings(settings_type, flat_list, targets, dependency_nodes) + + # Take out the dependent settings now that they've been published to all + # of the targets that require them. + for target in flat_list: + if settings_type in targets[target]: + del targets[target][settings_type] + + # Make sure static libraries don't declare dependencies on other static + # libraries, but that linkables depend on all unlinked static libraries + # that they need so that their link steps will be correct. + gii = generator_input_info + if gii["generator_wants_static_library_dependencies_adjusted"]: + AdjustStaticLibraryDependencies( + flat_list, + targets, + dependency_nodes, + gii["generator_wants_sorted_dependencies"], + ) + + # Apply "post"/"late"/"target" variable expansions and condition evaluations. + for target in flat_list: + target_dict = targets[target] + build_file = gyp.common.BuildFile(target) + ProcessVariablesAndConditionsInDict( + target_dict, PHASE_LATE, variables, build_file + ) + + # Move everything that can go into a "configurations" section into one. + for target in flat_list: + target_dict = targets[target] + SetUpConfigurations(target, target_dict) + + # Apply exclude (!) and regex (/) list filters. + for target in flat_list: + target_dict = targets[target] + ProcessListFiltersInDict(target, target_dict) + + # Apply "latelate" variable expansions and condition evaluations. + for target in flat_list: + target_dict = targets[target] + build_file = gyp.common.BuildFile(target) + ProcessVariablesAndConditionsInDict( + target_dict, PHASE_LATELATE, variables, build_file + ) + + # Make sure that the rules make sense, and build up rule_sources lists as + # needed. Not all generators will need to use the rule_sources lists, but + # some may, and it seems best to build the list in a common spot. + # Also validate actions and run_as elements in targets. + for target in flat_list: + target_dict = targets[target] + build_file = gyp.common.BuildFile(target) + ValidateTargetType(target, target_dict) + ValidateRulesInTarget(target, target_dict, extra_sources_for_rules) + ValidateRunAsInTarget(target, target_dict, build_file) + ValidateActionsInTarget(target, target_dict, build_file) + + # Generators might not expect ints. Turn them into strs. + TurnIntIntoStrInDict(data) + + # TODO(mark): Return |data| for now because the generator needs a list of + # build files that came in. In the future, maybe it should just accept + # a list, and not the whole data dict. + return [flat_list, targets, data] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input_test.py new file mode 100755 index 0000000000000..a18f72e9ebb0a --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input_test.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 + +# Copyright 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Unit tests for the input.py file.""" + +import gyp.input +import unittest + + +class TestFindCycles(unittest.TestCase): + def setUp(self): + self.nodes = {} + for x in ("a", "b", "c", "d", "e"): + self.nodes[x] = gyp.input.DependencyGraphNode(x) + + def _create_dependency(self, dependent, dependency): + dependent.dependencies.append(dependency) + dependency.dependents.append(dependent) + + def test_no_cycle_empty_graph(self): + for label, node in self.nodes.items(): + self.assertEqual([], node.FindCycles()) + + def test_no_cycle_line(self): + self._create_dependency(self.nodes["a"], self.nodes["b"]) + self._create_dependency(self.nodes["b"], self.nodes["c"]) + self._create_dependency(self.nodes["c"], self.nodes["d"]) + + for label, node in self.nodes.items(): + self.assertEqual([], node.FindCycles()) + + def test_no_cycle_dag(self): + self._create_dependency(self.nodes["a"], self.nodes["b"]) + self._create_dependency(self.nodes["a"], self.nodes["c"]) + self._create_dependency(self.nodes["b"], self.nodes["c"]) + + for label, node in self.nodes.items(): + self.assertEqual([], node.FindCycles()) + + def test_cycle_self_reference(self): + self._create_dependency(self.nodes["a"], self.nodes["a"]) + + self.assertEqual( + [[self.nodes["a"], self.nodes["a"]]], self.nodes["a"].FindCycles() + ) + + def test_cycle_two_nodes(self): + self._create_dependency(self.nodes["a"], self.nodes["b"]) + self._create_dependency(self.nodes["b"], self.nodes["a"]) + + self.assertEqual( + [[self.nodes["a"], self.nodes["b"], self.nodes["a"]]], + self.nodes["a"].FindCycles(), + ) + self.assertEqual( + [[self.nodes["b"], self.nodes["a"], self.nodes["b"]]], + self.nodes["b"].FindCycles(), + ) + + def test_two_cycles(self): + self._create_dependency(self.nodes["a"], self.nodes["b"]) + self._create_dependency(self.nodes["b"], self.nodes["a"]) + + self._create_dependency(self.nodes["b"], self.nodes["c"]) + self._create_dependency(self.nodes["c"], self.nodes["b"]) + + cycles = self.nodes["a"].FindCycles() + self.assertTrue([self.nodes["a"], self.nodes["b"], self.nodes["a"]] in cycles) + self.assertTrue([self.nodes["b"], self.nodes["c"], self.nodes["b"]] in cycles) + self.assertEqual(2, len(cycles)) + + def test_big_cycle(self): + self._create_dependency(self.nodes["a"], self.nodes["b"]) + self._create_dependency(self.nodes["b"], self.nodes["c"]) + self._create_dependency(self.nodes["c"], self.nodes["d"]) + self._create_dependency(self.nodes["d"], self.nodes["e"]) + self._create_dependency(self.nodes["e"], self.nodes["a"]) + + self.assertEqual( + [ + [ + self.nodes["a"], + self.nodes["b"], + self.nodes["c"], + self.nodes["d"], + self.nodes["e"], + self.nodes["a"], + ] + ], + self.nodes["a"].FindCycles(), + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py new file mode 100755 index 0000000000000..59647c9a89034 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py @@ -0,0 +1,771 @@ +#!/usr/bin/env python3 +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Utility functions to perform Xcode-style build steps. + +These functions are executed via gyp-mac-tool when using the Makefile generator. +""" + + +import fcntl +import fnmatch +import glob +import json +import os +import plistlib +import re +import shutil +import struct +import subprocess +import sys +import tempfile + + +def main(args): + executor = MacTool() + exit_code = executor.Dispatch(args) + if exit_code is not None: + sys.exit(exit_code) + + +class MacTool: + """This class performs all the Mac tooling steps. The methods can either be + executed directly, or dispatched from an argument list.""" + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + return getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like copy-info-plist to CopyInfoPlist""" + return name_string.title().replace("-", "") + + def ExecCopyBundleResource(self, source, dest, convert_to_binary): + """Copies a resource file to the bundle/Resources directory, performing any + necessary compilation on each resource.""" + convert_to_binary = convert_to_binary == "True" + extension = os.path.splitext(source)[1].lower() + if os.path.isdir(source): + # Copy tree. + # TODO(thakis): This copies file attributes like mtime, while the + # single-file branch below doesn't. This should probably be changed to + # be consistent with the single-file branch. + if os.path.exists(dest): + shutil.rmtree(dest) + shutil.copytree(source, dest) + elif extension == ".xib": + return self._CopyXIBFile(source, dest) + elif extension == ".storyboard": + return self._CopyXIBFile(source, dest) + elif extension == ".strings" and not convert_to_binary: + self._CopyStringsFile(source, dest) + else: + if os.path.exists(dest): + os.unlink(dest) + shutil.copy(source, dest) + + if convert_to_binary and extension in (".plist", ".strings"): + self._ConvertToBinary(dest) + + def _CopyXIBFile(self, source, dest): + """Compiles a XIB file with ibtool into a binary plist in the bundle.""" + + # ibtool sometimes crashes with relative paths. See crbug.com/314728. + base = os.path.dirname(os.path.realpath(__file__)) + if os.path.relpath(source): + source = os.path.join(base, source) + if os.path.relpath(dest): + dest = os.path.join(base, dest) + + args = ["xcrun", "ibtool", "--errors", "--warnings", "--notices"] + + if os.environ["XCODE_VERSION_ACTUAL"] > "0700": + args.extend(["--auto-activate-custom-fonts"]) + if "IPHONEOS_DEPLOYMENT_TARGET" in os.environ: + args.extend( + [ + "--target-device", + "iphone", + "--target-device", + "ipad", + "--minimum-deployment-target", + os.environ["IPHONEOS_DEPLOYMENT_TARGET"], + ] + ) + else: + args.extend( + [ + "--target-device", + "mac", + "--minimum-deployment-target", + os.environ["MACOSX_DEPLOYMENT_TARGET"], + ] + ) + + args.extend( + ["--output-format", "human-readable-text", "--compile", dest, source] + ) + + ibtool_section_re = re.compile(r"/\*.*\*/") + ibtool_re = re.compile(r".*note:.*is clipping its content") + try: + stdout = subprocess.check_output(args) + except subprocess.CalledProcessError as e: + print(e.output) + raise + current_section_header = None + for line in stdout.splitlines(): + if ibtool_section_re.match(line): + current_section_header = line + elif not ibtool_re.match(line): + if current_section_header: + print(current_section_header) + current_section_header = None + print(line) + return 0 + + def _ConvertToBinary(self, dest): + subprocess.check_call( + ["xcrun", "plutil", "-convert", "binary1", "-o", dest, dest] + ) + + def _CopyStringsFile(self, source, dest): + """Copies a .strings file using iconv to reconvert the input into UTF-16.""" + input_code = self._DetectInputEncoding(source) or "UTF-8" + + # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call + # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints + # CFPropertyListCreateFromXMLData(): Old-style plist parser: missing + # semicolon in dictionary. + # on invalid files. Do the same kind of validation. + import CoreFoundation + + with open(source, "rb") as in_file: + s = in_file.read() + d = CoreFoundation.CFDataCreate(None, s, len(s)) + _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None) + if error: + return + + with open(dest, "wb") as fp: + fp.write(s.decode(input_code).encode("UTF-16")) + + def _DetectInputEncoding(self, file_name): + """Reads the first few bytes from file_name and tries to guess the text + encoding. Returns None as a guess if it can't detect it.""" + with open(file_name, "rb") as fp: + try: + header = fp.read(3) + except Exception: + return None + if header.startswith(b"\xFE\xFF"): + return "UTF-16" + elif header.startswith(b"\xFF\xFE"): + return "UTF-16" + elif header.startswith(b"\xEF\xBB\xBF"): + return "UTF-8" + else: + return None + + def ExecCopyInfoPlist(self, source, dest, convert_to_binary, *keys): + """Copies the |source| Info.plist to the destination directory |dest|.""" + # Read the source Info.plist into memory. + with open(source) as fd: + lines = fd.read() + + # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild). + plist = plistlib.readPlistFromString(lines) + if keys: + plist.update(json.loads(keys[0])) + lines = plistlib.writePlistToString(plist) + + # Go through all the environment variables and replace them as variables in + # the file. + IDENT_RE = re.compile(r"[_/\s]") + for key in os.environ: + if key.startswith("_"): + continue + evar = "${%s}" % key + evalue = os.environ[key] + lines = lines.replace(lines, evar, evalue) + + # Xcode supports various suffices on environment variables, which are + # all undocumented. :rfc1034identifier is used in the standard project + # template these days, and :identifier was used earlier. They are used to + # convert non-url characters into things that look like valid urls -- + # except that the replacement character for :identifier, '_' isn't valid + # in a URL either -- oops, hence :rfc1034identifier was born. + evar = "${%s:identifier}" % key + evalue = IDENT_RE.sub("_", os.environ[key]) + lines = lines.replace(lines, evar, evalue) + + evar = "${%s:rfc1034identifier}" % key + evalue = IDENT_RE.sub("-", os.environ[key]) + lines = lines.replace(lines, evar, evalue) + + # Remove any keys with values that haven't been replaced. + lines = lines.splitlines() + for i in range(len(lines)): + if lines[i].strip().startswith("${"): + lines[i] = None + lines[i - 1] = None + lines = "\n".join(line for line in lines if line is not None) + + # Write out the file with variables replaced. + with open(dest, "w") as fd: + fd.write(lines) + + # Now write out PkgInfo file now that the Info.plist file has been + # "compiled". + self._WritePkgInfo(dest) + + if convert_to_binary == "True": + self._ConvertToBinary(dest) + + def _WritePkgInfo(self, info_plist): + """This writes the PkgInfo file from the data stored in Info.plist.""" + plist = plistlib.readPlist(info_plist) + if not plist: + return + + # Only create PkgInfo for executable types. + package_type = plist["CFBundlePackageType"] + if package_type != "APPL": + return + + # The format of PkgInfo is eight characters, representing the bundle type + # and bundle signature, each four characters. If that is missing, four + # '?' characters are used instead. + signature_code = plist.get("CFBundleSignature", "????") + if len(signature_code) != 4: # Wrong length resets everything, too. + signature_code = "?" * 4 + + dest = os.path.join(os.path.dirname(info_plist), "PkgInfo") + with open(dest, "w") as fp: + fp.write(f"{package_type}{signature_code}") + + def ExecFlock(self, lockfile, *cmd_list): + """Emulates the most basic behavior of Linux's flock(1).""" + # Rely on exception handling to report errors. + fd = os.open(lockfile, os.O_RDONLY | os.O_NOCTTY | os.O_CREAT, 0o666) + fcntl.flock(fd, fcntl.LOCK_EX) + return subprocess.call(cmd_list) + + def ExecFilterLibtool(self, *cmd_list): + """Calls libtool and filters out '/path/to/libtool: file: foo.o has no + symbols'.""" + libtool_re = re.compile( + r"^.*libtool: (?:for architecture: \S* )?" r"file: .* has no symbols$" + ) + libtool_re5 = re.compile( + r"^.*libtool: warning for library: " + + r".* the table of contents is empty " + + r"\(no object file members in the library define global symbols\)$" + ) + env = os.environ.copy() + # Ref: + # http://www.opensource.apple.com/source/cctools/cctools-809/misc/libtool.c + # The problem with this flag is that it resets the file mtime on the file to + # epoch=0, e.g. 1970-1-1 or 1969-12-31 depending on timezone. + env["ZERO_AR_DATE"] = "1" + libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env) + err = libtoolout.communicate()[1].decode("utf-8") + for line in err.splitlines(): + if not libtool_re.match(line) and not libtool_re5.match(line): + print(line, file=sys.stderr) + # Unconditionally touch the output .a file on the command line if present + # and the command succeeded. A bit hacky. + if not libtoolout.returncode: + for i in range(len(cmd_list) - 1): + if cmd_list[i] == "-o" and cmd_list[i + 1].endswith(".a"): + os.utime(cmd_list[i + 1], None) + break + return libtoolout.returncode + + def ExecPackageIosFramework(self, framework): + # Find the name of the binary based on the part before the ".framework". + binary = os.path.basename(framework).split(".")[0] + module_path = os.path.join(framework, "Modules") + if not os.path.exists(module_path): + os.mkdir(module_path) + module_template = ( + "framework module %s {\n" + ' umbrella header "%s.h"\n' + "\n" + " export *\n" + " module * { export * }\n" + "}\n" % (binary, binary) + ) + + with open(os.path.join(module_path, "module.modulemap"), "w") as module_file: + module_file.write(module_template) + + def ExecPackageFramework(self, framework, version): + """Takes a path to Something.framework and the Current version of that and + sets up all the symlinks.""" + # Find the name of the binary based on the part before the ".framework". + binary = os.path.basename(framework).split(".")[0] + + CURRENT = "Current" + RESOURCES = "Resources" + VERSIONS = "Versions" + + if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)): + # Binary-less frameworks don't seem to contain symlinks (see e.g. + # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle). + return + + # Move into the framework directory to set the symlinks correctly. + pwd = os.getcwd() + os.chdir(framework) + + # Set up the Current version. + self._Relink(version, os.path.join(VERSIONS, CURRENT)) + + # Set up the root symlinks. + self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary) + self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES) + + # Back to where we were before! + os.chdir(pwd) + + def _Relink(self, dest, link): + """Creates a symlink to |dest| named |link|. If |link| already exists, + it is overwritten.""" + if os.path.lexists(link): + os.remove(link) + os.symlink(dest, link) + + def ExecCompileIosFrameworkHeaderMap(self, out, framework, *all_headers): + framework_name = os.path.basename(framework).split(".")[0] + all_headers = [os.path.abspath(header) for header in all_headers] + filelist = {} + for header in all_headers: + filename = os.path.basename(header) + filelist[filename] = header + filelist[os.path.join(framework_name, filename)] = header + WriteHmap(out, filelist) + + def ExecCopyIosFrameworkHeaders(self, framework, *copy_headers): + header_path = os.path.join(framework, "Headers") + if not os.path.exists(header_path): + os.makedirs(header_path) + for header in copy_headers: + shutil.copy(header, os.path.join(header_path, os.path.basename(header))) + + def ExecCompileXcassets(self, keys, *inputs): + """Compiles multiple .xcassets files into a single .car file. + + This invokes 'actool' to compile all the inputs .xcassets files. The + |keys| arguments is a json-encoded dictionary of extra arguments to + pass to 'actool' when the asset catalogs contains an application icon + or a launch image. + + Note that 'actool' does not create the Assets.car file if the asset + catalogs does not contains imageset. + """ + command_line = [ + "xcrun", + "actool", + "--output-format", + "human-readable-text", + "--compress-pngs", + "--notices", + "--warnings", + "--errors", + ] + is_iphone_target = "IPHONEOS_DEPLOYMENT_TARGET" in os.environ + if is_iphone_target: + platform = os.environ["CONFIGURATION"].split("-")[-1] + if platform not in ("iphoneos", "iphonesimulator"): + platform = "iphonesimulator" + command_line.extend( + [ + "--platform", + platform, + "--target-device", + "iphone", + "--target-device", + "ipad", + "--minimum-deployment-target", + os.environ["IPHONEOS_DEPLOYMENT_TARGET"], + "--compile", + os.path.abspath(os.environ["CONTENTS_FOLDER_PATH"]), + ] + ) + else: + command_line.extend( + [ + "--platform", + "macosx", + "--target-device", + "mac", + "--minimum-deployment-target", + os.environ["MACOSX_DEPLOYMENT_TARGET"], + "--compile", + os.path.abspath(os.environ["UNLOCALIZED_RESOURCES_FOLDER_PATH"]), + ] + ) + if keys: + keys = json.loads(keys) + for key, value in keys.items(): + arg_name = "--" + key + if isinstance(value, bool): + if value: + command_line.append(arg_name) + elif isinstance(value, list): + for v in value: + command_line.append(arg_name) + command_line.append(str(v)) + else: + command_line.append(arg_name) + command_line.append(str(value)) + # Note: actool crashes if inputs path are relative, so use os.path.abspath + # to get absolute path name for inputs. + command_line.extend(map(os.path.abspath, inputs)) + subprocess.check_call(command_line) + + def ExecMergeInfoPlist(self, output, *inputs): + """Merge multiple .plist files into a single .plist file.""" + merged_plist = {} + for path in inputs: + plist = self._LoadPlistMaybeBinary(path) + self._MergePlist(merged_plist, plist) + plistlib.writePlist(merged_plist, output) + + def ExecCodeSignBundle(self, key, entitlements, provisioning, path, preserve): + """Code sign a bundle. + + This function tries to code sign an iOS bundle, following the same + algorithm as Xcode: + 1. pick the provisioning profile that best match the bundle identifier, + and copy it into the bundle as embedded.mobileprovision, + 2. copy Entitlements.plist from user or SDK next to the bundle, + 3. code sign the bundle. + """ + substitutions, overrides = self._InstallProvisioningProfile( + provisioning, self._GetCFBundleIdentifier() + ) + entitlements_path = self._InstallEntitlements( + entitlements, substitutions, overrides + ) + + args = ["codesign", "--force", "--sign", key] + if preserve == "True": + args.extend(["--deep", "--preserve-metadata=identifier,entitlements"]) + else: + args.extend(["--entitlements", entitlements_path]) + args.extend(["--timestamp=none", path]) + subprocess.check_call(args) + + def _InstallProvisioningProfile(self, profile, bundle_identifier): + """Installs embedded.mobileprovision into the bundle. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple containing two dictionary: variables substitutions and values + to overrides when generating the entitlements file. + """ + source_path, provisioning_data, team_id = self._FindProvisioningProfile( + profile, bundle_identifier + ) + target_path = os.path.join( + os.environ["BUILT_PRODUCTS_DIR"], + os.environ["CONTENTS_FOLDER_PATH"], + "embedded.mobileprovision", + ) + shutil.copy2(source_path, target_path) + substitutions = self._GetSubstitutions(bundle_identifier, team_id + ".") + return substitutions, provisioning_data["Entitlements"] + + def _FindProvisioningProfile(self, profile, bundle_identifier): + """Finds the .mobileprovision file to use for signing the bundle. + + Checks all the installed provisioning profiles (or if the user specified + the PROVISIONING_PROFILE variable, only consult it) and select the most + specific that correspond to the bundle identifier. + + Args: + profile: string, optional, short name of the .mobileprovision file + to use, if empty or the file is missing, the best file installed + will be used + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + + Returns: + A tuple of the path to the selected provisioning profile, the data of + the embedded plist in the provisioning profile and the team identifier + to use for code signing. + + Raises: + SystemExit: if no .mobileprovision can be used to sign the bundle. + """ + profiles_dir = os.path.join( + os.environ["HOME"], "Library", "MobileDevice", "Provisioning Profiles" + ) + if not os.path.isdir(profiles_dir): + print( + "cannot find mobile provisioning for %s" % (bundle_identifier), + file=sys.stderr, + ) + sys.exit(1) + provisioning_profiles = None + if profile: + profile_path = os.path.join(profiles_dir, profile + ".mobileprovision") + if os.path.exists(profile_path): + provisioning_profiles = [profile_path] + if not provisioning_profiles: + provisioning_profiles = glob.glob( + os.path.join(profiles_dir, "*.mobileprovision") + ) + valid_provisioning_profiles = {} + for profile_path in provisioning_profiles: + profile_data = self._LoadProvisioningProfile(profile_path) + app_id_pattern = profile_data.get("Entitlements", {}).get( + "application-identifier", "" + ) + for team_identifier in profile_data.get("TeamIdentifier", []): + app_id = f"{team_identifier}.{bundle_identifier}" + if fnmatch.fnmatch(app_id, app_id_pattern): + valid_provisioning_profiles[app_id_pattern] = ( + profile_path, + profile_data, + team_identifier, + ) + if not valid_provisioning_profiles: + print( + "cannot find mobile provisioning for %s" % (bundle_identifier), + file=sys.stderr, + ) + sys.exit(1) + # If the user has multiple provisioning profiles installed that can be + # used for ${bundle_identifier}, pick the most specific one (ie. the + # provisioning profile whose pattern is the longest). + selected_key = max(valid_provisioning_profiles, key=lambda v: len(v)) + return valid_provisioning_profiles[selected_key] + + def _LoadProvisioningProfile(self, profile_path): + """Extracts the plist embedded in a provisioning profile. + + Args: + profile_path: string, path to the .mobileprovision file + + Returns: + Content of the plist embedded in the provisioning profile as a dictionary. + """ + with tempfile.NamedTemporaryFile() as temp: + subprocess.check_call( + ["security", "cms", "-D", "-i", profile_path, "-o", temp.name] + ) + return self._LoadPlistMaybeBinary(temp.name) + + def _MergePlist(self, merged_plist, plist): + """Merge |plist| into |merged_plist|.""" + for key, value in plist.items(): + if isinstance(value, dict): + merged_value = merged_plist.get(key, {}) + if isinstance(merged_value, dict): + self._MergePlist(merged_value, value) + merged_plist[key] = merged_value + else: + merged_plist[key] = value + else: + merged_plist[key] = value + + def _LoadPlistMaybeBinary(self, plist_path): + """Loads into a memory a plist possibly encoded in binary format. + + This is a wrapper around plistlib.readPlist that tries to convert the + plist to the XML format if it can't be parsed (assuming that it is in + the binary format). + + Args: + plist_path: string, path to a plist file, in XML or binary format + + Returns: + Content of the plist as a dictionary. + """ + try: + # First, try to read the file using plistlib that only supports XML, + # and if an exception is raised, convert a temporary copy to XML and + # load that copy. + return plistlib.readPlist(plist_path) + except Exception: + pass + with tempfile.NamedTemporaryFile() as temp: + shutil.copy2(plist_path, temp.name) + subprocess.check_call(["plutil", "-convert", "xml1", temp.name]) + return plistlib.readPlist(temp.name) + + def _GetSubstitutions(self, bundle_identifier, app_identifier_prefix): + """Constructs a dictionary of variable substitutions for Entitlements.plist. + + Args: + bundle_identifier: string, value of CFBundleIdentifier from Info.plist + app_identifier_prefix: string, value for AppIdentifierPrefix + + Returns: + Dictionary of substitutions to apply when generating Entitlements.plist. + """ + return { + "CFBundleIdentifier": bundle_identifier, + "AppIdentifierPrefix": app_identifier_prefix, + } + + def _GetCFBundleIdentifier(self): + """Extracts CFBundleIdentifier value from Info.plist in the bundle. + + Returns: + Value of CFBundleIdentifier in the Info.plist located in the bundle. + """ + info_plist_path = os.path.join( + os.environ["TARGET_BUILD_DIR"], os.environ["INFOPLIST_PATH"] + ) + info_plist_data = self._LoadPlistMaybeBinary(info_plist_path) + return info_plist_data["CFBundleIdentifier"] + + def _InstallEntitlements(self, entitlements, substitutions, overrides): + """Generates and install the ${BundleName}.xcent entitlements file. + + Expands variables "$(variable)" pattern in the source entitlements file, + add extra entitlements defined in the .mobileprovision file and the copy + the generated plist to "${BundlePath}.xcent". + + Args: + entitlements: string, optional, path to the Entitlements.plist template + to use, defaults to "${SDKROOT}/Entitlements.plist" + substitutions: dictionary, variable substitutions + overrides: dictionary, values to add to the entitlements + + Returns: + Path to the generated entitlements file. + """ + source_path = entitlements + target_path = os.path.join( + os.environ["BUILT_PRODUCTS_DIR"], os.environ["PRODUCT_NAME"] + ".xcent" + ) + if not source_path: + source_path = os.path.join(os.environ["SDKROOT"], "Entitlements.plist") + shutil.copy2(source_path, target_path) + data = self._LoadPlistMaybeBinary(target_path) + data = self._ExpandVariables(data, substitutions) + if overrides: + for key in overrides: + if key not in data: + data[key] = overrides[key] + plistlib.writePlist(data, target_path) + return target_path + + def _ExpandVariables(self, data, substitutions): + """Expands variables "$(variable)" in data. + + Args: + data: object, can be either string, list or dictionary + substitutions: dictionary, variable substitutions to perform + + Returns: + Copy of data where each references to "$(variable)" has been replaced + by the corresponding value found in substitutions, or left intact if + the key was not found. + """ + if isinstance(data, str): + for key, value in substitutions.items(): + data = data.replace("$(%s)" % key, value) + return data + if isinstance(data, list): + return [self._ExpandVariables(v, substitutions) for v in data] + if isinstance(data, dict): + return {k: self._ExpandVariables(data[k], substitutions) for k in data} + return data + + +def NextGreaterPowerOf2(x): + return 2 ** (x).bit_length() + + +def WriteHmap(output_name, filelist): + """Generates a header map based on |filelist|. + + Per Mark Mentovai: + A header map is structured essentially as a hash table, keyed by names used + in #includes, and providing pathnames to the actual files. + + The implementation below and the comment above comes from inspecting: + http://www.opensource.apple.com/source/distcc/distcc-2503/distcc_dist/include_server/headermap.py?txt + while also looking at the implementation in clang in: + https://llvm.org/svn/llvm-project/cfe/trunk/lib/Lex/HeaderMap.cpp + """ + magic = 1751998832 + version = 1 + _reserved = 0 + count = len(filelist) + capacity = NextGreaterPowerOf2(count) + strings_offset = 24 + (12 * capacity) + max_value_length = max(len(value) for value in filelist.values()) + + out = open(output_name, "wb") + out.write( + struct.pack( + " 0 or arg.count("/") > 1: + arg = os.path.normpath(arg) + + # For a literal quote, CommandLineToArgvW requires 2n+1 backslashes + # preceding it, and results in n backslashes + the quote. So we substitute + # in 2* what we match, +1 more, plus the quote. + if quote_cmd: + arg = windows_quoter_regex.sub(lambda mo: 2 * mo.group(1) + '\\"', arg) + + # %'s also need to be doubled otherwise they're interpreted as batch + # positional arguments. Also make sure to escape the % so that they're + # passed literally through escaping so they can be singled to just the + # original %. Otherwise, trying to pass the literal representation that + # looks like an environment variable to the shell (e.g. %PATH%) would fail. + arg = arg.replace("%", "%%") + + # These commands are used in rsp files, so no escaping for the shell (via ^) + # is necessary. + + # As a workaround for programs that don't use CommandLineToArgvW, gyp + # supports msvs_quote_cmd=0, which simply disables all quoting. + if quote_cmd: + # Finally, wrap the whole thing in quotes so that the above quote rule + # applies and whitespace isn't a word break. + return f'"{arg}"' + + return arg + + +def EncodeRspFileList(args, quote_cmd): + """Process a list of arguments using QuoteCmdExeArgument.""" + # Note that the first argument is assumed to be the command. Don't add + # quotes around it because then built-ins like 'echo', etc. won't work. + # Take care to normpath only the path in the case of 'call ../x.bat' because + # otherwise the whole thing is incorrectly interpreted as a path and not + # normalized correctly. + if not args: + return "" + if args[0].startswith("call "): + call, program = args[0].split(" ", 1) + program = call + " " + os.path.normpath(program) + else: + program = os.path.normpath(args[0]) + return (program + " " + + " ".join(QuoteForRspFile(arg, quote_cmd) for arg in args[1:])) + + +def _GenericRetrieve(root, default, path): + """Given a list of dictionary keys |path| and a tree of dicts |root|, find + value at path, or return |default| if any of the path doesn't exist.""" + if not root: + return default + if not path: + return root + return _GenericRetrieve(root.get(path[0]), default, path[1:]) + + +def _AddPrefix(element, prefix): + """Add |prefix| to |element| or each subelement if element is iterable.""" + if element is None: + return element + # Note, not Iterable because we don't want to handle strings like that. + if isinstance(element, list) or isinstance(element, tuple): + return [prefix + e for e in element] + else: + return prefix + element + + +def _DoRemapping(element, map): + """If |element| then remap it through |map|. If |element| is iterable then + each item will be remapped. Any elements not found will be removed.""" + if map is not None and element is not None: + if not callable(map): + map = map.get # Assume it's a dict, otherwise a callable to do the remap. + if isinstance(element, list) or isinstance(element, tuple): + element = filter(None, [map(elem) for elem in element]) + else: + element = map(element) + return element + + +def _AppendOrReturn(append, element): + """If |append| is None, simply return |element|. If |append| is not None, + then add |element| to it, adding each item in |element| if it's a list or + tuple.""" + if append is not None and element is not None: + if isinstance(element, list) or isinstance(element, tuple): + append.extend(element) + else: + append.append(element) + else: + return element + + +def _FindDirectXInstallation(): + """Try to find an installation location for the DirectX SDK. Check for the + standard environment variable, and if that doesn't exist, try to find + via the registry. May return None if not found in either location.""" + # Return previously calculated value, if there is one + if hasattr(_FindDirectXInstallation, "dxsdk_dir"): + return _FindDirectXInstallation.dxsdk_dir + + dxsdk_dir = os.environ.get("DXSDK_DIR") + if not dxsdk_dir: + # Setup params to pass to and attempt to launch reg.exe. + cmd = ["reg.exe", "query", r"HKLM\Software\Microsoft\DirectX", "/s"] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = p.communicate()[0].decode("utf-8") + for line in stdout.splitlines(): + if "InstallPath" in line: + dxsdk_dir = line.split(" ")[3] + "\\" + + # Cache return value + _FindDirectXInstallation.dxsdk_dir = dxsdk_dir + return dxsdk_dir + + +def GetGlobalVSMacroEnv(vs_version): + """Get a dict of variables mapping internal VS macro names to their gyp + equivalents. Returns all variables that are independent of the target.""" + env = {} + # '$(VSInstallDir)' and '$(VCInstallDir)' are available when and only when + # Visual Studio is actually installed. + if vs_version.Path(): + env["$(VSInstallDir)"] = vs_version.Path() + env["$(VCInstallDir)"] = os.path.join(vs_version.Path(), "VC") + "\\" + # Chromium uses DXSDK_DIR in include/lib paths, but it may or may not be + # set. This happens when the SDK is sync'd via src-internal, rather than + # by typical end-user installation of the SDK. If it's not set, we don't + # want to leave the unexpanded variable in the path, so simply strip it. + dxsdk_dir = _FindDirectXInstallation() + env["$(DXSDK_DIR)"] = dxsdk_dir if dxsdk_dir else "" + # Try to find an installation location for the Windows DDK by checking + # the WDK_DIR environment variable, may be None. + env["$(WDK_DIR)"] = os.environ.get("WDK_DIR", "") + return env + + +def ExtractSharedMSVSSystemIncludes(configs, generator_flags): + """Finds msvs_system_include_dirs that are common to all targets, removes + them from all targets, and returns an OrderedSet containing them.""" + all_system_includes = OrderedSet(configs[0].get("msvs_system_include_dirs", [])) + for config in configs[1:]: + system_includes = config.get("msvs_system_include_dirs", []) + all_system_includes = all_system_includes & OrderedSet(system_includes) + if not all_system_includes: + return None + # Expand macros in all_system_includes. + env = GetGlobalVSMacroEnv(GetVSVersion(generator_flags)) + expanded_system_includes = OrderedSet( + [ExpandMacros(include, env) for include in all_system_includes] + ) + if any(["$" in include for include in expanded_system_includes]): + # Some path relies on target-specific variables, bail. + return None + + # Remove system includes shared by all targets from the targets. + for config in configs: + includes = config.get("msvs_system_include_dirs", []) + if includes: # Don't insert a msvs_system_include_dirs key if not needed. + # This must check the unexpanded includes list: + new_includes = [i for i in includes if i not in all_system_includes] + config["msvs_system_include_dirs"] = new_includes + return expanded_system_includes + + +class MsvsSettings: + """A class that understands the gyp 'msvs_...' values (especially the + msvs_settings field). They largely correpond to the VS2008 IDE DOM. This + class helps map those settings to command line options.""" + + def __init__(self, spec, generator_flags): + self.spec = spec + self.vs_version = GetVSVersion(generator_flags) + + supported_fields = [ + ("msvs_configuration_attributes", dict), + ("msvs_settings", dict), + ("msvs_system_include_dirs", list), + ("msvs_disabled_warnings", list), + ("msvs_precompiled_header", str), + ("msvs_precompiled_source", str), + ("msvs_configuration_platform", str), + ("msvs_target_platform", str), + ] + configs = spec["configurations"] + for field, default in supported_fields: + setattr(self, field, {}) + for configname, config in configs.items(): + getattr(self, field)[configname] = config.get(field, default()) + + self.msvs_cygwin_dirs = spec.get("msvs_cygwin_dirs", ["."]) + + unsupported_fields = [ + "msvs_prebuild", + "msvs_postbuild", + ] + unsupported = [] + for field in unsupported_fields: + for config in configs.values(): + if field in config: + unsupported += [ + "{} not supported (target {}).".format( + field, spec["target_name"] + ) + ] + if unsupported: + raise Exception("\n".join(unsupported)) + + def GetExtension(self): + """Returns the extension for the target, with no leading dot. + + Uses 'product_extension' if specified, otherwise uses MSVS defaults based on + the target type. + """ + ext = self.spec.get("product_extension", None) + if ext: + return ext + return gyp.MSVSUtil.TARGET_TYPE_EXT.get(self.spec["type"], "") + + def GetVSMacroEnv(self, base_to_build=None, config=None): + """Get a dict of variables mapping internal VS macro names to their gyp + equivalents.""" + target_arch = self.GetArch(config) + if target_arch == "x86": + target_platform = "Win32" + else: + target_platform = target_arch + target_name = self.spec.get("product_prefix", "") + self.spec.get( + "product_name", self.spec["target_name"] + ) + target_dir = base_to_build + "\\" if base_to_build else "" + target_ext = "." + self.GetExtension() + target_file_name = target_name + target_ext + + replacements = { + "$(InputName)": "${root}", + "$(InputPath)": "${source}", + "$(IntDir)": "$!INTERMEDIATE_DIR", + "$(OutDir)\\": target_dir, + "$(PlatformName)": target_platform, + "$(ProjectDir)\\": "", + "$(ProjectName)": self.spec["target_name"], + "$(TargetDir)\\": target_dir, + "$(TargetExt)": target_ext, + "$(TargetFileName)": target_file_name, + "$(TargetName)": target_name, + "$(TargetPath)": os.path.join(target_dir, target_file_name), + } + replacements.update(GetGlobalVSMacroEnv(self.vs_version)) + return replacements + + def ConvertVSMacros(self, s, base_to_build=None, config=None): + """Convert from VS macro names to something equivalent.""" + env = self.GetVSMacroEnv(base_to_build, config=config) + return ExpandMacros(s, env) + + def AdjustLibraries(self, libraries): + """Strip -l from library if it's specified with that.""" + libs = [lib[2:] if lib.startswith("-l") else lib for lib in libraries] + return [ + lib + ".lib" + if not lib.lower().endswith(".lib") and not lib.lower().endswith(".obj") + else lib + for lib in libs + ] + + def _GetAndMunge(self, field, path, default, prefix, append, map): + """Retrieve a value from |field| at |path| or return |default|. If + |append| is specified, and the item is found, it will be appended to that + object instead of returned. If |map| is specified, results will be + remapped through |map| before being returned or appended.""" + result = _GenericRetrieve(field, default, path) + result = _DoRemapping(result, map) + result = _AddPrefix(result, prefix) + return _AppendOrReturn(append, result) + + class _GetWrapper: + def __init__(self, parent, field, base_path, append=None): + self.parent = parent + self.field = field + self.base_path = [base_path] + self.append = append + + def __call__(self, name, map=None, prefix="", default=None): + return self.parent._GetAndMunge( + self.field, + self.base_path + [name], + default=default, + prefix=prefix, + append=self.append, + map=map, + ) + + def GetArch(self, config): + """Get architecture based on msvs_configuration_platform and + msvs_target_platform. Returns either 'x86' or 'x64'.""" + configuration_platform = self.msvs_configuration_platform.get(config, "") + platform = self.msvs_target_platform.get(config, "") + if not platform: # If no specific override, use the configuration's. + platform = configuration_platform + # Map from platform to architecture. + return {"Win32": "x86", "x64": "x64", "ARM64": "arm64"}.get(platform, "x86") + + def _TargetConfig(self, config): + """Returns the target-specific configuration.""" + # There's two levels of architecture/platform specification in VS. The + # first level is globally for the configuration (this is what we consider + # "the" config at the gyp level, which will be something like 'Debug' or + # 'Release'), VS2015 and later only use this level + if int(self.vs_version.short_name) >= 2015: + return config + # and a second target-specific configuration, which is an + # override for the global one. |config| is remapped here to take into + # account the local target-specific overrides to the global configuration. + arch = self.GetArch(config) + if arch == "x64" and not config.endswith("_x64"): + config += "_x64" + if arch == "x86" and config.endswith("_x64"): + config = config.rsplit("_", 1)[0] + return config + + def _Setting(self, path, config, default=None, prefix="", append=None, map=None): + """_GetAndMunge for msvs_settings.""" + return self._GetAndMunge( + self.msvs_settings[config], path, default, prefix, append, map + ) + + def _ConfigAttrib( + self, path, config, default=None, prefix="", append=None, map=None + ): + """_GetAndMunge for msvs_configuration_attributes.""" + return self._GetAndMunge( + self.msvs_configuration_attributes[config], + path, + default, + prefix, + append, + map, + ) + + def AdjustIncludeDirs(self, include_dirs, config): + """Updates include_dirs to expand VS specific paths, and adds the system + include dirs used for platform SDK and similar.""" + config = self._TargetConfig(config) + includes = include_dirs + self.msvs_system_include_dirs[config] + includes.extend( + self._Setting( + ("VCCLCompilerTool", "AdditionalIncludeDirectories"), config, default=[] + ) + ) + return [self.ConvertVSMacros(p, config=config) for p in includes] + + def AdjustMidlIncludeDirs(self, midl_include_dirs, config): + """Updates midl_include_dirs to expand VS specific paths, and adds the + system include dirs used for platform SDK and similar.""" + config = self._TargetConfig(config) + includes = midl_include_dirs + self.msvs_system_include_dirs[config] + includes.extend( + self._Setting( + ("VCMIDLTool", "AdditionalIncludeDirectories"), config, default=[] + ) + ) + return [self.ConvertVSMacros(p, config=config) for p in includes] + + def GetComputedDefines(self, config): + """Returns the set of defines that are injected to the defines list based + on other VS settings.""" + config = self._TargetConfig(config) + defines = [] + if self._ConfigAttrib(["CharacterSet"], config) == "1": + defines.extend(("_UNICODE", "UNICODE")) + if self._ConfigAttrib(["CharacterSet"], config) == "2": + defines.append("_MBCS") + defines.extend( + self._Setting( + ("VCCLCompilerTool", "PreprocessorDefinitions"), config, default=[] + ) + ) + return defines + + def GetCompilerPdbName(self, config, expand_special): + """Get the pdb file name that should be used for compiler invocations, or + None if there's no explicit name specified.""" + config = self._TargetConfig(config) + pdbname = self._Setting(("VCCLCompilerTool", "ProgramDataBaseFileName"), config) + if pdbname: + pdbname = expand_special(self.ConvertVSMacros(pdbname)) + return pdbname + + def GetMapFileName(self, config, expand_special): + """Gets the explicitly overridden map file name for a target or returns None + if it's not set.""" + config = self._TargetConfig(config) + map_file = self._Setting(("VCLinkerTool", "MapFileName"), config) + if map_file: + map_file = expand_special(self.ConvertVSMacros(map_file, config=config)) + return map_file + + def GetOutputName(self, config, expand_special): + """Gets the explicitly overridden output name for a target or returns None + if it's not overridden.""" + config = self._TargetConfig(config) + type = self.spec["type"] + root = "VCLibrarianTool" if type == "static_library" else "VCLinkerTool" + # TODO(scottmg): Handle OutputDirectory without OutputFile. + output_file = self._Setting((root, "OutputFile"), config) + if output_file: + output_file = expand_special( + self.ConvertVSMacros(output_file, config=config) + ) + return output_file + + def GetPDBName(self, config, expand_special, default): + """Gets the explicitly overridden pdb name for a target or returns + default if it's not overridden, or if no pdb will be generated.""" + config = self._TargetConfig(config) + output_file = self._Setting(("VCLinkerTool", "ProgramDatabaseFile"), config) + generate_debug_info = self._Setting( + ("VCLinkerTool", "GenerateDebugInformation"), config + ) + if generate_debug_info == "true": + if output_file: + return expand_special(self.ConvertVSMacros(output_file, config=config)) + else: + return default + else: + return None + + def GetNoImportLibrary(self, config): + """If NoImportLibrary: true, ninja will not expect the output to include + an import library.""" + config = self._TargetConfig(config) + noimplib = self._Setting(("NoImportLibrary",), config) + return noimplib == "true" + + def GetAsmflags(self, config): + """Returns the flags that need to be added to ml invocations.""" + config = self._TargetConfig(config) + asmflags = [] + safeseh = self._Setting(("MASM", "UseSafeExceptionHandlers"), config) + if safeseh == "true": + asmflags.append("/safeseh") + return asmflags + + def GetCflags(self, config): + """Returns the flags that need to be added to .c and .cc compilations.""" + config = self._TargetConfig(config) + cflags = [] + cflags.extend(["/wd" + w for w in self.msvs_disabled_warnings[config]]) + cl = self._GetWrapper( + self, self.msvs_settings[config], "VCCLCompilerTool", append=cflags + ) + cl( + "Optimization", + map={"0": "d", "1": "1", "2": "2", "3": "x"}, + prefix="/O", + default="2", + ) + cl("InlineFunctionExpansion", prefix="/Ob") + cl("DisableSpecificWarnings", prefix="/wd") + cl("StringPooling", map={"true": "/GF"}) + cl("EnableFiberSafeOptimizations", map={"true": "/GT"}) + cl("OmitFramePointers", map={"false": "-", "true": ""}, prefix="/Oy") + cl("EnableIntrinsicFunctions", map={"false": "-", "true": ""}, prefix="/Oi") + cl("FavorSizeOrSpeed", map={"1": "t", "2": "s"}, prefix="/O") + cl( + "FloatingPointModel", + map={"0": "precise", "1": "strict", "2": "fast"}, + prefix="/fp:", + default="0", + ) + cl("CompileAsManaged", map={"false": "", "true": "/clr"}) + cl("WholeProgramOptimization", map={"true": "/GL"}) + cl("WarningLevel", prefix="/W") + cl("WarnAsError", map={"true": "/WX"}) + cl( + "CallingConvention", + map={"0": "d", "1": "r", "2": "z", "3": "v"}, + prefix="/G", + ) + cl("DebugInformationFormat", map={"1": "7", "3": "i", "4": "I"}, prefix="/Z") + cl("RuntimeTypeInfo", map={"true": "/GR", "false": "/GR-"}) + cl("EnableFunctionLevelLinking", map={"true": "/Gy", "false": "/Gy-"}) + cl("MinimalRebuild", map={"true": "/Gm"}) + cl("BufferSecurityCheck", map={"true": "/GS", "false": "/GS-"}) + cl("BasicRuntimeChecks", map={"1": "s", "2": "u", "3": "1"}, prefix="/RTC") + cl( + "RuntimeLibrary", + map={"0": "T", "1": "Td", "2": "D", "3": "Dd"}, + prefix="/M", + ) + cl("ExceptionHandling", map={"1": "sc", "2": "a"}, prefix="/EH") + cl("DefaultCharIsUnsigned", map={"true": "/J"}) + cl( + "TreatWChar_tAsBuiltInType", + map={"false": "-", "true": ""}, + prefix="/Zc:wchar_t", + ) + cl("EnablePREfast", map={"true": "/analyze"}) + cl("AdditionalOptions", prefix="") + cl( + "EnableEnhancedInstructionSet", + map={"1": "SSE", "2": "SSE2", "3": "AVX", "4": "IA32", "5": "AVX2"}, + prefix="/arch:", + ) + cflags.extend( + [ + "/FI" + f + for f in self._Setting( + ("VCCLCompilerTool", "ForcedIncludeFiles"), config, default=[] + ) + ] + ) + if float(self.vs_version.project_version) >= 12.0: + # New flag introduced in VS2013 (project version 12.0) Forces writes to + # the program database (PDB) to be serialized through MSPDBSRV.EXE. + # https://msdn.microsoft.com/en-us/library/dn502518.aspx + cflags.append("/FS") + # ninja handles parallelism by itself, don't have the compiler do it too. + cflags = [x for x in cflags if not x.startswith("/MP")] + return cflags + + def _GetPchFlags(self, config, extension): + """Get the flags to be added to the cflags for precompiled header support.""" + config = self._TargetConfig(config) + # The PCH is only built once by a particular source file. Usage of PCH must + # only be for the same language (i.e. C vs. C++), so only include the pch + # flags when the language matches. + if self.msvs_precompiled_header[config]: + source_ext = os.path.splitext(self.msvs_precompiled_source[config])[1] + if _LanguageMatchesForPch(source_ext, extension): + pch = self.msvs_precompiled_header[config] + pchbase = os.path.split(pch)[1] + return ["/Yu" + pch, "/FI" + pch, "/Fp${pchprefix}." + pchbase + ".pch"] + return [] + + def GetCflagsC(self, config): + """Returns the flags that need to be added to .c compilations.""" + config = self._TargetConfig(config) + return self._GetPchFlags(config, ".c") + + def GetCflagsCC(self, config): + """Returns the flags that need to be added to .cc compilations.""" + config = self._TargetConfig(config) + return ["/TP"] + self._GetPchFlags(config, ".cc") + + def _GetAdditionalLibraryDirectories(self, root, config, gyp_to_build_path): + """Get and normalize the list of paths in AdditionalLibraryDirectories + setting.""" + config = self._TargetConfig(config) + libpaths = self._Setting( + (root, "AdditionalLibraryDirectories"), config, default=[] + ) + libpaths = [ + os.path.normpath(gyp_to_build_path(self.ConvertVSMacros(p, config=config))) + for p in libpaths + ] + return ['/LIBPATH:"' + p + '"' for p in libpaths] + + def GetLibFlags(self, config, gyp_to_build_path): + """Returns the flags that need to be added to lib commands.""" + config = self._TargetConfig(config) + libflags = [] + lib = self._GetWrapper( + self, self.msvs_settings[config], "VCLibrarianTool", append=libflags + ) + libflags.extend( + self._GetAdditionalLibraryDirectories( + "VCLibrarianTool", config, gyp_to_build_path + ) + ) + lib("LinkTimeCodeGeneration", map={"true": "/LTCG"}) + lib( + "TargetMachine", + map={"1": "X86", "17": "X64", "3": "ARM"}, + prefix="/MACHINE:", + ) + lib("AdditionalOptions") + return libflags + + def GetDefFile(self, gyp_to_build_path): + """Returns the .def file from sources, if any. Otherwise returns None.""" + spec = self.spec + if spec["type"] in ("shared_library", "loadable_module", "executable"): + def_files = [ + s for s in spec.get("sources", []) if s.lower().endswith(".def") + ] + if len(def_files) == 1: + return gyp_to_build_path(def_files[0]) + elif len(def_files) > 1: + raise Exception("Multiple .def files") + return None + + def _GetDefFileAsLdflags(self, ldflags, gyp_to_build_path): + """.def files get implicitly converted to a ModuleDefinitionFile for the + linker in the VS generator. Emulate that behaviour here.""" + def_file = self.GetDefFile(gyp_to_build_path) + if def_file: + ldflags.append('/DEF:"%s"' % def_file) + + def GetPGDName(self, config, expand_special): + """Gets the explicitly overridden pgd name for a target or returns None + if it's not overridden.""" + config = self._TargetConfig(config) + output_file = self._Setting(("VCLinkerTool", "ProfileGuidedDatabase"), config) + if output_file: + output_file = expand_special( + self.ConvertVSMacros(output_file, config=config) + ) + return output_file + + def GetLdflags( + self, + config, + gyp_to_build_path, + expand_special, + manifest_base_name, + output_name, + is_executable, + build_dir, + ): + """Returns the flags that need to be added to link commands, and the + manifest files.""" + config = self._TargetConfig(config) + ldflags = [] + ld = self._GetWrapper( + self, self.msvs_settings[config], "VCLinkerTool", append=ldflags + ) + self._GetDefFileAsLdflags(ldflags, gyp_to_build_path) + ld("GenerateDebugInformation", map={"true": "/DEBUG"}) + # TODO: These 'map' values come from machineTypeOption enum, + # and does not have an official value for ARM64 in VS2017 (yet). + # It needs to verify the ARM64 value when machineTypeOption is updated. + ld( + "TargetMachine", + map={"1": "X86", "17": "X64", "3": "ARM", "18": "ARM64"}, + prefix="/MACHINE:", + ) + ldflags.extend( + self._GetAdditionalLibraryDirectories( + "VCLinkerTool", config, gyp_to_build_path + ) + ) + ld("DelayLoadDLLs", prefix="/DELAYLOAD:") + ld("TreatLinkerWarningAsErrors", prefix="/WX", map={"true": "", "false": ":NO"}) + out = self.GetOutputName(config, expand_special) + if out: + ldflags.append("/OUT:" + out) + pdb = self.GetPDBName(config, expand_special, output_name + ".pdb") + if pdb: + ldflags.append("/PDB:" + pdb) + pgd = self.GetPGDName(config, expand_special) + if pgd: + ldflags.append("/PGD:" + pgd) + map_file = self.GetMapFileName(config, expand_special) + ld("GenerateMapFile", map={"true": "/MAP:" + map_file if map_file else "/MAP"}) + ld("MapExports", map={"true": "/MAPINFO:EXPORTS"}) + ld("AdditionalOptions", prefix="") + + minimum_required_version = self._Setting( + ("VCLinkerTool", "MinimumRequiredVersion"), config, default="" + ) + if minimum_required_version: + minimum_required_version = "," + minimum_required_version + ld( + "SubSystem", + map={ + "1": "CONSOLE%s" % minimum_required_version, + "2": "WINDOWS%s" % minimum_required_version, + }, + prefix="/SUBSYSTEM:", + ) + + stack_reserve_size = self._Setting( + ("VCLinkerTool", "StackReserveSize"), config, default="" + ) + if stack_reserve_size: + stack_commit_size = self._Setting( + ("VCLinkerTool", "StackCommitSize"), config, default="" + ) + if stack_commit_size: + stack_commit_size = "," + stack_commit_size + ldflags.append(f"/STACK:{stack_reserve_size}{stack_commit_size}") + + ld("TerminalServerAware", map={"1": ":NO", "2": ""}, prefix="/TSAWARE") + ld("LinkIncremental", map={"1": ":NO", "2": ""}, prefix="/INCREMENTAL") + ld("BaseAddress", prefix="/BASE:") + ld("FixedBaseAddress", map={"1": ":NO", "2": ""}, prefix="/FIXED") + ld("RandomizedBaseAddress", map={"1": ":NO", "2": ""}, prefix="/DYNAMICBASE") + ld("DataExecutionPrevention", map={"1": ":NO", "2": ""}, prefix="/NXCOMPAT") + ld("OptimizeReferences", map={"1": "NOREF", "2": "REF"}, prefix="/OPT:") + ld("ForceSymbolReferences", prefix="/INCLUDE:") + ld("EnableCOMDATFolding", map={"1": "NOICF", "2": "ICF"}, prefix="/OPT:") + ld( + "LinkTimeCodeGeneration", + map={"1": "", "2": ":PGINSTRUMENT", "3": ":PGOPTIMIZE", "4": ":PGUPDATE"}, + prefix="/LTCG", + ) + ld("IgnoreDefaultLibraryNames", prefix="/NODEFAULTLIB:") + ld("ResourceOnlyDLL", map={"true": "/NOENTRY"}) + ld("EntryPointSymbol", prefix="/ENTRY:") + ld("Profile", map={"true": "/PROFILE"}) + ld("LargeAddressAware", map={"1": ":NO", "2": ""}, prefix="/LARGEADDRESSAWARE") + # TODO(scottmg): This should sort of be somewhere else (not really a flag). + ld("AdditionalDependencies", prefix="") + + if self.GetArch(config) == "x86": + safeseh_default = "true" + else: + safeseh_default = None + ld( + "ImageHasSafeExceptionHandlers", + map={"false": ":NO", "true": ""}, + prefix="/SAFESEH", + default=safeseh_default, + ) + + # If the base address is not specifically controlled, DYNAMICBASE should + # be on by default. + if not any("DYNAMICBASE" in flag or flag == "/FIXED" for flag in ldflags): + ldflags.append("/DYNAMICBASE") + + # If the NXCOMPAT flag has not been specified, default to on. Despite the + # documentation that says this only defaults to on when the subsystem is + # Vista or greater (which applies to the linker), the IDE defaults it on + # unless it's explicitly off. + if not any("NXCOMPAT" in flag for flag in ldflags): + ldflags.append("/NXCOMPAT") + + have_def_file = any(flag.startswith("/DEF:") for flag in ldflags) + ( + manifest_flags, + intermediate_manifest, + manifest_files, + ) = self._GetLdManifestFlags( + config, + manifest_base_name, + gyp_to_build_path, + is_executable and not have_def_file, + build_dir, + ) + ldflags.extend(manifest_flags) + return ldflags, intermediate_manifest, manifest_files + + def _GetLdManifestFlags( + self, config, name, gyp_to_build_path, allow_isolation, build_dir + ): + """Returns a 3-tuple: + - the set of flags that need to be added to the link to generate + a default manifest + - the intermediate manifest that the linker will generate that should be + used to assert it doesn't add anything to the merged one. + - the list of all the manifest files to be merged by the manifest tool and + included into the link.""" + generate_manifest = self._Setting( + ("VCLinkerTool", "GenerateManifest"), config, default="true" + ) + if generate_manifest != "true": + # This means not only that the linker should not generate the intermediate + # manifest but also that the manifest tool should do nothing even when + # additional manifests are specified. + return ["/MANIFEST:NO"], [], [] + + output_name = name + ".intermediate.manifest" + flags = [ + "/MANIFEST", + "/ManifestFile:" + output_name, + ] + + # Instead of using the MANIFESTUAC flags, we generate a .manifest to + # include into the list of manifests. This allows us to avoid the need to + # do two passes during linking. The /MANIFEST flag and /ManifestFile are + # still used, and the intermediate manifest is used to assert that the + # final manifest we get from merging all the additional manifest files + # (plus the one we generate here) isn't modified by merging the + # intermediate into it. + + # Always NO, because we generate a manifest file that has what we want. + flags.append("/MANIFESTUAC:NO") + + config = self._TargetConfig(config) + enable_uac = self._Setting( + ("VCLinkerTool", "EnableUAC"), config, default="true" + ) + manifest_files = [] + generated_manifest_outer = ( + "" + "" + "%s" + ) + if enable_uac == "true": + execution_level = self._Setting( + ("VCLinkerTool", "UACExecutionLevel"), config, default="0" + ) + execution_level_map = { + "0": "asInvoker", + "1": "highestAvailable", + "2": "requireAdministrator", + } + + ui_access = self._Setting( + ("VCLinkerTool", "UACUIAccess"), config, default="false" + ) + + inner = """ + + + + + + +""".format( + execution_level_map[execution_level], + ui_access, + ) + else: + inner = "" + + generated_manifest_contents = generated_manifest_outer % inner + generated_name = name + ".generated.manifest" + # Need to join with the build_dir here as we're writing it during + # generation time, but we return the un-joined version because the build + # will occur in that directory. We only write the file if the contents + # have changed so that simply regenerating the project files doesn't + # cause a relink. + build_dir_generated_name = os.path.join(build_dir, generated_name) + gyp.common.EnsureDirExists(build_dir_generated_name) + f = gyp.common.WriteOnDiff(build_dir_generated_name) + f.write(generated_manifest_contents) + f.close() + manifest_files = [generated_name] + + if allow_isolation: + flags.append("/ALLOWISOLATION") + + manifest_files += self._GetAdditionalManifestFiles(config, gyp_to_build_path) + return flags, output_name, manifest_files + + def _GetAdditionalManifestFiles(self, config, gyp_to_build_path): + """Gets additional manifest files that are added to the default one + generated by the linker.""" + files = self._Setting( + ("VCManifestTool", "AdditionalManifestFiles"), config, default=[] + ) + if isinstance(files, str): + files = files.split(";") + return [ + os.path.normpath(gyp_to_build_path(self.ConvertVSMacros(f, config=config))) + for f in files + ] + + def IsUseLibraryDependencyInputs(self, config): + """Returns whether the target should be linked via Use Library Dependency + Inputs (using component .objs of a given .lib).""" + config = self._TargetConfig(config) + uldi = self._Setting(("VCLinkerTool", "UseLibraryDependencyInputs"), config) + return uldi == "true" + + def IsEmbedManifest(self, config): + """Returns whether manifest should be linked into binary.""" + config = self._TargetConfig(config) + embed = self._Setting( + ("VCManifestTool", "EmbedManifest"), config, default="true" + ) + return embed == "true" + + def IsLinkIncremental(self, config): + """Returns whether the target should be linked incrementally.""" + config = self._TargetConfig(config) + link_inc = self._Setting(("VCLinkerTool", "LinkIncremental"), config) + return link_inc != "1" + + def GetRcflags(self, config, gyp_to_ninja_path): + """Returns the flags that need to be added to invocations of the resource + compiler.""" + config = self._TargetConfig(config) + rcflags = [] + rc = self._GetWrapper( + self, self.msvs_settings[config], "VCResourceCompilerTool", append=rcflags + ) + rc("AdditionalIncludeDirectories", map=gyp_to_ninja_path, prefix="/I") + rcflags.append("/I" + gyp_to_ninja_path(".")) + rc("PreprocessorDefinitions", prefix="/d") + # /l arg must be in hex without leading '0x' + rc("Culture", prefix="/l", map=lambda x: hex(int(x))[2:]) + return rcflags + + def BuildCygwinBashCommandLine(self, args, path_to_base): + """Build a command line that runs args via cygwin bash. We assume that all + incoming paths are in Windows normpath'd form, so they need to be + converted to posix style for the part of the command line that's passed to + bash. We also have to do some Visual Studio macro emulation here because + various rules use magic VS names for things. Also note that rules that + contain ninja variables cannot be fixed here (for example ${source}), so + the outer generator needs to make sure that the paths that are written out + are in posix style, if the command line will be used here.""" + cygwin_dir = os.path.normpath( + os.path.join(path_to_base, self.msvs_cygwin_dirs[0]) + ) + cd = ("cd %s" % path_to_base).replace("\\", "/") + args = [a.replace("\\", "/").replace('"', '\\"') for a in args] + args = ["'%s'" % a.replace("'", "'\\''") for a in args] + bash_cmd = " ".join(args) + cmd = ( + 'call "%s\\setup_env.bat" && set CYGWIN=nontsec && ' % cygwin_dir + + f'bash -c "{cd} ; {bash_cmd}"' + ) + return cmd + + RuleShellFlags = collections.namedtuple("RuleShellFlags", ["cygwin", "quote"]) + + def GetRuleShellFlags(self, rule): + """Return RuleShellFlags about how the given rule should be run. This + includes whether it should run under cygwin (msvs_cygwin_shell), and + whether the commands should be quoted (msvs_quote_cmd).""" + # If the variable is unset, or set to 1 we use cygwin + cygwin = int(rule.get("msvs_cygwin_shell", + self.spec.get("msvs_cygwin_shell", 1))) != 0 + # Default to quoting. There's only a few special instances where the + # target command uses non-standard command line parsing and handle quotes + # and quote escaping differently. + quote_cmd = int(rule.get("msvs_quote_cmd", 1)) + assert quote_cmd != 0 or cygwin != 1, \ + "msvs_quote_cmd=0 only applicable for msvs_cygwin_shell=0" + return MsvsSettings.RuleShellFlags(cygwin, quote_cmd) + + def _HasExplicitRuleForExtension(self, spec, extension): + """Determine if there's an explicit rule for a particular extension.""" + for rule in spec.get("rules", []): + if rule["extension"] == extension: + return True + return False + + def _HasExplicitIdlActions(self, spec): + """Determine if an action should not run midl for .idl files.""" + return any( + [action.get("explicit_idl_action", 0) for action in spec.get("actions", [])] + ) + + def HasExplicitIdlRulesOrActions(self, spec): + """Determine if there's an explicit rule or action for idl files. When + there isn't we need to generate implicit rules to build MIDL .idl files.""" + return self._HasExplicitRuleForExtension( + spec, "idl" + ) or self._HasExplicitIdlActions(spec) + + def HasExplicitAsmRules(self, spec): + """Determine if there's an explicit rule for asm files. When there isn't we + need to generate implicit rules to assemble .asm files.""" + return self._HasExplicitRuleForExtension(spec, "asm") + + def GetIdlBuildData(self, source, config): + """Determine the implicit outputs for an idl file. Returns output + directory, outputs, and variables and flags that are required.""" + config = self._TargetConfig(config) + midl_get = self._GetWrapper(self, self.msvs_settings[config], "VCMIDLTool") + + def midl(name, default=None): + return self.ConvertVSMacros(midl_get(name, default=default), config=config) + + tlb = midl("TypeLibraryName", default="${root}.tlb") + header = midl("HeaderFileName", default="${root}.h") + dlldata = midl("DLLDataFileName", default="dlldata.c") + iid = midl("InterfaceIdentifierFileName", default="${root}_i.c") + proxy = midl("ProxyFileName", default="${root}_p.c") + # Note that .tlb is not included in the outputs as it is not always + # generated depending on the content of the input idl file. + outdir = midl("OutputDirectory", default="") + output = [header, dlldata, iid, proxy] + variables = [ + ("tlb", tlb), + ("h", header), + ("dlldata", dlldata), + ("iid", iid), + ("proxy", proxy), + ] + # TODO(scottmg): Are there configuration settings to set these flags? + target_platform = self.GetArch(config) + if target_platform == "x86": + target_platform = "win32" + flags = ["/char", "signed", "/env", target_platform, "/Oicf"] + return outdir, output, variables, flags + + +def _LanguageMatchesForPch(source_ext, pch_source_ext): + c_exts = (".c",) + cc_exts = (".cc", ".cxx", ".cpp") + return (source_ext in c_exts and pch_source_ext in c_exts) or ( + source_ext in cc_exts and pch_source_ext in cc_exts + ) + + +class PrecompiledHeader: + """Helper to generate dependencies and build rules to handle generation of + precompiled headers. Interface matches the GCH handler in xcode_emulation.py. + """ + + def __init__( + self, settings, config, gyp_to_build_path, gyp_to_unique_output, obj_ext + ): + self.settings = settings + self.config = config + pch_source = self.settings.msvs_precompiled_source[self.config] + self.pch_source = gyp_to_build_path(pch_source) + filename, _ = os.path.splitext(pch_source) + self.output_obj = gyp_to_unique_output(filename + obj_ext).lower() + + def _PchHeader(self): + """Get the header that will appear in an #include line for all source + files.""" + return self.settings.msvs_precompiled_header[self.config] + + def GetObjDependencies(self, sources, objs, arch): + """Given a list of sources files and the corresponding object files, + returns a list of the pch files that should be depended upon. The + additional wrapping in the return value is for interface compatibility + with make.py on Mac, and xcode_emulation.py.""" + assert arch is None + if not self._PchHeader(): + return [] + pch_ext = os.path.splitext(self.pch_source)[1] + for source in sources: + if _LanguageMatchesForPch(os.path.splitext(source)[1], pch_ext): + return [(None, None, self.output_obj)] + return [] + + def GetPchBuildCommands(self, arch): + """Not used on Windows as there are no additional build steps required + (instead, existing steps are modified in GetFlagsModifications below).""" + return [] + + def GetFlagsModifications( + self, input, output, implicit, command, cflags_c, cflags_cc, expand_special + ): + """Get the modified cflags and implicit dependencies that should be used + for the pch compilation step.""" + if input == self.pch_source: + pch_output = ["/Yc" + self._PchHeader()] + if command == "cxx": + return ( + [("cflags_cc", map(expand_special, cflags_cc + pch_output))], + self.output_obj, + [], + ) + elif command == "cc": + return ( + [("cflags_c", map(expand_special, cflags_c + pch_output))], + self.output_obj, + [], + ) + return [], output, implicit + + +vs_version = None + + +def GetVSVersion(generator_flags): + global vs_version + if not vs_version: + vs_version = gyp.MSVSVersion.SelectVisualStudioVersion( + generator_flags.get("msvs_version", "auto"), allow_fallback=False + ) + return vs_version + + +def _GetVsvarsSetupArgs(generator_flags, arch): + vs = GetVSVersion(generator_flags) + return vs.SetupScript() + + +def ExpandMacros(string, expansions): + """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv + for the canonical way to retrieve a suitable dict.""" + if "$" in string: + for old, new in expansions.items(): + assert "$(" not in new, new + string = string.replace(old, new) + return string + + +def _ExtractImportantEnvironment(output_of_set): + """Extracts environment variables required for the toolchain to run from + a textual dump output by the cmd.exe 'set' command.""" + envvars_to_save = ( + "goma_.*", # TODO(scottmg): This is ugly, but needed for goma. + "include", + "lib", + "libpath", + "path", + "pathext", + "systemroot", + "temp", + "tmp", + ) + env = {} + # This occasionally happens and leads to misleading SYSTEMROOT error messages + # if not caught here. + if output_of_set.count("=") == 0: + raise Exception("Invalid output_of_set. Value is:\n%s" % output_of_set) + for line in output_of_set.splitlines(): + for envvar in envvars_to_save: + if re.match(envvar + "=", line.lower()): + var, setting = line.split("=", 1) + if envvar == "path": + # Our own rules (for running gyp-win-tool) and other actions in + # Chromium rely on python being in the path. Add the path to this + # python here so that if it's not in the path when ninja is run + # later, python will still be found. + setting = os.path.dirname(sys.executable) + os.pathsep + setting + env[var.upper()] = setting + break + for required in ("SYSTEMROOT", "TEMP", "TMP"): + if required not in env: + raise Exception( + 'Environment variable "%s" ' + "required to be set to valid path" % required + ) + return env + + +def _FormatAsEnvironmentBlock(envvar_dict): + """Format as an 'environment block' directly suitable for CreateProcess. + Briefly this is a list of key=value\0, terminated by an additional \0. See + CreateProcess documentation for more details.""" + block = "" + nul = "\0" + for key, value in envvar_dict.items(): + block += key + "=" + value + nul + block += nul + return block + + +def _ExtractCLPath(output_of_where): + """Gets the path to cl.exe based on the output of calling the environment + setup batch file, followed by the equivalent of `where`.""" + # Take the first line, as that's the first found in the PATH. + for line in output_of_where.strip().splitlines(): + if line.startswith("LOC:"): + return line[len("LOC:") :].strip() + + +def GenerateEnvironmentFiles( + toplevel_build_dir, generator_flags, system_includes, open_out +): + """It's not sufficient to have the absolute path to the compiler, linker, + etc. on Windows, as those tools rely on .dlls being in the PATH. We also + need to support both x86 and x64 compilers within the same build (to support + msvs_target_platform hackery). Different architectures require a different + compiler binary, and different supporting environment variables (INCLUDE, + LIB, LIBPATH). So, we extract the environment here, wrap all invocations + of compiler tools (cl, link, lib, rc, midl, etc.) via win_tool.py which + sets up the environment, and then we do not prefix the compiler with + an absolute path, instead preferring something like "cl.exe" in the rule + which will then run whichever the environment setup has put in the path. + When the following procedure to generate environment files does not + meet your requirement (e.g. for custom toolchains), you can pass + "-G ninja_use_custom_environment_files" to the gyp to suppress file + generation and use custom environment files prepared by yourself.""" + archs = ("x86", "x64") + if generator_flags.get("ninja_use_custom_environment_files", 0): + cl_paths = {} + for arch in archs: + cl_paths[arch] = "cl.exe" + return cl_paths + vs = GetVSVersion(generator_flags) + cl_paths = {} + for arch in archs: + # Extract environment variables for subprocesses. + args = vs.SetupScript(arch) + args.extend(("&&", "set")) + popen = subprocess.Popen( + args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + variables = popen.communicate()[0].decode("utf-8") + if popen.returncode != 0: + raise Exception('"%s" failed with error %d' % (args, popen.returncode)) + env = _ExtractImportantEnvironment(variables) + + # Inject system includes from gyp files into INCLUDE. + if system_includes: + system_includes = system_includes | OrderedSet( + env.get("INCLUDE", "").split(";") + ) + env["INCLUDE"] = ";".join(system_includes) + + env_block = _FormatAsEnvironmentBlock(env) + f = open_out(os.path.join(toplevel_build_dir, "environment." + arch), "w") + f.write(env_block) + f.close() + + # Find cl.exe location for this architecture. + args = vs.SetupScript(arch) + args.extend( + ("&&", "for", "%i", "in", "(cl.exe)", "do", "@echo", "LOC:%~$PATH:i") + ) + popen = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE) + output = popen.communicate()[0].decode("utf-8") + cl_paths[arch] = _ExtractCLPath(output) + return cl_paths + + +def VerifyMissingSources(sources, build_dir, generator_flags, gyp_to_ninja): + """Emulate behavior of msvs_error_on_missing_sources present in the msvs + generator: Check that all regular source files, i.e. not created at run time, + exist on disk. Missing files cause needless recompilation when building via + VS, and we want this check to match for people/bots that build using ninja, + so they're not surprised when the VS build fails.""" + if int(generator_flags.get("msvs_error_on_missing_sources", 0)): + no_specials = filter(lambda x: "$" not in x, sources) + relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials] + missing = [x for x in relative if not os.path.exists(x)] + if missing: + # They'll look like out\Release\..\..\stuff\things.cc, so normalize the + # path for a slightly less crazy looking output. + cleaned_up = [os.path.normpath(x) for x in missing] + raise Exception("Missing input files:\n%s" % "\n".join(cleaned_up)) + + +# Sets some values in default_variables, which are required for many +# generators, run on Windows. +def CalculateCommonVariables(default_variables, params): + generator_flags = params.get("generator_flags", {}) + + # Set a variable so conditions can be based on msvs_version. + msvs_version = gyp.msvs_emulation.GetVSVersion(generator_flags) + default_variables["MSVS_VERSION"] = msvs_version.ShortName() + + # To determine processor word size on Windows, in addition to checking + # PROCESSOR_ARCHITECTURE (which reflects the word size of the current + # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which + # contains the actual word size of the system when running thru WOW64). + if "64" in os.environ.get("PROCESSOR_ARCHITECTURE", "") or "64" in os.environ.get( + "PROCESSOR_ARCHITEW6432", "" + ): + default_variables["MSVS_OS_BITS"] = 64 + else: + default_variables["MSVS_OS_BITS"] = 32 diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py new file mode 100644 index 0000000000000..0e3e86c7430d0 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py @@ -0,0 +1,174 @@ +# This file comes from +# https://github.com/martine/ninja/blob/master/misc/ninja_syntax.py +# Do not edit! Edit the upstream one instead. + +"""Python module for generating .ninja files. + +Note that this is emphatically not a required piece of Ninja; it's +just a helpful utility for build-file-generation systems that already +use Python. +""" + +import textwrap + + +def escape_path(word): + return word.replace("$ ", "$$ ").replace(" ", "$ ").replace(":", "$:") + + +class Writer: + def __init__(self, output, width=78): + self.output = output + self.width = width + + def newline(self): + self.output.write("\n") + + def comment(self, text): + for line in textwrap.wrap(text, self.width - 2): + self.output.write("# " + line + "\n") + + def variable(self, key, value, indent=0): + if value is None: + return + if isinstance(value, list): + value = " ".join(filter(None, value)) # Filter out empty strings. + self._line(f"{key} = {value}", indent) + + def pool(self, name, depth): + self._line("pool %s" % name) + self.variable("depth", depth, indent=1) + + def rule( + self, + name, + command, + description=None, + depfile=None, + generator=False, + pool=None, + restat=False, + rspfile=None, + rspfile_content=None, + deps=None, + ): + self._line("rule %s" % name) + self.variable("command", command, indent=1) + if description: + self.variable("description", description, indent=1) + if depfile: + self.variable("depfile", depfile, indent=1) + if generator: + self.variable("generator", "1", indent=1) + if pool: + self.variable("pool", pool, indent=1) + if restat: + self.variable("restat", "1", indent=1) + if rspfile: + self.variable("rspfile", rspfile, indent=1) + if rspfile_content: + self.variable("rspfile_content", rspfile_content, indent=1) + if deps: + self.variable("deps", deps, indent=1) + + def build( + self, outputs, rule, inputs=None, implicit=None, order_only=None, variables=None + ): + outputs = self._as_list(outputs) + all_inputs = self._as_list(inputs)[:] + out_outputs = list(map(escape_path, outputs)) + all_inputs = list(map(escape_path, all_inputs)) + + if implicit: + implicit = map(escape_path, self._as_list(implicit)) + all_inputs.append("|") + all_inputs.extend(implicit) + if order_only: + order_only = map(escape_path, self._as_list(order_only)) + all_inputs.append("||") + all_inputs.extend(order_only) + + self._line( + "build {}: {}".format(" ".join(out_outputs), " ".join([rule] + all_inputs)) + ) + + if variables: + if isinstance(variables, dict): + iterator = iter(variables.items()) + else: + iterator = iter(variables) + + for key, val in iterator: + self.variable(key, val, indent=1) + + return outputs + + def include(self, path): + self._line("include %s" % path) + + def subninja(self, path): + self._line("subninja %s" % path) + + def default(self, paths): + self._line("default %s" % " ".join(self._as_list(paths))) + + def _count_dollars_before_index(self, s, i): + """Returns the number of '$' characters right in front of s[i].""" + dollar_count = 0 + dollar_index = i - 1 + while dollar_index > 0 and s[dollar_index] == "$": + dollar_count += 1 + dollar_index -= 1 + return dollar_count + + def _line(self, text, indent=0): + """Write 'text' word-wrapped at self.width characters.""" + leading_space = " " * indent + while len(leading_space) + len(text) > self.width: + # The text is too wide; wrap if possible. + + # Find the rightmost space that would obey our width constraint and + # that's not an escaped space. + available_space = self.width - len(leading_space) - len(" $") + space = available_space + while True: + space = text.rfind(" ", 0, space) + if space < 0 or self._count_dollars_before_index(text, space) % 2 == 0: + break + + if space < 0: + # No such space; just use the first unescaped space we can find. + space = available_space - 1 + while True: + space = text.find(" ", space + 1) + if ( + space < 0 + or self._count_dollars_before_index(text, space) % 2 == 0 + ): + break + if space < 0: + # Give up on breaking. + break + + self.output.write(leading_space + text[0:space] + " $\n") + text = text[space + 1 :] + + # Subsequent lines are continuations, so indent them. + leading_space = " " * (indent + 2) + + self.output.write(leading_space + text + "\n") + + def _as_list(self, input): + if input is None: + return [] + if isinstance(input, list): + return input + return [input] + + +def escape(string): + """Escape a string such that it can be embedded into a Ninja file without + further interpretation.""" + assert "\n" not in string, "Ninja syntax does not allow newlines" + # We only have one special metacharacter: '$'. + return string.replace("$", "$$") diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py new file mode 100644 index 0000000000000..729cec0636273 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py @@ -0,0 +1,61 @@ +# Copyright 2014 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""A clone of the default copy.deepcopy that doesn't handle cyclic +structures or complex types except for dicts and lists. This is +because gyp copies so large structure that small copy overhead ends up +taking seconds in a project the size of Chromium.""" + + +class Error(Exception): + pass + + +__all__ = ["Error", "deepcopy"] + + +def deepcopy(x): + """Deep copy operation on gyp objects such as strings, ints, dicts + and lists. More than twice as fast as copy.deepcopy but much less + generic.""" + + try: + return _deepcopy_dispatch[type(x)](x) + except KeyError: + raise Error( + "Unsupported type %s for deepcopy. Use copy.deepcopy " + + "or expand simple_copy support." % type(x) + ) + + +_deepcopy_dispatch = d = {} + + +def _deepcopy_atomic(x): + return x + + +types = bool, float, int, str, type, type(None) + +for x in types: + d[x] = _deepcopy_atomic + + +def _deepcopy_list(x): + return [deepcopy(a) for a in x] + + +d[list] = _deepcopy_list + + +def _deepcopy_dict(x): + y = {} + for key, value in x.items(): + y[deepcopy(key)] = deepcopy(value) + return y + + +d[dict] = _deepcopy_dict + +del d diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py new file mode 100755 index 0000000000000..638eee4002941 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py @@ -0,0 +1,374 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Utility functions for Windows builds. + +These functions are executed via gyp-win-tool when using the ninja generator. +""" + + +import os +import re +import shutil +import subprocess +import stat +import string +import sys + +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) + +# A regex matching an argument corresponding to the output filename passed to +# link.exe. +_LINK_EXE_OUT_ARG = re.compile("/OUT:(?P.+)$", re.IGNORECASE) + + +def main(args): + executor = WinTool() + exit_code = executor.Dispatch(args) + if exit_code is not None: + sys.exit(exit_code) + + +class WinTool: + """This class performs all the Windows tooling steps. The methods can either + be executed directly, or dispatched from an argument list.""" + + def _UseSeparateMspdbsrv(self, env, args): + """Allows to use a unique instance of mspdbsrv.exe per linker instead of a + shared one.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + if args[0] != "link.exe": + return + + # Use the output filename passed to the linker to generate an endpoint name + # for mspdbsrv.exe. + endpoint_name = None + for arg in args: + m = _LINK_EXE_OUT_ARG.match(arg) + if m: + endpoint_name = re.sub( + r"\W+", "", "%s_%d" % (m.group("out"), os.getpid()) + ) + break + + if endpoint_name is None: + return + + # Adds the appropriate environment variable. This will be read by link.exe + # to know which instance of mspdbsrv.exe it should connect to (if it's + # not set then the default endpoint is used). + env["_MSPDBSRV_ENDPOINT_"] = endpoint_name + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + return getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like recursive-mirror to RecursiveMirror.""" + return name_string.title().replace("-", "") + + def _GetEnv(self, arch): + """Gets the saved environment from a file for a given architecture.""" + # The environment is saved as an "environment block" (see CreateProcess + # and msvs_emulation for details). We convert to a dict here. + # Drop last 2 NULs, one for list terminator, one for trailing vs. separator. + pairs = open(arch).read()[:-2].split("\0") + kvs = [item.split("=", 1) for item in pairs] + return dict(kvs) + + def ExecStamp(self, path): + """Simple stamp command.""" + open(path, "w").close() + + def ExecRecursiveMirror(self, source, dest): + """Emulation of rm -rf out && cp -af in out.""" + if os.path.exists(dest): + if os.path.isdir(dest): + + def _on_error(fn, path, excinfo): + # The operation failed, possibly because the file is set to + # read-only. If that's why, make it writable and try the op again. + if not os.access(path, os.W_OK): + os.chmod(path, stat.S_IWRITE) + fn(path) + + shutil.rmtree(dest, onerror=_on_error) + else: + if not os.access(dest, os.W_OK): + # Attempt to make the file writable before deleting it. + os.chmod(dest, stat.S_IWRITE) + os.unlink(dest) + + if os.path.isdir(source): + shutil.copytree(source, dest) + else: + shutil.copy2(source, dest) + + def ExecLinkWrapper(self, arch, use_separate_mspdbsrv, *args): + """Filter diagnostic output from link that looks like: + ' Creating library ui.dll.lib and object ui.dll.exp' + This happens when there are exports from the dll or exe. + """ + env = self._GetEnv(arch) + if use_separate_mspdbsrv == "True": + self._UseSeparateMspdbsrv(env, args) + if sys.platform == "win32": + args = list(args) # *args is a tuple by default, which is read-only. + args[0] = args[0].replace("/", "\\") + # https://docs.python.org/2/library/subprocess.html: + # "On Unix with shell=True [...] if args is a sequence, the first item + # specifies the command string, and any additional items will be treated as + # additional arguments to the shell itself. That is to say, Popen does the + # equivalent of: + # Popen(['/bin/sh', '-c', args[0], args[1], ...])" + # For that reason, since going through the shell doesn't seem necessary on + # non-Windows don't do that there. + link = subprocess.Popen( + args, + shell=sys.platform == "win32", + env=env, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + ) + out = link.communicate()[0].decode("utf-8") + for line in out.splitlines(): + if ( + not line.startswith(" Creating library ") + and not line.startswith("Generating code") + and not line.startswith("Finished generating code") + ): + print(line) + return link.returncode + + def ExecLinkWithManifests( + self, + arch, + embed_manifest, + out, + ldcmd, + resname, + mt, + rc, + intermediate_manifest, + *manifests + ): + """A wrapper for handling creating a manifest resource and then executing + a link command.""" + # The 'normal' way to do manifests is to have link generate a manifest + # based on gathering dependencies from the object files, then merge that + # manifest with other manifests supplied as sources, convert the merged + # manifest to a resource, and then *relink*, including the compiled + # version of the manifest resource. This breaks incremental linking, and + # is generally overly complicated. Instead, we merge all the manifests + # provided (along with one that includes what would normally be in the + # linker-generated one, see msvs_emulation.py), and include that into the + # first and only link. We still tell link to generate a manifest, but we + # only use that to assert that our simpler process did not miss anything. + variables = { + "python": sys.executable, + "arch": arch, + "out": out, + "ldcmd": ldcmd, + "resname": resname, + "mt": mt, + "rc": rc, + "intermediate_manifest": intermediate_manifest, + "manifests": " ".join(manifests), + } + add_to_ld = "" + if manifests: + subprocess.check_call( + "%(python)s gyp-win-tool manifest-wrapper %(arch)s %(mt)s -nologo " + "-manifest %(manifests)s -out:%(out)s.manifest" % variables + ) + if embed_manifest == "True": + subprocess.check_call( + "%(python)s gyp-win-tool manifest-to-rc %(arch)s %(out)s.manifest" + " %(out)s.manifest.rc %(resname)s" % variables + ) + subprocess.check_call( + "%(python)s gyp-win-tool rc-wrapper %(arch)s %(rc)s " + "%(out)s.manifest.rc" % variables + ) + add_to_ld = " %(out)s.manifest.res" % variables + subprocess.check_call(ldcmd + add_to_ld) + + # Run mt.exe on the theoretically complete manifest we generated, merging + # it with the one the linker generated to confirm that the linker + # generated one does not add anything. This is strictly unnecessary for + # correctness, it's only to verify that e.g. /MANIFESTDEPENDENCY was not + # used in a #pragma comment. + if manifests: + # Merge the intermediate one with ours to .assert.manifest, then check + # that .assert.manifest is identical to ours. + subprocess.check_call( + "%(python)s gyp-win-tool manifest-wrapper %(arch)s %(mt)s -nologo " + "-manifest %(out)s.manifest %(intermediate_manifest)s " + "-out:%(out)s.assert.manifest" % variables + ) + assert_manifest = "%(out)s.assert.manifest" % variables + our_manifest = "%(out)s.manifest" % variables + # Load and normalize the manifests. mt.exe sometimes removes whitespace, + # and sometimes doesn't unfortunately. + with open(our_manifest) as our_f: + with open(assert_manifest) as assert_f: + translator = str.maketrans('', '', string.whitespace) + our_data = our_f.read().translate(translator) + assert_data = assert_f.read().translate(translator) + if our_data != assert_data: + os.unlink(out) + + def dump(filename): + print(filename, file=sys.stderr) + print("-----", file=sys.stderr) + with open(filename) as f: + print(f.read(), file=sys.stderr) + print("-----", file=sys.stderr) + + dump(intermediate_manifest) + dump(our_manifest) + dump(assert_manifest) + sys.stderr.write( + 'Linker generated manifest "%s" added to final manifest "%s" ' + '(result in "%s"). ' + "Were /MANIFEST switches used in #pragma statements? " + % (intermediate_manifest, our_manifest, assert_manifest) + ) + return 1 + + def ExecManifestWrapper(self, arch, *args): + """Run manifest tool with environment set. Strip out undesirable warning + (some XML blocks are recognized by the OS loader, but not the manifest + tool).""" + env = self._GetEnv(arch) + popen = subprocess.Popen( + args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + out = popen.communicate()[0].decode("utf-8") + for line in out.splitlines(): + if line and "manifest authoring warning 81010002" not in line: + print(line) + return popen.returncode + + def ExecManifestToRc(self, arch, *args): + """Creates a resource file pointing a SxS assembly manifest. + |args| is tuple containing path to resource file, path to manifest file + and resource name which can be "1" (for executables) or "2" (for DLLs).""" + manifest_path, resource_path, resource_name = args + with open(resource_path, "w") as output: + output.write( + '#include \n%s RT_MANIFEST "%s"' + % (resource_name, os.path.abspath(manifest_path).replace("\\", "/")) + ) + + def ExecMidlWrapper(self, arch, outdir, tlb, h, dlldata, iid, proxy, idl, *flags): + """Filter noisy filenames output from MIDL compile step that isn't + quietable via command line flags. + """ + args = ( + ["midl", "/nologo"] + + list(flags) + + [ + "/out", + outdir, + "/tlb", + tlb, + "/h", + h, + "/dlldata", + dlldata, + "/iid", + iid, + "/proxy", + proxy, + idl, + ] + ) + env = self._GetEnv(arch) + popen = subprocess.Popen( + args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + out = popen.communicate()[0].decode("utf-8") + # Filter junk out of stdout, and write filtered versions. Output we want + # to filter is pairs of lines that look like this: + # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl + # objidl.idl + lines = out.splitlines() + prefixes = ("Processing ", "64 bit Processing ") + processing = {os.path.basename(x) for x in lines if x.startswith(prefixes)} + for line in lines: + if not line.startswith(prefixes) and line not in processing: + print(line) + return popen.returncode + + def ExecAsmWrapper(self, arch, *args): + """Filter logo banner from invocations of asm.exe.""" + env = self._GetEnv(arch) + popen = subprocess.Popen( + args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + out = popen.communicate()[0].decode("utf-8") + for line in out.splitlines(): + if ( + not line.startswith("Copyright (C) Microsoft Corporation") + and not line.startswith("Microsoft (R) Macro Assembler") + and not line.startswith(" Assembling: ") + and line + ): + print(line) + return popen.returncode + + def ExecRcWrapper(self, arch, *args): + """Filter logo banner from invocations of rc.exe. Older versions of RC + don't support the /nologo flag.""" + env = self._GetEnv(arch) + popen = subprocess.Popen( + args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + out = popen.communicate()[0].decode("utf-8") + for line in out.splitlines(): + if ( + not line.startswith("Microsoft (R) Windows (R) Resource Compiler") + and not line.startswith("Copyright (C) Microsoft Corporation") + and line + ): + print(line) + return popen.returncode + + def ExecActionWrapper(self, arch, rspfile, *dir): + """Runs an action command line from a response file using the environment + for |arch|. If |dir| is supplied, use that as the working directory.""" + env = self._GetEnv(arch) + # TODO(scottmg): This is a temporary hack to get some specific variables + # through to actions that are set after gyp-time. http://crbug.com/333738. + for k, v in os.environ.items(): + if k not in env: + env[k] = v + args = open(rspfile).read() + dir = dir[0] if dir else None + return subprocess.call(args, shell=True, env=env, cwd=dir) + + def ExecClCompile(self, project_dir, selected_files): + """Executed by msvs-ninja projects when the 'ClCompile' target is used to + build selected C/C++ files.""" + project_dir = os.path.relpath(project_dir, BASE_DIR) + selected_files = selected_files.split(";") + ninja_targets = [ + os.path.join(project_dir, filename) + "^^" for filename in selected_files + ] + cmd = ["ninja.exe"] + cmd.extend(ninja_targets) + return subprocess.call(cmd, shell=True, cwd=BASE_DIR) + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py new file mode 100644 index 0000000000000..a75d8eeab7bda --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py @@ -0,0 +1,1939 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +This module contains classes that help to emulate xcodebuild behavior on top of +other build systems, such as make and ninja. +""" + + +import copy +import gyp.common +import os +import os.path +import re +import shlex +import subprocess +import sys +from gyp.common import GypError + +# Populated lazily by XcodeVersion, for efficiency, and to fix an issue when +# "xcodebuild" is called too quickly (it has been found to return incorrect +# version number). +XCODE_VERSION_CACHE = None + +# Populated lazily by GetXcodeArchsDefault, to an |XcodeArchsDefault| instance +# corresponding to the installed version of Xcode. +XCODE_ARCHS_DEFAULT_CACHE = None + + +def XcodeArchsVariableMapping(archs, archs_including_64_bit=None): + """Constructs a dictionary with expansion for $(ARCHS_STANDARD) variable, + and optionally for $(ARCHS_STANDARD_INCLUDING_64_BIT).""" + mapping = {"$(ARCHS_STANDARD)": archs} + if archs_including_64_bit: + mapping["$(ARCHS_STANDARD_INCLUDING_64_BIT)"] = archs_including_64_bit + return mapping + + +class XcodeArchsDefault: + """A class to resolve ARCHS variable from xcode_settings, resolving Xcode + macros and implementing filtering by VALID_ARCHS. The expansion of macros + depends on the SDKROOT used ("macosx", "iphoneos", "iphonesimulator") and + on the version of Xcode. + """ + + # Match variable like $(ARCHS_STANDARD). + variable_pattern = re.compile(r"\$\([a-zA-Z_][a-zA-Z0-9_]*\)$") + + def __init__(self, default, mac, iphonesimulator, iphoneos): + self._default = (default,) + self._archs = {"mac": mac, "ios": iphoneos, "iossim": iphonesimulator} + + def _VariableMapping(self, sdkroot): + """Returns the dictionary of variable mapping depending on the SDKROOT.""" + sdkroot = sdkroot.lower() + if "iphoneos" in sdkroot: + return self._archs["ios"] + elif "iphonesimulator" in sdkroot: + return self._archs["iossim"] + else: + return self._archs["mac"] + + def _ExpandArchs(self, archs, sdkroot): + """Expands variables references in ARCHS, and remove duplicates.""" + variable_mapping = self._VariableMapping(sdkroot) + expanded_archs = [] + for arch in archs: + if self.variable_pattern.match(arch): + variable = arch + try: + variable_expansion = variable_mapping[variable] + for arch in variable_expansion: + if arch not in expanded_archs: + expanded_archs.append(arch) + except KeyError: + print('Warning: Ignoring unsupported variable "%s".' % variable) + elif arch not in expanded_archs: + expanded_archs.append(arch) + return expanded_archs + + def ActiveArchs(self, archs, valid_archs, sdkroot): + """Expands variables references in ARCHS, and filter by VALID_ARCHS if it + is defined (if not set, Xcode accept any value in ARCHS, otherwise, only + values present in VALID_ARCHS are kept).""" + expanded_archs = self._ExpandArchs(archs or self._default, sdkroot or "") + if valid_archs: + filtered_archs = [] + for arch in expanded_archs: + if arch in valid_archs: + filtered_archs.append(arch) + expanded_archs = filtered_archs + return expanded_archs + + +def GetXcodeArchsDefault(): + """Returns the |XcodeArchsDefault| object to use to expand ARCHS for the + installed version of Xcode. The default values used by Xcode for ARCHS + and the expansion of the variables depends on the version of Xcode used. + + For all version anterior to Xcode 5.0 or posterior to Xcode 5.1 included + uses $(ARCHS_STANDARD) if ARCHS is unset, while Xcode 5.0 to 5.0.2 uses + $(ARCHS_STANDARD_INCLUDING_64_BIT). This variable was added to Xcode 5.0 + and deprecated with Xcode 5.1. + + For "macosx" SDKROOT, all version starting with Xcode 5.0 includes 64-bit + architecture as part of $(ARCHS_STANDARD) and default to only building it. + + For "iphoneos" and "iphonesimulator" SDKROOT, 64-bit architectures are part + of $(ARCHS_STANDARD_INCLUDING_64_BIT) from Xcode 5.0. From Xcode 5.1, they + are also part of $(ARCHS_STANDARD). + + All these rules are coded in the construction of the |XcodeArchsDefault| + object to use depending on the version of Xcode detected. The object is + for performance reason.""" + global XCODE_ARCHS_DEFAULT_CACHE + if XCODE_ARCHS_DEFAULT_CACHE: + return XCODE_ARCHS_DEFAULT_CACHE + xcode_version, _ = XcodeVersion() + if xcode_version < "0500": + XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault( + "$(ARCHS_STANDARD)", + XcodeArchsVariableMapping(["i386"]), + XcodeArchsVariableMapping(["i386"]), + XcodeArchsVariableMapping(["armv7"]), + ) + elif xcode_version < "0510": + XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault( + "$(ARCHS_STANDARD_INCLUDING_64_BIT)", + XcodeArchsVariableMapping(["x86_64"], ["x86_64"]), + XcodeArchsVariableMapping(["i386"], ["i386", "x86_64"]), + XcodeArchsVariableMapping( + ["armv7", "armv7s"], ["armv7", "armv7s", "arm64"] + ), + ) + else: + XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault( + "$(ARCHS_STANDARD)", + XcodeArchsVariableMapping(["x86_64"], ["x86_64"]), + XcodeArchsVariableMapping(["i386", "x86_64"], ["i386", "x86_64"]), + XcodeArchsVariableMapping( + ["armv7", "armv7s", "arm64"], ["armv7", "armv7s", "arm64"] + ), + ) + return XCODE_ARCHS_DEFAULT_CACHE + + +class XcodeSettings: + """A class that understands the gyp 'xcode_settings' object.""" + + # Populated lazily by _SdkPath(). Shared by all XcodeSettings, so cached + # at class-level for efficiency. + _sdk_path_cache = {} + _platform_path_cache = {} + _sdk_root_cache = {} + + # Populated lazily by GetExtraPlistItems(). Shared by all XcodeSettings, so + # cached at class-level for efficiency. + _plist_cache = {} + + # Populated lazily by GetIOSPostbuilds. Shared by all XcodeSettings, so + # cached at class-level for efficiency. + _codesigning_key_cache = {} + + def __init__(self, spec): + self.spec = spec + + self.isIOS = False + self.mac_toolchain_dir = None + self.header_map_path = None + + # Per-target 'xcode_settings' are pushed down into configs earlier by gyp. + # This means self.xcode_settings[config] always contains all settings + # for that config -- the per-target settings as well. Settings that are + # the same for all configs are implicitly per-target settings. + self.xcode_settings = {} + configs = spec["configurations"] + for configname, config in configs.items(): + self.xcode_settings[configname] = config.get("xcode_settings", {}) + self._ConvertConditionalKeys(configname) + if self.xcode_settings[configname].get("IPHONEOS_DEPLOYMENT_TARGET", None): + self.isIOS = True + + # This is only non-None temporarily during the execution of some methods. + self.configname = None + + # Used by _AdjustLibrary to match .a and .dylib entries in libraries. + self.library_re = re.compile(r"^lib([^/]+)\.(a|dylib)$") + + def _ConvertConditionalKeys(self, configname): + """Converts or warns on conditional keys. Xcode supports conditional keys, + such as CODE_SIGN_IDENTITY[sdk=iphoneos*]. This is a partial implementation + with some keys converted while the rest force a warning.""" + settings = self.xcode_settings[configname] + conditional_keys = [key for key in settings if key.endswith("]")] + for key in conditional_keys: + # If you need more, speak up at http://crbug.com/122592 + if key.endswith("[sdk=iphoneos*]"): + if configname.endswith("iphoneos"): + new_key = key.split("[")[0] + settings[new_key] = settings[key] + else: + print( + "Warning: Conditional keys not implemented, ignoring:", + " ".join(conditional_keys), + ) + del settings[key] + + def _Settings(self): + assert self.configname + return self.xcode_settings[self.configname] + + def _Test(self, test_key, cond_key, default): + return self._Settings().get(test_key, default) == cond_key + + def _Appendf(self, lst, test_key, format_str, default=None): + if test_key in self._Settings(): + lst.append(format_str % str(self._Settings()[test_key])) + elif default: + lst.append(format_str % str(default)) + + def _WarnUnimplemented(self, test_key): + if test_key in self._Settings(): + print('Warning: Ignoring not yet implemented key "%s".' % test_key) + + def IsBinaryOutputFormat(self, configname): + default = "binary" if self.isIOS else "xml" + format = self.xcode_settings[configname].get("INFOPLIST_OUTPUT_FORMAT", default) + return format == "binary" + + def IsIosFramework(self): + return self.spec["type"] == "shared_library" and self._IsBundle() and self.isIOS + + def _IsBundle(self): + return ( + int(self.spec.get("mac_bundle", 0)) != 0 + or self._IsXCTest() + or self._IsXCUiTest() + ) + + def _IsXCTest(self): + return int(self.spec.get("mac_xctest_bundle", 0)) != 0 + + def _IsXCUiTest(self): + return int(self.spec.get("mac_xcuitest_bundle", 0)) != 0 + + def _IsIosAppExtension(self): + return int(self.spec.get("ios_app_extension", 0)) != 0 + + def _IsIosWatchKitExtension(self): + return int(self.spec.get("ios_watchkit_extension", 0)) != 0 + + def _IsIosWatchApp(self): + return int(self.spec.get("ios_watch_app", 0)) != 0 + + def GetFrameworkVersion(self): + """Returns the framework version of the current target. Only valid for + bundles.""" + assert self._IsBundle() + return self.GetPerTargetSetting("FRAMEWORK_VERSION", default="A") + + def GetWrapperExtension(self): + """Returns the bundle extension (.app, .framework, .plugin, etc). Only + valid for bundles.""" + assert self._IsBundle() + if self.spec["type"] in ("loadable_module", "shared_library"): + default_wrapper_extension = { + "loadable_module": "bundle", + "shared_library": "framework", + }[self.spec["type"]] + wrapper_extension = self.GetPerTargetSetting( + "WRAPPER_EXTENSION", default=default_wrapper_extension + ) + return "." + self.spec.get("product_extension", wrapper_extension) + elif self.spec["type"] == "executable": + if self._IsIosAppExtension() or self._IsIosWatchKitExtension(): + return "." + self.spec.get("product_extension", "appex") + else: + return "." + self.spec.get("product_extension", "app") + else: + assert False, "Don't know extension for '{}', target '{}'".format( + self.spec["type"], + self.spec["target_name"], + ) + + def GetProductName(self): + """Returns PRODUCT_NAME.""" + return self.spec.get("product_name", self.spec["target_name"]) + + def GetFullProductName(self): + """Returns FULL_PRODUCT_NAME.""" + if self._IsBundle(): + return self.GetWrapperName() + else: + return self._GetStandaloneBinaryPath() + + def GetWrapperName(self): + """Returns the directory name of the bundle represented by this target. + Only valid for bundles.""" + assert self._IsBundle() + return self.GetProductName() + self.GetWrapperExtension() + + def GetBundleContentsFolderPath(self): + """Returns the qualified path to the bundle's contents folder. E.g. + Chromium.app/Contents or Foo.bundle/Versions/A. Only valid for bundles.""" + if self.isIOS: + return self.GetWrapperName() + assert self._IsBundle() + if self.spec["type"] == "shared_library": + return os.path.join( + self.GetWrapperName(), "Versions", self.GetFrameworkVersion() + ) + else: + # loadable_modules have a 'Contents' folder like executables. + return os.path.join(self.GetWrapperName(), "Contents") + + def GetBundleResourceFolder(self): + """Returns the qualified path to the bundle's resource folder. E.g. + Chromium.app/Contents/Resources. Only valid for bundles.""" + assert self._IsBundle() + if self.isIOS: + return self.GetBundleContentsFolderPath() + return os.path.join(self.GetBundleContentsFolderPath(), "Resources") + + def GetBundleExecutableFolderPath(self): + """Returns the qualified path to the bundle's executables folder. E.g. + Chromium.app/Contents/MacOS. Only valid for bundles.""" + assert self._IsBundle() + if self.spec["type"] in ("shared_library") or self.isIOS: + return self.GetBundleContentsFolderPath() + elif self.spec["type"] in ("executable", "loadable_module"): + return os.path.join(self.GetBundleContentsFolderPath(), "MacOS") + + def GetBundleJavaFolderPath(self): + """Returns the qualified path to the bundle's Java resource folder. + E.g. Chromium.app/Contents/Resources/Java. Only valid for bundles.""" + assert self._IsBundle() + return os.path.join(self.GetBundleResourceFolder(), "Java") + + def GetBundleFrameworksFolderPath(self): + """Returns the qualified path to the bundle's frameworks folder. E.g, + Chromium.app/Contents/Frameworks. Only valid for bundles.""" + assert self._IsBundle() + return os.path.join(self.GetBundleContentsFolderPath(), "Frameworks") + + def GetBundleSharedFrameworksFolderPath(self): + """Returns the qualified path to the bundle's frameworks folder. E.g, + Chromium.app/Contents/SharedFrameworks. Only valid for bundles.""" + assert self._IsBundle() + return os.path.join(self.GetBundleContentsFolderPath(), "SharedFrameworks") + + def GetBundleSharedSupportFolderPath(self): + """Returns the qualified path to the bundle's shared support folder. E.g, + Chromium.app/Contents/SharedSupport. Only valid for bundles.""" + assert self._IsBundle() + if self.spec["type"] == "shared_library": + return self.GetBundleResourceFolder() + else: + return os.path.join(self.GetBundleContentsFolderPath(), "SharedSupport") + + def GetBundlePlugInsFolderPath(self): + """Returns the qualified path to the bundle's plugins folder. E.g, + Chromium.app/Contents/PlugIns. Only valid for bundles.""" + assert self._IsBundle() + return os.path.join(self.GetBundleContentsFolderPath(), "PlugIns") + + def GetBundleXPCServicesFolderPath(self): + """Returns the qualified path to the bundle's XPC services folder. E.g, + Chromium.app/Contents/XPCServices. Only valid for bundles.""" + assert self._IsBundle() + return os.path.join(self.GetBundleContentsFolderPath(), "XPCServices") + + def GetBundlePlistPath(self): + """Returns the qualified path to the bundle's plist file. E.g. + Chromium.app/Contents/Info.plist. Only valid for bundles.""" + assert self._IsBundle() + if ( + self.spec["type"] in ("executable", "loadable_module") + or self.IsIosFramework() + ): + return os.path.join(self.GetBundleContentsFolderPath(), "Info.plist") + else: + return os.path.join( + self.GetBundleContentsFolderPath(), "Resources", "Info.plist" + ) + + def GetProductType(self): + """Returns the PRODUCT_TYPE of this target.""" + if self._IsIosAppExtension(): + assert self._IsBundle(), ( + "ios_app_extension flag requires mac_bundle " + "(target %s)" % self.spec["target_name"] + ) + return "com.apple.product-type.app-extension" + if self._IsIosWatchKitExtension(): + assert self._IsBundle(), ( + "ios_watchkit_extension flag requires " + "mac_bundle (target %s)" % self.spec["target_name"] + ) + return "com.apple.product-type.watchkit-extension" + if self._IsIosWatchApp(): + assert self._IsBundle(), ( + "ios_watch_app flag requires mac_bundle " + "(target %s)" % self.spec["target_name"] + ) + return "com.apple.product-type.application.watchapp" + if self._IsXCUiTest(): + assert self._IsBundle(), ( + "mac_xcuitest_bundle flag requires mac_bundle " + "(target %s)" % self.spec["target_name"] + ) + return "com.apple.product-type.bundle.ui-testing" + if self._IsBundle(): + return { + "executable": "com.apple.product-type.application", + "loadable_module": "com.apple.product-type.bundle", + "shared_library": "com.apple.product-type.framework", + }[self.spec["type"]] + else: + return { + "executable": "com.apple.product-type.tool", + "loadable_module": "com.apple.product-type.library.dynamic", + "shared_library": "com.apple.product-type.library.dynamic", + "static_library": "com.apple.product-type.library.static", + }[self.spec["type"]] + + def GetMachOType(self): + """Returns the MACH_O_TYPE of this target.""" + # Weird, but matches Xcode. + if not self._IsBundle() and self.spec["type"] == "executable": + return "" + return { + "executable": "mh_execute", + "static_library": "staticlib", + "shared_library": "mh_dylib", + "loadable_module": "mh_bundle", + }[self.spec["type"]] + + def _GetBundleBinaryPath(self): + """Returns the name of the bundle binary of by this target. + E.g. Chromium.app/Contents/MacOS/Chromium. Only valid for bundles.""" + assert self._IsBundle() + return os.path.join( + self.GetBundleExecutableFolderPath(), self.GetExecutableName() + ) + + def _GetStandaloneExecutableSuffix(self): + if "product_extension" in self.spec: + return "." + self.spec["product_extension"] + return { + "executable": "", + "static_library": ".a", + "shared_library": ".dylib", + "loadable_module": ".so", + }[self.spec["type"]] + + def _GetStandaloneExecutablePrefix(self): + return self.spec.get( + "product_prefix", + { + "executable": "", + "static_library": "lib", + "shared_library": "lib", + # Non-bundled loadable_modules are called foo.so for some reason + # (that is, .so and no prefix) with the xcode build -- match that. + "loadable_module": "", + }[self.spec["type"]], + ) + + def _GetStandaloneBinaryPath(self): + """Returns the name of the non-bundle binary represented by this target. + E.g. hello_world. Only valid for non-bundles.""" + assert not self._IsBundle() + assert self.spec["type"] in ( + "executable", + "shared_library", + "static_library", + "loadable_module", + ), ("Unexpected type %s" % self.spec["type"]) + target = self.spec["target_name"] + if self.spec["type"] == "static_library": + if target[:3] == "lib": + target = target[3:] + elif self.spec["type"] in ("loadable_module", "shared_library"): + if target[:3] == "lib": + target = target[3:] + + target_prefix = self._GetStandaloneExecutablePrefix() + target = self.spec.get("product_name", target) + target_ext = self._GetStandaloneExecutableSuffix() + return target_prefix + target + target_ext + + def GetExecutableName(self): + """Returns the executable name of the bundle represented by this target. + E.g. Chromium.""" + if self._IsBundle(): + return self.spec.get("product_name", self.spec["target_name"]) + else: + return self._GetStandaloneBinaryPath() + + def GetExecutablePath(self): + """Returns the qualified path to the primary executable of the bundle + represented by this target. E.g. Chromium.app/Contents/MacOS/Chromium.""" + if self._IsBundle(): + return self._GetBundleBinaryPath() + else: + return self._GetStandaloneBinaryPath() + + def GetActiveArchs(self, configname): + """Returns the architectures this target should be built for.""" + config_settings = self.xcode_settings[configname] + xcode_archs_default = GetXcodeArchsDefault() + return xcode_archs_default.ActiveArchs( + config_settings.get("ARCHS"), + config_settings.get("VALID_ARCHS"), + config_settings.get("SDKROOT"), + ) + + def _GetSdkVersionInfoItem(self, sdk, infoitem): + # xcodebuild requires Xcode and can't run on Command Line Tools-only + # systems from 10.7 onward. + # Since the CLT has no SDK paths anyway, returning None is the + # most sensible route and should still do the right thing. + try: + return GetStdoutQuiet(["xcrun", "--sdk", sdk, infoitem]) + except GypError: + pass + + def _SdkRoot(self, configname): + if configname is None: + configname = self.configname + return self.GetPerConfigSetting("SDKROOT", configname, default="") + + def _XcodePlatformPath(self, configname=None): + sdk_root = self._SdkRoot(configname) + if sdk_root not in XcodeSettings._platform_path_cache: + platform_path = self._GetSdkVersionInfoItem( + sdk_root, "--show-sdk-platform-path" + ) + XcodeSettings._platform_path_cache[sdk_root] = platform_path + return XcodeSettings._platform_path_cache[sdk_root] + + def _SdkPath(self, configname=None): + sdk_root = self._SdkRoot(configname) + if sdk_root.startswith("/"): + return sdk_root + return self._XcodeSdkPath(sdk_root) + + def _XcodeSdkPath(self, sdk_root): + if sdk_root not in XcodeSettings._sdk_path_cache: + sdk_path = self._GetSdkVersionInfoItem(sdk_root, "--show-sdk-path") + XcodeSettings._sdk_path_cache[sdk_root] = sdk_path + if sdk_root: + XcodeSettings._sdk_root_cache[sdk_path] = sdk_root + return XcodeSettings._sdk_path_cache[sdk_root] + + def _AppendPlatformVersionMinFlags(self, lst): + self._Appendf(lst, "MACOSX_DEPLOYMENT_TARGET", "-mmacosx-version-min=%s") + if "IPHONEOS_DEPLOYMENT_TARGET" in self._Settings(): + # TODO: Implement this better? + sdk_path_basename = os.path.basename(self._SdkPath()) + if sdk_path_basename.lower().startswith("iphonesimulator"): + self._Appendf( + lst, "IPHONEOS_DEPLOYMENT_TARGET", "-mios-simulator-version-min=%s" + ) + else: + self._Appendf( + lst, "IPHONEOS_DEPLOYMENT_TARGET", "-miphoneos-version-min=%s" + ) + + def GetCflags(self, configname, arch=None): + """Returns flags that need to be added to .c, .cc, .m, and .mm + compilations.""" + # This functions (and the similar ones below) do not offer complete + # emulation of all xcode_settings keys. They're implemented on demand. + + self.configname = configname + cflags = [] + + sdk_root = self._SdkPath() + if "SDKROOT" in self._Settings() and sdk_root: + cflags.append("-isysroot %s" % sdk_root) + + if self.header_map_path: + cflags.append("-I%s" % self.header_map_path) + + if self._Test("CLANG_WARN_CONSTANT_CONVERSION", "YES", default="NO"): + cflags.append("-Wconstant-conversion") + + if self._Test("GCC_CHAR_IS_UNSIGNED_CHAR", "YES", default="NO"): + cflags.append("-funsigned-char") + + if self._Test("GCC_CW_ASM_SYNTAX", "YES", default="YES"): + cflags.append("-fasm-blocks") + + if "GCC_DYNAMIC_NO_PIC" in self._Settings(): + if self._Settings()["GCC_DYNAMIC_NO_PIC"] == "YES": + cflags.append("-mdynamic-no-pic") + else: + pass + # TODO: In this case, it depends on the target. xcode passes + # mdynamic-no-pic by default for executable and possibly static lib + # according to mento + + if self._Test("GCC_ENABLE_PASCAL_STRINGS", "YES", default="YES"): + cflags.append("-mpascal-strings") + + self._Appendf(cflags, "GCC_OPTIMIZATION_LEVEL", "-O%s", default="s") + + if self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="YES"): + dbg_format = self._Settings().get("DEBUG_INFORMATION_FORMAT", "dwarf") + if dbg_format == "dwarf": + cflags.append("-gdwarf-2") + elif dbg_format == "stabs": + raise NotImplementedError("stabs debug format is not supported yet.") + elif dbg_format == "dwarf-with-dsym": + cflags.append("-gdwarf-2") + else: + raise NotImplementedError("Unknown debug format %s" % dbg_format) + + if self._Settings().get("GCC_STRICT_ALIASING") == "YES": + cflags.append("-fstrict-aliasing") + elif self._Settings().get("GCC_STRICT_ALIASING") == "NO": + cflags.append("-fno-strict-aliasing") + + if self._Test("GCC_SYMBOLS_PRIVATE_EXTERN", "YES", default="NO"): + cflags.append("-fvisibility=hidden") + + if self._Test("GCC_TREAT_WARNINGS_AS_ERRORS", "YES", default="NO"): + cflags.append("-Werror") + + if self._Test("GCC_WARN_ABOUT_MISSING_NEWLINE", "YES", default="NO"): + cflags.append("-Wnewline-eof") + + # In Xcode, this is only activated when GCC_COMPILER_VERSION is clang or + # llvm-gcc. It also requires a fairly recent libtool, and + # if the system clang isn't used, DYLD_LIBRARY_PATH needs to contain the + # path to the libLTO.dylib that matches the used clang. + if self._Test("LLVM_LTO", "YES", default="NO"): + cflags.append("-flto") + + self._AppendPlatformVersionMinFlags(cflags) + + # TODO: + if self._Test("COPY_PHASE_STRIP", "YES", default="NO"): + self._WarnUnimplemented("COPY_PHASE_STRIP") + self._WarnUnimplemented("GCC_DEBUGGING_SYMBOLS") + self._WarnUnimplemented("GCC_ENABLE_OBJC_EXCEPTIONS") + + # TODO: This is exported correctly, but assigning to it is not supported. + self._WarnUnimplemented("MACH_O_TYPE") + self._WarnUnimplemented("PRODUCT_TYPE") + + # If GYP_CROSSCOMPILE (--cross-compiling), disable architecture-specific + # additions and assume these will be provided as required via CC_host, + # CXX_host, CC_target and CXX_target. + if not gyp.common.CrossCompileRequested(): + if arch is not None: + archs = [arch] + else: + assert self.configname + archs = self.GetActiveArchs(self.configname) + if len(archs) != 1: + # TODO: Supporting fat binaries will be annoying. + self._WarnUnimplemented("ARCHS") + archs = ["i386"] + cflags.append("-arch " + archs[0]) + + if archs[0] in ("i386", "x86_64"): + if self._Test("GCC_ENABLE_SSE3_EXTENSIONS", "YES", default="NO"): + cflags.append("-msse3") + if self._Test( + "GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS", "YES", default="NO" + ): + cflags.append("-mssse3") # Note 3rd 's'. + if self._Test("GCC_ENABLE_SSE41_EXTENSIONS", "YES", default="NO"): + cflags.append("-msse4.1") + if self._Test("GCC_ENABLE_SSE42_EXTENSIONS", "YES", default="NO"): + cflags.append("-msse4.2") + + cflags += self._Settings().get("WARNING_CFLAGS", []) + + if self._IsXCTest(): + platform_root = self._XcodePlatformPath(configname) + if platform_root: + cflags.append("-F" + platform_root + "/Developer/Library/Frameworks/") + + if sdk_root: + framework_root = sdk_root + else: + framework_root = "" + config = self.spec["configurations"][self.configname] + framework_dirs = config.get("mac_framework_dirs", []) + for directory in framework_dirs: + cflags.append("-F" + directory.replace("$(SDKROOT)", framework_root)) + + self.configname = None + return cflags + + def GetCflagsC(self, configname): + """Returns flags that need to be added to .c, and .m compilations.""" + self.configname = configname + cflags_c = [] + if self._Settings().get("GCC_C_LANGUAGE_STANDARD", "") == "ansi": + cflags_c.append("-ansi") + else: + self._Appendf(cflags_c, "GCC_C_LANGUAGE_STANDARD", "-std=%s") + cflags_c += self._Settings().get("OTHER_CFLAGS", []) + self.configname = None + return cflags_c + + def GetCflagsCC(self, configname): + """Returns flags that need to be added to .cc, and .mm compilations.""" + self.configname = configname + cflags_cc = [] + + clang_cxx_language_standard = self._Settings().get( + "CLANG_CXX_LANGUAGE_STANDARD" + ) + # Note: Don't make c++0x to c++11 so that c++0x can be used with older + # clangs that don't understand c++11 yet (like Xcode 4.2's). + if clang_cxx_language_standard: + cflags_cc.append("-std=%s" % clang_cxx_language_standard) + + self._Appendf(cflags_cc, "CLANG_CXX_LIBRARY", "-stdlib=%s") + + if self._Test("GCC_ENABLE_CPP_RTTI", "NO", default="YES"): + cflags_cc.append("-fno-rtti") + if self._Test("GCC_ENABLE_CPP_EXCEPTIONS", "NO", default="YES"): + cflags_cc.append("-fno-exceptions") + if self._Test("GCC_INLINES_ARE_PRIVATE_EXTERN", "YES", default="NO"): + cflags_cc.append("-fvisibility-inlines-hidden") + if self._Test("GCC_THREADSAFE_STATICS", "NO", default="YES"): + cflags_cc.append("-fno-threadsafe-statics") + # Note: This flag is a no-op for clang, it only has an effect for gcc. + if self._Test("GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO", "NO", default="YES"): + cflags_cc.append("-Wno-invalid-offsetof") + + other_ccflags = [] + + for flag in self._Settings().get("OTHER_CPLUSPLUSFLAGS", ["$(inherited)"]): + # TODO: More general variable expansion. Missing in many other places too. + if flag in ("$inherited", "$(inherited)", "${inherited}"): + flag = "$OTHER_CFLAGS" + if flag in ("$OTHER_CFLAGS", "$(OTHER_CFLAGS)", "${OTHER_CFLAGS}"): + other_ccflags += self._Settings().get("OTHER_CFLAGS", []) + else: + other_ccflags.append(flag) + cflags_cc += other_ccflags + + self.configname = None + return cflags_cc + + def _AddObjectiveCGarbageCollectionFlags(self, flags): + gc_policy = self._Settings().get("GCC_ENABLE_OBJC_GC", "unsupported") + if gc_policy == "supported": + flags.append("-fobjc-gc") + elif gc_policy == "required": + flags.append("-fobjc-gc-only") + + def _AddObjectiveCARCFlags(self, flags): + if self._Test("CLANG_ENABLE_OBJC_ARC", "YES", default="NO"): + flags.append("-fobjc-arc") + + def _AddObjectiveCMissingPropertySynthesisFlags(self, flags): + if self._Test( + "CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS", "YES", default="NO" + ): + flags.append("-Wobjc-missing-property-synthesis") + + def GetCflagsObjC(self, configname): + """Returns flags that need to be added to .m compilations.""" + self.configname = configname + cflags_objc = [] + self._AddObjectiveCGarbageCollectionFlags(cflags_objc) + self._AddObjectiveCARCFlags(cflags_objc) + self._AddObjectiveCMissingPropertySynthesisFlags(cflags_objc) + self.configname = None + return cflags_objc + + def GetCflagsObjCC(self, configname): + """Returns flags that need to be added to .mm compilations.""" + self.configname = configname + cflags_objcc = [] + self._AddObjectiveCGarbageCollectionFlags(cflags_objcc) + self._AddObjectiveCARCFlags(cflags_objcc) + self._AddObjectiveCMissingPropertySynthesisFlags(cflags_objcc) + if self._Test("GCC_OBJC_CALL_CXX_CDTORS", "YES", default="NO"): + cflags_objcc.append("-fobjc-call-cxx-cdtors") + self.configname = None + return cflags_objcc + + def GetInstallNameBase(self): + """Return DYLIB_INSTALL_NAME_BASE for this target.""" + # Xcode sets this for shared_libraries, and for nonbundled loadable_modules. + if self.spec["type"] != "shared_library" and ( + self.spec["type"] != "loadable_module" or self._IsBundle() + ): + return None + install_base = self.GetPerTargetSetting( + "DYLIB_INSTALL_NAME_BASE", + default="/Library/Frameworks" if self._IsBundle() else "/usr/local/lib", + ) + return install_base + + def _StandardizePath(self, path): + """Do :standardizepath processing for path.""" + # I'm not quite sure what :standardizepath does. Just call normpath(), + # but don't let @executable_path/../foo collapse to foo. + if "/" in path: + prefix, rest = "", path + if path.startswith("@"): + prefix, rest = path.split("/", 1) + rest = os.path.normpath(rest) # :standardizepath + path = os.path.join(prefix, rest) + return path + + def GetInstallName(self): + """Return LD_DYLIB_INSTALL_NAME for this target.""" + # Xcode sets this for shared_libraries, and for nonbundled loadable_modules. + if self.spec["type"] != "shared_library" and ( + self.spec["type"] != "loadable_module" or self._IsBundle() + ): + return None + + default_install_name = ( + "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)" + ) + install_name = self.GetPerTargetSetting( + "LD_DYLIB_INSTALL_NAME", default=default_install_name + ) + + # Hardcode support for the variables used in chromium for now, to + # unblock people using the make build. + if "$" in install_name: + assert install_name in ( + "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/" + "$(WRAPPER_NAME)/$(PRODUCT_NAME)", + default_install_name, + ), ( + "Variables in LD_DYLIB_INSTALL_NAME are not generally supported " + "yet in target '%s' (got '%s')" + % (self.spec["target_name"], install_name) + ) + + install_name = install_name.replace( + "$(DYLIB_INSTALL_NAME_BASE:standardizepath)", + self._StandardizePath(self.GetInstallNameBase()), + ) + if self._IsBundle(): + # These are only valid for bundles, hence the |if|. + install_name = install_name.replace( + "$(WRAPPER_NAME)", self.GetWrapperName() + ) + install_name = install_name.replace( + "$(PRODUCT_NAME)", self.GetProductName() + ) + else: + assert "$(WRAPPER_NAME)" not in install_name + assert "$(PRODUCT_NAME)" not in install_name + + install_name = install_name.replace( + "$(EXECUTABLE_PATH)", self.GetExecutablePath() + ) + return install_name + + def _MapLinkerFlagFilename(self, ldflag, gyp_to_build_path): + """Checks if ldflag contains a filename and if so remaps it from + gyp-directory-relative to build-directory-relative.""" + # This list is expanded on demand. + # They get matched as: + # -exported_symbols_list file + # -Wl,exported_symbols_list file + # -Wl,exported_symbols_list,file + LINKER_FILE = r"(\S+)" + WORD = r"\S+" + linker_flags = [ + ["-exported_symbols_list", LINKER_FILE], # Needed for NaCl. + ["-unexported_symbols_list", LINKER_FILE], + ["-reexported_symbols_list", LINKER_FILE], + ["-sectcreate", WORD, WORD, LINKER_FILE], # Needed for remoting. + ] + for flag_pattern in linker_flags: + regex = re.compile("(?:-Wl,)?" + "[ ,]".join(flag_pattern)) + m = regex.match(ldflag) + if m: + ldflag = ( + ldflag[: m.start(1)] + + gyp_to_build_path(m.group(1)) + + ldflag[m.end(1) :] + ) + # Required for ffmpeg (no idea why they don't use LIBRARY_SEARCH_PATHS, + # TODO(thakis): Update ffmpeg.gyp): + if ldflag.startswith("-L"): + ldflag = "-L" + gyp_to_build_path(ldflag[len("-L") :]) + return ldflag + + def GetLdflags(self, configname, product_dir, gyp_to_build_path, arch=None): + """Returns flags that need to be passed to the linker. + + Args: + configname: The name of the configuration to get ld flags for. + product_dir: The directory where products such static and dynamic + libraries are placed. This is added to the library search path. + gyp_to_build_path: A function that converts paths relative to the + current gyp file to paths relative to the build directory. + """ + self.configname = configname + ldflags = [] + + # The xcode build is relative to a gyp file's directory, and OTHER_LDFLAGS + # can contain entries that depend on this. Explicitly absolutify these. + for ldflag in self._Settings().get("OTHER_LDFLAGS", []): + ldflags.append(self._MapLinkerFlagFilename(ldflag, gyp_to_build_path)) + + if self._Test("DEAD_CODE_STRIPPING", "YES", default="NO"): + ldflags.append("-Wl,-dead_strip") + + if self._Test("PREBINDING", "YES", default="NO"): + ldflags.append("-Wl,-prebind") + + self._Appendf( + ldflags, "DYLIB_COMPATIBILITY_VERSION", "-compatibility_version %s" + ) + self._Appendf(ldflags, "DYLIB_CURRENT_VERSION", "-current_version %s") + + self._AppendPlatformVersionMinFlags(ldflags) + + if "SDKROOT" in self._Settings() and self._SdkPath(): + ldflags.append("-isysroot " + self._SdkPath()) + + for library_path in self._Settings().get("LIBRARY_SEARCH_PATHS", []): + ldflags.append("-L" + gyp_to_build_path(library_path)) + + if "ORDER_FILE" in self._Settings(): + ldflags.append( + "-Wl,-order_file " + + "-Wl," + + gyp_to_build_path(self._Settings()["ORDER_FILE"]) + ) + + if not gyp.common.CrossCompileRequested(): + if arch is not None: + archs = [arch] + else: + assert self.configname + archs = self.GetActiveArchs(self.configname) + if len(archs) != 1: + # TODO: Supporting fat binaries will be annoying. + self._WarnUnimplemented("ARCHS") + archs = ["i386"] + ldflags.append("-arch " + archs[0]) + + # Xcode adds the product directory by default. + # Rewrite -L. to -L./ to work around http://www.openradar.me/25313838 + ldflags.append("-L" + (product_dir if product_dir != "." else "./")) + + install_name = self.GetInstallName() + if install_name and self.spec["type"] != "loadable_module": + ldflags.append("-install_name " + install_name.replace(" ", r"\ ")) + + for rpath in self._Settings().get("LD_RUNPATH_SEARCH_PATHS", []): + ldflags.append("-Wl,-rpath," + rpath) + + sdk_root = self._SdkPath() + if not sdk_root: + sdk_root = "" + config = self.spec["configurations"][self.configname] + framework_dirs = config.get("mac_framework_dirs", []) + for directory in framework_dirs: + ldflags.append("-F" + directory.replace("$(SDKROOT)", sdk_root)) + + if self._IsXCTest(): + platform_root = self._XcodePlatformPath(configname) + if sdk_root and platform_root: + ldflags.append("-F" + platform_root + "/Developer/Library/Frameworks/") + ldflags.append("-framework XCTest") + + is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension() + if sdk_root and is_extension: + # Adds the link flags for extensions. These flags are common for all + # extensions and provide loader and main function. + # These flags reflect the compilation options used by xcode to compile + # extensions. + xcode_version, _ = XcodeVersion() + if xcode_version < "0900": + ldflags.append("-lpkstart") + ldflags.append( + sdk_root + + "/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit" + ) + else: + ldflags.append("-e _NSExtensionMain") + ldflags.append("-fapplication-extension") + + self._Appendf(ldflags, "CLANG_CXX_LIBRARY", "-stdlib=%s") + + self.configname = None + return ldflags + + def GetLibtoolflags(self, configname): + """Returns flags that need to be passed to the static linker. + + Args: + configname: The name of the configuration to get ld flags for. + """ + self.configname = configname + libtoolflags = [] + + for libtoolflag in self._Settings().get("OTHER_LDFLAGS", []): + libtoolflags.append(libtoolflag) + # TODO(thakis): ARCHS? + + self.configname = None + return libtoolflags + + def GetPerTargetSettings(self): + """Gets a list of all the per-target settings. This will only fetch keys + whose values are the same across all configurations.""" + first_pass = True + result = {} + for configname in sorted(self.xcode_settings.keys()): + if first_pass: + result = dict(self.xcode_settings[configname]) + first_pass = False + else: + for key, value in self.xcode_settings[configname].items(): + if key not in result: + continue + elif result[key] != value: + del result[key] + return result + + def GetPerConfigSetting(self, setting, configname, default=None): + if configname in self.xcode_settings: + return self.xcode_settings[configname].get(setting, default) + else: + return self.GetPerTargetSetting(setting, default) + + def GetPerTargetSetting(self, setting, default=None): + """Tries to get xcode_settings.setting from spec. Assumes that the setting + has the same value in all configurations and throws otherwise.""" + is_first_pass = True + result = None + for configname in sorted(self.xcode_settings.keys()): + if is_first_pass: + result = self.xcode_settings[configname].get(setting, None) + is_first_pass = False + else: + assert result == self.xcode_settings[configname].get(setting, None), ( + "Expected per-target setting for '%s', got per-config setting " + "(target %s)" % (setting, self.spec["target_name"]) + ) + if result is None: + return default + return result + + def _GetStripPostbuilds(self, configname, output_binary, quiet): + """Returns a list of shell commands that contain the shell commands + necessary to strip this target's binary. These should be run as postbuilds + before the actual postbuilds run.""" + self.configname = configname + + result = [] + if self._Test("DEPLOYMENT_POSTPROCESSING", "YES", default="NO") and self._Test( + "STRIP_INSTALLED_PRODUCT", "YES", default="NO" + ): + + default_strip_style = "debugging" + if ( + self.spec["type"] == "loadable_module" or self._IsIosAppExtension() + ) and self._IsBundle(): + default_strip_style = "non-global" + elif self.spec["type"] == "executable": + default_strip_style = "all" + + strip_style = self._Settings().get("STRIP_STYLE", default_strip_style) + strip_flags = {"all": "", "non-global": "-x", "debugging": "-S"}[ + strip_style + ] + + explicit_strip_flags = self._Settings().get("STRIPFLAGS", "") + if explicit_strip_flags: + strip_flags += " " + _NormalizeEnvVarReferences(explicit_strip_flags) + + if not quiet: + result.append("echo STRIP\\(%s\\)" % self.spec["target_name"]) + result.append(f"strip {strip_flags} {output_binary}") + + self.configname = None + return result + + def _GetDebugInfoPostbuilds(self, configname, output, output_binary, quiet): + """Returns a list of shell commands that contain the shell commands + necessary to massage this target's debug information. These should be run + as postbuilds before the actual postbuilds run.""" + self.configname = configname + + # For static libraries, no dSYMs are created. + result = [] + if ( + self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="YES") + and self._Test( + "DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym", default="dwarf" + ) + and self.spec["type"] != "static_library" + ): + if not quiet: + result.append("echo DSYMUTIL\\(%s\\)" % self.spec["target_name"]) + result.append("dsymutil {} -o {}".format(output_binary, output + ".dSYM")) + + self.configname = None + return result + + def _GetTargetPostbuilds(self, configname, output, output_binary, quiet=False): + """Returns a list of shell commands that contain the shell commands + to run as postbuilds for this target, before the actual postbuilds.""" + # dSYMs need to build before stripping happens. + return self._GetDebugInfoPostbuilds( + configname, output, output_binary, quiet + ) + self._GetStripPostbuilds(configname, output_binary, quiet) + + def _GetIOSPostbuilds(self, configname, output_binary): + """Return a shell command to codesign the iOS output binary so it can + be deployed to a device. This should be run as the very last step of the + build.""" + if not ( + self.isIOS + and (self.spec["type"] == "executable" or self._IsXCTest()) + or self.IsIosFramework() + ): + return [] + + postbuilds = [] + product_name = self.GetFullProductName() + settings = self.xcode_settings[configname] + + # Xcode expects XCTests to be copied into the TEST_HOST dir. + if self._IsXCTest(): + source = os.path.join("${BUILT_PRODUCTS_DIR}", product_name) + test_host = os.path.dirname(settings.get("TEST_HOST")) + xctest_destination = os.path.join(test_host, "PlugIns", product_name) + postbuilds.extend([f"ditto {source} {xctest_destination}"]) + + key = self._GetIOSCodeSignIdentityKey(settings) + if not key: + return postbuilds + + # Warn for any unimplemented signing xcode keys. + unimpl = ["OTHER_CODE_SIGN_FLAGS"] + unimpl = set(unimpl) & set(self.xcode_settings[configname].keys()) + if unimpl: + print( + "Warning: Some codesign keys not implemented, ignoring: %s" + % ", ".join(sorted(unimpl)) + ) + + if self._IsXCTest(): + # For device xctests, Xcode copies two extra frameworks into $TEST_HOST. + test_host = os.path.dirname(settings.get("TEST_HOST")) + frameworks_dir = os.path.join(test_host, "Frameworks") + platform_root = self._XcodePlatformPath(configname) + frameworks = [ + "Developer/Library/PrivateFrameworks/IDEBundleInjection.framework", + "Developer/Library/Frameworks/XCTest.framework", + ] + for framework in frameworks: + source = os.path.join(platform_root, framework) + destination = os.path.join(frameworks_dir, os.path.basename(framework)) + postbuilds.extend([f"ditto {source} {destination}"]) + + # Then re-sign everything with 'preserve=True' + postbuilds.extend( + [ + '%s code-sign-bundle "%s" "%s" "%s" "%s" %s' + % ( + os.path.join("${TARGET_BUILD_DIR}", "gyp-mac-tool"), + key, + settings.get("CODE_SIGN_ENTITLEMENTS", ""), + settings.get("PROVISIONING_PROFILE", ""), + destination, + True, + ) + ] + ) + plugin_dir = os.path.join(test_host, "PlugIns") + targets = [os.path.join(plugin_dir, product_name), test_host] + for target in targets: + postbuilds.extend( + [ + '%s code-sign-bundle "%s" "%s" "%s" "%s" %s' + % ( + os.path.join("${TARGET_BUILD_DIR}", "gyp-mac-tool"), + key, + settings.get("CODE_SIGN_ENTITLEMENTS", ""), + settings.get("PROVISIONING_PROFILE", ""), + target, + True, + ) + ] + ) + + postbuilds.extend( + [ + '%s code-sign-bundle "%s" "%s" "%s" "%s" %s' + % ( + os.path.join("${TARGET_BUILD_DIR}", "gyp-mac-tool"), + key, + settings.get("CODE_SIGN_ENTITLEMENTS", ""), + settings.get("PROVISIONING_PROFILE", ""), + os.path.join("${BUILT_PRODUCTS_DIR}", product_name), + False, + ) + ] + ) + return postbuilds + + def _GetIOSCodeSignIdentityKey(self, settings): + identity = settings.get("CODE_SIGN_IDENTITY") + if not identity: + return None + if identity not in XcodeSettings._codesigning_key_cache: + output = subprocess.check_output( + ["security", "find-identity", "-p", "codesigning", "-v"] + ) + for line in output.splitlines(): + if identity in line: + fingerprint = line.split()[1] + cache = XcodeSettings._codesigning_key_cache + assert identity not in cache or fingerprint == cache[identity], ( + "Multiple codesigning fingerprints for identity: %s" % identity + ) + XcodeSettings._codesigning_key_cache[identity] = fingerprint + return XcodeSettings._codesigning_key_cache.get(identity, "") + + def AddImplicitPostbuilds( + self, configname, output, output_binary, postbuilds=[], quiet=False + ): + """Returns a list of shell commands that should run before and after + |postbuilds|.""" + assert output_binary is not None + pre = self._GetTargetPostbuilds(configname, output, output_binary, quiet) + post = self._GetIOSPostbuilds(configname, output_binary) + return pre + postbuilds + post + + def _AdjustLibrary(self, library, config_name=None): + if library.endswith(".framework"): + l_flag = "-framework " + os.path.splitext(os.path.basename(library))[0] + else: + m = self.library_re.match(library) + if m: + l_flag = "-l" + m.group(1) + else: + l_flag = library + + sdk_root = self._SdkPath(config_name) + if not sdk_root: + sdk_root = "" + # Xcode 7 started shipping with ".tbd" (text based stubs) files instead of + # ".dylib" without providing a real support for them. What it does, for + # "/usr/lib" libraries, is do "-L/usr/lib -lname" which is dependent on the + # library order and cause collision when building Chrome. + # + # Instead substitute ".tbd" to ".dylib" in the generated project when the + # following conditions are both true: + # - library is referenced in the gyp file as "$(SDKROOT)/**/*.dylib", + # - the ".dylib" file does not exists but a ".tbd" file do. + library = l_flag.replace("$(SDKROOT)", sdk_root) + if l_flag.startswith("$(SDKROOT)"): + basename, ext = os.path.splitext(library) + if ext == ".dylib" and not os.path.exists(library): + tbd_library = basename + ".tbd" + if os.path.exists(tbd_library): + library = tbd_library + return library + + def AdjustLibraries(self, libraries, config_name=None): + """Transforms entries like 'Cocoa.framework' in libraries into entries like + '-framework Cocoa', 'libcrypto.dylib' into '-lcrypto', etc. + """ + libraries = [self._AdjustLibrary(library, config_name) for library in libraries] + return libraries + + def _BuildMachineOSBuild(self): + return GetStdout(["sw_vers", "-buildVersion"]) + + def _XcodeIOSDeviceFamily(self, configname): + family = self.xcode_settings[configname].get("TARGETED_DEVICE_FAMILY", "1") + return [int(x) for x in family.split(",")] + + def GetExtraPlistItems(self, configname=None): + """Returns a dictionary with extra items to insert into Info.plist.""" + if configname not in XcodeSettings._plist_cache: + cache = {} + cache["BuildMachineOSBuild"] = self._BuildMachineOSBuild() + + xcode_version, xcode_build = XcodeVersion() + cache["DTXcode"] = xcode_version + cache["DTXcodeBuild"] = xcode_build + compiler = self.xcode_settings[configname].get("GCC_VERSION") + if compiler is not None: + cache["DTCompiler"] = compiler + + sdk_root = self._SdkRoot(configname) + if not sdk_root: + sdk_root = self._DefaultSdkRoot() + sdk_version = self._GetSdkVersionInfoItem(sdk_root, "--show-sdk-version") + cache["DTSDKName"] = sdk_root + (sdk_version or "") + if xcode_version >= "0720": + cache["DTSDKBuild"] = self._GetSdkVersionInfoItem( + sdk_root, "--show-sdk-build-version" + ) + elif xcode_version >= "0430": + cache["DTSDKBuild"] = sdk_version + else: + cache["DTSDKBuild"] = cache["BuildMachineOSBuild"] + + if self.isIOS: + cache["MinimumOSVersion"] = self.xcode_settings[configname].get( + "IPHONEOS_DEPLOYMENT_TARGET" + ) + cache["DTPlatformName"] = sdk_root + cache["DTPlatformVersion"] = sdk_version + + if configname.endswith("iphoneos"): + cache["CFBundleSupportedPlatforms"] = ["iPhoneOS"] + cache["DTPlatformBuild"] = cache["DTSDKBuild"] + else: + cache["CFBundleSupportedPlatforms"] = ["iPhoneSimulator"] + # This is weird, but Xcode sets DTPlatformBuild to an empty field + # for simulator builds. + cache["DTPlatformBuild"] = "" + XcodeSettings._plist_cache[configname] = cache + + # Include extra plist items that are per-target, not per global + # XcodeSettings. + items = dict(XcodeSettings._plist_cache[configname]) + if self.isIOS: + items["UIDeviceFamily"] = self._XcodeIOSDeviceFamily(configname) + return items + + def _DefaultSdkRoot(self): + """Returns the default SDKROOT to use. + + Prior to version 5.0.0, if SDKROOT was not explicitly set in the Xcode + project, then the environment variable was empty. Starting with this + version, Xcode uses the name of the newest SDK installed. + """ + xcode_version, _ = XcodeVersion() + if xcode_version < "0500": + return "" + default_sdk_path = self._XcodeSdkPath("") + default_sdk_root = XcodeSettings._sdk_root_cache.get(default_sdk_path) + if default_sdk_root: + return default_sdk_root + try: + all_sdks = GetStdout(["xcodebuild", "-showsdks"]) + except GypError: + # If xcodebuild fails, there will be no valid SDKs + return "" + for line in all_sdks.splitlines(): + items = line.split() + if len(items) >= 3 and items[-2] == "-sdk": + sdk_root = items[-1] + sdk_path = self._XcodeSdkPath(sdk_root) + if sdk_path == default_sdk_path: + return sdk_root + return "" + + +class MacPrefixHeader: + """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature. + + This feature consists of several pieces: + * If GCC_PREFIX_HEADER is present, all compilations in that project get an + additional |-include path_to_prefix_header| cflag. + * If GCC_PRECOMPILE_PREFIX_HEADER is present too, then the prefix header is + instead compiled, and all other compilations in the project get an + additional |-include path_to_compiled_header| instead. + + Compiled prefix headers have the extension gch. There is one gch file for + every language used in the project (c, cc, m, mm), since gch files for + different languages aren't compatible. + + gch files themselves are built with the target's normal cflags, but they + obviously don't get the |-include| flag. Instead, they need a -x flag that + describes their language. + + All o files in the target need to depend on the gch file, to make sure + it's built before any o file is built. + + This class helps with some of these tasks, but it needs help from the build + system for writing dependencies to the gch files, for writing build commands + for the gch files, and for figuring out the location of the gch files. + """ + + def __init__( + self, xcode_settings, gyp_path_to_build_path, gyp_path_to_build_output + ): + """If xcode_settings is None, all methods on this class are no-ops. + + Args: + gyp_path_to_build_path: A function that takes a gyp-relative path, + and returns a path relative to the build directory. + gyp_path_to_build_output: A function that takes a gyp-relative path and + a language code ('c', 'cc', 'm', or 'mm'), and that returns a path + to where the output of precompiling that path for that language + should be placed (without the trailing '.gch'). + """ + # This doesn't support per-configuration prefix headers. Good enough + # for now. + self.header = None + self.compile_headers = False + if xcode_settings: + self.header = xcode_settings.GetPerTargetSetting("GCC_PREFIX_HEADER") + self.compile_headers = ( + xcode_settings.GetPerTargetSetting( + "GCC_PRECOMPILE_PREFIX_HEADER", default="NO" + ) + != "NO" + ) + self.compiled_headers = {} + if self.header: + if self.compile_headers: + for lang in ["c", "cc", "m", "mm"]: + self.compiled_headers[lang] = gyp_path_to_build_output( + self.header, lang + ) + self.header = gyp_path_to_build_path(self.header) + + def _CompiledHeader(self, lang, arch): + assert self.compile_headers + h = self.compiled_headers[lang] + if arch: + h += "." + arch + return h + + def GetInclude(self, lang, arch=None): + """Gets the cflags to include the prefix header for language |lang|.""" + if self.compile_headers and lang in self.compiled_headers: + return "-include %s" % self._CompiledHeader(lang, arch) + elif self.header: + return "-include %s" % self.header + else: + return "" + + def _Gch(self, lang, arch): + """Returns the actual file name of the prefix header for language |lang|.""" + assert self.compile_headers + return self._CompiledHeader(lang, arch) + ".gch" + + def GetObjDependencies(self, sources, objs, arch=None): + """Given a list of source files and the corresponding object files, returns + a list of (source, object, gch) tuples, where |gch| is the build-directory + relative path to the gch file each object file depends on. |compilable[i]| + has to be the source file belonging to |objs[i]|.""" + if not self.header or not self.compile_headers: + return [] + + result = [] + for source, obj in zip(sources, objs): + ext = os.path.splitext(source)[1] + lang = { + ".c": "c", + ".cpp": "cc", + ".cc": "cc", + ".cxx": "cc", + ".m": "m", + ".mm": "mm", + }.get(ext, None) + if lang: + result.append((source, obj, self._Gch(lang, arch))) + return result + + def GetPchBuildCommands(self, arch=None): + """Returns [(path_to_gch, language_flag, language, header)]. + |path_to_gch| and |header| are relative to the build directory. + """ + if not self.header or not self.compile_headers: + return [] + return [ + (self._Gch("c", arch), "-x c-header", "c", self.header), + (self._Gch("cc", arch), "-x c++-header", "cc", self.header), + (self._Gch("m", arch), "-x objective-c-header", "m", self.header), + (self._Gch("mm", arch), "-x objective-c++-header", "mm", self.header), + ] + + +def XcodeVersion(): + """Returns a tuple of version and build version of installed Xcode.""" + # `xcodebuild -version` output looks like + # Xcode 4.6.3 + # Build version 4H1503 + # or like + # Xcode 3.2.6 + # Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0 + # BuildVersion: 10M2518 + # Convert that to ('0463', '4H1503') or ('0326', '10M2518'). + global XCODE_VERSION_CACHE + if XCODE_VERSION_CACHE: + return XCODE_VERSION_CACHE + version = "" + build = "" + try: + version_list = GetStdoutQuiet(["xcodebuild", "-version"]).splitlines() + # In some circumstances xcodebuild exits 0 but doesn't return + # the right results; for example, a user on 10.7 or 10.8 with + # a bogus path set via xcode-select + # In that case this may be a CLT-only install so fall back to + # checking that version. + if len(version_list) < 2: + raise GypError("xcodebuild returned unexpected results") + version = version_list[0].split()[-1] # Last word on first line + build = version_list[-1].split()[-1] # Last word on last line + except GypError: # Xcode not installed so look for XCode Command Line Tools + version = CLTVersion() # macOS Catalina returns 11.0.0.0.1.1567737322 + if not version: + raise GypError("No Xcode or CLT version detected!") + # Be careful to convert "4.2.3" to "0423" and "11.0.0" to "1100": + version = version.split(".")[:3] # Just major, minor, micro + version[0] = version[0].zfill(2) # Add a leading zero if major is one digit + version = ("".join(version) + "00")[:4] # Limit to exactly four characters + XCODE_VERSION_CACHE = (version, build) + return XCODE_VERSION_CACHE + + +# This function ported from the logic in Homebrew's CLT version check +def CLTVersion(): + """Returns the version of command-line tools from pkgutil.""" + # pkgutil output looks like + # package-id: com.apple.pkg.CLTools_Executables + # version: 5.0.1.0.1.1382131676 + # volume: / + # location: / + # install-time: 1382544035 + # groups: com.apple.FindSystemFiles.pkg-group + # com.apple.DevToolsBoth.pkg-group + # com.apple.DevToolsNonRelocatableShared.pkg-group + STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo" + FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI" + MAVERICKS_PKG_ID = "com.apple.pkg.CLTools_Executables" + + regex = re.compile("version: (?P.+)") + for key in [MAVERICKS_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID]: + try: + output = GetStdout(["/usr/sbin/pkgutil", "--pkg-info", key]) + return re.search(regex, output).groupdict()["version"] + except GypError: + continue + + regex = re.compile(r'Command Line Tools for Xcode\s+(?P\S+)') + try: + output = GetStdout(["/usr/sbin/softwareupdate", "--history"]) + return re.search(regex, output).groupdict()["version"] + except GypError: + return None + + +def GetStdoutQuiet(cmdlist): + """Returns the content of standard output returned by invoking |cmdlist|. + Ignores the stderr. + Raises |GypError| if the command return with a non-zero return code.""" + job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out = job.communicate()[0].decode("utf-8") + if job.returncode != 0: + raise GypError("Error %d running %s" % (job.returncode, cmdlist[0])) + return out.rstrip("\n") + + +def GetStdout(cmdlist): + """Returns the content of standard output returned by invoking |cmdlist|. + Raises |GypError| if the command return with a non-zero return code.""" + job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE) + out = job.communicate()[0].decode("utf-8") + if job.returncode != 0: + sys.stderr.write(out + "\n") + raise GypError("Error %d running %s" % (job.returncode, cmdlist[0])) + return out.rstrip("\n") + + +def MergeGlobalXcodeSettingsToSpec(global_dict, spec): + """Merges the global xcode_settings dictionary into each configuration of the + target represented by spec. For keys that are both in the global and the local + xcode_settings dict, the local key gets precedence. + """ + # The xcode generator special-cases global xcode_settings and does something + # that amounts to merging in the global xcode_settings into each local + # xcode_settings dict. + global_xcode_settings = global_dict.get("xcode_settings", {}) + for config in spec["configurations"].values(): + if "xcode_settings" in config: + new_settings = global_xcode_settings.copy() + new_settings.update(config["xcode_settings"]) + config["xcode_settings"] = new_settings + + +def IsMacBundle(flavor, spec): + """Returns if |spec| should be treated as a bundle. + + Bundles are directories with a certain subdirectory structure, instead of + just a single file. Bundle rules do not produce a binary but also package + resources into that directory.""" + is_mac_bundle = ( + int(spec.get("mac_xctest_bundle", 0)) != 0 + or int(spec.get("mac_xcuitest_bundle", 0)) != 0 + or (int(spec.get("mac_bundle", 0)) != 0 and flavor == "mac") + ) + + if is_mac_bundle: + assert spec["type"] != "none", ( + 'mac_bundle targets cannot have type none (target "%s")' + % spec["target_name"] + ) + return is_mac_bundle + + +def GetMacBundleResources(product_dir, xcode_settings, resources): + """Yields (output, resource) pairs for every resource in |resources|. + Only call this for mac bundle targets. + + Args: + product_dir: Path to the directory containing the output bundle, + relative to the build directory. + xcode_settings: The XcodeSettings of the current target. + resources: A list of bundle resources, relative to the build directory. + """ + dest = os.path.join(product_dir, xcode_settings.GetBundleResourceFolder()) + for res in resources: + output = dest + + # The make generator doesn't support it, so forbid it everywhere + # to keep the generators more interchangeable. + assert " " not in res, "Spaces in resource filenames not supported (%s)" % res + + # Split into (path,file). + res_parts = os.path.split(res) + + # Now split the path into (prefix,maybe.lproj). + lproj_parts = os.path.split(res_parts[0]) + # If the resource lives in a .lproj bundle, add that to the destination. + if lproj_parts[1].endswith(".lproj"): + output = os.path.join(output, lproj_parts[1]) + + output = os.path.join(output, res_parts[1]) + # Compiled XIB files are referred to by .nib. + if output.endswith(".xib"): + output = os.path.splitext(output)[0] + ".nib" + # Compiled storyboard files are referred to by .storyboardc. + if output.endswith(".storyboard"): + output = os.path.splitext(output)[0] + ".storyboardc" + + yield output, res + + +def GetMacInfoPlist(product_dir, xcode_settings, gyp_path_to_build_path): + """Returns (info_plist, dest_plist, defines, extra_env), where: + * |info_plist| is the source plist path, relative to the + build directory, + * |dest_plist| is the destination plist path, relative to the + build directory, + * |defines| is a list of preprocessor defines (empty if the plist + shouldn't be preprocessed, + * |extra_env| is a dict of env variables that should be exported when + invoking |mac_tool copy-info-plist|. + + Only call this for mac bundle targets. + + Args: + product_dir: Path to the directory containing the output bundle, + relative to the build directory. + xcode_settings: The XcodeSettings of the current target. + gyp_to_build_path: A function that converts paths relative to the + current gyp file to paths relative to the build directory. + """ + info_plist = xcode_settings.GetPerTargetSetting("INFOPLIST_FILE") + if not info_plist: + return None, None, [], {} + + # The make generator doesn't support it, so forbid it everywhere + # to keep the generators more interchangeable. + assert " " not in info_plist, ( + "Spaces in Info.plist filenames not supported (%s)" % info_plist + ) + + info_plist = gyp_path_to_build_path(info_plist) + + # If explicitly set to preprocess the plist, invoke the C preprocessor and + # specify any defines as -D flags. + if ( + xcode_settings.GetPerTargetSetting("INFOPLIST_PREPROCESS", default="NO") + == "YES" + ): + # Create an intermediate file based on the path. + defines = shlex.split( + xcode_settings.GetPerTargetSetting( + "INFOPLIST_PREPROCESSOR_DEFINITIONS", default="" + ) + ) + else: + defines = [] + + dest_plist = os.path.join(product_dir, xcode_settings.GetBundlePlistPath()) + extra_env = xcode_settings.GetPerTargetSettings() + + return info_plist, dest_plist, defines, extra_env + + +def _GetXcodeEnv( + xcode_settings, built_products_dir, srcroot, configuration, additional_settings=None +): + """Return the environment variables that Xcode would set. See + http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW153 + for a full list. + + Args: + xcode_settings: An XcodeSettings object. If this is None, this function + returns an empty dict. + built_products_dir: Absolute path to the built products dir. + srcroot: Absolute path to the source root. + configuration: The build configuration name. + additional_settings: An optional dict with more values to add to the + result. + """ + + if not xcode_settings: + return {} + + # This function is considered a friend of XcodeSettings, so let it reach into + # its implementation details. + spec = xcode_settings.spec + + # These are filled in on an as-needed basis. + env = { + "BUILT_FRAMEWORKS_DIR": built_products_dir, + "BUILT_PRODUCTS_DIR": built_products_dir, + "CONFIGURATION": configuration, + "PRODUCT_NAME": xcode_settings.GetProductName(), + # For FULL_PRODUCT_NAME see: + # /Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications/MacOSX\ Product\ Types.xcspec # noqa: E501 + "SRCROOT": srcroot, + "SOURCE_ROOT": "${SRCROOT}", + # This is not true for static libraries, but currently the env is only + # written for bundles: + "TARGET_BUILD_DIR": built_products_dir, + "TEMP_DIR": "${TMPDIR}", + "XCODE_VERSION_ACTUAL": XcodeVersion()[0], + } + if xcode_settings.GetPerConfigSetting("SDKROOT", configuration): + env["SDKROOT"] = xcode_settings._SdkPath(configuration) + else: + env["SDKROOT"] = "" + + if xcode_settings.mac_toolchain_dir: + env["DEVELOPER_DIR"] = xcode_settings.mac_toolchain_dir + + if spec["type"] in ( + "executable", + "static_library", + "shared_library", + "loadable_module", + ): + env["EXECUTABLE_NAME"] = xcode_settings.GetExecutableName() + env["EXECUTABLE_PATH"] = xcode_settings.GetExecutablePath() + env["FULL_PRODUCT_NAME"] = xcode_settings.GetFullProductName() + mach_o_type = xcode_settings.GetMachOType() + if mach_o_type: + env["MACH_O_TYPE"] = mach_o_type + env["PRODUCT_TYPE"] = xcode_settings.GetProductType() + if xcode_settings._IsBundle(): + # xcodeproj_file.py sets the same Xcode subfolder value for this as for + # FRAMEWORKS_FOLDER_PATH so Xcode builds will actually use FFP's value. + env["BUILT_FRAMEWORKS_DIR"] = os.path.join( + built_products_dir + os.sep + xcode_settings.GetBundleFrameworksFolderPath() + ) + env["CONTENTS_FOLDER_PATH"] = xcode_settings.GetBundleContentsFolderPath() + env["EXECUTABLE_FOLDER_PATH"] = xcode_settings.GetBundleExecutableFolderPath() + env[ + "UNLOCALIZED_RESOURCES_FOLDER_PATH" + ] = xcode_settings.GetBundleResourceFolder() + env["JAVA_FOLDER_PATH"] = xcode_settings.GetBundleJavaFolderPath() + env["FRAMEWORKS_FOLDER_PATH"] = xcode_settings.GetBundleFrameworksFolderPath() + env[ + "SHARED_FRAMEWORKS_FOLDER_PATH" + ] = xcode_settings.GetBundleSharedFrameworksFolderPath() + env[ + "SHARED_SUPPORT_FOLDER_PATH" + ] = xcode_settings.GetBundleSharedSupportFolderPath() + env["PLUGINS_FOLDER_PATH"] = xcode_settings.GetBundlePlugInsFolderPath() + env["XPCSERVICES_FOLDER_PATH"] = xcode_settings.GetBundleXPCServicesFolderPath() + env["INFOPLIST_PATH"] = xcode_settings.GetBundlePlistPath() + env["WRAPPER_NAME"] = xcode_settings.GetWrapperName() + + install_name = xcode_settings.GetInstallName() + if install_name: + env["LD_DYLIB_INSTALL_NAME"] = install_name + install_name_base = xcode_settings.GetInstallNameBase() + if install_name_base: + env["DYLIB_INSTALL_NAME_BASE"] = install_name_base + xcode_version, _ = XcodeVersion() + if xcode_version >= "0500" and not env.get("SDKROOT"): + sdk_root = xcode_settings._SdkRoot(configuration) + if not sdk_root: + sdk_root = xcode_settings._XcodeSdkPath("") + if sdk_root is None: + sdk_root = "" + env["SDKROOT"] = sdk_root + + if not additional_settings: + additional_settings = {} + else: + # Flatten lists to strings. + for k in additional_settings: + if not isinstance(additional_settings[k], str): + additional_settings[k] = " ".join(additional_settings[k]) + additional_settings.update(env) + + for k in additional_settings: + additional_settings[k] = _NormalizeEnvVarReferences(additional_settings[k]) + + return additional_settings + + +def _NormalizeEnvVarReferences(str): + """Takes a string containing variable references in the form ${FOO}, $(FOO), + or $FOO, and returns a string with all variable references in the form ${FOO}. + """ + # $FOO -> ${FOO} + str = re.sub(r"\$([a-zA-Z_][a-zA-Z0-9_]*)", r"${\1}", str) + + # $(FOO) -> ${FOO} + matches = re.findall(r"(\$\(([a-zA-Z0-9\-_]+)\))", str) + for match in matches: + to_replace, variable = match + assert "$(" not in match, "$($(FOO)) variables not supported: " + match + str = str.replace(to_replace, "${" + variable + "}") + + return str + + +def ExpandEnvVars(string, expansions): + """Expands ${VARIABLES}, $(VARIABLES), and $VARIABLES in string per the + expansions list. If the variable expands to something that references + another variable, this variable is expanded as well if it's in env -- + until no variables present in env are left.""" + for k, v in reversed(expansions): + string = string.replace("${" + k + "}", v) + string = string.replace("$(" + k + ")", v) + string = string.replace("$" + k, v) + return string + + +def _TopologicallySortedEnvVarKeys(env): + """Takes a dict |env| whose values are strings that can refer to other keys, + for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of + env such that key2 is after key1 in L if env[key2] refers to env[key1]. + + Throws an Exception in case of dependency cycles. + """ + # Since environment variables can refer to other variables, the evaluation + # order is important. Below is the logic to compute the dependency graph + # and sort it. + regex = re.compile(r"\$\{([a-zA-Z0-9\-_]+)\}") + + def GetEdges(node): + # Use a definition of edges such that user_of_variable -> used_varible. + # This happens to be easier in this case, since a variable's + # definition contains all variables it references in a single string. + # We can then reverse the result of the topological sort at the end. + # Since: reverse(topsort(DAG)) = topsort(reverse_edges(DAG)) + matches = {v for v in regex.findall(env[node]) if v in env} + for dependee in matches: + assert "${" not in dependee, "Nested variables not supported: " + dependee + return matches + + try: + # Topologically sort, and then reverse, because we used an edge definition + # that's inverted from the expected result of this function (see comment + # above). + order = gyp.common.TopologicallySorted(env.keys(), GetEdges) + order.reverse() + return order + except gyp.common.CycleError as e: + raise GypError( + "Xcode environment variables are cyclically dependent: " + str(e.nodes) + ) + + +def GetSortedXcodeEnv( + xcode_settings, built_products_dir, srcroot, configuration, additional_settings=None +): + env = _GetXcodeEnv( + xcode_settings, built_products_dir, srcroot, configuration, additional_settings + ) + return [(key, env[key]) for key in _TopologicallySortedEnvVarKeys(env)] + + +def GetSpecPostbuildCommands(spec, quiet=False): + """Returns the list of postbuilds explicitly defined on |spec|, in a form + executable by a shell.""" + postbuilds = [] + for postbuild in spec.get("postbuilds", []): + if not quiet: + postbuilds.append( + "echo POSTBUILD\\(%s\\) %s" + % (spec["target_name"], postbuild["postbuild_name"]) + ) + postbuilds.append(gyp.common.EncodePOSIXShellList(postbuild["action"])) + return postbuilds + + +def _HasIOSTarget(targets): + """Returns true if any target contains the iOS specific key + IPHONEOS_DEPLOYMENT_TARGET.""" + for target_dict in targets.values(): + for config in target_dict["configurations"].values(): + if config.get("xcode_settings", {}).get("IPHONEOS_DEPLOYMENT_TARGET"): + return True + return False + + +def _AddIOSDeviceConfigurations(targets): + """Clone all targets and append -iphoneos to the name. Configure these targets + to build for iOS devices and use correct architectures for those builds.""" + for target_dict in targets.values(): + toolset = target_dict["toolset"] + configs = target_dict["configurations"] + for config_name, simulator_config_dict in dict(configs).items(): + iphoneos_config_dict = copy.deepcopy(simulator_config_dict) + configs[config_name + "-iphoneos"] = iphoneos_config_dict + configs[config_name + "-iphonesimulator"] = simulator_config_dict + if toolset == "target": + simulator_config_dict["xcode_settings"]["SDKROOT"] = "iphonesimulator" + iphoneos_config_dict["xcode_settings"]["SDKROOT"] = "iphoneos" + return targets + + +def CloneConfigurationForDeviceAndEmulator(target_dicts): + """If |target_dicts| contains any iOS targets, automatically create -iphoneos + targets for iOS device builds.""" + if _HasIOSTarget(target_dicts): + return _AddIOSDeviceConfigurations(target_dicts) + return target_dicts diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py new file mode 100644 index 0000000000000..bb74eacbeaf4a --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py @@ -0,0 +1,302 @@ +# Copyright (c) 2014 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Xcode-ninja wrapper project file generator. + +This updates the data structures passed to the Xcode gyp generator to build +with ninja instead. The Xcode project itself is transformed into a list of +executable targets, each with a build step to build with ninja, and a target +with every source and resource file. This appears to sidestep some of the +major performance headaches experienced using complex projects and large number +of targets within Xcode. +""" + +import errno +import gyp.generator.ninja +import os +import re +import xml.sax.saxutils + + +def _WriteWorkspace(main_gyp, sources_gyp, params): + """ Create a workspace to wrap main and sources gyp paths. """ + (build_file_root, build_file_ext) = os.path.splitext(main_gyp) + workspace_path = build_file_root + ".xcworkspace" + options = params["options"] + if options.generator_output: + workspace_path = os.path.join(options.generator_output, workspace_path) + try: + os.makedirs(workspace_path) + except OSError as e: + if e.errno != errno.EEXIST: + raise + output_string = ( + '\n' + '\n' + ) + for gyp_name in [main_gyp, sources_gyp]: + name = os.path.splitext(os.path.basename(gyp_name))[0] + ".xcodeproj" + name = xml.sax.saxutils.quoteattr("group:" + name) + output_string += " \n" % name + output_string += "\n" + + workspace_file = os.path.join(workspace_path, "contents.xcworkspacedata") + + try: + with open(workspace_file) as input_file: + input_string = input_file.read() + if input_string == output_string: + return + except OSError: + # Ignore errors if the file doesn't exist. + pass + + with open(workspace_file, "w") as output_file: + output_file.write(output_string) + + +def _TargetFromSpec(old_spec, params): + """ Create fake target for xcode-ninja wrapper. """ + # Determine ninja top level build dir (e.g. /path/to/out). + ninja_toplevel = None + jobs = 0 + if params: + options = params["options"] + ninja_toplevel = os.path.join( + options.toplevel_dir, gyp.generator.ninja.ComputeOutputDir(params) + ) + jobs = params.get("generator_flags", {}).get("xcode_ninja_jobs", 0) + + target_name = old_spec.get("target_name") + product_name = old_spec.get("product_name", target_name) + product_extension = old_spec.get("product_extension") + + ninja_target = {} + ninja_target["target_name"] = target_name + ninja_target["product_name"] = product_name + if product_extension: + ninja_target["product_extension"] = product_extension + ninja_target["toolset"] = old_spec.get("toolset") + ninja_target["default_configuration"] = old_spec.get("default_configuration") + ninja_target["configurations"] = {} + + # Tell Xcode to look in |ninja_toplevel| for build products. + new_xcode_settings = {} + if ninja_toplevel: + new_xcode_settings["CONFIGURATION_BUILD_DIR"] = ( + "%s/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" % ninja_toplevel + ) + + if "configurations" in old_spec: + for config in old_spec["configurations"]: + old_xcode_settings = old_spec["configurations"][config].get( + "xcode_settings", {} + ) + if "IPHONEOS_DEPLOYMENT_TARGET" in old_xcode_settings: + new_xcode_settings["CODE_SIGNING_REQUIRED"] = "NO" + new_xcode_settings["IPHONEOS_DEPLOYMENT_TARGET"] = old_xcode_settings[ + "IPHONEOS_DEPLOYMENT_TARGET" + ] + for key in ["BUNDLE_LOADER", "TEST_HOST"]: + if key in old_xcode_settings: + new_xcode_settings[key] = old_xcode_settings[key] + + ninja_target["configurations"][config] = {} + ninja_target["configurations"][config][ + "xcode_settings" + ] = new_xcode_settings + + ninja_target["mac_bundle"] = old_spec.get("mac_bundle", 0) + ninja_target["mac_xctest_bundle"] = old_spec.get("mac_xctest_bundle", 0) + ninja_target["ios_app_extension"] = old_spec.get("ios_app_extension", 0) + ninja_target["ios_watchkit_extension"] = old_spec.get("ios_watchkit_extension", 0) + ninja_target["ios_watchkit_app"] = old_spec.get("ios_watchkit_app", 0) + ninja_target["type"] = old_spec["type"] + if ninja_toplevel: + ninja_target["actions"] = [ + { + "action_name": "Compile and copy %s via ninja" % target_name, + "inputs": [], + "outputs": [], + "action": [ + "env", + "PATH=%s" % os.environ["PATH"], + "ninja", + "-C", + new_xcode_settings["CONFIGURATION_BUILD_DIR"], + target_name, + ], + "message": "Compile and copy %s via ninja" % target_name, + }, + ] + if jobs > 0: + ninja_target["actions"][0]["action"].extend(("-j", jobs)) + return ninja_target + + +def IsValidTargetForWrapper(target_extras, executable_target_pattern, spec): + """Limit targets for Xcode wrapper. + + Xcode sometimes performs poorly with too many targets, so only include + proper executable targets, with filters to customize. + Arguments: + target_extras: Regular expression to always add, matching any target. + executable_target_pattern: Regular expression limiting executable targets. + spec: Specifications for target. + """ + target_name = spec.get("target_name") + # Always include targets matching target_extras. + if target_extras is not None and re.search(target_extras, target_name): + return True + + # Otherwise just show executable targets and xc_tests. + if int(spec.get("mac_xctest_bundle", 0)) != 0 or ( + spec.get("type", "") == "executable" + and spec.get("product_extension", "") != "bundle" + ): + + # If there is a filter and the target does not match, exclude the target. + if executable_target_pattern is not None: + if not re.search(executable_target_pattern, target_name): + return False + return True + return False + + +def CreateWrapper(target_list, target_dicts, data, params): + """Initialize targets for the ninja wrapper. + + This sets up the necessary variables in the targets to generate Xcode projects + that use ninja as an external builder. + Arguments: + target_list: List of target pairs: 'base/base.gyp:base'. + target_dicts: Dict of target properties keyed on target pair. + data: Dict of flattened build files keyed on gyp path. + params: Dict of global options for gyp. + """ + orig_gyp = params["build_files"][0] + for gyp_name, gyp_dict in data.items(): + if gyp_name == orig_gyp: + depth = gyp_dict["_DEPTH"] + + # Check for custom main gyp name, otherwise use the default CHROMIUM_GYP_FILE + # and prepend .ninja before the .gyp extension. + generator_flags = params.get("generator_flags", {}) + main_gyp = generator_flags.get("xcode_ninja_main_gyp", None) + if main_gyp is None: + (build_file_root, build_file_ext) = os.path.splitext(orig_gyp) + main_gyp = build_file_root + ".ninja" + build_file_ext + + # Create new |target_list|, |target_dicts| and |data| data structures. + new_target_list = [] + new_target_dicts = {} + new_data = {} + + # Set base keys needed for |data|. + new_data[main_gyp] = {} + new_data[main_gyp]["included_files"] = [] + new_data[main_gyp]["targets"] = [] + new_data[main_gyp]["xcode_settings"] = data[orig_gyp].get("xcode_settings", {}) + + # Normally the xcode-ninja generator includes only valid executable targets. + # If |xcode_ninja_executable_target_pattern| is set, that list is reduced to + # executable targets that match the pattern. (Default all) + executable_target_pattern = generator_flags.get( + "xcode_ninja_executable_target_pattern", None + ) + + # For including other non-executable targets, add the matching target name + # to the |xcode_ninja_target_pattern| regular expression. (Default none) + target_extras = generator_flags.get("xcode_ninja_target_pattern", None) + + for old_qualified_target in target_list: + spec = target_dicts[old_qualified_target] + if IsValidTargetForWrapper(target_extras, executable_target_pattern, spec): + # Add to new_target_list. + target_name = spec.get("target_name") + new_target_name = f"{main_gyp}:{target_name}#target" + new_target_list.append(new_target_name) + + # Add to new_target_dicts. + new_target_dicts[new_target_name] = _TargetFromSpec(spec, params) + + # Add to new_data. + for old_target in data[old_qualified_target.split(":")[0]]["targets"]: + if old_target["target_name"] == target_name: + new_data_target = {} + new_data_target["target_name"] = old_target["target_name"] + new_data_target["toolset"] = old_target["toolset"] + new_data[main_gyp]["targets"].append(new_data_target) + + # Create sources target. + sources_target_name = "sources_for_indexing" + sources_target = _TargetFromSpec( + { + "target_name": sources_target_name, + "toolset": "target", + "default_configuration": "Default", + "mac_bundle": "0", + "type": "executable", + }, + None, + ) + + # Tell Xcode to look everywhere for headers. + sources_target["configurations"] = {"Default": {"include_dirs": [depth]}} + + # Put excluded files into the sources target so they can be opened in Xcode. + skip_excluded_files = not generator_flags.get( + "xcode_ninja_list_excluded_files", True + ) + + sources = [] + for target, target_dict in target_dicts.items(): + base = os.path.dirname(target) + files = target_dict.get("sources", []) + target_dict.get( + "mac_bundle_resources", [] + ) + + if not skip_excluded_files: + files.extend( + target_dict.get("sources_excluded", []) + + target_dict.get("mac_bundle_resources_excluded", []) + ) + + for action in target_dict.get("actions", []): + files.extend(action.get("inputs", [])) + + if not skip_excluded_files: + files.extend(action.get("inputs_excluded", [])) + + # Remove files starting with $. These are mostly intermediate files for the + # build system. + files = [file for file in files if not file.startswith("$")] + + # Make sources relative to root build file. + relative_path = os.path.dirname(main_gyp) + sources += [ + os.path.relpath(os.path.join(base, file), relative_path) for file in files + ] + + sources_target["sources"] = sorted(set(sources)) + + # Put sources_to_index in it's own gyp. + sources_gyp = os.path.join(os.path.dirname(main_gyp), sources_target_name + ".gyp") + fully_qualified_target_name = f"{sources_gyp}:{sources_target_name}#target" + + # Add to new_target_list, new_target_dicts and new_data. + new_target_list.append(fully_qualified_target_name) + new_target_dicts[fully_qualified_target_name] = sources_target + new_data_target = {} + new_data_target["target_name"] = sources_target["target_name"] + new_data_target["_DEPTH"] = depth + new_data_target["toolset"] = "target" + new_data[sources_gyp] = {} + new_data[sources_gyp]["targets"] = [] + new_data[sources_gyp]["included_files"] = [] + new_data[sources_gyp]["xcode_settings"] = data[orig_gyp].get("xcode_settings", {}) + new_data[sources_gyp]["targets"].append(new_data_target) + + # Write workspace to file. + _WriteWorkspace(main_gyp, sources_gyp, params) + return (new_target_list, new_target_dicts, new_data) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py new file mode 100644 index 0000000000000..4e0ec5e8828f7 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py @@ -0,0 +1,3197 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Xcode project file generator. + +This module is both an Xcode project file generator and a documentation of the +Xcode project file format. Knowledge of the project file format was gained +based on extensive experience with Xcode, and by making changes to projects in +Xcode.app and observing the resultant changes in the associated project files. + +XCODE PROJECT FILES + +The generator targets the file format as written by Xcode 3.2 (specifically, +3.2.6), but past experience has taught that the format has not changed +significantly in the past several years, and future versions of Xcode are able +to read older project files. + +Xcode project files are "bundled": the project "file" from an end-user's +perspective is actually a directory with an ".xcodeproj" extension. The +project file from this module's perspective is actually a file inside this +directory, always named "project.pbxproj". This file contains a complete +description of the project and is all that is needed to use the xcodeproj. +Other files contained in the xcodeproj directory are simply used to store +per-user settings, such as the state of various UI elements in the Xcode +application. + +The project.pbxproj file is a property list, stored in a format almost +identical to the NeXTstep property list format. The file is able to carry +Unicode data, and is encoded in UTF-8. The root element in the property list +is a dictionary that contains several properties of minimal interest, and two +properties of immense interest. The most important property is a dictionary +named "objects". The entire structure of the project is represented by the +children of this property. The objects dictionary is keyed by unique 96-bit +values represented by 24 uppercase hexadecimal characters. Each value in the +objects dictionary is itself a dictionary, describing an individual object. + +Each object in the dictionary is a member of a class, which is identified by +the "isa" property of each object. A variety of classes are represented in a +project file. Objects can refer to other objects by ID, using the 24-character +hexadecimal object key. A project's objects form a tree, with a root object +of class PBXProject at the root. As an example, the PBXProject object serves +as parent to an XCConfigurationList object defining the build configurations +used in the project, a PBXGroup object serving as a container for all files +referenced in the project, and a list of target objects, each of which defines +a target in the project. There are several different types of target object, +such as PBXNativeTarget and PBXAggregateTarget. In this module, this +relationship is expressed by having each target type derive from an abstract +base named XCTarget. + +The project.pbxproj file's root dictionary also contains a property, sibling to +the "objects" dictionary, named "rootObject". The value of rootObject is a +24-character object key referring to the root PBXProject object in the +objects dictionary. + +In Xcode, every file used as input to a target or produced as a final product +of a target must appear somewhere in the hierarchy rooted at the PBXGroup +object referenced by the PBXProject's mainGroup property. A PBXGroup is +generally represented as a folder in the Xcode application. PBXGroups can +contain other PBXGroups as well as PBXFileReferences, which are pointers to +actual files. + +Each XCTarget contains a list of build phases, represented in this module by +the abstract base XCBuildPhase. Examples of concrete XCBuildPhase derivations +are PBXSourcesBuildPhase and PBXFrameworksBuildPhase, which correspond to the +"Compile Sources" and "Link Binary With Libraries" phases displayed in the +Xcode application. Files used as input to these phases (for example, source +files in the former case and libraries and frameworks in the latter) are +represented by PBXBuildFile objects, referenced by elements of "files" lists +in XCTarget objects. Each PBXBuildFile object refers to a PBXBuildFile +object as a "weak" reference: it does not "own" the PBXBuildFile, which is +owned by the root object's mainGroup or a descendant group. In most cases, the +layer of indirection between an XCBuildPhase and a PBXFileReference via a +PBXBuildFile appears extraneous, but there's actually one reason for this: +file-specific compiler flags are added to the PBXBuildFile object so as to +allow a single file to be a member of multiple targets while having distinct +compiler flags for each. These flags can be modified in the Xcode applciation +in the "Build" tab of a File Info window. + +When a project is open in the Xcode application, Xcode will rewrite it. As +such, this module is careful to adhere to the formatting used by Xcode, to +avoid insignificant changes appearing in the file when it is used in the +Xcode application. This will keep version control repositories happy, and +makes it possible to compare a project file used in Xcode to one generated by +this module to determine if any significant changes were made in the +application. + +Xcode has its own way of assigning 24-character identifiers to each object, +which is not duplicated here. Because the identifier only is only generated +once, when an object is created, and is then left unchanged, there is no need +to attempt to duplicate Xcode's behavior in this area. The generator is free +to select any identifier, even at random, to refer to the objects it creates, +and Xcode will retain those identifiers and use them when subsequently +rewriting the project file. However, the generator would choose new random +identifiers each time the project files are generated, leading to difficulties +comparing "used" project files to "pristine" ones produced by this module, +and causing the appearance of changes as every object identifier is changed +when updated projects are checked in to a version control repository. To +mitigate this problem, this module chooses identifiers in a more deterministic +way, by hashing a description of each object as well as its parent and ancestor +objects. This strategy should result in minimal "shift" in IDs as successive +generations of project files are produced. + +THIS MODULE + +This module introduces several classes, all derived from the XCObject class. +Nearly all of the "brains" are built into the XCObject class, which understands +how to create and modify objects, maintain the proper tree structure, compute +identifiers, and print objects. For the most part, classes derived from +XCObject need only provide a _schema class object, a dictionary that +expresses what properties objects of the class may contain. + +Given this structure, it's possible to build a minimal project file by creating +objects of the appropriate types and making the proper connections: + + config_list = XCConfigurationList() + group = PBXGroup() + project = PBXProject({'buildConfigurationList': config_list, + 'mainGroup': group}) + +With the project object set up, it can be added to an XCProjectFile object. +XCProjectFile is a pseudo-class in the sense that it is a concrete XCObject +subclass that does not actually correspond to a class type found in a project +file. Rather, it is used to represent the project file's root dictionary. +Printing an XCProjectFile will print the entire project file, including the +full "objects" dictionary. + + project_file = XCProjectFile({'rootObject': project}) + project_file.ComputeIDs() + project_file.Print() + +Xcode project files are always encoded in UTF-8. This module will accept +strings of either the str class or the unicode class. Strings of class str +are assumed to already be encoded in UTF-8. Obviously, if you're just using +ASCII, you won't encounter difficulties because ASCII is a UTF-8 subset. +Strings of class unicode are handled properly and encoded in UTF-8 when +a project file is output. +""" + +import gyp.common +from functools import cmp_to_key +import hashlib +from operator import attrgetter +import posixpath +import re +import struct +import sys + + +def cmp(x, y): + return (x > y) - (x < y) + + +# See XCObject._EncodeString. This pattern is used to determine when a string +# can be printed unquoted. Strings that match this pattern may be printed +# unquoted. Strings that do not match must be quoted and may be further +# transformed to be properly encoded. Note that this expression matches the +# characters listed with "+", for 1 or more occurrences: if a string is empty, +# it must not match this pattern, because it needs to be encoded as "". +_unquoted = re.compile("^[A-Za-z0-9$./_]+$") + +# Strings that match this pattern are quoted regardless of what _unquoted says. +# Oddly, Xcode will quote any string with a run of three or more underscores. +_quoted = re.compile("___") + +# This pattern should match any character that needs to be escaped by +# XCObject._EncodeString. See that function. +_escaped = re.compile('[\\\\"]|[\x00-\x1f]') + + +# Used by SourceTreeAndPathFromPath +_path_leading_variable = re.compile(r"^\$\((.*?)\)(/(.*))?$") + + +def SourceTreeAndPathFromPath(input_path): + """Given input_path, returns a tuple with sourceTree and path values. + + Examples: + input_path (source_tree, output_path) + '$(VAR)/path' ('VAR', 'path') + '$(VAR)' ('VAR', None) + 'path' (None, 'path') + """ + + source_group_match = _path_leading_variable.match(input_path) + if source_group_match: + source_tree = source_group_match.group(1) + output_path = source_group_match.group(3) # This may be None. + else: + source_tree = None + output_path = input_path + + return (source_tree, output_path) + + +def ConvertVariablesToShellSyntax(input_string): + return re.sub(r"\$\((.*?)\)", "${\\1}", input_string) + + +class XCObject: + """The abstract base of all class types used in Xcode project files. + + Class variables: + _schema: A dictionary defining the properties of this class. The keys to + _schema are string property keys as used in project files. Values + are a list of four or five elements: + [ is_list, property_type, is_strong, is_required, default ] + is_list: True if the property described is a list, as opposed + to a single element. + property_type: The type to use as the value of the property, + or if is_list is True, the type to use for each + element of the value's list. property_type must + be an XCObject subclass, or one of the built-in + types str, int, or dict. + is_strong: If property_type is an XCObject subclass, is_strong + is True to assert that this class "owns," or serves + as parent, to the property value (or, if is_list is + True, values). is_strong must be False if + property_type is not an XCObject subclass. + is_required: True if the property is required for the class. + Note that is_required being True does not preclude + an empty string ("", in the case of property_type + str) or list ([], in the case of is_list True) from + being set for the property. + default: Optional. If is_required is True, default may be set + to provide a default value for objects that do not supply + their own value. If is_required is True and default + is not provided, users of the class must supply their own + value for the property. + Note that although the values of the array are expressed in + boolean terms, subclasses provide values as integers to conserve + horizontal space. + _should_print_single_line: False in XCObject. Subclasses whose objects + should be written to the project file in the + alternate single-line format, such as + PBXFileReference and PBXBuildFile, should + set this to True. + _encode_transforms: Used by _EncodeString to encode unprintable characters. + The index into this list is the ordinal of the + character to transform; each value is a string + used to represent the character in the output. XCObject + provides an _encode_transforms list suitable for most + XCObject subclasses. + _alternate_encode_transforms: Provided for subclasses that wish to use + the alternate encoding rules. Xcode seems + to use these rules when printing objects in + single-line format. Subclasses that desire + this behavior should set _encode_transforms + to _alternate_encode_transforms. + _hashables: A list of XCObject subclasses that can be hashed by ComputeIDs + to construct this object's ID. Most classes that need custom + hashing behavior should do it by overriding Hashables, + but in some cases an object's parent may wish to push a + hashable value into its child, and it can do so by appending + to _hashables. + Attributes: + id: The object's identifier, a 24-character uppercase hexadecimal string. + Usually, objects being created should not set id until the entire + project file structure is built. At that point, UpdateIDs() should + be called on the root object to assign deterministic values for id to + each object in the tree. + parent: The object's parent. This is set by a parent XCObject when a child + object is added to it. + _properties: The object's property dictionary. An object's properties are + described by its class' _schema variable. + """ + + _schema = {} + _should_print_single_line = False + + # See _EncodeString. + _encode_transforms = [] + i = 0 + while i < ord(" "): + _encode_transforms.append("\\U%04x" % i) + i = i + 1 + _encode_transforms[7] = "\\a" + _encode_transforms[8] = "\\b" + _encode_transforms[9] = "\\t" + _encode_transforms[10] = "\\n" + _encode_transforms[11] = "\\v" + _encode_transforms[12] = "\\f" + _encode_transforms[13] = "\\n" + + _alternate_encode_transforms = list(_encode_transforms) + _alternate_encode_transforms[9] = chr(9) + _alternate_encode_transforms[10] = chr(10) + _alternate_encode_transforms[11] = chr(11) + + def __init__(self, properties=None, id=None, parent=None): + self.id = id + self.parent = parent + self._properties = {} + self._hashables = [] + self._SetDefaultsFromSchema() + self.UpdateProperties(properties) + + def __repr__(self): + try: + name = self.Name() + except NotImplementedError: + return f"<{self.__class__.__name__} at 0x{id(self):x}>" + return f"<{self.__class__.__name__} {name!r} at 0x{id(self):x}>" + + def Copy(self): + """Make a copy of this object. + + The new object will have its own copy of lists and dicts. Any XCObject + objects owned by this object (marked "strong") will be copied in the + new object, even those found in lists. If this object has any weak + references to other XCObjects, the same references are added to the new + object without making a copy. + """ + + that = self.__class__(id=self.id, parent=self.parent) + for key, value in self._properties.items(): + is_strong = self._schema[key][2] + + if isinstance(value, XCObject): + if is_strong: + new_value = value.Copy() + new_value.parent = that + that._properties[key] = new_value + else: + that._properties[key] = value + elif isinstance(value, (str, int)): + that._properties[key] = value + elif isinstance(value, list): + if is_strong: + # If is_strong is True, each element is an XCObject, so it's safe to + # call Copy. + that._properties[key] = [] + for item in value: + new_item = item.Copy() + new_item.parent = that + that._properties[key].append(new_item) + else: + that._properties[key] = value[:] + elif isinstance(value, dict): + # dicts are never strong. + if is_strong: + raise TypeError( + "Strong dict for key " + key + " in " + self.__class__.__name__ + ) + else: + that._properties[key] = value.copy() + else: + raise TypeError( + "Unexpected type " + + value.__class__.__name__ + + " for key " + + key + + " in " + + self.__class__.__name__ + ) + + return that + + def Name(self): + """Return the name corresponding to an object. + + Not all objects necessarily need to be nameable, and not all that do have + a "name" property. Override as needed. + """ + + # If the schema indicates that "name" is required, try to access the + # property even if it doesn't exist. This will result in a KeyError + # being raised for the property that should be present, which seems more + # appropriate than NotImplementedError in this case. + if "name" in self._properties or ( + "name" in self._schema and self._schema["name"][3] + ): + return self._properties["name"] + + raise NotImplementedError(self.__class__.__name__ + " must implement Name") + + def Comment(self): + """Return a comment string for the object. + + Most objects just use their name as the comment, but PBXProject uses + different values. + + The returned comment is not escaped and does not have any comment marker + strings applied to it. + """ + + return self.Name() + + def Hashables(self): + hashables = [self.__class__.__name__] + + name = self.Name() + if name is not None: + hashables.append(name) + + hashables.extend(self._hashables) + + return hashables + + def HashablesForChild(self): + return None + + def ComputeIDs(self, recursive=True, overwrite=True, seed_hash=None): + """Set "id" properties deterministically. + + An object's "id" property is set based on a hash of its class type and + name, as well as the class type and name of all ancestor objects. As + such, it is only advisable to call ComputeIDs once an entire project file + tree is built. + + If recursive is True, recurse into all descendant objects and update their + hashes. + + If overwrite is True, any existing value set in the "id" property will be + replaced. + """ + + def _HashUpdate(hash, data): + """Update hash with data's length and contents. + + If the hash were updated only with the value of data, it would be + possible for clowns to induce collisions by manipulating the names of + their objects. By adding the length, it's exceedingly less likely that + ID collisions will be encountered, intentionally or not. + """ + + hash.update(struct.pack(">i", len(data))) + if isinstance(data, str): + data = data.encode("utf-8") + hash.update(data) + + if seed_hash is None: + seed_hash = hashlib.sha1() + + hash = seed_hash.copy() + + hashables = self.Hashables() + assert len(hashables) > 0 + for hashable in hashables: + _HashUpdate(hash, hashable) + + if recursive: + hashables_for_child = self.HashablesForChild() + if hashables_for_child is None: + child_hash = hash + else: + assert len(hashables_for_child) > 0 + child_hash = seed_hash.copy() + for hashable in hashables_for_child: + _HashUpdate(child_hash, hashable) + + for child in self.Children(): + child.ComputeIDs(recursive, overwrite, child_hash) + + if overwrite or self.id is None: + # Xcode IDs are only 96 bits (24 hex characters), but a SHA-1 digest is + # is 160 bits. Instead of throwing out 64 bits of the digest, xor them + # into the portion that gets used. + assert hash.digest_size % 4 == 0 + digest_int_count = hash.digest_size // 4 + digest_ints = struct.unpack(">" + "I" * digest_int_count, hash.digest()) + id_ints = [0, 0, 0] + for index in range(0, digest_int_count): + id_ints[index % 3] ^= digest_ints[index] + self.id = "%08X%08X%08X" % tuple(id_ints) + + def EnsureNoIDCollisions(self): + """Verifies that no two objects have the same ID. Checks all descendants. + """ + + ids = {} + descendants = self.Descendants() + for descendant in descendants: + if descendant.id in ids: + other = ids[descendant.id] + raise KeyError( + 'Duplicate ID %s, objects "%s" and "%s" in "%s"' + % ( + descendant.id, + str(descendant._properties), + str(other._properties), + self._properties["rootObject"].Name(), + ) + ) + ids[descendant.id] = descendant + + def Children(self): + """Returns a list of all of this object's owned (strong) children.""" + + children = [] + for property, attributes in self._schema.items(): + (is_list, property_type, is_strong) = attributes[0:3] + if is_strong and property in self._properties: + if not is_list: + children.append(self._properties[property]) + else: + children.extend(self._properties[property]) + return children + + def Descendants(self): + """Returns a list of all of this object's descendants, including this + object. + """ + + children = self.Children() + descendants = [self] + for child in children: + descendants.extend(child.Descendants()) + return descendants + + def PBXProjectAncestor(self): + # The base case for recursion is defined at PBXProject.PBXProjectAncestor. + if self.parent: + return self.parent.PBXProjectAncestor() + return None + + def _EncodeComment(self, comment): + """Encodes a comment to be placed in the project file output, mimicking + Xcode behavior. + """ + + # This mimics Xcode behavior by wrapping the comment in "/*" and "*/". If + # the string already contains a "*/", it is turned into "(*)/". This keeps + # the file writer from outputting something that would be treated as the + # end of a comment in the middle of something intended to be entirely a + # comment. + + return "/* " + comment.replace("*/", "(*)/") + " */" + + def _EncodeTransform(self, match): + # This function works closely with _EncodeString. It will only be called + # by re.sub with match.group(0) containing a character matched by the + # the _escaped expression. + char = match.group(0) + + # Backslashes (\) and quotation marks (") are always replaced with a + # backslash-escaped version of the same. Everything else gets its + # replacement from the class' _encode_transforms array. + if char == "\\": + return "\\\\" + if char == '"': + return '\\"' + return self._encode_transforms[ord(char)] + + def _EncodeString(self, value): + """Encodes a string to be placed in the project file output, mimicking + Xcode behavior. + """ + + # Use quotation marks when any character outside of the range A-Z, a-z, 0-9, + # $ (dollar sign), . (period), and _ (underscore) is present. Also use + # quotation marks to represent empty strings. + # + # Escape " (double-quote) and \ (backslash) by preceding them with a + # backslash. + # + # Some characters below the printable ASCII range are encoded specially: + # 7 ^G BEL is encoded as "\a" + # 8 ^H BS is encoded as "\b" + # 11 ^K VT is encoded as "\v" + # 12 ^L NP is encoded as "\f" + # 127 ^? DEL is passed through as-is without escaping + # - In PBXFileReference and PBXBuildFile objects: + # 9 ^I HT is passed through as-is without escaping + # 10 ^J NL is passed through as-is without escaping + # 13 ^M CR is passed through as-is without escaping + # - In other objects: + # 9 ^I HT is encoded as "\t" + # 10 ^J NL is encoded as "\n" + # 13 ^M CR is encoded as "\n" rendering it indistinguishable from + # 10 ^J NL + # All other characters within the ASCII control character range (0 through + # 31 inclusive) are encoded as "\U001f" referring to the Unicode code point + # in hexadecimal. For example, character 14 (^N SO) is encoded as "\U000e". + # Characters above the ASCII range are passed through to the output encoded + # as UTF-8 without any escaping. These mappings are contained in the + # class' _encode_transforms list. + + if _unquoted.search(value) and not _quoted.search(value): + return value + + return '"' + _escaped.sub(self._EncodeTransform, value) + '"' + + def _XCPrint(self, file, tabs, line): + file.write("\t" * tabs + line) + + def _XCPrintableValue(self, tabs, value, flatten_list=False): + """Returns a representation of value that may be printed in a project file, + mimicking Xcode's behavior. + + _XCPrintableValue can handle str and int values, XCObjects (which are + made printable by returning their id property), and list and dict objects + composed of any of the above types. When printing a list or dict, and + _should_print_single_line is False, the tabs parameter is used to determine + how much to indent the lines corresponding to the items in the list or + dict. + + If flatten_list is True, single-element lists will be transformed into + strings. + """ + + printable = "" + comment = None + + if self._should_print_single_line: + sep = " " + element_tabs = "" + end_tabs = "" + else: + sep = "\n" + element_tabs = "\t" * (tabs + 1) + end_tabs = "\t" * tabs + + if isinstance(value, XCObject): + printable += value.id + comment = value.Comment() + elif isinstance(value, str): + printable += self._EncodeString(value) + elif isinstance(value, str): + printable += self._EncodeString(value.encode("utf-8")) + elif isinstance(value, int): + printable += str(value) + elif isinstance(value, list): + if flatten_list and len(value) <= 1: + if len(value) == 0: + printable += self._EncodeString("") + else: + printable += self._EncodeString(value[0]) + else: + printable = "(" + sep + for item in value: + printable += ( + element_tabs + + self._XCPrintableValue(tabs + 1, item, flatten_list) + + "," + + sep + ) + printable += end_tabs + ")" + elif isinstance(value, dict): + printable = "{" + sep + for item_key, item_value in sorted(value.items()): + printable += ( + element_tabs + + self._XCPrintableValue(tabs + 1, item_key, flatten_list) + + " = " + + self._XCPrintableValue(tabs + 1, item_value, flatten_list) + + ";" + + sep + ) + printable += end_tabs + "}" + else: + raise TypeError("Can't make " + value.__class__.__name__ + " printable") + + if comment: + printable += " " + self._EncodeComment(comment) + + return printable + + def _XCKVPrint(self, file, tabs, key, value): + """Prints a key and value, members of an XCObject's _properties dictionary, + to file. + + tabs is an int identifying the indentation level. If the class' + _should_print_single_line variable is True, tabs is ignored and the + key-value pair will be followed by a space insead of a newline. + """ + + if self._should_print_single_line: + printable = "" + after_kv = " " + else: + printable = "\t" * tabs + after_kv = "\n" + + # Xcode usually prints remoteGlobalIDString values in PBXContainerItemProxy + # objects without comments. Sometimes it prints them with comments, but + # the majority of the time, it doesn't. To avoid unnecessary changes to + # the project file after Xcode opens it, don't write comments for + # remoteGlobalIDString. This is a sucky hack and it would certainly be + # cleaner to extend the schema to indicate whether or not a comment should + # be printed, but since this is the only case where the problem occurs and + # Xcode itself can't seem to make up its mind, the hack will suffice. + # + # Also see PBXContainerItemProxy._schema['remoteGlobalIDString']. + if key == "remoteGlobalIDString" and isinstance(self, PBXContainerItemProxy): + value_to_print = value.id + else: + value_to_print = value + + # PBXBuildFile's settings property is represented in the output as a dict, + # but a hack here has it represented as a string. Arrange to strip off the + # quotes so that it shows up in the output as expected. + if key == "settings" and isinstance(self, PBXBuildFile): + strip_value_quotes = True + else: + strip_value_quotes = False + + # In another one-off, let's set flatten_list on buildSettings properties + # of XCBuildConfiguration objects, because that's how Xcode treats them. + if key == "buildSettings" and isinstance(self, XCBuildConfiguration): + flatten_list = True + else: + flatten_list = False + + try: + printable_key = self._XCPrintableValue(tabs, key, flatten_list) + printable_value = self._XCPrintableValue(tabs, value_to_print, flatten_list) + if ( + strip_value_quotes + and len(printable_value) > 1 + and printable_value[0] == '"' + and printable_value[-1] == '"' + ): + printable_value = printable_value[1:-1] + printable += printable_key + " = " + printable_value + ";" + after_kv + except TypeError as e: + gyp.common.ExceptionAppend(e, 'while printing key "%s"' % key) + raise + + self._XCPrint(file, 0, printable) + + def Print(self, file=sys.stdout): + """Prints a reprentation of this object to file, adhering to Xcode output + formatting. + """ + + self.VerifyHasRequiredProperties() + + if self._should_print_single_line: + # When printing an object in a single line, Xcode doesn't put any space + # between the beginning of a dictionary (or presumably a list) and the + # first contained item, so you wind up with snippets like + # ...CDEF = {isa = PBXFileReference; fileRef = 0123... + # If it were me, I would have put a space in there after the opening + # curly, but I guess this is just another one of those inconsistencies + # between how Xcode prints PBXFileReference and PBXBuildFile objects as + # compared to other objects. Mimic Xcode's behavior here by using an + # empty string for sep. + sep = "" + end_tabs = 0 + else: + sep = "\n" + end_tabs = 2 + + # Start the object. For example, '\t\tPBXProject = {\n'. + self._XCPrint(file, 2, self._XCPrintableValue(2, self) + " = {" + sep) + + # "isa" isn't in the _properties dictionary, it's an intrinsic property + # of the class which the object belongs to. Xcode always outputs "isa" + # as the first element of an object dictionary. + self._XCKVPrint(file, 3, "isa", self.__class__.__name__) + + # The remaining elements of an object dictionary are sorted alphabetically. + for property, value in sorted(self._properties.items()): + self._XCKVPrint(file, 3, property, value) + + # End the object. + self._XCPrint(file, end_tabs, "};\n") + + def UpdateProperties(self, properties, do_copy=False): + """Merge the supplied properties into the _properties dictionary. + + The input properties must adhere to the class schema or a KeyError or + TypeError exception will be raised. If adding an object of an XCObject + subclass and the schema indicates a strong relationship, the object's + parent will be set to this object. + + If do_copy is True, then lists, dicts, strong-owned XCObjects, and + strong-owned XCObjects in lists will be copied instead of having their + references added. + """ + + if properties is None: + return + + for property, value in properties.items(): + # Make sure the property is in the schema. + if property not in self._schema: + raise KeyError(property + " not in " + self.__class__.__name__) + + # Make sure the property conforms to the schema. + (is_list, property_type, is_strong) = self._schema[property][0:3] + if is_list: + if value.__class__ != list: + raise TypeError( + property + + " of " + + self.__class__.__name__ + + " must be list, not " + + value.__class__.__name__ + ) + for item in value: + if not isinstance(item, property_type) and not ( + isinstance(item, str) and property_type == str + ): + # Accept unicode where str is specified. str is treated as + # UTF-8-encoded. + raise TypeError( + "item of " + + property + + " of " + + self.__class__.__name__ + + " must be " + + property_type.__name__ + + ", not " + + item.__class__.__name__ + ) + elif not isinstance(value, property_type) and not ( + isinstance(value, str) and property_type == str + ): + # Accept unicode where str is specified. str is treated as + # UTF-8-encoded. + raise TypeError( + property + + " of " + + self.__class__.__name__ + + " must be " + + property_type.__name__ + + ", not " + + value.__class__.__name__ + ) + + # Checks passed, perform the assignment. + if do_copy: + if isinstance(value, XCObject): + if is_strong: + self._properties[property] = value.Copy() + else: + self._properties[property] = value + elif isinstance(value, (str, int)): + self._properties[property] = value + elif isinstance(value, list): + if is_strong: + # If is_strong is True, each element is an XCObject, + # so it's safe to call Copy. + self._properties[property] = [] + for item in value: + self._properties[property].append(item.Copy()) + else: + self._properties[property] = value[:] + elif isinstance(value, dict): + self._properties[property] = value.copy() + else: + raise TypeError( + "Don't know how to copy a " + + value.__class__.__name__ + + " object for " + + property + + " in " + + self.__class__.__name__ + ) + else: + self._properties[property] = value + + # Set up the child's back-reference to this object. Don't use |value| + # any more because it may not be right if do_copy is true. + if is_strong: + if not is_list: + self._properties[property].parent = self + else: + for item in self._properties[property]: + item.parent = self + + def HasProperty(self, key): + return key in self._properties + + def GetProperty(self, key): + return self._properties[key] + + def SetProperty(self, key, value): + self.UpdateProperties({key: value}) + + def DelProperty(self, key): + if key in self._properties: + del self._properties[key] + + def AppendProperty(self, key, value): + # TODO(mark): Support ExtendProperty too (and make this call that)? + + # Schema validation. + if key not in self._schema: + raise KeyError(key + " not in " + self.__class__.__name__) + + (is_list, property_type, is_strong) = self._schema[key][0:3] + if not is_list: + raise TypeError(key + " of " + self.__class__.__name__ + " must be list") + if not isinstance(value, property_type): + raise TypeError( + "item of " + + key + + " of " + + self.__class__.__name__ + + " must be " + + property_type.__name__ + + ", not " + + value.__class__.__name__ + ) + + # If the property doesn't exist yet, create a new empty list to receive the + # item. + self._properties[key] = self._properties.get(key, []) + + # Set up the ownership link. + if is_strong: + value.parent = self + + # Store the item. + self._properties[key].append(value) + + def VerifyHasRequiredProperties(self): + """Ensure that all properties identified as required by the schema are + set. + """ + + # TODO(mark): A stronger verification mechanism is needed. Some + # subclasses need to perform validation beyond what the schema can enforce. + for property, attributes in self._schema.items(): + (is_list, property_type, is_strong, is_required) = attributes[0:4] + if is_required and property not in self._properties: + raise KeyError(self.__class__.__name__ + " requires " + property) + + def _SetDefaultsFromSchema(self): + """Assign object default values according to the schema. This will not + overwrite properties that have already been set.""" + + defaults = {} + for property, attributes in self._schema.items(): + (is_list, property_type, is_strong, is_required) = attributes[0:4] + if ( + is_required + and len(attributes) >= 5 + and property not in self._properties + ): + default = attributes[4] + + defaults[property] = default + + if len(defaults) > 0: + # Use do_copy=True so that each new object gets its own copy of strong + # objects, lists, and dicts. + self.UpdateProperties(defaults, do_copy=True) + + +class XCHierarchicalElement(XCObject): + """Abstract base for PBXGroup and PBXFileReference. Not represented in a + project file.""" + + # TODO(mark): Do name and path belong here? Probably so. + # If path is set and name is not, name may have a default value. Name will + # be set to the basename of path, if the basename of path is different from + # the full value of path. If path is already just a leaf name, name will + # not be set. + _schema = XCObject._schema.copy() + _schema.update( + { + "comments": [0, str, 0, 0], + "fileEncoding": [0, str, 0, 0], + "includeInIndex": [0, int, 0, 0], + "indentWidth": [0, int, 0, 0], + "lineEnding": [0, int, 0, 0], + "sourceTree": [0, str, 0, 1, ""], + "tabWidth": [0, int, 0, 0], + "usesTabs": [0, int, 0, 0], + "wrapsLines": [0, int, 0, 0], + } + ) + + def __init__(self, properties=None, id=None, parent=None): + # super + XCObject.__init__(self, properties, id, parent) + if "path" in self._properties and "name" not in self._properties: + path = self._properties["path"] + name = posixpath.basename(path) + if name != "" and path != name: + self.SetProperty("name", name) + + if "path" in self._properties and ( + "sourceTree" not in self._properties + or self._properties["sourceTree"] == "" + ): + # If the pathname begins with an Xcode variable like "$(SDKROOT)/", take + # the variable out and make the path be relative to that variable by + # assigning the variable name as the sourceTree. + (source_tree, path) = SourceTreeAndPathFromPath(self._properties["path"]) + if source_tree is not None: + self._properties["sourceTree"] = source_tree + if path is not None: + self._properties["path"] = path + if ( + source_tree is not None + and path is None + and "name" not in self._properties + ): + # The path was of the form "$(SDKROOT)" with no path following it. + # This object is now relative to that variable, so it has no path + # attribute of its own. It does, however, keep a name. + del self._properties["path"] + self._properties["name"] = source_tree + + def Name(self): + if "name" in self._properties: + return self._properties["name"] + elif "path" in self._properties: + return self._properties["path"] + else: + # This happens in the case of the root PBXGroup. + return None + + def Hashables(self): + """Custom hashables for XCHierarchicalElements. + + XCHierarchicalElements are special. Generally, their hashes shouldn't + change if the paths don't change. The normal XCObject implementation of + Hashables adds a hashable for each object, which means that if + the hierarchical structure changes (possibly due to changes caused when + TakeOverOnlyChild runs and encounters slight changes in the hierarchy), + the hashes will change. For example, if a project file initially contains + a/b/f1 and a/b becomes collapsed into a/b, f1 will have a single parent + a/b. If someone later adds a/f2 to the project file, a/b can no longer be + collapsed, and f1 winds up with parent b and grandparent a. That would + be sufficient to change f1's hash. + + To counteract this problem, hashables for all XCHierarchicalElements except + for the main group (which has neither a name nor a path) are taken to be + just the set of path components. Because hashables are inherited from + parents, this provides assurance that a/b/f1 has the same set of hashables + whether its parent is b or a/b. + + The main group is a special case. As it is permitted to have no name or + path, it is permitted to use the standard XCObject hash mechanism. This + is not considered a problem because there can be only one main group. + """ + + if self == self.PBXProjectAncestor()._properties["mainGroup"]: + # super + return XCObject.Hashables(self) + + hashables = [] + + # Put the name in first, ensuring that if TakeOverOnlyChild collapses + # children into a top-level group like "Source", the name always goes + # into the list of hashables without interfering with path components. + if "name" in self._properties: + # Make it less likely for people to manipulate hashes by following the + # pattern of always pushing an object type value onto the list first. + hashables.append(self.__class__.__name__ + ".name") + hashables.append(self._properties["name"]) + + # NOTE: This still has the problem that if an absolute path is encountered, + # including paths with a sourceTree, they'll still inherit their parents' + # hashables, even though the paths aren't relative to their parents. This + # is not expected to be much of a problem in practice. + path = self.PathFromSourceTreeAndPath() + if path is not None: + components = path.split(posixpath.sep) + for component in components: + hashables.append(self.__class__.__name__ + ".path") + hashables.append(component) + + hashables.extend(self._hashables) + + return hashables + + def Compare(self, other): + # Allow comparison of these types. PBXGroup has the highest sort rank; + # PBXVariantGroup is treated as equal to PBXFileReference. + valid_class_types = { + PBXFileReference: "file", + PBXGroup: "group", + PBXVariantGroup: "file", + } + self_type = valid_class_types[self.__class__] + other_type = valid_class_types[other.__class__] + + if self_type == other_type: + # If the two objects are of the same sort rank, compare their names. + return cmp(self.Name(), other.Name()) + + # Otherwise, sort groups before everything else. + if self_type == "group": + return -1 + return 1 + + def CompareRootGroup(self, other): + # This function should be used only to compare direct children of the + # containing PBXProject's mainGroup. These groups should appear in the + # listed order. + # TODO(mark): "Build" is used by gyp.generator.xcode, perhaps the + # generator should have a way of influencing this list rather than having + # to hardcode for the generator here. + order = [ + "Source", + "Intermediates", + "Projects", + "Frameworks", + "Products", + "Build", + ] + + # If the groups aren't in the listed order, do a name comparison. + # Otherwise, groups in the listed order should come before those that + # aren't. + self_name = self.Name() + other_name = other.Name() + self_in = isinstance(self, PBXGroup) and self_name in order + other_in = isinstance(self, PBXGroup) and other_name in order + if not self_in and not other_in: + return self.Compare(other) + if self_name in order and other_name not in order: + return -1 + if other_name in order and self_name not in order: + return 1 + + # If both groups are in the listed order, go by the defined order. + self_index = order.index(self_name) + other_index = order.index(other_name) + if self_index < other_index: + return -1 + if self_index > other_index: + return 1 + return 0 + + def PathFromSourceTreeAndPath(self): + # Turn the object's sourceTree and path properties into a single flat + # string of a form comparable to the path parameter. If there's a + # sourceTree property other than "", wrap it in $(...) for the + # comparison. + components = [] + if self._properties["sourceTree"] != "": + components.append("$(" + self._properties["sourceTree"] + ")") + if "path" in self._properties: + components.append(self._properties["path"]) + + if len(components) > 0: + return posixpath.join(*components) + + return None + + def FullPath(self): + # Returns a full path to self relative to the project file, or relative + # to some other source tree. Start with self, and walk up the chain of + # parents prepending their paths, if any, until no more parents are + # available (project-relative path) or until a path relative to some + # source tree is found. + xche = self + path = None + while isinstance(xche, XCHierarchicalElement) and ( + path is None or (not path.startswith("/") and not path.startswith("$")) + ): + this_path = xche.PathFromSourceTreeAndPath() + if this_path is not None and path is not None: + path = posixpath.join(this_path, path) + elif this_path is not None: + path = this_path + xche = xche.parent + + return path + + +class PBXGroup(XCHierarchicalElement): + """ + Attributes: + _children_by_path: Maps pathnames of children of this PBXGroup to the + actual child XCHierarchicalElement objects. + _variant_children_by_name_and_path: Maps (name, path) tuples of + PBXVariantGroup children to the actual child PBXVariantGroup objects. + """ + + _schema = XCHierarchicalElement._schema.copy() + _schema.update( + { + "children": [1, XCHierarchicalElement, 1, 1, []], + "name": [0, str, 0, 0], + "path": [0, str, 0, 0], + } + ) + + def __init__(self, properties=None, id=None, parent=None): + # super + XCHierarchicalElement.__init__(self, properties, id, parent) + self._children_by_path = {} + self._variant_children_by_name_and_path = {} + for child in self._properties.get("children", []): + self._AddChildToDicts(child) + + def Hashables(self): + # super + hashables = XCHierarchicalElement.Hashables(self) + + # It is not sufficient to just rely on name and parent to build a unique + # hashable : a node could have two child PBXGroup sharing a common name. + # To add entropy the hashable is enhanced with the names of all its + # children. + for child in self._properties.get("children", []): + child_name = child.Name() + if child_name is not None: + hashables.append(child_name) + + return hashables + + def HashablesForChild(self): + # To avoid a circular reference the hashables used to compute a child id do + # not include the child names. + return XCHierarchicalElement.Hashables(self) + + def _AddChildToDicts(self, child): + # Sets up this PBXGroup object's dicts to reference the child properly. + child_path = child.PathFromSourceTreeAndPath() + if child_path: + if child_path in self._children_by_path: + raise ValueError("Found multiple children with path " + child_path) + self._children_by_path[child_path] = child + + if isinstance(child, PBXVariantGroup): + child_name = child._properties.get("name", None) + key = (child_name, child_path) + if key in self._variant_children_by_name_and_path: + raise ValueError( + "Found multiple PBXVariantGroup children with " + + "name " + + str(child_name) + + " and path " + + str(child_path) + ) + self._variant_children_by_name_and_path[key] = child + + def AppendChild(self, child): + # Callers should use this instead of calling + # AppendProperty('children', child) directly because this function + # maintains the group's dicts. + self.AppendProperty("children", child) + self._AddChildToDicts(child) + + def GetChildByName(self, name): + # This is not currently optimized with a dict as GetChildByPath is because + # it has few callers. Most callers probably want GetChildByPath. This + # function is only useful to get children that have names but no paths, + # which is rare. The children of the main group ("Source", "Products", + # etc.) is pretty much the only case where this likely to come up. + # + # TODO(mark): Maybe this should raise an error if more than one child is + # present with the same name. + if "children" not in self._properties: + return None + + for child in self._properties["children"]: + if child.Name() == name: + return child + + return None + + def GetChildByPath(self, path): + if not path: + return None + + if path in self._children_by_path: + return self._children_by_path[path] + + return None + + def GetChildByRemoteObject(self, remote_object): + # This method is a little bit esoteric. Given a remote_object, which + # should be a PBXFileReference in another project file, this method will + # return this group's PBXReferenceProxy object serving as a local proxy + # for the remote PBXFileReference. + # + # This function might benefit from a dict optimization as GetChildByPath + # for some workloads, but profiling shows that it's not currently a + # problem. + if "children" not in self._properties: + return None + + for child in self._properties["children"]: + if not isinstance(child, PBXReferenceProxy): + continue + + container_proxy = child._properties["remoteRef"] + if container_proxy._properties["remoteGlobalIDString"] == remote_object: + return child + + return None + + def AddOrGetFileByPath(self, path, hierarchical): + """Returns an existing or new file reference corresponding to path. + + If hierarchical is True, this method will create or use the necessary + hierarchical group structure corresponding to path. Otherwise, it will + look in and create an item in the current group only. + + If an existing matching reference is found, it is returned, otherwise, a + new one will be created, added to the correct group, and returned. + + If path identifies a directory by virtue of carrying a trailing slash, + this method returns a PBXFileReference of "folder" type. If path + identifies a variant, by virtue of it identifying a file inside a directory + with an ".lproj" extension, this method returns a PBXVariantGroup + containing the variant named by path, and possibly other variants. For + all other paths, a "normal" PBXFileReference will be returned. + """ + + # Adding or getting a directory? Directories end with a trailing slash. + is_dir = False + if path.endswith("/"): + is_dir = True + path = posixpath.normpath(path) + if is_dir: + path = path + "/" + + # Adding or getting a variant? Variants are files inside directories + # with an ".lproj" extension. Xcode uses variants for localization. For + # a variant path/to/Language.lproj/MainMenu.nib, put a variant group named + # MainMenu.nib inside path/to, and give it a variant named Language. In + # this example, grandparent would be set to path/to and parent_root would + # be set to Language. + variant_name = None + parent = posixpath.dirname(path) + grandparent = posixpath.dirname(parent) + parent_basename = posixpath.basename(parent) + (parent_root, parent_ext) = posixpath.splitext(parent_basename) + if parent_ext == ".lproj": + variant_name = parent_root + if grandparent == "": + grandparent = None + + # Putting a directory inside a variant group is not currently supported. + assert not is_dir or variant_name is None + + path_split = path.split(posixpath.sep) + if ( + len(path_split) == 1 + or ((is_dir or variant_name is not None) and len(path_split) == 2) + or not hierarchical + ): + # The PBXFileReference or PBXVariantGroup will be added to or gotten from + # this PBXGroup, no recursion necessary. + if variant_name is None: + # Add or get a PBXFileReference. + file_ref = self.GetChildByPath(path) + if file_ref is not None: + assert file_ref.__class__ == PBXFileReference + else: + file_ref = PBXFileReference({"path": path}) + self.AppendChild(file_ref) + else: + # Add or get a PBXVariantGroup. The variant group name is the same + # as the basename (MainMenu.nib in the example above). grandparent + # specifies the path to the variant group itself, and path_split[-2:] + # is the path of the specific variant relative to its group. + variant_group_name = posixpath.basename(path) + variant_group_ref = self.AddOrGetVariantGroupByNameAndPath( + variant_group_name, grandparent + ) + variant_path = posixpath.sep.join(path_split[-2:]) + variant_ref = variant_group_ref.GetChildByPath(variant_path) + if variant_ref is not None: + assert variant_ref.__class__ == PBXFileReference + else: + variant_ref = PBXFileReference( + {"name": variant_name, "path": variant_path} + ) + variant_group_ref.AppendChild(variant_ref) + # The caller is interested in the variant group, not the specific + # variant file. + file_ref = variant_group_ref + return file_ref + else: + # Hierarchical recursion. Add or get a PBXGroup corresponding to the + # outermost path component, and then recurse into it, chopping off that + # path component. + next_dir = path_split[0] + group_ref = self.GetChildByPath(next_dir) + if group_ref is not None: + assert group_ref.__class__ == PBXGroup + else: + group_ref = PBXGroup({"path": next_dir}) + self.AppendChild(group_ref) + return group_ref.AddOrGetFileByPath( + posixpath.sep.join(path_split[1:]), hierarchical + ) + + def AddOrGetVariantGroupByNameAndPath(self, name, path): + """Returns an existing or new PBXVariantGroup for name and path. + + If a PBXVariantGroup identified by the name and path arguments is already + present as a child of this object, it is returned. Otherwise, a new + PBXVariantGroup with the correct properties is created, added as a child, + and returned. + + This method will generally be called by AddOrGetFileByPath, which knows + when to create a variant group based on the structure of the pathnames + passed to it. + """ + + key = (name, path) + if key in self._variant_children_by_name_and_path: + variant_group_ref = self._variant_children_by_name_and_path[key] + assert variant_group_ref.__class__ == PBXVariantGroup + return variant_group_ref + + variant_group_properties = {"name": name} + if path is not None: + variant_group_properties["path"] = path + variant_group_ref = PBXVariantGroup(variant_group_properties) + self.AppendChild(variant_group_ref) + + return variant_group_ref + + def TakeOverOnlyChild(self, recurse=False): + """If this PBXGroup has only one child and it's also a PBXGroup, take + it over by making all of its children this object's children. + + This function will continue to take over only children when those children + are groups. If there are three PBXGroups representing a, b, and c, with + c inside b and b inside a, and a and b have no other children, this will + result in a taking over both b and c, forming a PBXGroup for a/b/c. + + If recurse is True, this function will recurse into children and ask them + to collapse themselves by taking over only children as well. Assuming + an example hierarchy with files at a/b/c/d1, a/b/c/d2, and a/b/c/d3/e/f + (d1, d2, and f are files, the rest are groups), recursion will result in + a group for a/b/c containing a group for d3/e. + """ + + # At this stage, check that child class types are PBXGroup exactly, + # instead of using isinstance. The only subclass of PBXGroup, + # PBXVariantGroup, should not participate in reparenting in the same way: + # reparenting by merging different object types would be wrong. + while ( + len(self._properties["children"]) == 1 + and self._properties["children"][0].__class__ == PBXGroup + ): + # Loop to take over the innermost only-child group possible. + + child = self._properties["children"][0] + + # Assume the child's properties, including its children. Save a copy + # of this object's old properties, because they'll still be needed. + # This object retains its existing id and parent attributes. + old_properties = self._properties + self._properties = child._properties + self._children_by_path = child._children_by_path + + if ( + "sourceTree" not in self._properties + or self._properties["sourceTree"] == "" + ): + # The child was relative to its parent. Fix up the path. Note that + # children with a sourceTree other than "" are not relative to + # their parents, so no path fix-up is needed in that case. + if "path" in old_properties: + if "path" in self._properties: + # Both the original parent and child have paths set. + self._properties["path"] = posixpath.join( + old_properties["path"], self._properties["path"] + ) + else: + # Only the original parent has a path, use it. + self._properties["path"] = old_properties["path"] + if "sourceTree" in old_properties: + # The original parent had a sourceTree set, use it. + self._properties["sourceTree"] = old_properties["sourceTree"] + + # If the original parent had a name set, keep using it. If the original + # parent didn't have a name but the child did, let the child's name + # live on. If the name attribute seems unnecessary now, get rid of it. + if "name" in old_properties and old_properties["name"] not in ( + None, + self.Name(), + ): + self._properties["name"] = old_properties["name"] + if ( + "name" in self._properties + and "path" in self._properties + and self._properties["name"] == self._properties["path"] + ): + del self._properties["name"] + + # Notify all children of their new parent. + for child in self._properties["children"]: + child.parent = self + + # If asked to recurse, recurse. + if recurse: + for child in self._properties["children"]: + if child.__class__ == PBXGroup: + child.TakeOverOnlyChild(recurse) + + def SortGroup(self): + self._properties["children"] = sorted( + self._properties["children"], key=cmp_to_key(lambda x, y: x.Compare(y)) + ) + + # Recurse. + for child in self._properties["children"]: + if isinstance(child, PBXGroup): + child.SortGroup() + + +class XCFileLikeElement(XCHierarchicalElement): + # Abstract base for objects that can be used as the fileRef property of + # PBXBuildFile. + + def PathHashables(self): + # A PBXBuildFile that refers to this object will call this method to + # obtain additional hashables specific to this XCFileLikeElement. Don't + # just use this object's hashables, they're not specific and unique enough + # on their own (without access to the parent hashables.) Instead, provide + # hashables that identify this object by path by getting its hashables as + # well as the hashables of ancestor XCHierarchicalElement objects. + + hashables = [] + xche = self + while isinstance(xche, XCHierarchicalElement): + xche_hashables = xche.Hashables() + for index, xche_hashable in enumerate(xche_hashables): + hashables.insert(index, xche_hashable) + xche = xche.parent + return hashables + + +class XCContainerPortal(XCObject): + # Abstract base for objects that can be used as the containerPortal property + # of PBXContainerItemProxy. + pass + + +class XCRemoteObject(XCObject): + # Abstract base for objects that can be used as the remoteGlobalIDString + # property of PBXContainerItemProxy. + pass + + +class PBXFileReference(XCFileLikeElement, XCContainerPortal, XCRemoteObject): + _schema = XCFileLikeElement._schema.copy() + _schema.update( + { + "explicitFileType": [0, str, 0, 0], + "lastKnownFileType": [0, str, 0, 0], + "name": [0, str, 0, 0], + "path": [0, str, 0, 1], + } + ) + + # Weird output rules for PBXFileReference. + _should_print_single_line = True + # super + _encode_transforms = XCFileLikeElement._alternate_encode_transforms + + def __init__(self, properties=None, id=None, parent=None): + # super + XCFileLikeElement.__init__(self, properties, id, parent) + if "path" in self._properties and self._properties["path"].endswith("/"): + self._properties["path"] = self._properties["path"][:-1] + is_dir = True + else: + is_dir = False + + if ( + "path" in self._properties + and "lastKnownFileType" not in self._properties + and "explicitFileType" not in self._properties + ): + # TODO(mark): This is the replacement for a replacement for a quick hack. + # It is no longer incredibly sucky, but this list needs to be extended. + extension_map = { + "a": "archive.ar", + "app": "wrapper.application", + "bdic": "file", + "bundle": "wrapper.cfbundle", + "c": "sourcecode.c.c", + "cc": "sourcecode.cpp.cpp", + "cpp": "sourcecode.cpp.cpp", + "css": "text.css", + "cxx": "sourcecode.cpp.cpp", + "dart": "sourcecode", + "dylib": "compiled.mach-o.dylib", + "framework": "wrapper.framework", + "gyp": "sourcecode", + "gypi": "sourcecode", + "h": "sourcecode.c.h", + "hxx": "sourcecode.cpp.h", + "icns": "image.icns", + "java": "sourcecode.java", + "js": "sourcecode.javascript", + "kext": "wrapper.kext", + "m": "sourcecode.c.objc", + "mm": "sourcecode.cpp.objcpp", + "nib": "wrapper.nib", + "o": "compiled.mach-o.objfile", + "pdf": "image.pdf", + "pl": "text.script.perl", + "plist": "text.plist.xml", + "pm": "text.script.perl", + "png": "image.png", + "py": "text.script.python", + "r": "sourcecode.rez", + "rez": "sourcecode.rez", + "s": "sourcecode.asm", + "storyboard": "file.storyboard", + "strings": "text.plist.strings", + "swift": "sourcecode.swift", + "ttf": "file", + "xcassets": "folder.assetcatalog", + "xcconfig": "text.xcconfig", + "xcdatamodel": "wrapper.xcdatamodel", + "xcdatamodeld": "wrapper.xcdatamodeld", + "xib": "file.xib", + "y": "sourcecode.yacc", + } + + prop_map = { + "dart": "explicitFileType", + "gyp": "explicitFileType", + "gypi": "explicitFileType", + } + + if is_dir: + file_type = "folder" + prop_name = "lastKnownFileType" + else: + basename = posixpath.basename(self._properties["path"]) + (root, ext) = posixpath.splitext(basename) + # Check the map using a lowercase extension. + # TODO(mark): Maybe it should try with the original case first and fall + # back to lowercase, in case there are any instances where case + # matters. There currently aren't. + if ext != "": + ext = ext[1:].lower() + + # TODO(mark): "text" is the default value, but "file" is appropriate + # for unrecognized files not containing text. Xcode seems to choose + # based on content. + file_type = extension_map.get(ext, "text") + prop_name = prop_map.get(ext, "lastKnownFileType") + + self._properties[prop_name] = file_type + + +class PBXVariantGroup(PBXGroup, XCFileLikeElement): + """PBXVariantGroup is used by Xcode to represent localizations.""" + + # No additions to the schema relative to PBXGroup. + pass + + +# PBXReferenceProxy is also an XCFileLikeElement subclass. It is defined below +# because it uses PBXContainerItemProxy, defined below. + + +class XCBuildConfiguration(XCObject): + _schema = XCObject._schema.copy() + _schema.update( + { + "baseConfigurationReference": [0, PBXFileReference, 0, 0], + "buildSettings": [0, dict, 0, 1, {}], + "name": [0, str, 0, 1], + } + ) + + def HasBuildSetting(self, key): + return key in self._properties["buildSettings"] + + def GetBuildSetting(self, key): + return self._properties["buildSettings"][key] + + def SetBuildSetting(self, key, value): + # TODO(mark): If a list, copy? + self._properties["buildSettings"][key] = value + + def AppendBuildSetting(self, key, value): + if key not in self._properties["buildSettings"]: + self._properties["buildSettings"][key] = [] + self._properties["buildSettings"][key].append(value) + + def DelBuildSetting(self, key): + if key in self._properties["buildSettings"]: + del self._properties["buildSettings"][key] + + def SetBaseConfiguration(self, value): + self._properties["baseConfigurationReference"] = value + + +class XCConfigurationList(XCObject): + # _configs is the default list of configurations. + _configs = [ + XCBuildConfiguration({"name": "Debug"}), + XCBuildConfiguration({"name": "Release"}), + ] + + _schema = XCObject._schema.copy() + _schema.update( + { + "buildConfigurations": [1, XCBuildConfiguration, 1, 1, _configs], + "defaultConfigurationIsVisible": [0, int, 0, 1, 1], + "defaultConfigurationName": [0, str, 0, 1, "Release"], + } + ) + + def Name(self): + return ( + "Build configuration list for " + + self.parent.__class__.__name__ + + ' "' + + self.parent.Name() + + '"' + ) + + def ConfigurationNamed(self, name): + """Convenience accessor to obtain an XCBuildConfiguration by name.""" + for configuration in self._properties["buildConfigurations"]: + if configuration._properties["name"] == name: + return configuration + + raise KeyError(name) + + def DefaultConfiguration(self): + """Convenience accessor to obtain the default XCBuildConfiguration.""" + return self.ConfigurationNamed(self._properties["defaultConfigurationName"]) + + def HasBuildSetting(self, key): + """Determines the state of a build setting in all XCBuildConfiguration + child objects. + + If all child objects have key in their build settings, and the value is the + same in all child objects, returns 1. + + If no child objects have the key in their build settings, returns 0. + + If some, but not all, child objects have the key in their build settings, + or if any children have different values for the key, returns -1. + """ + + has = None + value = None + for configuration in self._properties["buildConfigurations"]: + configuration_has = configuration.HasBuildSetting(key) + if has is None: + has = configuration_has + elif has != configuration_has: + return -1 + + if configuration_has: + configuration_value = configuration.GetBuildSetting(key) + if value is None: + value = configuration_value + elif value != configuration_value: + return -1 + + if not has: + return 0 + + return 1 + + def GetBuildSetting(self, key): + """Gets the build setting for key. + + All child XCConfiguration objects must have the same value set for the + setting, or a ValueError will be raised. + """ + + # TODO(mark): This is wrong for build settings that are lists. The list + # contents should be compared (and a list copy returned?) + + value = None + for configuration in self._properties["buildConfigurations"]: + configuration_value = configuration.GetBuildSetting(key) + if value is None: + value = configuration_value + else: + if value != configuration_value: + raise ValueError("Variant values for " + key) + + return value + + def SetBuildSetting(self, key, value): + """Sets the build setting for key to value in all child + XCBuildConfiguration objects. + """ + + for configuration in self._properties["buildConfigurations"]: + configuration.SetBuildSetting(key, value) + + def AppendBuildSetting(self, key, value): + """Appends value to the build setting for key, which is treated as a list, + in all child XCBuildConfiguration objects. + """ + + for configuration in self._properties["buildConfigurations"]: + configuration.AppendBuildSetting(key, value) + + def DelBuildSetting(self, key): + """Deletes the build setting key from all child XCBuildConfiguration + objects. + """ + + for configuration in self._properties["buildConfigurations"]: + configuration.DelBuildSetting(key) + + def SetBaseConfiguration(self, value): + """Sets the build configuration in all child XCBuildConfiguration objects. + """ + + for configuration in self._properties["buildConfigurations"]: + configuration.SetBaseConfiguration(value) + + +class PBXBuildFile(XCObject): + _schema = XCObject._schema.copy() + _schema.update( + { + "fileRef": [0, XCFileLikeElement, 0, 1], + "settings": [0, str, 0, 0], # hack, it's a dict + } + ) + + # Weird output rules for PBXBuildFile. + _should_print_single_line = True + _encode_transforms = XCObject._alternate_encode_transforms + + def Name(self): + # Example: "main.cc in Sources" + return self._properties["fileRef"].Name() + " in " + self.parent.Name() + + def Hashables(self): + # super + hashables = XCObject.Hashables(self) + + # It is not sufficient to just rely on Name() to get the + # XCFileLikeElement's name, because that is not a complete pathname. + # PathHashables returns hashables unique enough that no two + # PBXBuildFiles should wind up with the same set of hashables, unless + # someone adds the same file multiple times to the same target. That + # would be considered invalid anyway. + hashables.extend(self._properties["fileRef"].PathHashables()) + + return hashables + + +class XCBuildPhase(XCObject): + """Abstract base for build phase classes. Not represented in a project + file. + + Attributes: + _files_by_path: A dict mapping each path of a child in the files list by + path (keys) to the corresponding PBXBuildFile children (values). + _files_by_xcfilelikeelement: A dict mapping each XCFileLikeElement (keys) + to the corresponding PBXBuildFile children (values). + """ + + # TODO(mark): Some build phase types, like PBXShellScriptBuildPhase, don't + # actually have a "files" list. XCBuildPhase should not have "files" but + # another abstract subclass of it should provide this, and concrete build + # phase types that do have "files" lists should be derived from that new + # abstract subclass. XCBuildPhase should only provide buildActionMask and + # runOnlyForDeploymentPostprocessing, and not files or the various + # file-related methods and attributes. + + _schema = XCObject._schema.copy() + _schema.update( + { + "buildActionMask": [0, int, 0, 1, 0x7FFFFFFF], + "files": [1, PBXBuildFile, 1, 1, []], + "runOnlyForDeploymentPostprocessing": [0, int, 0, 1, 0], + } + ) + + def __init__(self, properties=None, id=None, parent=None): + # super + XCObject.__init__(self, properties, id, parent) + + self._files_by_path = {} + self._files_by_xcfilelikeelement = {} + for pbxbuildfile in self._properties.get("files", []): + self._AddBuildFileToDicts(pbxbuildfile) + + def FileGroup(self, path): + # Subclasses must override this by returning a two-element tuple. The + # first item in the tuple should be the PBXGroup to which "path" should be + # added, either as a child or deeper descendant. The second item should + # be a boolean indicating whether files should be added into hierarchical + # groups or one single flat group. + raise NotImplementedError(self.__class__.__name__ + " must implement FileGroup") + + def _AddPathToDict(self, pbxbuildfile, path): + """Adds path to the dict tracking paths belonging to this build phase. + + If the path is already a member of this build phase, raises an exception. + """ + + if path in self._files_by_path: + raise ValueError("Found multiple build files with path " + path) + self._files_by_path[path] = pbxbuildfile + + def _AddBuildFileToDicts(self, pbxbuildfile, path=None): + """Maintains the _files_by_path and _files_by_xcfilelikeelement dicts. + + If path is specified, then it is the path that is being added to the + phase, and pbxbuildfile must contain either a PBXFileReference directly + referencing that path, or it must contain a PBXVariantGroup that itself + contains a PBXFileReference referencing the path. + + If path is not specified, either the PBXFileReference's path or the paths + of all children of the PBXVariantGroup are taken as being added to the + phase. + + If the path is already present in the phase, raises an exception. + + If the PBXFileReference or PBXVariantGroup referenced by pbxbuildfile + are already present in the phase, referenced by a different PBXBuildFile + object, raises an exception. This does not raise an exception when + a PBXFileReference or PBXVariantGroup reappear and are referenced by the + same PBXBuildFile that has already introduced them, because in the case + of PBXVariantGroup objects, they may correspond to multiple paths that are + not all added simultaneously. When this situation occurs, the path needs + to be added to _files_by_path, but nothing needs to change in + _files_by_xcfilelikeelement, and the caller should have avoided adding + the PBXBuildFile if it is already present in the list of children. + """ + + xcfilelikeelement = pbxbuildfile._properties["fileRef"] + + paths = [] + if path is not None: + # It's best when the caller provides the path. + if isinstance(xcfilelikeelement, PBXVariantGroup): + paths.append(path) + else: + # If the caller didn't provide a path, there can be either multiple + # paths (PBXVariantGroup) or one. + if isinstance(xcfilelikeelement, PBXVariantGroup): + for variant in xcfilelikeelement._properties["children"]: + paths.append(variant.FullPath()) + else: + paths.append(xcfilelikeelement.FullPath()) + + # Add the paths first, because if something's going to raise, the + # messages provided by _AddPathToDict are more useful owing to its + # having access to a real pathname and not just an object's Name(). + for a_path in paths: + self._AddPathToDict(pbxbuildfile, a_path) + + # If another PBXBuildFile references this XCFileLikeElement, there's a + # problem. + if ( + xcfilelikeelement in self._files_by_xcfilelikeelement + and self._files_by_xcfilelikeelement[xcfilelikeelement] != pbxbuildfile + ): + raise ValueError( + "Found multiple build files for " + xcfilelikeelement.Name() + ) + self._files_by_xcfilelikeelement[xcfilelikeelement] = pbxbuildfile + + def AppendBuildFile(self, pbxbuildfile, path=None): + # Callers should use this instead of calling + # AppendProperty('files', pbxbuildfile) directly because this function + # maintains the object's dicts. Better yet, callers can just call AddFile + # with a pathname and not worry about building their own PBXBuildFile + # objects. + self.AppendProperty("files", pbxbuildfile) + self._AddBuildFileToDicts(pbxbuildfile, path) + + def AddFile(self, path, settings=None): + (file_group, hierarchical) = self.FileGroup(path) + file_ref = file_group.AddOrGetFileByPath(path, hierarchical) + + if file_ref in self._files_by_xcfilelikeelement and isinstance( + file_ref, PBXVariantGroup + ): + # There's already a PBXBuildFile in this phase corresponding to the + # PBXVariantGroup. path just provides a new variant that belongs to + # the group. Add the path to the dict. + pbxbuildfile = self._files_by_xcfilelikeelement[file_ref] + self._AddBuildFileToDicts(pbxbuildfile, path) + else: + # Add a new PBXBuildFile to get file_ref into the phase. + if settings is None: + pbxbuildfile = PBXBuildFile({"fileRef": file_ref}) + else: + pbxbuildfile = PBXBuildFile({"fileRef": file_ref, "settings": settings}) + self.AppendBuildFile(pbxbuildfile, path) + + +class PBXHeadersBuildPhase(XCBuildPhase): + # No additions to the schema relative to XCBuildPhase. + + def Name(self): + return "Headers" + + def FileGroup(self, path): + return self.PBXProjectAncestor().RootGroupForPath(path) + + +class PBXResourcesBuildPhase(XCBuildPhase): + # No additions to the schema relative to XCBuildPhase. + + def Name(self): + return "Resources" + + def FileGroup(self, path): + return self.PBXProjectAncestor().RootGroupForPath(path) + + +class PBXSourcesBuildPhase(XCBuildPhase): + # No additions to the schema relative to XCBuildPhase. + + def Name(self): + return "Sources" + + def FileGroup(self, path): + return self.PBXProjectAncestor().RootGroupForPath(path) + + +class PBXFrameworksBuildPhase(XCBuildPhase): + # No additions to the schema relative to XCBuildPhase. + + def Name(self): + return "Frameworks" + + def FileGroup(self, path): + (root, ext) = posixpath.splitext(path) + if ext != "": + ext = ext[1:].lower() + if ext == "o": + # .o files are added to Xcode Frameworks phases, but conceptually aren't + # frameworks, they're more like sources or intermediates. Redirect them + # to show up in one of those other groups. + return self.PBXProjectAncestor().RootGroupForPath(path) + else: + return (self.PBXProjectAncestor().FrameworksGroup(), False) + + +class PBXShellScriptBuildPhase(XCBuildPhase): + _schema = XCBuildPhase._schema.copy() + _schema.update( + { + "inputPaths": [1, str, 0, 1, []], + "name": [0, str, 0, 0], + "outputPaths": [1, str, 0, 1, []], + "shellPath": [0, str, 0, 1, "/bin/sh"], + "shellScript": [0, str, 0, 1], + "showEnvVarsInLog": [0, int, 0, 0], + } + ) + + def Name(self): + if "name" in self._properties: + return self._properties["name"] + + return "ShellScript" + + +class PBXCopyFilesBuildPhase(XCBuildPhase): + _schema = XCBuildPhase._schema.copy() + _schema.update( + { + "dstPath": [0, str, 0, 1], + "dstSubfolderSpec": [0, int, 0, 1], + "name": [0, str, 0, 0], + } + ) + + # path_tree_re matches "$(DIR)/path", "$(DIR)/$(DIR2)/path" or just "$(DIR)". + # Match group 1 is "DIR", group 3 is "path" or "$(DIR2") or "$(DIR2)/path" + # or None. If group 3 is "path", group 4 will be None otherwise group 4 is + # "DIR2" and group 6 is "path". + path_tree_re = re.compile(r"^\$\((.*?)\)(/(\$\((.*?)\)(/(.*)|)|(.*)|)|)$") + + # path_tree_{first,second}_to_subfolder map names of Xcode variables to the + # associated dstSubfolderSpec property value used in a PBXCopyFilesBuildPhase + # object. + path_tree_first_to_subfolder = { + # Types that can be chosen via the Xcode UI. + "BUILT_PRODUCTS_DIR": 16, # Products Directory + "BUILT_FRAMEWORKS_DIR": 10, # Not an official Xcode macro. + # Existed before support for the + # names below was added. Maps to + # "Frameworks". + } + + path_tree_second_to_subfolder = { + "WRAPPER_NAME": 1, # Wrapper + # Although Xcode's friendly name is "Executables", the destination + # is demonstrably the value of the build setting + # EXECUTABLE_FOLDER_PATH not EXECUTABLES_FOLDER_PATH. + "EXECUTABLE_FOLDER_PATH": 6, # Executables. + "UNLOCALIZED_RESOURCES_FOLDER_PATH": 7, # Resources + "JAVA_FOLDER_PATH": 15, # Java Resources + "FRAMEWORKS_FOLDER_PATH": 10, # Frameworks + "SHARED_FRAMEWORKS_FOLDER_PATH": 11, # Shared Frameworks + "SHARED_SUPPORT_FOLDER_PATH": 12, # Shared Support + "PLUGINS_FOLDER_PATH": 13, # PlugIns + # For XPC Services, Xcode sets both dstPath and dstSubfolderSpec. + # Note that it re-uses the BUILT_PRODUCTS_DIR value for + # dstSubfolderSpec. dstPath is set below. + "XPCSERVICES_FOLDER_PATH": 16, # XPC Services. + } + + def Name(self): + if "name" in self._properties: + return self._properties["name"] + + return "CopyFiles" + + def FileGroup(self, path): + return self.PBXProjectAncestor().RootGroupForPath(path) + + def SetDestination(self, path): + """Set the dstSubfolderSpec and dstPath properties from path. + + path may be specified in the same notation used for XCHierarchicalElements, + specifically, "$(DIR)/path". + """ + + path_tree_match = self.path_tree_re.search(path) + if path_tree_match: + path_tree = path_tree_match.group(1) + if path_tree in self.path_tree_first_to_subfolder: + subfolder = self.path_tree_first_to_subfolder[path_tree] + relative_path = path_tree_match.group(3) + if relative_path is None: + relative_path = "" + + if subfolder == 16 and path_tree_match.group(4) is not None: + # BUILT_PRODUCTS_DIR (16) is the first element in a path whose + # second element is possibly one of the variable names in + # path_tree_second_to_subfolder. Xcode sets the values of all these + # variables to relative paths so .gyp files must prefix them with + # BUILT_PRODUCTS_DIR, e.g. + # $(BUILT_PRODUCTS_DIR)/$(PLUGINS_FOLDER_PATH). Then + # xcode_emulation.py can export these variables with the same values + # as Xcode yet make & ninja files can determine the absolute path + # to the target. Xcode uses the dstSubfolderSpec value set here + # to determine the full path. + # + # An alternative of xcode_emulation.py setting the values to + # absolute paths when exporting these variables has been + # ruled out because then the values would be different + # depending on the build tool. + # + # Another alternative is to invent new names for the variables used + # to match to the subfolder indices in the second table. .gyp files + # then will not need to prepend $(BUILT_PRODUCTS_DIR) because + # xcode_emulation.py can set the values of those variables to + # the absolute paths when exporting. This is possibly the thinking + # behind BUILT_FRAMEWORKS_DIR which is used in exactly this manner. + # + # Requiring prepending BUILT_PRODUCTS_DIR has been chosen because + # this same way could be used to specify destinations in .gyp files + # that pre-date this addition to GYP. However they would only work + # with the Xcode generator. + # The previous version of xcode_emulation.py + # does not export these variables. Such files will get the benefit + # of the Xcode UI showing the proper destination name simply by + # regenerating the projects with this version of GYP. + path_tree = path_tree_match.group(4) + relative_path = path_tree_match.group(6) + separator = "/" + + if path_tree in self.path_tree_second_to_subfolder: + subfolder = self.path_tree_second_to_subfolder[path_tree] + if relative_path is None: + relative_path = "" + separator = "" + if path_tree == "XPCSERVICES_FOLDER_PATH": + relative_path = ( + "$(CONTENTS_FOLDER_PATH)/XPCServices" + + separator + + relative_path + ) + else: + # subfolder = 16 from above + # The second element of the path is an unrecognized variable. + # Include it and any remaining elements in relative_path. + relative_path = path_tree_match.group(3) + + else: + # The path starts with an unrecognized Xcode variable + # name like $(SRCROOT). Xcode will still handle this + # as an "absolute path" that starts with the variable. + subfolder = 0 + relative_path = path + elif path.startswith("/"): + # Special case. Absolute paths are in dstSubfolderSpec 0. + subfolder = 0 + relative_path = path[1:] + else: + raise ValueError( + f"Can't use path {path} in a {self.__class__.__name__}" + ) + + self._properties["dstPath"] = relative_path + self._properties["dstSubfolderSpec"] = subfolder + + +class PBXBuildRule(XCObject): + _schema = XCObject._schema.copy() + _schema.update( + { + "compilerSpec": [0, str, 0, 1], + "filePatterns": [0, str, 0, 0], + "fileType": [0, str, 0, 1], + "isEditable": [0, int, 0, 1, 1], + "outputFiles": [1, str, 0, 1, []], + "script": [0, str, 0, 0], + } + ) + + def Name(self): + # Not very inspired, but it's what Xcode uses. + return self.__class__.__name__ + + def Hashables(self): + # super + hashables = XCObject.Hashables(self) + + # Use the hashables of the weak objects that this object refers to. + hashables.append(self._properties["fileType"]) + if "filePatterns" in self._properties: + hashables.append(self._properties["filePatterns"]) + return hashables + + +class PBXContainerItemProxy(XCObject): + # When referencing an item in this project file, containerPortal is the + # PBXProject root object of this project file. When referencing an item in + # another project file, containerPortal is a PBXFileReference identifying + # the other project file. + # + # When serving as a proxy to an XCTarget (in this project file or another), + # proxyType is 1. When serving as a proxy to a PBXFileReference (in another + # project file), proxyType is 2. Type 2 is used for references to the + # producs of the other project file's targets. + # + # Xcode is weird about remoteGlobalIDString. Usually, it's printed without + # a comment, indicating that it's tracked internally simply as a string, but + # sometimes it's printed with a comment (usually when the object is initially + # created), indicating that it's tracked as a project file object at least + # sometimes. This module always tracks it as an object, but contains a hack + # to prevent it from printing the comment in the project file output. See + # _XCKVPrint. + _schema = XCObject._schema.copy() + _schema.update( + { + "containerPortal": [0, XCContainerPortal, 0, 1], + "proxyType": [0, int, 0, 1], + "remoteGlobalIDString": [0, XCRemoteObject, 0, 1], + "remoteInfo": [0, str, 0, 1], + } + ) + + def __repr__(self): + props = self._properties + name = "{}.gyp:{}".format(props["containerPortal"].Name(), props["remoteInfo"]) + return f"<{self.__class__.__name__} {name!r} at 0x{id(self):x}>" + + def Name(self): + # Admittedly not the best name, but it's what Xcode uses. + return self.__class__.__name__ + + def Hashables(self): + # super + hashables = XCObject.Hashables(self) + + # Use the hashables of the weak objects that this object refers to. + hashables.extend(self._properties["containerPortal"].Hashables()) + hashables.extend(self._properties["remoteGlobalIDString"].Hashables()) + return hashables + + +class PBXTargetDependency(XCObject): + # The "target" property accepts an XCTarget object, and obviously not + # NoneType. But XCTarget is defined below, so it can't be put into the + # schema yet. The definition of PBXTargetDependency can't be moved below + # XCTarget because XCTarget's own schema references PBXTargetDependency. + # Python doesn't deal well with this circular relationship, and doesn't have + # a real way to do forward declarations. To work around, the type of + # the "target" property is reset below, after XCTarget is defined. + # + # At least one of "name" and "target" is required. + _schema = XCObject._schema.copy() + _schema.update( + { + "name": [0, str, 0, 0], + "target": [0, None.__class__, 0, 0], + "targetProxy": [0, PBXContainerItemProxy, 1, 1], + } + ) + + def __repr__(self): + name = self._properties.get("name") or self._properties["target"].Name() + return f"<{self.__class__.__name__} {name!r} at 0x{id(self):x}>" + + def Name(self): + # Admittedly not the best name, but it's what Xcode uses. + return self.__class__.__name__ + + def Hashables(self): + # super + hashables = XCObject.Hashables(self) + + # Use the hashables of the weak objects that this object refers to. + hashables.extend(self._properties["targetProxy"].Hashables()) + return hashables + + +class PBXReferenceProxy(XCFileLikeElement): + _schema = XCFileLikeElement._schema.copy() + _schema.update( + { + "fileType": [0, str, 0, 1], + "path": [0, str, 0, 1], + "remoteRef": [0, PBXContainerItemProxy, 1, 1], + } + ) + + +class XCTarget(XCRemoteObject): + # An XCTarget is really just an XCObject, the XCRemoteObject thing is just + # to allow PBXProject to be used in the remoteGlobalIDString property of + # PBXContainerItemProxy. + # + # Setting a "name" property at instantiation may also affect "productName", + # which may in turn affect the "PRODUCT_NAME" build setting in children of + # "buildConfigurationList". See __init__ below. + _schema = XCRemoteObject._schema.copy() + _schema.update( + { + "buildConfigurationList": [ + 0, + XCConfigurationList, + 1, + 1, + XCConfigurationList(), + ], + "buildPhases": [1, XCBuildPhase, 1, 1, []], + "dependencies": [1, PBXTargetDependency, 1, 1, []], + "name": [0, str, 0, 1], + "productName": [0, str, 0, 1], + } + ) + + def __init__( + self, + properties=None, + id=None, + parent=None, + force_outdir=None, + force_prefix=None, + force_extension=None, + ): + # super + XCRemoteObject.__init__(self, properties, id, parent) + + # Set up additional defaults not expressed in the schema. If a "name" + # property was supplied, set "productName" if it is not present. Also set + # the "PRODUCT_NAME" build setting in each configuration, but only if + # the setting is not present in any build configuration. + if "name" in self._properties: + if "productName" not in self._properties: + self.SetProperty("productName", self._properties["name"]) + + if "productName" in self._properties: + if "buildConfigurationList" in self._properties: + configs = self._properties["buildConfigurationList"] + if configs.HasBuildSetting("PRODUCT_NAME") == 0: + configs.SetBuildSetting( + "PRODUCT_NAME", self._properties["productName"] + ) + + def AddDependency(self, other): + pbxproject = self.PBXProjectAncestor() + other_pbxproject = other.PBXProjectAncestor() + if pbxproject == other_pbxproject: + # Add a dependency to another target in the same project file. + container = PBXContainerItemProxy( + { + "containerPortal": pbxproject, + "proxyType": 1, + "remoteGlobalIDString": other, + "remoteInfo": other.Name(), + } + ) + dependency = PBXTargetDependency( + {"target": other, "targetProxy": container} + ) + self.AppendProperty("dependencies", dependency) + else: + # Add a dependency to a target in a different project file. + other_project_ref = pbxproject.AddOrGetProjectReference(other_pbxproject)[1] + container = PBXContainerItemProxy( + { + "containerPortal": other_project_ref, + "proxyType": 1, + "remoteGlobalIDString": other, + "remoteInfo": other.Name(), + } + ) + dependency = PBXTargetDependency( + {"name": other.Name(), "targetProxy": container} + ) + self.AppendProperty("dependencies", dependency) + + # Proxy all of these through to the build configuration list. + + def ConfigurationNamed(self, name): + return self._properties["buildConfigurationList"].ConfigurationNamed(name) + + def DefaultConfiguration(self): + return self._properties["buildConfigurationList"].DefaultConfiguration() + + def HasBuildSetting(self, key): + return self._properties["buildConfigurationList"].HasBuildSetting(key) + + def GetBuildSetting(self, key): + return self._properties["buildConfigurationList"].GetBuildSetting(key) + + def SetBuildSetting(self, key, value): + return self._properties["buildConfigurationList"].SetBuildSetting(key, value) + + def AppendBuildSetting(self, key, value): + return self._properties["buildConfigurationList"].AppendBuildSetting(key, value) + + def DelBuildSetting(self, key): + return self._properties["buildConfigurationList"].DelBuildSetting(key) + + +# Redefine the type of the "target" property. See PBXTargetDependency._schema +# above. +PBXTargetDependency._schema["target"][1] = XCTarget + + +class PBXNativeTarget(XCTarget): + # buildPhases is overridden in the schema to be able to set defaults. + # + # NOTE: Contrary to most objects, it is advisable to set parent when + # constructing PBXNativeTarget. A parent of an XCTarget must be a PBXProject + # object. A parent reference is required for a PBXNativeTarget during + # construction to be able to set up the target defaults for productReference, + # because a PBXBuildFile object must be created for the target and it must + # be added to the PBXProject's mainGroup hierarchy. + _schema = XCTarget._schema.copy() + _schema.update( + { + "buildPhases": [ + 1, + XCBuildPhase, + 1, + 1, + [PBXSourcesBuildPhase(), PBXFrameworksBuildPhase()], + ], + "buildRules": [1, PBXBuildRule, 1, 1, []], + "productReference": [0, PBXFileReference, 0, 1], + "productType": [0, str, 0, 1], + } + ) + + # Mapping from Xcode product-types to settings. The settings are: + # filetype : used for explicitFileType in the project file + # prefix : the prefix for the file name + # suffix : the suffix for the file name + _product_filetypes = { + "com.apple.product-type.application": ["wrapper.application", "", ".app"], + "com.apple.product-type.application.watchapp": [ + "wrapper.application", + "", + ".app", + ], + "com.apple.product-type.watchkit-extension": [ + "wrapper.app-extension", + "", + ".appex", + ], + "com.apple.product-type.app-extension": ["wrapper.app-extension", "", ".appex"], + "com.apple.product-type.bundle": ["wrapper.cfbundle", "", ".bundle"], + "com.apple.product-type.framework": ["wrapper.framework", "", ".framework"], + "com.apple.product-type.library.dynamic": [ + "compiled.mach-o.dylib", + "lib", + ".dylib", + ], + "com.apple.product-type.library.static": ["archive.ar", "lib", ".a"], + "com.apple.product-type.tool": ["compiled.mach-o.executable", "", ""], + "com.apple.product-type.bundle.unit-test": ["wrapper.cfbundle", "", ".xctest"], + "com.apple.product-type.bundle.ui-testing": ["wrapper.cfbundle", "", ".xctest"], + "com.googlecode.gyp.xcode.bundle": ["compiled.mach-o.dylib", "", ".so"], + "com.apple.product-type.kernel-extension": ["wrapper.kext", "", ".kext"], + } + + def __init__( + self, + properties=None, + id=None, + parent=None, + force_outdir=None, + force_prefix=None, + force_extension=None, + ): + # super + XCTarget.__init__(self, properties, id, parent) + + if ( + "productName" in self._properties + and "productType" in self._properties + and "productReference" not in self._properties + and self._properties["productType"] in self._product_filetypes + ): + products_group = None + pbxproject = self.PBXProjectAncestor() + if pbxproject is not None: + products_group = pbxproject.ProductsGroup() + + if products_group is not None: + (filetype, prefix, suffix) = self._product_filetypes[ + self._properties["productType"] + ] + # Xcode does not have a distinct type for loadable modules that are + # pure BSD targets (not in a bundle wrapper). GYP allows such modules + # to be specified by setting a target type to loadable_module without + # having mac_bundle set. These are mapped to the pseudo-product type + # com.googlecode.gyp.xcode.bundle. + # + # By picking up this special type and converting it to a dynamic + # library (com.apple.product-type.library.dynamic) with fix-ups, + # single-file loadable modules can be produced. + # + # MACH_O_TYPE is changed to mh_bundle to produce the proper file type + # (as opposed to mh_dylib). In order for linking to succeed, + # DYLIB_CURRENT_VERSION and DYLIB_COMPATIBILITY_VERSION must be + # cleared. They are meaningless for type mh_bundle. + # + # Finally, the .so extension is forcibly applied over the default + # (.dylib), unless another forced extension is already selected. + # .dylib is plainly wrong, and .bundle is used by loadable_modules in + # bundle wrappers (com.apple.product-type.bundle). .so seems an odd + # choice because it's used as the extension on many other systems that + # don't distinguish between linkable shared libraries and non-linkable + # loadable modules, but there's precedent: Python loadable modules on + # Mac OS X use an .so extension. + if self._properties["productType"] == "com.googlecode.gyp.xcode.bundle": + self._properties[ + "productType" + ] = "com.apple.product-type.library.dynamic" + self.SetBuildSetting("MACH_O_TYPE", "mh_bundle") + self.SetBuildSetting("DYLIB_CURRENT_VERSION", "") + self.SetBuildSetting("DYLIB_COMPATIBILITY_VERSION", "") + if force_extension is None: + force_extension = suffix[1:] + + if ( + self._properties["productType"] + == "com.apple.product-type-bundle.unit.test" + or self._properties["productType"] + == "com.apple.product-type-bundle.ui-testing" + ): + if force_extension is None: + force_extension = suffix[1:] + + if force_extension is not None: + # If it's a wrapper (bundle), set WRAPPER_EXTENSION. + # Extension override. + suffix = "." + force_extension + if filetype.startswith("wrapper."): + self.SetBuildSetting("WRAPPER_EXTENSION", force_extension) + else: + self.SetBuildSetting("EXECUTABLE_EXTENSION", force_extension) + + if filetype.startswith("compiled.mach-o.executable"): + product_name = self._properties["productName"] + product_name += suffix + suffix = "" + self.SetProperty("productName", product_name) + self.SetBuildSetting("PRODUCT_NAME", product_name) + + # Xcode handles most prefixes based on the target type, however there + # are exceptions. If a "BSD Dynamic Library" target is added in the + # Xcode UI, Xcode sets EXECUTABLE_PREFIX. This check duplicates that + # behavior. + if force_prefix is not None: + prefix = force_prefix + if filetype.startswith("wrapper."): + self.SetBuildSetting("WRAPPER_PREFIX", prefix) + else: + self.SetBuildSetting("EXECUTABLE_PREFIX", prefix) + + if force_outdir is not None: + self.SetBuildSetting("TARGET_BUILD_DIR", force_outdir) + + # TODO(tvl): Remove the below hack. + # http://code.google.com/p/gyp/issues/detail?id=122 + + # Some targets include the prefix in the target_name. These targets + # really should just add a product_name setting that doesn't include + # the prefix. For example: + # target_name = 'libevent', product_name = 'event' + # This check cleans up for them. + product_name = self._properties["productName"] + prefix_len = len(prefix) + if prefix_len and (product_name[:prefix_len] == prefix): + product_name = product_name[prefix_len:] + self.SetProperty("productName", product_name) + self.SetBuildSetting("PRODUCT_NAME", product_name) + + ref_props = { + "explicitFileType": filetype, + "includeInIndex": 0, + "path": prefix + product_name + suffix, + "sourceTree": "BUILT_PRODUCTS_DIR", + } + file_ref = PBXFileReference(ref_props) + products_group.AppendChild(file_ref) + self.SetProperty("productReference", file_ref) + + def GetBuildPhaseByType(self, type): + if "buildPhases" not in self._properties: + return None + + the_phase = None + for phase in self._properties["buildPhases"]: + if isinstance(phase, type): + # Some phases may be present in multiples in a well-formed project file, + # but phases like PBXSourcesBuildPhase may only be present singly, and + # this function is intended as an aid to GetBuildPhaseByType. Loop + # over the entire list of phases and assert if more than one of the + # desired type is found. + assert the_phase is None + the_phase = phase + + return the_phase + + def HeadersPhase(self): + headers_phase = self.GetBuildPhaseByType(PBXHeadersBuildPhase) + if headers_phase is None: + headers_phase = PBXHeadersBuildPhase() + + # The headers phase should come before the resources, sources, and + # frameworks phases, if any. + insert_at = len(self._properties["buildPhases"]) + for index, phase in enumerate(self._properties["buildPhases"]): + if ( + isinstance(phase, PBXResourcesBuildPhase) + or isinstance(phase, PBXSourcesBuildPhase) + or isinstance(phase, PBXFrameworksBuildPhase) + ): + insert_at = index + break + + self._properties["buildPhases"].insert(insert_at, headers_phase) + headers_phase.parent = self + + return headers_phase + + def ResourcesPhase(self): + resources_phase = self.GetBuildPhaseByType(PBXResourcesBuildPhase) + if resources_phase is None: + resources_phase = PBXResourcesBuildPhase() + + # The resources phase should come before the sources and frameworks + # phases, if any. + insert_at = len(self._properties["buildPhases"]) + for index, phase in enumerate(self._properties["buildPhases"]): + if isinstance(phase, PBXSourcesBuildPhase) or isinstance( + phase, PBXFrameworksBuildPhase + ): + insert_at = index + break + + self._properties["buildPhases"].insert(insert_at, resources_phase) + resources_phase.parent = self + + return resources_phase + + def SourcesPhase(self): + sources_phase = self.GetBuildPhaseByType(PBXSourcesBuildPhase) + if sources_phase is None: + sources_phase = PBXSourcesBuildPhase() + self.AppendProperty("buildPhases", sources_phase) + + return sources_phase + + def FrameworksPhase(self): + frameworks_phase = self.GetBuildPhaseByType(PBXFrameworksBuildPhase) + if frameworks_phase is None: + frameworks_phase = PBXFrameworksBuildPhase() + self.AppendProperty("buildPhases", frameworks_phase) + + return frameworks_phase + + def AddDependency(self, other): + # super + XCTarget.AddDependency(self, other) + + static_library_type = "com.apple.product-type.library.static" + shared_library_type = "com.apple.product-type.library.dynamic" + framework_type = "com.apple.product-type.framework" + if ( + isinstance(other, PBXNativeTarget) + and "productType" in self._properties + and self._properties["productType"] != static_library_type + and "productType" in other._properties + and ( + other._properties["productType"] == static_library_type + or ( + ( + other._properties["productType"] == shared_library_type + or other._properties["productType"] == framework_type + ) + and ( + (not other.HasBuildSetting("MACH_O_TYPE")) + or other.GetBuildSetting("MACH_O_TYPE") != "mh_bundle" + ) + ) + ) + ): + + file_ref = other.GetProperty("productReference") + + pbxproject = self.PBXProjectAncestor() + other_pbxproject = other.PBXProjectAncestor() + if pbxproject != other_pbxproject: + other_project_product_group = pbxproject.AddOrGetProjectReference( + other_pbxproject + )[0] + file_ref = other_project_product_group.GetChildByRemoteObject(file_ref) + + self.FrameworksPhase().AppendProperty( + "files", PBXBuildFile({"fileRef": file_ref}) + ) + + +class PBXAggregateTarget(XCTarget): + pass + + +class PBXProject(XCContainerPortal): + # A PBXProject is really just an XCObject, the XCContainerPortal thing is + # just to allow PBXProject to be used in the containerPortal property of + # PBXContainerItemProxy. + """ + + Attributes: + path: "sample.xcodeproj". TODO(mark) Document me! + _other_pbxprojects: A dictionary, keyed by other PBXProject objects. Each + value is a reference to the dict in the + projectReferences list associated with the keyed + PBXProject. + """ + + _schema = XCContainerPortal._schema.copy() + _schema.update( + { + "attributes": [0, dict, 0, 0], + "buildConfigurationList": [ + 0, + XCConfigurationList, + 1, + 1, + XCConfigurationList(), + ], + "compatibilityVersion": [0, str, 0, 1, "Xcode 3.2"], + "hasScannedForEncodings": [0, int, 0, 1, 1], + "mainGroup": [0, PBXGroup, 1, 1, PBXGroup()], + "projectDirPath": [0, str, 0, 1, ""], + "projectReferences": [1, dict, 0, 0], + "projectRoot": [0, str, 0, 1, ""], + "targets": [1, XCTarget, 1, 1, []], + } + ) + + def __init__(self, properties=None, id=None, parent=None, path=None): + self.path = path + self._other_pbxprojects = {} + # super + XCContainerPortal.__init__(self, properties, id, parent) + + def Name(self): + name = self.path + if name[-10:] == ".xcodeproj": + name = name[:-10] + return posixpath.basename(name) + + def Path(self): + return self.path + + def Comment(self): + return "Project object" + + def Children(self): + # super + children = XCContainerPortal.Children(self) + + # Add children that the schema doesn't know about. Maybe there's a more + # elegant way around this, but this is the only case where we need to own + # objects in a dictionary (that is itself in a list), and three lines for + # a one-off isn't that big a deal. + if "projectReferences" in self._properties: + for reference in self._properties["projectReferences"]: + children.append(reference["ProductGroup"]) + + return children + + def PBXProjectAncestor(self): + return self + + def _GroupByName(self, name): + if "mainGroup" not in self._properties: + self.SetProperty("mainGroup", PBXGroup()) + + main_group = self._properties["mainGroup"] + group = main_group.GetChildByName(name) + if group is None: + group = PBXGroup({"name": name}) + main_group.AppendChild(group) + + return group + + # SourceGroup and ProductsGroup are created by default in Xcode's own + # templates. + def SourceGroup(self): + return self._GroupByName("Source") + + def ProductsGroup(self): + return self._GroupByName("Products") + + # IntermediatesGroup is used to collect source-like files that are generated + # by rules or script phases and are placed in intermediate directories such + # as DerivedSources. + def IntermediatesGroup(self): + return self._GroupByName("Intermediates") + + # FrameworksGroup and ProjectsGroup are top-level groups used to collect + # frameworks and projects. + def FrameworksGroup(self): + return self._GroupByName("Frameworks") + + def ProjectsGroup(self): + return self._GroupByName("Projects") + + def RootGroupForPath(self, path): + """Returns a PBXGroup child of this object to which path should be added. + + This method is intended to choose between SourceGroup and + IntermediatesGroup on the basis of whether path is present in a source + directory or an intermediates directory. For the purposes of this + determination, any path located within a derived file directory such as + PROJECT_DERIVED_FILE_DIR is treated as being in an intermediates + directory. + + The returned value is a two-element tuple. The first element is the + PBXGroup, and the second element specifies whether that group should be + organized hierarchically (True) or as a single flat list (False). + """ + + # TODO(mark): make this a class variable and bind to self on call? + # Also, this list is nowhere near exhaustive. + # INTERMEDIATE_DIR and SHARED_INTERMEDIATE_DIR are used by + # gyp.generator.xcode. There should probably be some way for that module + # to push the names in, rather than having to hard-code them here. + source_tree_groups = { + "DERIVED_FILE_DIR": (self.IntermediatesGroup, True), + "INTERMEDIATE_DIR": (self.IntermediatesGroup, True), + "PROJECT_DERIVED_FILE_DIR": (self.IntermediatesGroup, True), + "SHARED_INTERMEDIATE_DIR": (self.IntermediatesGroup, True), + } + + (source_tree, path) = SourceTreeAndPathFromPath(path) + if source_tree is not None and source_tree in source_tree_groups: + (group_func, hierarchical) = source_tree_groups[source_tree] + group = group_func() + return (group, hierarchical) + + # TODO(mark): make additional choices based on file extension. + + return (self.SourceGroup(), True) + + def AddOrGetFileInRootGroup(self, path): + """Returns a PBXFileReference corresponding to path in the correct group + according to RootGroupForPath's heuristics. + + If an existing PBXFileReference for path exists, it will be returned. + Otherwise, one will be created and returned. + """ + + (group, hierarchical) = self.RootGroupForPath(path) + return group.AddOrGetFileByPath(path, hierarchical) + + def RootGroupsTakeOverOnlyChildren(self, recurse=False): + """Calls TakeOverOnlyChild for all groups in the main group.""" + + for group in self._properties["mainGroup"]._properties["children"]: + if isinstance(group, PBXGroup): + group.TakeOverOnlyChild(recurse) + + def SortGroups(self): + # Sort the children of the mainGroup (like "Source" and "Products") + # according to their defined order. + self._properties["mainGroup"]._properties["children"] = sorted( + self._properties["mainGroup"]._properties["children"], + key=cmp_to_key(lambda x, y: x.CompareRootGroup(y)), + ) + + # Sort everything else by putting group before files, and going + # alphabetically by name within sections of groups and files. SortGroup + # is recursive. + for group in self._properties["mainGroup"]._properties["children"]: + if not isinstance(group, PBXGroup): + continue + + if group.Name() == "Products": + # The Products group is a special case. Instead of sorting + # alphabetically, sort things in the order of the targets that + # produce the products. To do this, just build up a new list of + # products based on the targets. + products = [] + for target in self._properties["targets"]: + if not isinstance(target, PBXNativeTarget): + continue + product = target._properties["productReference"] + # Make sure that the product is already in the products group. + assert product in group._properties["children"] + products.append(product) + + # Make sure that this process doesn't miss anything that was already + # in the products group. + assert len(products) == len(group._properties["children"]) + group._properties["children"] = products + else: + group.SortGroup() + + def AddOrGetProjectReference(self, other_pbxproject): + """Add a reference to another project file (via PBXProject object) to this + one. + + Returns [ProductGroup, ProjectRef]. ProductGroup is a PBXGroup object in + this project file that contains a PBXReferenceProxy object for each + product of each PBXNativeTarget in the other project file. ProjectRef is + a PBXFileReference to the other project file. + + If this project file already references the other project file, the + existing ProductGroup and ProjectRef are returned. The ProductGroup will + still be updated if necessary. + """ + + if "projectReferences" not in self._properties: + self._properties["projectReferences"] = [] + + product_group = None + project_ref = None + + if other_pbxproject not in self._other_pbxprojects: + # This project file isn't yet linked to the other one. Establish the + # link. + product_group = PBXGroup({"name": "Products"}) + + # ProductGroup is strong. + product_group.parent = self + + # There's nothing unique about this PBXGroup, and if left alone, it will + # wind up with the same set of hashables as all other PBXGroup objects + # owned by the projectReferences list. Add the hashables of the + # remote PBXProject that it's related to. + product_group._hashables.extend(other_pbxproject.Hashables()) + + # The other project reports its path as relative to the same directory + # that this project's path is relative to. The other project's path + # is not necessarily already relative to this project. Figure out the + # pathname that this project needs to use to refer to the other one. + this_path = posixpath.dirname(self.Path()) + projectDirPath = self.GetProperty("projectDirPath") + if projectDirPath: + if posixpath.isabs(projectDirPath[0]): + this_path = projectDirPath + else: + this_path = posixpath.join(this_path, projectDirPath) + other_path = gyp.common.RelativePath(other_pbxproject.Path(), this_path) + + # ProjectRef is weak (it's owned by the mainGroup hierarchy). + project_ref = PBXFileReference( + { + "lastKnownFileType": "wrapper.pb-project", + "path": other_path, + "sourceTree": "SOURCE_ROOT", + } + ) + self.ProjectsGroup().AppendChild(project_ref) + + ref_dict = {"ProductGroup": product_group, "ProjectRef": project_ref} + self._other_pbxprojects[other_pbxproject] = ref_dict + self.AppendProperty("projectReferences", ref_dict) + + # Xcode seems to sort this list case-insensitively + self._properties["projectReferences"] = sorted( + self._properties["projectReferences"], + key=lambda x: x["ProjectRef"].Name().lower() + ) + else: + # The link already exists. Pull out the relevnt data. + project_ref_dict = self._other_pbxprojects[other_pbxproject] + product_group = project_ref_dict["ProductGroup"] + project_ref = project_ref_dict["ProjectRef"] + + self._SetUpProductReferences(other_pbxproject, product_group, project_ref) + + inherit_unique_symroot = self._AllSymrootsUnique(other_pbxproject, False) + targets = other_pbxproject.GetProperty("targets") + if all(self._AllSymrootsUnique(t, inherit_unique_symroot) for t in targets): + dir_path = project_ref._properties["path"] + product_group._hashables.extend(dir_path) + + return [product_group, project_ref] + + def _AllSymrootsUnique(self, target, inherit_unique_symroot): + # Returns True if all configurations have a unique 'SYMROOT' attribute. + # The value of inherit_unique_symroot decides, if a configuration is assumed + # to inherit a unique 'SYMROOT' attribute from its parent, if it doesn't + # define an explicit value for 'SYMROOT'. + symroots = self._DefinedSymroots(target) + for s in self._DefinedSymroots(target): + if ( + s is not None + and not self._IsUniqueSymrootForTarget(s) + or s is None + and not inherit_unique_symroot + ): + return False + return True if symroots else inherit_unique_symroot + + def _DefinedSymroots(self, target): + # Returns all values for the 'SYMROOT' attribute defined in all + # configurations for this target. If any configuration doesn't define the + # 'SYMROOT' attribute, None is added to the returned set. If all + # configurations don't define the 'SYMROOT' attribute, an empty set is + # returned. + config_list = target.GetProperty("buildConfigurationList") + symroots = set() + for config in config_list.GetProperty("buildConfigurations"): + setting = config.GetProperty("buildSettings") + if "SYMROOT" in setting: + symroots.add(setting["SYMROOT"]) + else: + symroots.add(None) + if len(symroots) == 1 and None in symroots: + return set() + return symroots + + def _IsUniqueSymrootForTarget(self, symroot): + # This method returns True if all configurations in target contain a + # 'SYMROOT' attribute that is unique for the given target. A value is + # unique, if the Xcode macro '$SRCROOT' appears in it in any form. + uniquifier = ["$SRCROOT", "$(SRCROOT)"] + if any(x in symroot for x in uniquifier): + return True + return False + + def _SetUpProductReferences(self, other_pbxproject, product_group, project_ref): + # TODO(mark): This only adds references to products in other_pbxproject + # when they don't exist in this pbxproject. Perhaps it should also + # remove references from this pbxproject that are no longer present in + # other_pbxproject. Perhaps it should update various properties if they + # change. + for target in other_pbxproject._properties["targets"]: + if not isinstance(target, PBXNativeTarget): + continue + + other_fileref = target._properties["productReference"] + if product_group.GetChildByRemoteObject(other_fileref) is None: + # Xcode sets remoteInfo to the name of the target and not the name + # of its product, despite this proxy being a reference to the product. + container_item = PBXContainerItemProxy( + { + "containerPortal": project_ref, + "proxyType": 2, + "remoteGlobalIDString": other_fileref, + "remoteInfo": target.Name(), + } + ) + # TODO(mark): Does sourceTree get copied straight over from the other + # project? Can the other project ever have lastKnownFileType here + # instead of explicitFileType? (Use it if so?) Can path ever be + # unset? (I don't think so.) Can other_fileref have name set, and + # does it impact the PBXReferenceProxy if so? These are the questions + # that perhaps will be answered one day. + reference_proxy = PBXReferenceProxy( + { + "fileType": other_fileref._properties["explicitFileType"], + "path": other_fileref._properties["path"], + "sourceTree": other_fileref._properties["sourceTree"], + "remoteRef": container_item, + } + ) + + product_group.AppendChild(reference_proxy) + + def SortRemoteProductReferences(self): + # For each remote project file, sort the associated ProductGroup in the + # same order that the targets are sorted in the remote project file. This + # is the sort order used by Xcode. + + def CompareProducts(x, y, remote_products): + # x and y are PBXReferenceProxy objects. Go through their associated + # PBXContainerItem to get the remote PBXFileReference, which will be + # present in the remote_products list. + x_remote = x._properties["remoteRef"]._properties["remoteGlobalIDString"] + y_remote = y._properties["remoteRef"]._properties["remoteGlobalIDString"] + x_index = remote_products.index(x_remote) + y_index = remote_products.index(y_remote) + + # Use the order of each remote PBXFileReference in remote_products to + # determine the sort order. + return cmp(x_index, y_index) + + for other_pbxproject, ref_dict in self._other_pbxprojects.items(): + # Build up a list of products in the remote project file, ordered the + # same as the targets that produce them. + remote_products = [] + for target in other_pbxproject._properties["targets"]: + if not isinstance(target, PBXNativeTarget): + continue + remote_products.append(target._properties["productReference"]) + + # Sort the PBXReferenceProxy children according to the list of remote + # products. + product_group = ref_dict["ProductGroup"] + product_group._properties["children"] = sorted( + product_group._properties["children"], + key=cmp_to_key( + lambda x, y, rp=remote_products: CompareProducts(x, y, rp)), + ) + + +class XCProjectFile(XCObject): + _schema = XCObject._schema.copy() + _schema.update( + { + "archiveVersion": [0, int, 0, 1, 1], + "classes": [0, dict, 0, 1, {}], + "objectVersion": [0, int, 0, 1, 46], + "rootObject": [0, PBXProject, 1, 1], + } + ) + + def ComputeIDs(self, recursive=True, overwrite=True, hash=None): + # Although XCProjectFile is implemented here as an XCObject, it's not a + # proper object in the Xcode sense, and it certainly doesn't have its own + # ID. Pass through an attempt to update IDs to the real root object. + if recursive: + self._properties["rootObject"].ComputeIDs(recursive, overwrite, hash) + + def Print(self, file=sys.stdout): + self.VerifyHasRequiredProperties() + + # Add the special "objects" property, which will be caught and handled + # separately during printing. This structure allows a fairly standard + # loop do the normal printing. + self._properties["objects"] = {} + self._XCPrint(file, 0, "// !$*UTF8*$!\n") + if self._should_print_single_line: + self._XCPrint(file, 0, "{ ") + else: + self._XCPrint(file, 0, "{\n") + for property, value in sorted( + self._properties.items() + ): + if property == "objects": + self._PrintObjects(file) + else: + self._XCKVPrint(file, 1, property, value) + self._XCPrint(file, 0, "}\n") + del self._properties["objects"] + + def _PrintObjects(self, file): + if self._should_print_single_line: + self._XCPrint(file, 0, "objects = {") + else: + self._XCPrint(file, 1, "objects = {\n") + + objects_by_class = {} + for object in self.Descendants(): + if object == self: + continue + class_name = object.__class__.__name__ + if class_name not in objects_by_class: + objects_by_class[class_name] = [] + objects_by_class[class_name].append(object) + + for class_name in sorted(objects_by_class): + self._XCPrint(file, 0, "\n") + self._XCPrint(file, 0, "/* Begin " + class_name + " section */\n") + for object in sorted( + objects_by_class[class_name], key=attrgetter("id") + ): + object.Print(file) + self._XCPrint(file, 0, "/* End " + class_name + " section */\n") + + if self._should_print_single_line: + self._XCPrint(file, 0, "}; ") + else: + self._XCPrint(file, 1, "};\n") diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py new file mode 100644 index 0000000000000..530196366946d --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py @@ -0,0 +1,65 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Applies a fix to CR LF TAB handling in xml.dom. + +Fixes this: http://code.google.com/p/chromium/issues/detail?id=76293 +Working around this: http://bugs.python.org/issue5752 +TODO(bradnelson): Consider dropping this when we drop XP support. +""" + + +import xml.dom.minidom + + +def _Replacement_write_data(writer, data, is_attrib=False): + """Writes datachars to writer.""" + data = data.replace("&", "&").replace("<", "<") + data = data.replace('"', """).replace(">", ">") + if is_attrib: + data = data.replace("\r", " ").replace("\n", " ").replace("\t", " ") + writer.write(data) + + +def _Replacement_writexml(self, writer, indent="", addindent="", newl=""): + # indent = current indentation + # addindent = indentation to add to higher levels + # newl = newline string + writer.write(indent + "<" + self.tagName) + + attrs = self._get_attributes() + a_names = sorted(attrs.keys()) + + for a_name in a_names: + writer.write(' %s="' % a_name) + _Replacement_write_data(writer, attrs[a_name].value, is_attrib=True) + writer.write('"') + if self.childNodes: + writer.write(">%s" % newl) + for node in self.childNodes: + node.writexml(writer, indent + addindent, addindent, newl) + writer.write(f"{indent}{newl}") + else: + writer.write("/>%s" % newl) + + +class XmlFix: + """Object to manage temporary patching of xml.dom.minidom.""" + + def __init__(self): + # Preserve current xml.dom.minidom functions. + self.write_data = xml.dom.minidom._write_data + self.writexml = xml.dom.minidom.Element.writexml + # Inject replacement versions of a function and a method. + xml.dom.minidom._write_data = _Replacement_write_data + xml.dom.minidom.Element.writexml = _Replacement_writexml + + def Cleanup(self): + if self.write_data: + xml.dom.minidom._write_data = self.write_data + xml.dom.minidom.Element.writexml = self.writexml + self.write_data = None + + def __del__(self): + self.Cleanup() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pyproject.toml b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pyproject.toml new file mode 100644 index 0000000000000..d8a5451520cc3 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pyproject.toml @@ -0,0 +1,41 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "gyp-next" +version = "0.14.0" +authors = [ + { name="Node.js contributors", email="ryzokuken@disroot.org" }, +] +description = "A fork of the GYP build system for use in the Node.js projects" +readme = "README.md" +license = { file="LICENSE" } +requires-python = ">=3.6" +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", +] + +[project.optional-dependencies] +dev = ["flake8", "pytest"] + +[project.scripts] +gyp = "gyp:script_main" + +[project.urls] +"Homepage" = "https://github.com/nodejs/gyp-next" + +[tool.setuptools] +package-dir = {"" = "pylib"} +packages = ["gyp", "gyp.generator"] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/test_gyp.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/test_gyp.py new file mode 100755 index 0000000000000..b7bb956b8ed58 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/test_gyp.py @@ -0,0 +1,261 @@ +#!/usr/bin/env python3 +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""gyptest.py -- test runner for GYP tests.""" + + +import argparse +import os +import platform +import subprocess +import sys +import time + + +def is_test_name(f): + return f.startswith("gyptest") and f.endswith(".py") + + +def find_all_gyptest_files(directory): + result = [] + for root, dirs, files in os.walk(directory): + result.extend([os.path.join(root, f) for f in files if is_test_name(f)]) + result.sort() + return result + + +def main(argv=None): + if argv is None: + argv = sys.argv + + parser = argparse.ArgumentParser() + parser.add_argument("-a", "--all", action="store_true", help="run all tests") + parser.add_argument("-C", "--chdir", action="store", help="change to directory") + parser.add_argument( + "-f", + "--format", + action="store", + default="", + help="run tests with the specified formats", + ) + parser.add_argument( + "-G", + "--gyp_option", + action="append", + default=[], + help="Add -G options to the gyp command line", + ) + parser.add_argument( + "-l", "--list", action="store_true", help="list available tests and exit" + ) + parser.add_argument( + "-n", + "--no-exec", + action="store_true", + help="no execute, just print the command line", + ) + parser.add_argument( + "--path", action="append", default=[], help="additional $PATH directory" + ) + parser.add_argument( + "-q", + "--quiet", + action="store_true", + help="quiet, don't print anything unless there are failures", + ) + parser.add_argument( + "-v", + "--verbose", + action="store_true", + help="print configuration info and test results.", + ) + parser.add_argument("tests", nargs="*") + args = parser.parse_args(argv[1:]) + + if args.chdir: + os.chdir(args.chdir) + + if args.path: + extra_path = [os.path.abspath(p) for p in args.path] + extra_path = os.pathsep.join(extra_path) + os.environ["PATH"] = extra_path + os.pathsep + os.environ["PATH"] + + if not args.tests: + if not args.all: + sys.stderr.write("Specify -a to get all tests.\n") + return 1 + args.tests = ["test"] + + tests = [] + for arg in args.tests: + if os.path.isdir(arg): + tests.extend(find_all_gyptest_files(os.path.normpath(arg))) + else: + if not is_test_name(os.path.basename(arg)): + print(arg, "is not a valid gyp test name.", file=sys.stderr) + sys.exit(1) + tests.append(arg) + + if args.list: + for test in tests: + print(test) + sys.exit(0) + + os.environ["PYTHONPATH"] = os.path.abspath("test/lib") + + if args.verbose: + print_configuration_info() + + if args.gyp_option and not args.quiet: + print("Extra Gyp options: %s\n" % args.gyp_option) + + if args.format: + format_list = args.format.split(",") + else: + format_list = { + "aix5": ["make"], + "os400": ["make"], + "freebsd7": ["make"], + "freebsd8": ["make"], + "openbsd5": ["make"], + "cygwin": ["msvs"], + "win32": ["msvs", "ninja"], + "linux": ["make", "ninja"], + "linux2": ["make", "ninja"], + "linux3": ["make", "ninja"], + # TODO: Re-enable xcode-ninja. + # https://bugs.chromium.org/p/gyp/issues/detail?id=530 + # 'darwin': ['make', 'ninja', 'xcode', 'xcode-ninja'], + "darwin": ["make", "ninja", "xcode"], + }[sys.platform] + + gyp_options = [] + for option in args.gyp_option: + gyp_options += ["-G", option] + + runner = Runner(format_list, tests, gyp_options, args.verbose) + runner.run() + + if not args.quiet: + runner.print_results() + + return 1 if runner.failures else 0 + + +def print_configuration_info(): + print("Test configuration:") + if sys.platform == "darwin": + sys.path.append(os.path.abspath("test/lib")) + import TestMac + + print(f" Mac {platform.mac_ver()[0]} {platform.mac_ver()[2]}") + print(f" Xcode {TestMac.Xcode.Version()}") + elif sys.platform == "win32": + sys.path.append(os.path.abspath("pylib")) + import gyp.MSVSVersion + + print(" Win %s %s\n" % platform.win32_ver()[0:2]) + print(" MSVS %s" % gyp.MSVSVersion.SelectVisualStudioVersion().Description()) + elif sys.platform in ("linux", "linux2"): + print(" Linux %s" % " ".join(platform.linux_distribution())) + print(f" Python {platform.python_version()}") + print(f" PYTHONPATH={os.environ['PYTHONPATH']}") + print() + + +class Runner: + def __init__(self, formats, tests, gyp_options, verbose): + self.formats = formats + self.tests = tests + self.verbose = verbose + self.gyp_options = gyp_options + self.failures = [] + self.num_tests = len(formats) * len(tests) + num_digits = len(str(self.num_tests)) + self.fmt_str = "[%%%dd/%%%dd] (%%s) %%s" % (num_digits, num_digits) + self.isatty = sys.stdout.isatty() and not self.verbose + self.env = os.environ.copy() + self.hpos = 0 + + def run(self): + run_start = time.time() + + i = 1 + for fmt in self.formats: + for test in self.tests: + self.run_test(test, fmt, i) + i += 1 + + if self.isatty: + self.erase_current_line() + + self.took = time.time() - run_start + + def run_test(self, test, fmt, i): + if self.isatty: + self.erase_current_line() + + msg = self.fmt_str % (i, self.num_tests, fmt, test) + self.print_(msg) + + start = time.time() + cmd = [sys.executable, test] + self.gyp_options + self.env["TESTGYP_FORMAT"] = fmt + proc = subprocess.Popen( + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=self.env + ) + proc.wait() + took = time.time() - start + + stdout = proc.stdout.read().decode("utf8") + if proc.returncode == 2: + res = "skipped" + elif proc.returncode: + res = "failed" + self.failures.append(f"({test}) {fmt}") + else: + res = "passed" + res_msg = f" {res} {took:.3f}s" + self.print_(res_msg) + + if stdout and not stdout.endswith(("PASSED\n", "NO RESULT\n")): + print() + print("\n".join(f" {line}" for line in stdout.splitlines())) + elif not self.isatty: + print() + + def print_(self, msg): + print(msg, end="") + index = msg.rfind("\n") + if index == -1: + self.hpos += len(msg) + else: + self.hpos = len(msg) - index + sys.stdout.flush() + + def erase_current_line(self): + print("\b" * self.hpos + " " * self.hpos + "\b" * self.hpos, end="") + sys.stdout.flush() + self.hpos = 0 + + def print_results(self): + num_failures = len(self.failures) + if num_failures: + print() + if num_failures == 1: + print("Failed the following test:") + else: + print("Failed the following %d tests:" % num_failures) + print("\t" + "\n\t".join(sorted(self.failures))) + print() + print( + "Ran %d tests in %.3fs, %d failed." + % (self.num_tests, self.took, num_failures) + ) + print() + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.pbfilespec b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.pbfilespec similarity index 100% rename from node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.pbfilespec rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.pbfilespec diff --git a/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.xclangspec b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.xclangspec similarity index 100% rename from node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.xclangspec rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.xclangspec diff --git a/node_modules/node-gyp/gyp/tools/emacs/gyp-tests.el b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/gyp-tests.el similarity index 100% rename from node_modules/node-gyp/gyp/tools/emacs/gyp-tests.el rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/gyp-tests.el diff --git a/node_modules/node-gyp/gyp/tools/emacs/gyp.el b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/gyp.el similarity index 100% rename from node_modules/node-gyp/gyp/tools/emacs/gyp.el rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/gyp.el diff --git a/node_modules/node-gyp/gyp/tools/emacs/run-unit-tests.sh b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/run-unit-tests.sh similarity index 100% rename from node_modules/node-gyp/gyp/tools/emacs/run-unit-tests.sh rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/run-unit-tests.sh diff --git a/node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp similarity index 100% rename from node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp diff --git a/node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp.fontified b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp.fontified similarity index 100% rename from node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp.fontified rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp.fontified diff --git a/node_modules/node-gyp/gyp/tools/graphviz.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/graphviz.py similarity index 100% rename from node_modules/node-gyp/gyp/tools/graphviz.py rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/graphviz.py diff --git a/node_modules/node-gyp/gyp/tools/pretty_gyp.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_gyp.py similarity index 100% rename from node_modules/node-gyp/gyp/tools/pretty_gyp.py rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_gyp.py diff --git a/node_modules/node-gyp/gyp/tools/pretty_sln.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_sln.py similarity index 100% rename from node_modules/node-gyp/gyp/tools/pretty_sln.py rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_sln.py diff --git a/node_modules/node-gyp/gyp/tools/pretty_vcproj.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_vcproj.py similarity index 100% rename from node_modules/node-gyp/gyp/tools/pretty_vcproj.py rename to node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_vcproj.py diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/Find-VisualStudio.cs b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/Find-VisualStudio.cs new file mode 100644 index 0000000000000..d2e45a76275f5 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/Find-VisualStudio.cs @@ -0,0 +1,250 @@ +// Copyright 2017 - Refael Ackermann +// Distributed under MIT style license +// See accompanying file LICENSE at https://github.com/node4good/windows-autoconf + +// Usage: +// powershell -ExecutionPolicy Unrestricted -Command "Add-Type -Path Find-VisualStudio.cs; [VisualStudioConfiguration.Main]::PrintJson()" +// This script needs to be compatible with PowerShell v2 to run on Windows 2008R2 and Windows 7. + +using System; +using System.Text; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace VisualStudioConfiguration +{ + [Flags] + public enum InstanceState : uint + { + None = 0, + Local = 1, + Registered = 2, + NoRebootRequired = 4, + NoErrors = 8, + Complete = 4294967295, + } + + [Guid("6380BCFF-41D3-4B2E-8B2E-BF8A6810C848")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface IEnumSetupInstances + { + + void Next([MarshalAs(UnmanagedType.U4), In] int celt, + [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface), Out] ISetupInstance[] rgelt, + [MarshalAs(UnmanagedType.U4)] out int pceltFetched); + + void Skip([MarshalAs(UnmanagedType.U4), In] int celt); + + void Reset(); + + [return: MarshalAs(UnmanagedType.Interface)] + IEnumSetupInstances Clone(); + } + + [Guid("42843719-DB4C-46C2-8E7C-64F1816EFD5B")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupConfiguration + { + } + + [Guid("26AAB78C-4A60-49D6-AF3B-3C35BC93365D")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupConfiguration2 : ISetupConfiguration + { + + [return: MarshalAs(UnmanagedType.Interface)] + IEnumSetupInstances EnumInstances(); + + [return: MarshalAs(UnmanagedType.Interface)] + ISetupInstance GetInstanceForCurrentProcess(); + + [return: MarshalAs(UnmanagedType.Interface)] + ISetupInstance GetInstanceForPath([MarshalAs(UnmanagedType.LPWStr), In] string path); + + [return: MarshalAs(UnmanagedType.Interface)] + IEnumSetupInstances EnumAllInstances(); + } + + [Guid("B41463C3-8866-43B5-BC33-2B0676F7F42E")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupInstance + { + } + + [Guid("89143C9A-05AF-49B0-B717-72E218A2185C")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupInstance2 : ISetupInstance + { + [return: MarshalAs(UnmanagedType.BStr)] + string GetInstanceId(); + + [return: MarshalAs(UnmanagedType.Struct)] + System.Runtime.InteropServices.ComTypes.FILETIME GetInstallDate(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetInstallationName(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetInstallationPath(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetInstallationVersion(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetDisplayName([MarshalAs(UnmanagedType.U4), In] int lcid); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetDescription([MarshalAs(UnmanagedType.U4), In] int lcid); + + [return: MarshalAs(UnmanagedType.BStr)] + string ResolvePath([MarshalAs(UnmanagedType.LPWStr), In] string pwszRelativePath); + + [return: MarshalAs(UnmanagedType.U4)] + InstanceState GetState(); + + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + ISetupPackageReference[] GetPackages(); + + ISetupPackageReference GetProduct(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetProductPath(); + + [return: MarshalAs(UnmanagedType.VariantBool)] + bool IsLaunchable(); + + [return: MarshalAs(UnmanagedType.VariantBool)] + bool IsComplete(); + + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + ISetupPropertyStore GetProperties(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetEnginePath(); + } + + [Guid("DA8D8A16-B2B6-4487-A2F1-594CCCCD6BF5")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupPackageReference + { + + [return: MarshalAs(UnmanagedType.BStr)] + string GetId(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetVersion(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetChip(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetLanguage(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetBranch(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetType(); + + [return: MarshalAs(UnmanagedType.BStr)] + string GetUniqueId(); + + [return: MarshalAs(UnmanagedType.VariantBool)] + bool GetIsExtension(); + } + + [Guid("c601c175-a3be-44bc-91f6-4568d230fc83")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [ComImport] + public interface ISetupPropertyStore + { + + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_BSTR)] + string[] GetNames(); + + object GetValue([MarshalAs(UnmanagedType.LPWStr), In] string pwszName); + } + + [Guid("42843719-DB4C-46C2-8E7C-64F1816EFD5B")] + [CoClass(typeof(SetupConfigurationClass))] + [ComImport] + public interface SetupConfiguration : ISetupConfiguration2, ISetupConfiguration + { + } + + [Guid("177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D")] + [ClassInterface(ClassInterfaceType.None)] + [ComImport] + public class SetupConfigurationClass + { + } + + public static class Main + { + public static void PrintJson() + { + ISetupConfiguration query = new SetupConfiguration(); + ISetupConfiguration2 query2 = (ISetupConfiguration2)query; + IEnumSetupInstances e = query2.EnumAllInstances(); + + int pceltFetched; + ISetupInstance2[] rgelt = new ISetupInstance2[1]; + List instances = new List(); + while (true) + { + e.Next(1, rgelt, out pceltFetched); + if (pceltFetched <= 0) + { + Console.WriteLine(String.Format("[{0}]", string.Join(",", instances.ToArray()))); + return; + } + + try + { + instances.Add(InstanceJson(rgelt[0])); + } + catch (COMException) + { + // Ignore instances that can't be queried. + } + } + } + + private static string JsonString(string s) + { + return "\"" + s.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\""; + } + + private static string InstanceJson(ISetupInstance2 setupInstance2) + { + // Visual Studio component directory: + // https://docs.microsoft.com/en-us/visualstudio/install/workload-and-component-ids + + StringBuilder json = new StringBuilder(); + json.Append("{"); + + string path = JsonString(setupInstance2.GetInstallationPath()); + json.Append(String.Format("\"path\":{0},", path)); + + string version = JsonString(setupInstance2.GetInstallationVersion()); + json.Append(String.Format("\"version\":{0},", version)); + + List packages = new List(); + foreach (ISetupPackageReference package in setupInstance2.GetPackages()) + { + string id = JsonString(package.GetId()); + packages.Add(id); + } + json.Append(String.Format("\"packages\":[{0}]", string.Join(",", packages.ToArray()))); + + json.Append("}"); + return json.ToString(); + } + } +} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js new file mode 100644 index 0000000000000..ea1f90652a05d --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js @@ -0,0 +1,213 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const glob = require('glob') +const log = require('npmlog') +const which = require('which') +const win = process.platform === 'win32' + +function build (gyp, argv, callback) { + var platformMake = 'make' + if (process.platform === 'aix') { + platformMake = 'gmake' + } else if (process.platform === 'os400') { + platformMake = 'gmake' + } else if (process.platform.indexOf('bsd') !== -1) { + platformMake = 'gmake' + } else if (win && argv.length > 0) { + argv = argv.map(function (target) { + return '/t:' + target + }) + } + + var makeCommand = gyp.opts.make || process.env.MAKE || platformMake + var command = win ? 'msbuild' : makeCommand + var jobs = gyp.opts.jobs || process.env.JOBS + var buildType + var config + var arch + var nodeDir + var guessedSolution + + loadConfigGypi() + + /** + * Load the "config.gypi" file that was generated during "configure". + */ + + function loadConfigGypi () { + var configPath = path.resolve('build', 'config.gypi') + + fs.readFile(configPath, 'utf8', function (err, data) { + if (err) { + if (err.code === 'ENOENT') { + callback(new Error('You must run `node-gyp configure` first!')) + } else { + callback(err) + } + return + } + config = JSON.parse(data.replace(/#.+\n/, '')) + + // get the 'arch', 'buildType', and 'nodeDir' vars from the config + buildType = config.target_defaults.default_configuration + arch = config.variables.target_arch + nodeDir = config.variables.nodedir + + if ('debug' in gyp.opts) { + buildType = gyp.opts.debug ? 'Debug' : 'Release' + } + if (!buildType) { + buildType = 'Release' + } + + log.verbose('build type', buildType) + log.verbose('architecture', arch) + log.verbose('node dev dir', nodeDir) + + if (win) { + findSolutionFile() + } else { + doWhich() + } + }) + } + + /** + * On Windows, find the first build/*.sln file. + */ + + function findSolutionFile () { + glob('build/*.sln', function (err, files) { + if (err) { + return callback(err) + } + if (files.length === 0) { + return callback(new Error('Could not find *.sln file. Did you run "configure"?')) + } + guessedSolution = files[0] + log.verbose('found first Solution file', guessedSolution) + doWhich() + }) + } + + /** + * Uses node-which to locate the msbuild / make executable. + */ + + function doWhich () { + // On Windows use msbuild provided by node-gyp configure + if (win) { + if (!config.variables.msbuild_path) { + return callback(new Error( + 'MSBuild is not set, please run `node-gyp configure`.')) + } + command = config.variables.msbuild_path + log.verbose('using MSBuild:', command) + doBuild() + return + } + // First make sure we have the build command in the PATH + which(command, function (err, execPath) { + if (err) { + // Some other error or 'make' not found on Unix, report that to the user + callback(err) + return + } + log.verbose('`which` succeeded for `' + command + '`', execPath) + doBuild() + }) + } + + /** + * Actually spawn the process and compile the module. + */ + + function doBuild () { + // Enable Verbose build + var verbose = log.levels[log.level] <= log.levels.verbose + var j + + if (!win && verbose) { + argv.push('V=1') + } + + if (win && !verbose) { + argv.push('/clp:Verbosity=minimal') + } + + if (win) { + // Turn off the Microsoft logo on Windows + argv.push('/nologo') + } + + // Specify the build type, Release by default + if (win) { + // Convert .gypi config target_arch to MSBuild /Platform + // Since there are many ways to state '32-bit Intel', default to it. + // N.B. msbuild's Condition string equality tests are case-insensitive. + var archLower = arch.toLowerCase() + var p = archLower === 'x64' ? 'x64' + : (archLower === 'arm' ? 'ARM' + : (archLower === 'arm64' ? 'ARM64' : 'Win32')) + argv.push('/p:Configuration=' + buildType + ';Platform=' + p) + if (jobs) { + j = parseInt(jobs, 10) + if (!isNaN(j) && j > 0) { + argv.push('/m:' + j) + } else if (jobs.toUpperCase() === 'MAX') { + argv.push('/m:' + require('os').cpus().length) + } + } + } else { + argv.push('BUILDTYPE=' + buildType) + // Invoke the Makefile in the 'build' dir. + argv.push('-C') + argv.push('build') + if (jobs) { + j = parseInt(jobs, 10) + if (!isNaN(j) && j > 0) { + argv.push('--jobs') + argv.push(j) + } else if (jobs.toUpperCase() === 'MAX') { + argv.push('--jobs') + argv.push(require('os').cpus().length) + } + } + } + + if (win) { + // did the user specify their own .sln file? + var hasSln = argv.some(function (arg) { + return path.extname(arg) === '.sln' + }) + if (!hasSln) { + argv.unshift(gyp.opts.solution || guessedSolution) + } + } + + if (!win) { + // Add build-time dependency symlinks (such as Python) to PATH + const buildBinsDir = path.resolve('build', 'node_gyp_bins') + process.env.PATH = `${buildBinsDir}:${process.env.PATH}` + log.verbose('bin symlinks', `adding symlinks (such as Python), at "${buildBinsDir}", to PATH`) + } + + var proc = gyp.spawn(command, argv) + proc.on('exit', onExit) + } + + function onExit (code, signal) { + if (code !== 0) { + return callback(new Error('`' + command + '` failed with exit code: ' + code)) + } + if (signal) { + return callback(new Error('`' + command + '` got signal: ' + signal)) + } + callback() + } +} + +module.exports = build +module.exports.usage = 'Invokes `' + (win ? 'msbuild' : 'make') + '` and builds the module' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/clean.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/clean.js new file mode 100644 index 0000000000000..dbfa4dbb99d3c --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/clean.js @@ -0,0 +1,15 @@ +'use strict' + +const rm = require('rimraf') +const log = require('npmlog') + +function clean (gyp, argv, callback) { + // Remove the 'build' dir + var buildDir = 'build' + + log.verbose('clean', 'removing "%s" directory', buildDir) + rm(buildDir, callback) +} + +module.exports = clean +module.exports.usage = 'Removes any generated build files and the "out" dir' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/configure.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/configure.js new file mode 100644 index 0000000000000..1ca3ade70935e --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/configure.js @@ -0,0 +1,360 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const log = require('npmlog') +const os = require('os') +const processRelease = require('./process-release') +const win = process.platform === 'win32' +const findNodeDirectory = require('./find-node-directory') +const createConfigGypi = require('./create-config-gypi') +const msgFormat = require('util').format +var findPython = require('./find-python') +if (win) { + var findVisualStudio = require('./find-visualstudio') +} + +function configure (gyp, argv, callback) { + var python + var buildDir = path.resolve('build') + var buildBinsDir = path.join(buildDir, 'node_gyp_bins') + var configNames = ['config.gypi', 'common.gypi'] + var configs = [] + var nodeDir + var release = processRelease(argv, gyp, process.version, process.release) + + findPython(gyp.opts.python, function (err, found) { + if (err) { + callback(err) + } else { + python = found + getNodeDir() + } + }) + + function getNodeDir () { + // 'python' should be set by now + process.env.PYTHON = python + + if (gyp.opts.nodedir) { + // --nodedir was specified. use that for the dev files + nodeDir = gyp.opts.nodedir.replace(/^~/, os.homedir()) + + log.verbose('get node dir', 'compiling against specified --nodedir dev files: %s', nodeDir) + createBuildDir() + } else { + // if no --nodedir specified, ensure node dependencies are installed + if ('v' + release.version !== process.version) { + // if --target was given, then determine a target version to compile for + log.verbose('get node dir', 'compiling against --target node version: %s', release.version) + } else { + // if no --target was specified then use the current host node version + log.verbose('get node dir', 'no --target version specified, falling back to host node version: %s', release.version) + } + + if (!release.semver) { + // could not parse the version string with semver + return callback(new Error('Invalid version number: ' + release.version)) + } + + // If the tarball option is set, always remove and reinstall the headers + // into devdir. Otherwise only install if they're not already there. + gyp.opts.ensure = !gyp.opts.tarball + + gyp.commands.install([release.version], function (err) { + if (err) { + return callback(err) + } + log.verbose('get node dir', 'target node version installed:', release.versionDir) + nodeDir = path.resolve(gyp.devDir, release.versionDir) + createBuildDir() + }) + } + } + + function createBuildDir () { + log.verbose('build dir', 'attempting to create "build" dir: %s', buildDir) + + const deepestBuildDirSubdirectory = win ? buildDir : buildBinsDir + fs.mkdir(deepestBuildDirSubdirectory, { recursive: true }, function (err, isNew) { + if (err) { + return callback(err) + } + log.verbose( + 'build dir', '"build" dir needed to be created?', isNew ? 'Yes' : 'No' + ) + if (win) { + findVisualStudio(release.semver, gyp.opts.msvs_version, + createConfigFile) + } else { + createPythonSymlink() + createConfigFile() + } + }) + } + + function createPythonSymlink () { + const symlinkDestination = path.join(buildBinsDir, 'python3') + + log.verbose('python symlink', `creating symlink to "${python}" at "${symlinkDestination}"`) + + fs.unlink(symlinkDestination, function (err) { + if (err && err.code !== 'ENOENT') { + log.verbose('python symlink', 'error when attempting to remove existing symlink') + log.verbose('python symlink', err.stack, 'errno: ' + err.errno) + } + fs.symlink(python, symlinkDestination, function (err) { + if (err) { + log.verbose('python symlink', 'error when attempting to create Python symlink') + log.verbose('python symlink', err.stack, 'errno: ' + err.errno) + } + }) + }) + } + + function createConfigFile (err, vsInfo) { + if (err) { + return callback(err) + } + if (process.platform === 'win32') { + process.env.GYP_MSVS_VERSION = Math.min(vsInfo.versionYear, 2015) + process.env.GYP_MSVS_OVERRIDE_PATH = vsInfo.path + } + createConfigGypi({ gyp, buildDir, nodeDir, vsInfo }).then(configPath => { + configs.push(configPath) + findConfigs() + }).catch(err => { + callback(err) + }) + } + + function findConfigs () { + var name = configNames.shift() + if (!name) { + return runGyp() + } + var fullPath = path.resolve(name) + + log.verbose(name, 'checking for gypi file: %s', fullPath) + fs.stat(fullPath, function (err) { + if (err) { + if (err.code === 'ENOENT') { + findConfigs() // check next gypi filename + } else { + callback(err) + } + } else { + log.verbose(name, 'found gypi file') + configs.push(fullPath) + findConfigs() + } + }) + } + + function runGyp (err) { + if (err) { + return callback(err) + } + + if (!~argv.indexOf('-f') && !~argv.indexOf('--format')) { + if (win) { + log.verbose('gyp', 'gyp format was not specified; forcing "msvs"') + // force the 'make' target for non-Windows + argv.push('-f', 'msvs') + } else { + log.verbose('gyp', 'gyp format was not specified; forcing "make"') + // force the 'make' target for non-Windows + argv.push('-f', 'make') + } + } + + // include all the ".gypi" files that were found + configs.forEach(function (config) { + argv.push('-I', config) + }) + + // For AIX and z/OS we need to set up the path to the exports file + // which contains the symbols needed for linking. + var nodeExpFile + if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') { + var ext = process.platform === 'os390' ? 'x' : 'exp' + var nodeRootDir = findNodeDirectory() + var candidates + + if (process.platform === 'aix' || process.platform === 'os400') { + candidates = [ + 'include/node/node', + 'out/Release/node', + 'out/Debug/node', + 'node' + ].map(function (file) { + return file + '.' + ext + }) + } else { + candidates = [ + 'out/Release/lib.target/libnode', + 'out/Debug/lib.target/libnode', + 'out/Release/obj.target/libnode', + 'out/Debug/obj.target/libnode', + 'lib/libnode' + ].map(function (file) { + return file + '.' + ext + }) + } + + var logprefix = 'find exports file' + nodeExpFile = findAccessibleSync(logprefix, nodeRootDir, candidates) + if (nodeExpFile !== undefined) { + log.verbose(logprefix, 'Found exports file: %s', nodeExpFile) + } else { + var msg = msgFormat('Could not find node.%s file in %s', ext, nodeRootDir) + log.error(logprefix, 'Could not find exports file') + return callback(new Error(msg)) + } + } + + // For z/OS we need to set up the path to zoslib include directory, + // which contains headers included in v8config.h. + var zoslibIncDir + if (process.platform === 'os390') { + logprefix = "find zoslib's zos-base.h:" + let msg + var zoslibIncPath = process.env.ZOSLIB_INCLUDES + if (zoslibIncPath) { + zoslibIncPath = findAccessibleSync(logprefix, zoslibIncPath, ['zos-base.h']) + if (zoslibIncPath === undefined) { + msg = msgFormat('Could not find zos-base.h file in the directory set ' + + 'in ZOSLIB_INCLUDES environment variable: %s; set it ' + + 'to the correct path, or unset it to search %s', process.env.ZOSLIB_INCLUDES, nodeRootDir) + } + } else { + candidates = [ + 'include/node/zoslib/zos-base.h', + 'include/zoslib/zos-base.h', + 'zoslib/include/zos-base.h', + 'install/include/node/zoslib/zos-base.h' + ] + zoslibIncPath = findAccessibleSync(logprefix, nodeRootDir, candidates) + if (zoslibIncPath === undefined) { + msg = msgFormat('Could not find any of %s in directory %s; set ' + + 'environmant variable ZOSLIB_INCLUDES to the path ' + + 'that contains zos-base.h', candidates.toString(), nodeRootDir) + } + } + if (zoslibIncPath !== undefined) { + zoslibIncDir = path.dirname(zoslibIncPath) + log.verbose(logprefix, "Found zoslib's zos-base.h in: %s", zoslibIncDir) + } else if (release.version.split('.')[0] >= 16) { + // zoslib is only shipped in Node v16 and above. + log.error(logprefix, msg) + return callback(new Error(msg)) + } + } + + // this logic ported from the old `gyp_addon` python file + var gypScript = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py') + var addonGypi = path.resolve(__dirname, '..', 'addon.gypi') + var commonGypi = path.resolve(nodeDir, 'include/node/common.gypi') + fs.stat(commonGypi, function (err) { + if (err) { + commonGypi = path.resolve(nodeDir, 'common.gypi') + } + + var outputDir = 'build' + if (win) { + // Windows expects an absolute path + outputDir = buildDir + } + var nodeGypDir = path.resolve(__dirname, '..') + + var nodeLibFile = path.join(nodeDir, + !gyp.opts.nodedir ? '<(target_arch)' : '$(Configuration)', + release.name + '.lib') + + argv.push('-I', addonGypi) + argv.push('-I', commonGypi) + argv.push('-Dlibrary=shared_library') + argv.push('-Dvisibility=default') + argv.push('-Dnode_root_dir=' + nodeDir) + if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') { + argv.push('-Dnode_exp_file=' + nodeExpFile) + if (process.platform === 'os390' && zoslibIncDir) { + argv.push('-Dzoslib_include_dir=' + zoslibIncDir) + } + } + argv.push('-Dnode_gyp_dir=' + nodeGypDir) + + // Do this to keep Cygwin environments happy, else the unescaped '\' gets eaten up, + // resulting in bad paths, Ex c:parentFolderfolderanotherFolder instead of c:\parentFolder\folder\anotherFolder + if (win) { + nodeLibFile = nodeLibFile.replace(/\\/g, '\\\\') + } + argv.push('-Dnode_lib_file=' + nodeLibFile) + argv.push('-Dmodule_root_dir=' + process.cwd()) + argv.push('-Dnode_engine=' + + (gyp.opts.node_engine || process.jsEngine || 'v8')) + argv.push('--depth=.') + argv.push('--no-parallel') + + // tell gyp to write the Makefile/Solution files into output_dir + argv.push('--generator-output', outputDir) + + // tell make to write its output into the same dir + argv.push('-Goutput_dir=.') + + // enforce use of the "binding.gyp" file + argv.unshift('binding.gyp') + + // execute `gyp` from the current target nodedir + argv.unshift(gypScript) + + // make sure python uses files that came with this particular node package + var pypath = [path.join(__dirname, '..', 'gyp', 'pylib')] + if (process.env.PYTHONPATH) { + pypath.push(process.env.PYTHONPATH) + } + process.env.PYTHONPATH = pypath.join(win ? ';' : ':') + + var cp = gyp.spawn(python, argv) + cp.on('exit', onCpExit) + }) + } + + function onCpExit (code) { + if (code !== 0) { + callback(new Error('`gyp` failed with exit code: ' + code)) + } else { + // we're done + callback() + } + } +} + +/** + * Returns the first file or directory from an array of candidates that is + * readable by the current user, or undefined if none of the candidates are + * readable. + */ +function findAccessibleSync (logprefix, dir, candidates) { + for (var next = 0; next < candidates.length; next++) { + var candidate = path.resolve(dir, candidates[next]) + try { + var fd = fs.openSync(candidate, 'r') + } catch (e) { + // this candidate was not found or not readable, do nothing + log.silly(logprefix, 'Could not open %s: %s', candidate, e.message) + continue + } + fs.closeSync(fd) + log.silly(logprefix, 'Found readable %s', candidate) + return candidate + } + + return undefined +} + +module.exports = configure +module.exports.test = { + findAccessibleSync: findAccessibleSync +} +module.exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/create-config-gypi.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/create-config-gypi.js new file mode 100644 index 0000000000000..ced4911502733 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/create-config-gypi.js @@ -0,0 +1,147 @@ +'use strict' + +const fs = require('graceful-fs') +const log = require('npmlog') +const path = require('path') + +function parseConfigGypi (config) { + // translated from tools/js2c.py of Node.js + // 1. string comments + config = config.replace(/#.*/g, '') + // 2. join multiline strings + config = config.replace(/'$\s+'/mg, '') + // 3. normalize string literals from ' into " + config = config.replace(/'/g, '"') + return JSON.parse(config) +} + +async function getBaseConfigGypi ({ gyp, nodeDir }) { + // try reading $nodeDir/include/node/config.gypi first when: + // 1. --dist-url or --nodedir is specified + // 2. and --force-process-config is not specified + const useCustomHeaders = gyp.opts.nodedir || gyp.opts.disturl || gyp.opts['dist-url'] + const shouldReadConfigGypi = useCustomHeaders && !gyp.opts['force-process-config'] + if (shouldReadConfigGypi && nodeDir) { + try { + const baseConfigGypiPath = path.resolve(nodeDir, 'include/node/config.gypi') + const baseConfigGypi = await fs.promises.readFile(baseConfigGypiPath) + return parseConfigGypi(baseConfigGypi.toString()) + } catch (err) { + log.warn('read config.gypi', err.message) + } + } + + // fallback to process.config if it is invalid + return JSON.parse(JSON.stringify(process.config)) +} + +async function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo }) { + const config = await getBaseConfigGypi({ gyp, nodeDir }) + if (!config.target_defaults) { + config.target_defaults = {} + } + if (!config.variables) { + config.variables = {} + } + + const defaults = config.target_defaults + const variables = config.variables + + // don't inherit the "defaults" from the base config.gypi. + // doing so could cause problems in cases where the `node` executable was + // compiled on a different machine (with different lib/include paths) than + // the machine where the addon is being built to + defaults.cflags = [] + defaults.defines = [] + defaults.include_dirs = [] + defaults.libraries = [] + + // set the default_configuration prop + if ('debug' in gyp.opts) { + defaults.default_configuration = gyp.opts.debug ? 'Debug' : 'Release' + } + + if (!defaults.default_configuration) { + defaults.default_configuration = 'Release' + } + + // set the target_arch variable + variables.target_arch = gyp.opts.arch || process.arch || 'ia32' + if (variables.target_arch === 'arm64') { + defaults.msvs_configuration_platform = 'ARM64' + defaults.xcode_configuration_platform = 'arm64' + } + + // set the node development directory + variables.nodedir = nodeDir + + // disable -T "thin" static archives by default + variables.standalone_static_library = gyp.opts.thin ? 0 : 1 + + if (process.platform === 'win32') { + defaults.msbuild_toolset = vsInfo.toolset + if (vsInfo.sdk) { + defaults.msvs_windows_target_platform_version = vsInfo.sdk + } + if (variables.target_arch === 'arm64') { + if (vsInfo.versionMajor > 15 || + (vsInfo.versionMajor === 15 && vsInfo.versionMajor >= 9)) { + defaults.msvs_enable_marmasm = 1 + } else { + log.warn('Compiling ARM64 assembly is only available in\n' + + 'Visual Studio 2017 version 15.9 and above') + } + } + variables.msbuild_path = vsInfo.msBuild + } + + // loop through the rest of the opts and add the unknown ones as variables. + // this allows for module-specific configure flags like: + // + // $ node-gyp configure --shared-libxml2 + Object.keys(gyp.opts).forEach(function (opt) { + if (opt === 'argv') { + return + } + if (opt in gyp.configDefs) { + return + } + variables[opt.replace(/-/g, '_')] = gyp.opts[opt] + }) + + return config +} + +async function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo }) { + const configFilename = 'config.gypi' + const configPath = path.resolve(buildDir, configFilename) + + log.verbose('build/' + configFilename, 'creating config file') + + const config = await getCurrentConfigGypi({ gyp, nodeDir, vsInfo }) + + // ensures that any boolean values in config.gypi get stringified + function boolsToString (k, v) { + if (typeof v === 'boolean') { + return String(v) + } + return v + } + + log.silly('build/' + configFilename, config) + + // now write out the config.gypi file to the build/ dir + const prefix = '# Do not edit. File was generated by node-gyp\'s "configure" step' + + const json = JSON.stringify(config, boolsToString, 2) + log.verbose('build/' + configFilename, 'writing out config file: %s', configPath) + await fs.promises.writeFile(configPath, [prefix, json, ''].join('\n')) + + return configPath +} + +module.exports = createConfigGypi +module.exports.test = { + parseConfigGypi: parseConfigGypi, + getCurrentConfigGypi: getCurrentConfigGypi +} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-node-directory.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-node-directory.js new file mode 100644 index 0000000000000..0dd781a6cfae8 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-node-directory.js @@ -0,0 +1,63 @@ +'use strict' + +const path = require('path') +const log = require('npmlog') + +function findNodeDirectory (scriptLocation, processObj) { + // set dirname and process if not passed in + // this facilitates regression tests + if (scriptLocation === undefined) { + scriptLocation = __dirname + } + if (processObj === undefined) { + processObj = process + } + + // Have a look to see what is above us, to try and work out where we are + var npmParentDirectory = path.join(scriptLocation, '../../../..') + log.verbose('node-gyp root', 'npm_parent_directory is ' + + path.basename(npmParentDirectory)) + var nodeRootDir = '' + + log.verbose('node-gyp root', 'Finding node root directory') + if (path.basename(npmParentDirectory) === 'deps') { + // We are in a build directory where this script lives in + // deps/npm/node_modules/node-gyp/lib + nodeRootDir = path.join(npmParentDirectory, '..') + log.verbose('node-gyp root', 'in build directory, root = ' + + nodeRootDir) + } else if (path.basename(npmParentDirectory) === 'node_modules') { + // We are in a node install directory where this script lives in + // lib/node_modules/npm/node_modules/node-gyp/lib or + // node_modules/npm/node_modules/node-gyp/lib depending on the + // platform + if (processObj.platform === 'win32') { + nodeRootDir = path.join(npmParentDirectory, '..') + } else { + nodeRootDir = path.join(npmParentDirectory, '../..') + } + log.verbose('node-gyp root', 'in install directory, root = ' + + nodeRootDir) + } else { + // We don't know where we are, try working it out from the location + // of the node binary + var nodeDir = path.dirname(processObj.execPath) + var directoryUp = path.basename(nodeDir) + if (directoryUp === 'bin') { + nodeRootDir = path.join(nodeDir, '..') + } else if (directoryUp === 'Release' || directoryUp === 'Debug') { + // If we are a recently built node, and the directory structure + // is that of a repository. If we are on Windows then we only need + // to go one level up, everything else, two + if (processObj.platform === 'win32') { + nodeRootDir = path.join(nodeDir, '..') + } else { + nodeRootDir = path.join(nodeDir, '../..') + } + } + // Else return the default blank, "". + } + return nodeRootDir +} + +module.exports = findNodeDirectory diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js new file mode 100644 index 0000000000000..a445e825b9d7e --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js @@ -0,0 +1,344 @@ +'use strict' + +const log = require('npmlog') +const semver = require('semver') +const cp = require('child_process') +const extend = require('util')._extend // eslint-disable-line +const win = process.platform === 'win32' +const logWithPrefix = require('./util').logWithPrefix + +const systemDrive = process.env.SystemDrive || 'C:' +const username = process.env.USERNAME || process.env.USER || getOsUserInfo() +const localAppData = process.env.LOCALAPPDATA || `${systemDrive}\\${username}\\AppData\\Local` +const foundLocalAppData = process.env.LOCALAPPDATA || username +const programFiles = process.env.ProgramW6432 || process.env.ProgramFiles || `${systemDrive}\\Program Files` +const programFilesX86 = process.env['ProgramFiles(x86)'] || `${programFiles} (x86)` + +const winDefaultLocationsArray = [] +for (const majorMinor of ['39', '38', '37', '36']) { + if (foundLocalAppData) { + winDefaultLocationsArray.push( + `${localAppData}\\Programs\\Python\\Python${majorMinor}\\python.exe`, + `${programFiles}\\Python${majorMinor}\\python.exe`, + `${localAppData}\\Programs\\Python\\Python${majorMinor}-32\\python.exe`, + `${programFiles}\\Python${majorMinor}-32\\python.exe`, + `${programFilesX86}\\Python${majorMinor}-32\\python.exe` + ) + } else { + winDefaultLocationsArray.push( + `${programFiles}\\Python${majorMinor}\\python.exe`, + `${programFiles}\\Python${majorMinor}-32\\python.exe`, + `${programFilesX86}\\Python${majorMinor}-32\\python.exe` + ) + } +} + +function getOsUserInfo () { + try { + return require('os').userInfo().username + } catch (e) {} +} + +function PythonFinder (configPython, callback) { + this.callback = callback + this.configPython = configPython + this.errorLog = [] +} + +PythonFinder.prototype = { + log: logWithPrefix(log, 'find Python'), + argsExecutable: ['-c', 'import sys; print(sys.executable);'], + argsVersion: ['-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);'], + semverRange: '>=3.6.0', + + // These can be overridden for testing: + execFile: cp.execFile, + env: process.env, + win: win, + pyLauncher: 'py.exe', + winDefaultLocations: winDefaultLocationsArray, + + // Logs a message at verbose level, but also saves it to be displayed later + // at error level if an error occurs. This should help diagnose the problem. + addLog: function addLog (message) { + this.log.verbose(message) + this.errorLog.push(message) + }, + + // Find Python by trying a sequence of possibilities. + // Ignore errors, keep trying until Python is found. + findPython: function findPython () { + const SKIP = 0; const FAIL = 1 + var toCheck = getChecks.apply(this) + + function getChecks () { + if (this.env.NODE_GYP_FORCE_PYTHON) { + return [{ + before: () => { + this.addLog( + 'checking Python explicitly set from NODE_GYP_FORCE_PYTHON') + this.addLog('- process.env.NODE_GYP_FORCE_PYTHON is ' + + `"${this.env.NODE_GYP_FORCE_PYTHON}"`) + }, + check: this.checkCommand, + arg: this.env.NODE_GYP_FORCE_PYTHON + }] + } + + var checks = [ + { + before: () => { + if (!this.configPython) { + this.addLog( + 'Python is not set from command line or npm configuration') + return SKIP + } + this.addLog('checking Python explicitly set from command line or ' + + 'npm configuration') + this.addLog('- "--python=" or "npm config get python" is ' + + `"${this.configPython}"`) + }, + check: this.checkCommand, + arg: this.configPython + }, + { + before: () => { + if (!this.env.PYTHON) { + this.addLog('Python is not set from environment variable ' + + 'PYTHON') + return SKIP + } + this.addLog('checking Python explicitly set from environment ' + + 'variable PYTHON') + this.addLog(`- process.env.PYTHON is "${this.env.PYTHON}"`) + }, + check: this.checkCommand, + arg: this.env.PYTHON + }, + { + before: () => { this.addLog('checking if "python3" can be used') }, + check: this.checkCommand, + arg: 'python3' + }, + { + before: () => { this.addLog('checking if "python" can be used') }, + check: this.checkCommand, + arg: 'python' + } + ] + + if (this.win) { + for (var i = 0; i < this.winDefaultLocations.length; ++i) { + const location = this.winDefaultLocations[i] + checks.push({ + before: () => { + this.addLog('checking if Python is ' + + `${location}`) + }, + check: this.checkExecPath, + arg: location + }) + } + checks.push({ + before: () => { + this.addLog( + 'checking if the py launcher can be used to find Python 3') + }, + check: this.checkPyLauncher + }) + } + + return checks + } + + function runChecks (err) { + this.log.silly('runChecks: err = %j', (err && err.stack) || err) + + const check = toCheck.shift() + if (!check) { + return this.fail() + } + + const before = check.before.apply(this) + if (before === SKIP) { + return runChecks.apply(this) + } + if (before === FAIL) { + return this.fail() + } + + const args = [runChecks.bind(this)] + if (check.arg) { + args.unshift(check.arg) + } + check.check.apply(this, args) + } + + runChecks.apply(this) + }, + + // Check if command is a valid Python to use. + // Will exit the Python finder on success. + // If on Windows, run in a CMD shell to support BAT/CMD launchers. + checkCommand: function checkCommand (command, errorCallback) { + var exec = command + var args = this.argsExecutable + var shell = false + if (this.win) { + // Arguments have to be manually quoted + exec = `"${exec}"` + args = args.map(a => `"${a}"`) + shell = true + } + + this.log.verbose(`- executing "${command}" to get executable path`) + this.run(exec, args, shell, function (err, execPath) { + // Possible outcomes: + // - Error: not in PATH, not executable or execution fails + // - Gibberish: the next command to check version will fail + // - Absolute path to executable + if (err) { + this.addLog(`- "${command}" is not in PATH or produced an error`) + return errorCallback(err) + } + this.addLog(`- executable path is "${execPath}"`) + this.checkExecPath(execPath, errorCallback) + }.bind(this)) + }, + + // Check if the py launcher can find a valid Python to use. + // Will exit the Python finder on success. + // Distributions of Python on Windows by default install with the "py.exe" + // Python launcher which is more likely to exist than the Python executable + // being in the $PATH. + // Because the Python launcher supports Python 2 and Python 3, we should + // explicitly request a Python 3 version. This is done by supplying "-3" as + // the first command line argument. Since "py.exe -3" would be an invalid + // executable for "execFile", we have to use the launcher to figure out + // where the actual "python.exe" executable is located. + checkPyLauncher: function checkPyLauncher (errorCallback) { + this.log.verbose( + `- executing "${this.pyLauncher}" to get Python 3 executable path`) + this.run(this.pyLauncher, ['-3', ...this.argsExecutable], false, + function (err, execPath) { + // Possible outcomes: same as checkCommand + if (err) { + this.addLog( + `- "${this.pyLauncher}" is not in PATH or produced an error`) + return errorCallback(err) + } + this.addLog(`- executable path is "${execPath}"`) + this.checkExecPath(execPath, errorCallback) + }.bind(this)) + }, + + // Check if a Python executable is the correct version to use. + // Will exit the Python finder on success. + checkExecPath: function checkExecPath (execPath, errorCallback) { + this.log.verbose(`- executing "${execPath}" to get version`) + this.run(execPath, this.argsVersion, false, function (err, version) { + // Possible outcomes: + // - Error: executable can not be run (likely meaning the command wasn't + // a Python executable and the previous command produced gibberish) + // - Gibberish: somehow the last command produced an executable path, + // this will fail when verifying the version + // - Version of the Python executable + if (err) { + this.addLog(`- "${execPath}" could not be run`) + return errorCallback(err) + } + this.addLog(`- version is "${version}"`) + + const range = new semver.Range(this.semverRange) + var valid = false + try { + valid = range.test(version) + } catch (err) { + this.log.silly('range.test() threw:\n%s', err.stack) + this.addLog(`- "${execPath}" does not have a valid version`) + this.addLog('- is it a Python executable?') + return errorCallback(err) + } + + if (!valid) { + this.addLog(`- version is ${version} - should be ${this.semverRange}`) + this.addLog('- THIS VERSION OF PYTHON IS NOT SUPPORTED') + return errorCallback(new Error( + `Found unsupported Python version ${version}`)) + } + this.succeed(execPath, version) + }.bind(this)) + }, + + // Run an executable or shell command, trimming the output. + run: function run (exec, args, shell, callback) { + var env = extend({}, this.env) + env.TERM = 'dumb' + const opts = { env: env, shell: shell } + + this.log.silly('execFile: exec = %j', exec) + this.log.silly('execFile: args = %j', args) + this.log.silly('execFile: opts = %j', opts) + try { + this.execFile(exec, args, opts, execFileCallback.bind(this)) + } catch (err) { + this.log.silly('execFile: threw:\n%s', err.stack) + return callback(err) + } + + function execFileCallback (err, stdout, stderr) { + this.log.silly('execFile result: err = %j', (err && err.stack) || err) + this.log.silly('execFile result: stdout = %j', stdout) + this.log.silly('execFile result: stderr = %j', stderr) + if (err) { + return callback(err) + } + const execPath = stdout.trim() + callback(null, execPath) + } + }, + + succeed: function succeed (execPath, version) { + this.log.info(`using Python version ${version} found at "${execPath}"`) + process.nextTick(this.callback.bind(null, null, execPath)) + }, + + fail: function fail () { + const errorLog = this.errorLog.join('\n') + + const pathExample = this.win ? 'C:\\Path\\To\\python.exe' + : '/path/to/pythonexecutable' + // For Windows 80 col console, use up to the column before the one marked + // with X (total 79 chars including logger prefix, 58 chars usable here): + // X + const info = [ + '**********************************************************', + 'You need to install the latest version of Python.', + 'Node-gyp should be able to find and use Python. If not,', + 'you can try one of the following options:', + `- Use the switch --python="${pathExample}"`, + ' (accepted by both node-gyp and npm)', + '- Set the environment variable PYTHON', + '- Set the npm configuration variable python:', + ` npm config set python "${pathExample}"`, + 'For more information consult the documentation at:', + 'https://github.com/nodejs/node-gyp#installation', + '**********************************************************' + ].join('\n') + + this.log.error(`\n${errorLog}\n\n${info}\n`) + process.nextTick(this.callback.bind(null, new Error( + 'Could not find any Python installation to use'))) + } +} + +function findPython (configPython, callback) { + var finder = new PythonFinder(configPython, callback) + finder.findPython() +} + +module.exports = findPython +module.exports.test = { + PythonFinder: PythonFinder, + findPython: findPython +} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-visualstudio.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-visualstudio.js new file mode 100644 index 0000000000000..16f6e79559307 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-visualstudio.js @@ -0,0 +1,463 @@ +'use strict' + +const log = require('npmlog') +const execFile = require('child_process').execFile +const fs = require('fs') +const path = require('path').win32 +const logWithPrefix = require('./util').logWithPrefix +const regSearchKeys = require('./util').regSearchKeys + +function findVisualStudio (nodeSemver, configMsvsVersion, callback) { + const finder = new VisualStudioFinder(nodeSemver, configMsvsVersion, + callback) + finder.findVisualStudio() +} + +function VisualStudioFinder (nodeSemver, configMsvsVersion, callback) { + this.nodeSemver = nodeSemver + this.configMsvsVersion = configMsvsVersion + this.callback = callback + this.errorLog = [] + this.validVersions = [] +} + +VisualStudioFinder.prototype = { + log: logWithPrefix(log, 'find VS'), + + regSearchKeys: regSearchKeys, + + // Logs a message at verbose level, but also saves it to be displayed later + // at error level if an error occurs. This should help diagnose the problem. + addLog: function addLog (message) { + this.log.verbose(message) + this.errorLog.push(message) + }, + + findVisualStudio: function findVisualStudio () { + this.configVersionYear = null + this.configPath = null + if (this.configMsvsVersion) { + this.addLog('msvs_version was set from command line or npm config') + if (this.configMsvsVersion.match(/^\d{4}$/)) { + this.configVersionYear = parseInt(this.configMsvsVersion, 10) + this.addLog( + `- looking for Visual Studio version ${this.configVersionYear}`) + } else { + this.configPath = path.resolve(this.configMsvsVersion) + this.addLog( + `- looking for Visual Studio installed in "${this.configPath}"`) + } + } else { + this.addLog('msvs_version not set from command line or npm config') + } + + if (process.env.VCINSTALLDIR) { + this.envVcInstallDir = + path.resolve(process.env.VCINSTALLDIR, '..') + this.addLog('running in VS Command Prompt, installation path is:\n' + + `"${this.envVcInstallDir}"\n- will only use this version`) + } else { + this.addLog('VCINSTALLDIR not set, not running in VS Command Prompt') + } + + this.findVisualStudio2017OrNewer((info) => { + if (info) { + return this.succeed(info) + } + this.findVisualStudio2015((info) => { + if (info) { + return this.succeed(info) + } + this.findVisualStudio2013((info) => { + if (info) { + return this.succeed(info) + } + this.fail() + }) + }) + }) + }, + + succeed: function succeed (info) { + this.log.info(`using VS${info.versionYear} (${info.version}) found at:` + + `\n"${info.path}"` + + '\nrun with --verbose for detailed information') + process.nextTick(this.callback.bind(null, null, info)) + }, + + fail: function fail () { + if (this.configMsvsVersion && this.envVcInstallDir) { + this.errorLog.push( + 'msvs_version does not match this VS Command Prompt or the', + 'installation cannot be used.') + } else if (this.configMsvsVersion) { + // If msvs_version was specified but finding VS failed, print what would + // have been accepted + this.errorLog.push('') + if (this.validVersions) { + this.errorLog.push('valid versions for msvs_version:') + this.validVersions.forEach((version) => { + this.errorLog.push(`- "${version}"`) + }) + } else { + this.errorLog.push('no valid versions for msvs_version were found') + } + } + + const errorLog = this.errorLog.join('\n') + + // For Windows 80 col console, use up to the column before the one marked + // with X (total 79 chars including logger prefix, 62 chars usable here): + // X + const infoLog = [ + '**************************************************************', + 'You need to install the latest version of Visual Studio', + 'including the "Desktop development with C++" workload.', + 'For more information consult the documentation at:', + 'https://github.com/nodejs/node-gyp#on-windows', + '**************************************************************' + ].join('\n') + + this.log.error(`\n${errorLog}\n\n${infoLog}\n`) + process.nextTick(this.callback.bind(null, new Error( + 'Could not find any Visual Studio installation to use'))) + }, + + // Invoke the PowerShell script to get information about Visual Studio 2017 + // or newer installations + findVisualStudio2017OrNewer: function findVisualStudio2017OrNewer (cb) { + var ps = path.join(process.env.SystemRoot, 'System32', + 'WindowsPowerShell', 'v1.0', 'powershell.exe') + var csFile = path.join(__dirname, 'Find-VisualStudio.cs') + var psArgs = [ + '-ExecutionPolicy', + 'Unrestricted', + '-NoProfile', + '-Command', + '&{Add-Type -Path \'' + csFile + '\';' + '[VisualStudioConfiguration.Main]::PrintJson()}' + ] + + this.log.silly('Running', ps, psArgs) + var child = execFile(ps, psArgs, { encoding: 'utf8' }, + (err, stdout, stderr) => { + this.parseData(err, stdout, stderr, cb) + }) + child.stdin.end() + }, + + // Parse the output of the PowerShell script and look for an installation + // of Visual Studio 2017 or newer to use + parseData: function parseData (err, stdout, stderr, cb) { + this.log.silly('PS stderr = %j', stderr) + + const failPowershell = () => { + this.addLog( + 'could not use PowerShell to find Visual Studio 2017 or newer, try re-running with \'--loglevel silly\' for more details') + cb(null) + } + + if (err) { + this.log.silly('PS err = %j', err && (err.stack || err)) + return failPowershell() + } + + var vsInfo + try { + vsInfo = JSON.parse(stdout) + } catch (e) { + this.log.silly('PS stdout = %j', stdout) + this.log.silly(e) + return failPowershell() + } + + if (!Array.isArray(vsInfo)) { + this.log.silly('PS stdout = %j', stdout) + return failPowershell() + } + + vsInfo = vsInfo.map((info) => { + this.log.silly(`processing installation: "${info.path}"`) + info.path = path.resolve(info.path) + var ret = this.getVersionInfo(info) + ret.path = info.path + ret.msBuild = this.getMSBuild(info, ret.versionYear) + ret.toolset = this.getToolset(info, ret.versionYear) + ret.sdk = this.getSDK(info) + return ret + }) + this.log.silly('vsInfo:', vsInfo) + + // Remove future versions or errors parsing version number + vsInfo = vsInfo.filter((info) => { + if (info.versionYear) { + return true + } + this.addLog(`unknown version "${info.version}" found at "${info.path}"`) + return false + }) + + // Sort to place newer versions first + vsInfo.sort((a, b) => b.versionYear - a.versionYear) + + for (var i = 0; i < vsInfo.length; ++i) { + const info = vsInfo[i] + this.addLog(`checking VS${info.versionYear} (${info.version}) found ` + + `at:\n"${info.path}"`) + + if (info.msBuild) { + this.addLog('- found "Visual Studio C++ core features"') + } else { + this.addLog('- "Visual Studio C++ core features" missing') + continue + } + + if (info.toolset) { + this.addLog(`- found VC++ toolset: ${info.toolset}`) + } else { + this.addLog('- missing any VC++ toolset') + continue + } + + if (info.sdk) { + this.addLog(`- found Windows SDK: ${info.sdk}`) + } else { + this.addLog('- missing any Windows SDK') + continue + } + + if (!this.checkConfigVersion(info.versionYear, info.path)) { + continue + } + + return cb(info) + } + + this.addLog( + 'could not find a version of Visual Studio 2017 or newer to use') + cb(null) + }, + + // Helper - process version information + getVersionInfo: function getVersionInfo (info) { + const match = /^(\d+)\.(\d+)\..*/.exec(info.version) + if (!match) { + this.log.silly('- failed to parse version:', info.version) + return {} + } + this.log.silly('- version match = %j', match) + var ret = { + version: info.version, + versionMajor: parseInt(match[1], 10), + versionMinor: parseInt(match[2], 10) + } + if (ret.versionMajor === 15) { + ret.versionYear = 2017 + return ret + } + if (ret.versionMajor === 16) { + ret.versionYear = 2019 + return ret + } + if (ret.versionMajor === 17) { + ret.versionYear = 2022 + return ret + } + this.log.silly('- unsupported version:', ret.versionMajor) + return {} + }, + + msBuildPathExists: function msBuildPathExists (path) { + return fs.existsSync(path) + }, + + // Helper - process MSBuild information + getMSBuild: function getMSBuild (info, versionYear) { + const pkg = 'Microsoft.VisualStudio.VC.MSBuild.Base' + const msbuildPath = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'MSBuild.exe') + const msbuildPathArm64 = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'arm64', 'MSBuild.exe') + if (info.packages.indexOf(pkg) !== -1) { + this.log.silly('- found VC.MSBuild.Base') + if (versionYear === 2017) { + return path.join(info.path, 'MSBuild', '15.0', 'Bin', 'MSBuild.exe') + } + if (versionYear === 2019) { + return msbuildPath + } + } + /** + * Visual Studio 2022 doesn't have the MSBuild package. + * Support for compiling _on_ ARM64 was added in MSVC 14.32.31326, + * so let's leverage it if the user has an ARM64 device. + */ + if (process.arch === 'arm64' && this.msBuildPathExists(msbuildPathArm64)) { + return msbuildPathArm64 + } else if (this.msBuildPathExists(msbuildPath)) { + return msbuildPath + } + return null + }, + + // Helper - process toolset information + getToolset: function getToolset (info, versionYear) { + const pkg = 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64' + const express = 'Microsoft.VisualStudio.WDExpress' + + if (info.packages.indexOf(pkg) !== -1) { + this.log.silly('- found VC.Tools.x86.x64') + } else if (info.packages.indexOf(express) !== -1) { + this.log.silly('- found Visual Studio Express (looking for toolset)') + } else { + return null + } + + if (versionYear === 2017) { + return 'v141' + } else if (versionYear === 2019) { + return 'v142' + } else if (versionYear === 2022) { + return 'v143' + } + this.log.silly('- invalid versionYear:', versionYear) + return null + }, + + // Helper - process Windows SDK information + getSDK: function getSDK (info) { + const win8SDK = 'Microsoft.VisualStudio.Component.Windows81SDK' + const win10SDKPrefix = 'Microsoft.VisualStudio.Component.Windows10SDK.' + const win11SDKPrefix = 'Microsoft.VisualStudio.Component.Windows11SDK.' + + var Win10or11SDKVer = 0 + info.packages.forEach((pkg) => { + if (!pkg.startsWith(win10SDKPrefix) && !pkg.startsWith(win11SDKPrefix)) { + return + } + const parts = pkg.split('.') + if (parts.length > 5 && parts[5] !== 'Desktop') { + this.log.silly('- ignoring non-Desktop Win10/11SDK:', pkg) + return + } + const foundSdkVer = parseInt(parts[4], 10) + if (isNaN(foundSdkVer)) { + // Microsoft.VisualStudio.Component.Windows10SDK.IpOverUsb + this.log.silly('- failed to parse Win10/11SDK number:', pkg) + return + } + this.log.silly('- found Win10/11SDK:', foundSdkVer) + Win10or11SDKVer = Math.max(Win10or11SDKVer, foundSdkVer) + }) + + if (Win10or11SDKVer !== 0) { + return `10.0.${Win10or11SDKVer}.0` + } else if (info.packages.indexOf(win8SDK) !== -1) { + this.log.silly('- found Win8SDK') + return '8.1' + } + return null + }, + + // Find an installation of Visual Studio 2015 to use + findVisualStudio2015: function findVisualStudio2015 (cb) { + if (this.nodeSemver.major >= 19) { + this.addLog( + 'not looking for VS2015 as it is only supported up to Node.js 18') + return cb(null) + } + return this.findOldVS({ + version: '14.0', + versionMajor: 14, + versionMinor: 0, + versionYear: 2015, + toolset: 'v140' + }, cb) + }, + + // Find an installation of Visual Studio 2013 to use + findVisualStudio2013: function findVisualStudio2013 (cb) { + if (this.nodeSemver.major >= 9) { + this.addLog( + 'not looking for VS2013 as it is only supported up to Node.js 8') + return cb(null) + } + return this.findOldVS({ + version: '12.0', + versionMajor: 12, + versionMinor: 0, + versionYear: 2013, + toolset: 'v120' + }, cb) + }, + + // Helper - common code for VS2013 and VS2015 + findOldVS: function findOldVS (info, cb) { + const regVC7 = ['HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7', + 'HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7'] + const regMSBuild = 'HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions' + + this.addLog(`looking for Visual Studio ${info.versionYear}`) + this.regSearchKeys(regVC7, info.version, [], (err, res) => { + if (err) { + this.addLog('- not found') + return cb(null) + } + + const vsPath = path.resolve(res, '..') + this.addLog(`- found in "${vsPath}"`) + + const msBuildRegOpts = process.arch === 'ia32' ? [] : ['/reg:32'] + this.regSearchKeys([`${regMSBuild}\\${info.version}`], + 'MSBuildToolsPath', msBuildRegOpts, (err, res) => { + if (err) { + this.addLog( + '- could not find MSBuild in registry for this version') + return cb(null) + } + + const msBuild = path.join(res, 'MSBuild.exe') + this.addLog(`- MSBuild in "${msBuild}"`) + + if (!this.checkConfigVersion(info.versionYear, vsPath)) { + return cb(null) + } + + info.path = vsPath + info.msBuild = msBuild + info.sdk = null + cb(info) + }) + }) + }, + + // After finding a usable version of Visual Studio: + // - add it to validVersions to be displayed at the end if a specific + // version was requested and not found; + // - check if this is the version that was requested. + // - check if this matches the Visual Studio Command Prompt + checkConfigVersion: function checkConfigVersion (versionYear, vsPath) { + this.validVersions.push(versionYear) + this.validVersions.push(vsPath) + + if (this.configVersionYear && this.configVersionYear !== versionYear) { + this.addLog('- msvs_version does not match this version') + return false + } + if (this.configPath && + path.relative(this.configPath, vsPath) !== '') { + this.addLog('- msvs_version does not point to this installation') + return false + } + if (this.envVcInstallDir && + path.relative(this.envVcInstallDir, vsPath) !== '') { + this.addLog('- does not match this Visual Studio Command Prompt') + return false + } + + return true + } +} + +module.exports = findVisualStudio +module.exports.test = { + VisualStudioFinder: VisualStudioFinder, + findVisualStudio: findVisualStudio +} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/install.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/install.js new file mode 100644 index 0000000000000..1eb9f14c6742a --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/install.js @@ -0,0 +1,458 @@ +'use strict' + +const fs = require('graceful-fs') +const os = require('os') +const { backOff } = require('exponential-backoff') +const rm = require('rimraf') +const tar = require('tar') +const path = require('path') +const util = require('util') +const stream = require('stream') +const crypto = require('crypto') +const log = require('npmlog') +const semver = require('semver') +const fetch = require('make-fetch-happen') +const processRelease = require('./process-release') +const win = process.platform === 'win32' +const streamPipeline = util.promisify(stream.pipeline) + +/** + * @param {typeof import('graceful-fs')} fs + */ + +async function install (fs, gyp, argv) { + const release = processRelease(argv, gyp, process.version, process.release) + // Detecting target_arch based on logic from create-cnfig-gyp.js. Used on Windows only. + const arch = win ? (gyp.opts.target_arch || gyp.opts.arch || process.arch || 'ia32') : '' + // Used to prevent downloading tarball if only new node.lib is required on Windows. + let shouldDownloadTarball = true + + // Determine which node dev files version we are installing + log.verbose('install', 'input version string %j', release.version) + + if (!release.semver) { + // could not parse the version string with semver + throw new Error('Invalid version number: ' + release.version) + } + + if (semver.lt(release.version, '0.8.0')) { + throw new Error('Minimum target version is `0.8.0` or greater. Got: ' + release.version) + } + + // 0.x.y-pre versions are not published yet and cannot be installed. Bail. + if (release.semver.prerelease[0] === 'pre') { + log.verbose('detected "pre" node version', release.version) + if (!gyp.opts.nodedir) { + throw new Error('"pre" versions of node cannot be installed, use the --nodedir flag instead') + } + log.verbose('--nodedir flag was passed; skipping install', gyp.opts.nodedir) + return + } + + // flatten version into String + log.verbose('install', 'installing version: %s', release.versionDir) + + // the directory where the dev files will be installed + const devDir = path.resolve(gyp.devDir, release.versionDir) + + // If '--ensure' was passed, then don't *always* install the version; + // check if it is already installed, and only install when needed + if (gyp.opts.ensure) { + log.verbose('install', '--ensure was passed, so won\'t reinstall if already installed') + try { + await fs.promises.stat(devDir) + } catch (err) { + if (err.code === 'ENOENT') { + log.verbose('install', 'version not already installed, continuing with install', release.version) + try { + return await go() + } catch (err) { + return rollback(err) + } + } else if (err.code === 'EACCES') { + return eaccesFallback(err) + } + throw err + } + log.verbose('install', 'version is already installed, need to check "installVersion"') + const installVersionFile = path.resolve(devDir, 'installVersion') + let installVersion = 0 + try { + const ver = await fs.promises.readFile(installVersionFile, 'ascii') + installVersion = parseInt(ver, 10) || 0 + } catch (err) { + if (err.code !== 'ENOENT') { + throw err + } + } + log.verbose('got "installVersion"', installVersion) + log.verbose('needs "installVersion"', gyp.package.installVersion) + if (installVersion < gyp.package.installVersion) { + log.verbose('install', 'version is no good; reinstalling') + try { + return await go() + } catch (err) { + return rollback(err) + } + } + log.verbose('install', 'version is good') + if (win) { + log.verbose('on Windows; need to check node.lib') + const nodeLibPath = path.resolve(devDir, arch, 'node.lib') + try { + await fs.promises.stat(nodeLibPath) + } catch (err) { + if (err.code === 'ENOENT') { + log.verbose('install', `version not already installed for ${arch}, continuing with install`, release.version) + try { + shouldDownloadTarball = false + return await go() + } catch (err) { + return rollback(err) + } + } else if (err.code === 'EACCES') { + return eaccesFallback(err) + } + throw err + } + } + } else { + try { + return await go() + } catch (err) { + return rollback(err) + } + } + + async function copyDirectory (src, dest) { + try { + await fs.promises.stat(src) + } catch { + throw new Error(`Missing source directory for copy: ${src}`) + } + await fs.promises.mkdir(dest, { recursive: true }) + const entries = await fs.promises.readdir(src, { withFileTypes: true }) + for (const entry of entries) { + if (entry.isDirectory()) { + await copyDirectory(path.join(src, entry.name), path.join(dest, entry.name)) + } else if (entry.isFile()) { + // with parallel installs, copying files may cause file errors on + // Windows so use an exponential backoff to resolve collisions + await backOff(async () => { + try { + await fs.promises.copyFile(path.join(src, entry.name), path.join(dest, entry.name)) + } catch (err) { + // if ensure, check if file already exists and that's good enough + if (gyp.opts.ensure && err.code === 'EBUSY') { + try { + await fs.promises.stat(path.join(dest, entry.name)) + return + } catch {} + } + throw err + } + }) + } else { + throw new Error('Unexpected file directory entry type') + } + } + } + + async function go () { + log.verbose('ensuring devDir is created', devDir) + + // first create the dir for the node dev files + try { + const created = await fs.promises.mkdir(devDir, { recursive: true }) + + if (created) { + log.verbose('created devDir', created) + } + } catch (err) { + if (err.code === 'EACCES') { + return eaccesFallback(err) + } + + throw err + } + + // now download the node tarball + const tarPath = gyp.opts.tarball + let extractErrors = false + let extractCount = 0 + const contentShasums = {} + const expectShasums = {} + + // checks if a file to be extracted from the tarball is valid. + // only .h header files and the gyp files get extracted + function isValid (path) { + const isValid = valid(path) + if (isValid) { + log.verbose('extracted file from tarball', path) + extractCount++ + } else { + // invalid + log.silly('ignoring from tarball', path) + } + return isValid + } + + function onwarn (code, message) { + extractErrors = true + log.error('error while extracting tarball', code, message) + } + + // download the tarball and extract! + // Ommited on Windows if only new node.lib is required + + // on Windows there can be file errors from tar if parallel installs + // are happening (not uncommon with multiple native modules) so + // extract the tarball to a temp directory first and then copy over + const tarExtractDir = win ? await fs.promises.mkdtemp(path.join(os.tmpdir(), 'node-gyp-tmp-')) : devDir + + try { + if (shouldDownloadTarball) { + if (tarPath) { + await tar.extract({ + file: tarPath, + strip: 1, + filter: isValid, + onwarn, + cwd: tarExtractDir + }) + } else { + try { + const res = await download(gyp, release.tarballUrl) + + if (res.status !== 200) { + throw new Error(`${res.status} response downloading ${release.tarballUrl}`) + } + + await streamPipeline( + res.body, + // content checksum + new ShaSum((_, checksum) => { + const filename = path.basename(release.tarballUrl).trim() + contentShasums[filename] = checksum + log.verbose('content checksum', filename, checksum) + }), + tar.extract({ + strip: 1, + cwd: tarExtractDir, + filter: isValid, + onwarn + }) + ) + } catch (err) { + // something went wrong downloading the tarball? + if (err.code === 'ENOTFOUND') { + throw new Error('This is most likely not a problem with node-gyp or the package itself and\n' + + 'is related to network connectivity. In most cases you are behind a proxy or have bad \n' + + 'network settings.') + } + throw err + } + } + + // invoked after the tarball has finished being extracted + if (extractErrors || extractCount === 0) { + throw new Error('There was a fatal problem while downloading/extracting the tarball') + } + + log.verbose('tarball', 'done parsing tarball') + } + + const installVersionPath = path.resolve(tarExtractDir, 'installVersion') + await Promise.all([ + // need to download node.lib + ...(win ? [downloadNodeLib()] : []), + // write the "installVersion" file + fs.promises.writeFile(installVersionPath, gyp.package.installVersion + '\n'), + // Only download SHASUMS.txt if we downloaded something in need of SHA verification + ...(!tarPath || win ? [downloadShasums()] : []) + ]) + + log.verbose('download contents checksum', JSON.stringify(contentShasums)) + // check content shasums + for (const k in contentShasums) { + log.verbose('validating download checksum for ' + k, '(%s == %s)', contentShasums[k], expectShasums[k]) + if (contentShasums[k] !== expectShasums[k]) { + throw new Error(k + ' local checksum ' + contentShasums[k] + ' not match remote ' + expectShasums[k]) + } + } + + // copy over the files from the temp tarball extract directory to devDir + if (tarExtractDir !== devDir) { + await copyDirectory(tarExtractDir, devDir) + } + } finally { + if (tarExtractDir !== devDir) { + try { + // try to cleanup temp dir + await util.promisify(rm)(tarExtractDir) + } catch { + log.warn('failed to clean up temp tarball extract directory') + } + } + } + + async function downloadShasums () { + log.verbose('check download content checksum, need to download `SHASUMS256.txt`...') + log.verbose('checksum url', release.shasumsUrl) + + const res = await download(gyp, release.shasumsUrl) + + if (res.status !== 200) { + throw new Error(`${res.status} status code downloading checksum`) + } + + for (const line of (await res.text()).trim().split('\n')) { + const items = line.trim().split(/\s+/) + if (items.length !== 2) { + return + } + + // 0035d18e2dcf9aad669b1c7c07319e17abfe3762 ./node-v0.11.4.tar.gz + const name = items[1].replace(/^\.\//, '') + expectShasums[name] = items[0] + } + + log.verbose('checksum data', JSON.stringify(expectShasums)) + } + + async function downloadNodeLib () { + log.verbose('on Windows; need to download `' + release.name + '.lib`...') + const dir = path.resolve(tarExtractDir, arch) + const targetLibPath = path.resolve(dir, release.name + '.lib') + const { libUrl, libPath } = release[arch] + const name = `${arch} ${release.name}.lib` + log.verbose(name, 'dir', dir) + log.verbose(name, 'url', libUrl) + + await fs.promises.mkdir(dir, { recursive: true }) + log.verbose('streaming', name, 'to:', targetLibPath) + + const res = await download(gyp, libUrl) + + // Since only required node.lib is downloaded throw error if it is not fetched + if (res.status !== 200) { + throw new Error(`${res.status} status code downloading ${name}`) + } + + return streamPipeline( + res.body, + new ShaSum((_, checksum) => { + contentShasums[libPath] = checksum + log.verbose('content checksum', libPath, checksum) + }), + fs.createWriteStream(targetLibPath) + ) + } // downloadNodeLib() + } // go() + + /** + * Checks if a given filename is "valid" for this installation. + */ + + function valid (file) { + // header files + const extname = path.extname(file) + return extname === '.h' || extname === '.gypi' + } + + async function rollback (err) { + log.warn('install', 'got an error, rolling back install') + // roll-back the install if anything went wrong + await util.promisify(gyp.commands.remove)([release.versionDir]) + throw err + } + + /** + * The EACCES fallback is a workaround for npm's `sudo` behavior, where + * it drops the permissions before invoking any child processes (like + * node-gyp). So what happens is the "nobody" user doesn't have + * permission to create the dev dir. As a fallback, make the tmpdir() be + * the dev dir for this installation. This is not ideal, but at least + * the compilation will succeed... + */ + + async function eaccesFallback (err) { + const noretry = '--node_gyp_internal_noretry' + if (argv.indexOf(noretry) !== -1) { + throw err + } + const tmpdir = os.tmpdir() + gyp.devDir = path.resolve(tmpdir, '.node-gyp') + let userString = '' + try { + // os.userInfo can fail on some systems, it's not critical here + userString = ` ("${os.userInfo().username}")` + } catch (e) {} + log.warn('EACCES', 'current user%s does not have permission to access the dev dir "%s"', userString, devDir) + log.warn('EACCES', 'attempting to reinstall using temporary dev dir "%s"', gyp.devDir) + if (process.cwd() === tmpdir) { + log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space') + gyp.todo.push({ name: 'remove', args: argv }) + } + return util.promisify(gyp.commands.install)([noretry].concat(argv)) + } +} + +class ShaSum extends stream.Transform { + constructor (callback) { + super() + this._callback = callback + this._digester = crypto.createHash('sha256') + } + + _transform (chunk, _, callback) { + this._digester.update(chunk) + callback(null, chunk) + } + + _flush (callback) { + this._callback(null, this._digester.digest('hex')) + callback() + } +} + +async function download (gyp, url) { + log.http('GET', url) + + const requestOpts = { + headers: { + 'User-Agent': `node-gyp v${gyp.version} (node ${process.version})`, + Connection: 'keep-alive' + }, + proxy: gyp.opts.proxy, + noProxy: gyp.opts.noproxy + } + + const cafile = gyp.opts.cafile + if (cafile) { + requestOpts.ca = await readCAFile(cafile) + } + + const res = await fetch(url, requestOpts) + log.http(res.status, res.url) + + return res +} + +async function readCAFile (filename) { + // The CA file can contain multiple certificates so split on certificate + // boundaries. [\S\s]*? is used to match everything including newlines. + const ca = await fs.promises.readFile(filename, 'utf8') + const re = /(-----BEGIN CERTIFICATE-----[\S\s]*?-----END CERTIFICATE-----)/g + return ca.match(re) +} + +module.exports = function (gyp, argv, callback) { + install(fs, gyp, argv).then(callback.bind(undefined, null), callback) +} +module.exports.test = { + download, + install, + readCAFile +} +module.exports.usage = 'Install node development files for the specified node version.' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/list.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/list.js new file mode 100644 index 0000000000000..405ebc0d88959 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/list.js @@ -0,0 +1,27 @@ +'use strict' + +const fs = require('graceful-fs') +const log = require('npmlog') + +function list (gyp, args, callback) { + var devDir = gyp.devDir + log.verbose('list', 'using node-gyp dir:', devDir) + + fs.readdir(devDir, onreaddir) + + function onreaddir (err, versions) { + if (err && err.code !== 'ENOENT') { + return callback(err) + } + + if (Array.isArray(versions)) { + versions = versions.filter(function (v) { return v !== 'current' }) + } else { + versions = [] + } + callback(null, versions) + } +} + +module.exports = list +module.exports.usage = 'Prints a listing of the currently installed node development files' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/node-gyp.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/node-gyp.js new file mode 100644 index 0000000000000..e492ec1026d9d --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/node-gyp.js @@ -0,0 +1,215 @@ +'use strict' + +const path = require('path') +const nopt = require('nopt') +const log = require('npmlog') +const childProcess = require('child_process') +const EE = require('events').EventEmitter +const inherits = require('util').inherits +const commands = [ + // Module build commands + 'build', + 'clean', + 'configure', + 'rebuild', + // Development Header File management commands + 'install', + 'list', + 'remove' +] +const aliases = { + ls: 'list', + rm: 'remove' +} + +// differentiate node-gyp's logs from npm's +log.heading = 'gyp' + +function gyp () { + return new Gyp() +} + +function Gyp () { + var self = this + + this.devDir = '' + this.commands = {} + + commands.forEach(function (command) { + self.commands[command] = function (argv, callback) { + log.verbose('command', command, argv) + return require('./' + command)(self, argv, callback) + } + }) +} +inherits(Gyp, EE) +exports.Gyp = Gyp +var proto = Gyp.prototype + +/** + * Export the contents of the package.json. + */ + +proto.package = require('../package.json') + +/** + * nopt configuration definitions + */ + +proto.configDefs = { + help: Boolean, // everywhere + arch: String, // 'configure' + cafile: String, // 'install' + debug: Boolean, // 'build' + directory: String, // bin + make: String, // 'build' + msvs_version: String, // 'configure' + ensure: Boolean, // 'install' + solution: String, // 'build' (windows only) + proxy: String, // 'install' + noproxy: String, // 'install' + devdir: String, // everywhere + nodedir: String, // 'configure' + loglevel: String, // everywhere + python: String, // 'configure' + 'dist-url': String, // 'install' + tarball: String, // 'install' + jobs: String, // 'build' + thin: String, // 'configure' + 'force-process-config': Boolean // 'configure' +} + +/** + * nopt shorthands + */ + +proto.shorthands = { + release: '--no-debug', + C: '--directory', + debug: '--debug', + j: '--jobs', + silly: '--loglevel=silly', + verbose: '--loglevel=verbose', + silent: '--loglevel=silent' +} + +/** + * expose the command aliases for the bin file to use. + */ + +proto.aliases = aliases + +/** + * Parses the given argv array and sets the 'opts', + * 'argv' and 'command' properties. + */ + +proto.parseArgv = function parseOpts (argv) { + this.opts = nopt(this.configDefs, this.shorthands, argv) + this.argv = this.opts.argv.remain.slice() + + var commands = this.todo = [] + + // create a copy of the argv array with aliases mapped + argv = this.argv.map(function (arg) { + // is this an alias? + if (arg in this.aliases) { + arg = this.aliases[arg] + } + return arg + }, this) + + // process the mapped args into "command" objects ("name" and "args" props) + argv.slice().forEach(function (arg) { + if (arg in this.commands) { + var args = argv.splice(0, argv.indexOf(arg)) + argv.shift() + if (commands.length > 0) { + commands[commands.length - 1].args = args + } + commands.push({ name: arg, args: [] }) + } + }, this) + if (commands.length > 0) { + commands[commands.length - 1].args = argv.splice(0) + } + + // support for inheriting config env variables from npm + var npmConfigPrefix = 'npm_config_' + Object.keys(process.env).forEach(function (name) { + if (name.indexOf(npmConfigPrefix) !== 0) { + return + } + var val = process.env[name] + if (name === npmConfigPrefix + 'loglevel') { + log.level = val + } else { + // add the user-defined options to the config + name = name.substring(npmConfigPrefix.length) + // gyp@741b7f1 enters an infinite loop when it encounters + // zero-length options so ensure those don't get through. + if (name) { + // convert names like force_process_config to force-process-config + if (name.includes('_')) { + name = name.replace(/_/g, '-') + } + this.opts[name] = val + } + } + }, this) + + if (this.opts.loglevel) { + log.level = this.opts.loglevel + } + log.resume() +} + +/** + * Spawns a child process and emits a 'spawn' event. + */ + +proto.spawn = function spawn (command, args, opts) { + if (!opts) { + opts = {} + } + if (!opts.silent && !opts.stdio) { + opts.stdio = [0, 1, 2] + } + var cp = childProcess.spawn(command, args, opts) + log.info('spawn', command) + log.info('spawn args', args) + return cp +} + +/** + * Returns the usage instructions for node-gyp. + */ + +proto.usage = function usage () { + var str = [ + '', + ' Usage: node-gyp [options]', + '', + ' where is one of:', + commands.map(function (c) { + return ' - ' + c + ' - ' + require('./' + c).usage + }).join('\n'), + '', + 'node-gyp@' + this.version + ' ' + path.resolve(__dirname, '..'), + 'node@' + process.versions.node + ].join('\n') + return str +} + +/** + * Version number getter. + */ + +Object.defineProperty(proto, 'version', { + get: function () { + return this.package.version + }, + enumerable: true +}) + +module.exports = exports = gyp diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/process-release.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/process-release.js new file mode 100644 index 0000000000000..95b55e4426dee --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/process-release.js @@ -0,0 +1,147 @@ +/* eslint-disable node/no-deprecated-api */ + +'use strict' + +const semver = require('semver') +const url = require('url') +const path = require('path') +const log = require('npmlog') + +// versions where -headers.tar.gz started shipping +const headersTarballRange = '>= 3.0.0 || ~0.12.10 || ~0.10.42' +const bitsre = /\/win-(x86|x64|arm64)\// +const bitsreV3 = /\/win-(x86|ia32|x64)\// // io.js v3.x.x shipped with "ia32" but should +// have been "x86" + +// Captures all the logic required to determine download URLs, local directory and +// file names. Inputs come from command-line switches (--target, --dist-url), +// `process.version` and `process.release` where it exists. +function processRelease (argv, gyp, defaultVersion, defaultRelease) { + var version = (semver.valid(argv[0]) && argv[0]) || gyp.opts.target || defaultVersion + var versionSemver = semver.parse(version) + var overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl + var isDefaultVersion + var isNamedForLegacyIojs + var name + var distBaseUrl + var baseUrl + var libUrl32 + var libUrl64 + var libUrlArm64 + var tarballUrl + var canGetHeaders + + if (!versionSemver) { + // not a valid semver string, nothing we can do + return { version: version } + } + // flatten version into String + version = versionSemver.version + + // defaultVersion should come from process.version so ought to be valid semver + isDefaultVersion = version === semver.parse(defaultVersion).version + + // can't use process.release if we're using --target=x.y.z + if (!isDefaultVersion) { + defaultRelease = null + } + + if (defaultRelease) { + // v3 onward, has process.release + name = defaultRelease.name.replace(/io\.js/, 'iojs') // remove the '.' for directory naming purposes + } else { + // old node or alternative --target= + // semver.satisfies() doesn't like prerelease tags so test major directly + isNamedForLegacyIojs = versionSemver.major >= 1 && versionSemver.major < 4 + // isNamedForLegacyIojs is required to support Electron < 4 (in particular Electron 3) + // as previously this logic was used to ensure "iojs" was used to download iojs releases + // and "node" for node releases. Unfortunately the logic was broad enough that electron@3 + // published release assets as "iojs" so that the node-gyp logic worked. Once Electron@3 has + // been EOL for a while (late 2019) we should remove this hack. + name = isNamedForLegacyIojs ? 'iojs' : 'node' + } + + // check for the nvm.sh standard mirror env variables + if (!overrideDistUrl && process.env.NODEJS_ORG_MIRROR) { + overrideDistUrl = process.env.NODEJS_ORG_MIRROR + } + + if (overrideDistUrl) { + log.verbose('download', 'using dist-url', overrideDistUrl) + } + + if (overrideDistUrl) { + distBaseUrl = overrideDistUrl.replace(/\/+$/, '') + } else { + distBaseUrl = 'https://nodejs.org/dist' + } + distBaseUrl += '/v' + version + '/' + + // new style, based on process.release so we have a lot of the data we need + if (defaultRelease && defaultRelease.headersUrl && !overrideDistUrl) { + baseUrl = url.resolve(defaultRelease.headersUrl, './') + libUrl32 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'x86', versionSemver.major) + libUrl64 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'x64', versionSemver.major) + libUrlArm64 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'arm64', versionSemver.major) + tarballUrl = defaultRelease.headersUrl + } else { + // older versions without process.release are captured here and we have to make + // a lot of assumptions, additionally if you --target=x.y.z then we can't use the + // current process.release + baseUrl = distBaseUrl + libUrl32 = resolveLibUrl(name, baseUrl, 'x86', versionSemver.major) + libUrl64 = resolveLibUrl(name, baseUrl, 'x64', versionSemver.major) + libUrlArm64 = resolveLibUrl(name, baseUrl, 'arm64', versionSemver.major) + + // making the bold assumption that anything with a version number >3.0.0 will + // have a *-headers.tar.gz file in its dist location, even some frankenstein + // custom version + canGetHeaders = semver.satisfies(versionSemver, headersTarballRange) + tarballUrl = url.resolve(baseUrl, name + '-v' + version + (canGetHeaders ? '-headers' : '') + '.tar.gz') + } + + return { + version: version, + semver: versionSemver, + name: name, + baseUrl: baseUrl, + tarballUrl: tarballUrl, + shasumsUrl: url.resolve(baseUrl, 'SHASUMS256.txt'), + versionDir: (name !== 'node' ? name + '-' : '') + version, + ia32: { + libUrl: libUrl32, + libPath: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrl32).path)) + }, + x64: { + libUrl: libUrl64, + libPath: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrl64).path)) + }, + arm64: { + libUrl: libUrlArm64, + libPath: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrlArm64).path)) + } + } +} + +function normalizePath (p) { + return path.normalize(p).replace(/\\/g, '/') +} + +function resolveLibUrl (name, defaultUrl, arch, versionMajor) { + var base = url.resolve(defaultUrl, './') + var hasLibUrl = bitsre.test(defaultUrl) || (versionMajor === 3 && bitsreV3.test(defaultUrl)) + + if (!hasLibUrl) { + // let's assume it's a baseUrl then + if (versionMajor >= 1) { + return url.resolve(base, 'win-' + arch + '/' + name + '.lib') + } + // prior to io.js@1.0.0 32-bit node.lib lives in /, 64-bit lives in /x64/ + return url.resolve(base, (arch === 'x86' ? '' : arch + '/') + name + '.lib') + } + + // else we have a proper url to a .lib, just make sure it's the right arch + return defaultUrl.replace(versionMajor === 3 ? bitsreV3 : bitsre, '/win-' + arch + '/') +} + +module.exports = processRelease diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/rebuild.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/rebuild.js new file mode 100644 index 0000000000000..a1c5b27cbe56a --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/rebuild.js @@ -0,0 +1,13 @@ +'use strict' + +function rebuild (gyp, argv, callback) { + gyp.todo.push( + { name: 'clean', args: [] } + , { name: 'configure', args: argv } + , { name: 'build', args: [] } + ) + process.nextTick(callback) +} + +module.exports = rebuild +module.exports.usage = 'Runs "clean", "configure" and "build" all at once' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/remove.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/remove.js new file mode 100644 index 0000000000000..8c945e5659001 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/remove.js @@ -0,0 +1,46 @@ +'use strict' + +const fs = require('fs') +const rm = require('rimraf') +const path = require('path') +const log = require('npmlog') +const semver = require('semver') + +function remove (gyp, argv, callback) { + var devDir = gyp.devDir + log.verbose('remove', 'using node-gyp dir:', devDir) + + // get the user-specified version to remove + var version = argv[0] || gyp.opts.target + log.verbose('remove', 'removing target version:', version) + + if (!version) { + return callback(new Error('You must specify a version number to remove. Ex: "' + process.version + '"')) + } + + var versionSemver = semver.parse(version) + if (versionSemver) { + // flatten the version Array into a String + version = versionSemver.version + } + + var versionPath = path.resolve(gyp.devDir, version) + log.verbose('remove', 'removing development files for version:', version) + + // first check if its even installed + fs.stat(versionPath, function (err) { + if (err) { + if (err.code === 'ENOENT') { + callback(null, 'version was already uninstalled: ' + version) + } else { + callback(err) + } + return + } + // Go ahead and delete the dir + rm(versionPath, callback) + }) +} + +module.exports = exports = remove +module.exports.usage = 'Removes the node development files for the specified version' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/util.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/util.js new file mode 100644 index 0000000000000..3e23c628e6ad7 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/util.js @@ -0,0 +1,64 @@ +'use strict' + +const log = require('npmlog') +const execFile = require('child_process').execFile +const path = require('path') + +function logWithPrefix (log, prefix) { + function setPrefix (logFunction) { + return (...args) => logFunction.apply(null, [ prefix, ...args ]) // eslint-disable-line + } + return { + silly: setPrefix(log.silly), + verbose: setPrefix(log.verbose), + info: setPrefix(log.info), + warn: setPrefix(log.warn), + error: setPrefix(log.error) + } +} + +function regGetValue (key, value, addOpts, cb) { + const outReValue = value.replace(/\W/g, '.') + const outRe = new RegExp(`^\\s+${outReValue}\\s+REG_\\w+\\s+(\\S.*)$`, 'im') + const reg = path.join(process.env.SystemRoot, 'System32', 'reg.exe') + const regArgs = ['query', key, '/v', value].concat(addOpts) + + log.silly('reg', 'running', reg, regArgs) + const child = execFile(reg, regArgs, { encoding: 'utf8' }, + function (err, stdout, stderr) { + log.silly('reg', 'reg.exe stdout = %j', stdout) + if (err || stderr.trim() !== '') { + log.silly('reg', 'reg.exe err = %j', err && (err.stack || err)) + log.silly('reg', 'reg.exe stderr = %j', stderr) + return cb(err, stderr) + } + + const result = outRe.exec(stdout) + if (!result) { + log.silly('reg', 'error parsing stdout') + return cb(new Error('Could not parse output of reg.exe')) + } + log.silly('reg', 'found: %j', result[1]) + cb(null, result[1]) + }) + child.stdin.end() +} + +function regSearchKeys (keys, value, addOpts, cb) { + var i = 0 + const search = () => { + log.silly('reg-search', 'looking for %j in %j', value, keys[i]) + regGetValue(keys[i], value, addOpts, (err, res) => { + ++i + if (err && i < keys.length) { return search() } + cb(err, res) + }) + } + search() +} + +module.exports = { + logWithPrefix: logWithPrefix, + regGetValue: regGetValue, + regSearchKeys: regSearchKeys +} diff --git a/node_modules/node-gyp/macOS_Catalina.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina.md similarity index 100% rename from node_modules/node-gyp/macOS_Catalina.md rename to node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina.md diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina_acid_test.sh b/node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina_acid_test.sh new file mode 100644 index 0000000000000..e1e98941a8e4c --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina_acid_test.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +pkgs=( + "com.apple.pkg.DeveloperToolsCLILeo" # standalone + "com.apple.pkg.DeveloperToolsCLI" # from XCode + "com.apple.pkg.CLTools_Executables" # Mavericks +) + +for pkg in "${pkgs[@]}"; do + output=$(/usr/sbin/pkgutil --pkg-info "$pkg" 2>/dev/null) + if [ "$output" ]; then + version=$(echo "$output" | grep 'version' | cut -d' ' -f2) + break + fi +done + +if [ "$version" ]; then + echo "Command Line Tools version: $version" +else + echo >&2 'Command Line Tools not found' +fi diff --git a/node_modules/node-gyp/node_modules/which/LICENSE b/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/LICENSE similarity index 100% rename from node_modules/node-gyp/node_modules/which/LICENSE rename to node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/LICENSE diff --git a/node_modules/node-gyp/node_modules/which/bin/node-which b/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/bin/node-which similarity index 100% rename from node_modules/node-gyp/node_modules/which/bin/node-which rename to node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/bin/node-which diff --git a/node_modules/node-gyp/node_modules/which/package.json b/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/which/package.json rename to node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/package.json diff --git a/node_modules/node-gyp/node_modules/which/which.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/which.js similarity index 100% rename from node_modules/node-gyp/node_modules/which/which.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/which.js diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/package.json b/node_modules/@npmcli/run-script/node_modules/node-gyp/package.json new file mode 100644 index 0000000000000..38359c3008c04 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/package.json @@ -0,0 +1,51 @@ +{ + "name": "node-gyp", + "description": "Node.js native addon build tool", + "license": "MIT", + "keywords": [ + "native", + "addon", + "module", + "c", + "c++", + "bindings", + "gyp" + ], + "version": "9.4.1", + "installVersion": 11, + "author": "Nathan Rajlich (http://tootallnate.net)", + "repository": { + "type": "git", + "url": "git://github.com/nodejs/node-gyp.git" + }, + "preferGlobal": true, + "bin": "./bin/node-gyp.js", + "main": "./lib/node-gyp.js", + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "glob": "^7.1.4", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^10.0.3", + "nopt": "^6.0.0", + "npmlog": "^6.0.0", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.2", + "which": "^2.0.2" + }, + "engines": { + "node": "^12.13 || ^14.13 || >=16" + }, + "devDependencies": { + "bindings": "^1.5.0", + "mocha": "^10.2.0", + "nan": "^2.14.2", + "require-inject": "^1.4.4", + "standard": "^14.3.4" + }, + "scripts": { + "lint": "standard */*.js test/**/*.js", + "test": "npm run lint && mocha --reporter=test/reporter.js test/test-download.js test/test-*" + } +} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/src/win_delay_load_hook.cc b/node_modules/@npmcli/run-script/node_modules/node-gyp/src/win_delay_load_hook.cc new file mode 100644 index 0000000000000..169f8029f10fd --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/src/win_delay_load_hook.cc @@ -0,0 +1,39 @@ +/* + * When this file is linked to a DLL, it sets up a delay-load hook that + * intervenes when the DLL is trying to load the host executable + * dynamically. Instead of trying to locate the .exe file it'll just + * return a handle to the process image. + * + * This allows compiled addons to work when the host executable is renamed. + */ + +#ifdef _MSC_VER + +#pragma managed(push, off) + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include + +#include +#include + +static FARPROC WINAPI load_exe_hook(unsigned int event, DelayLoadInfo* info) { + HMODULE m; + if (event != dliNotePreLoadLibrary) + return NULL; + + if (_stricmp(info->szDll, HOST_BINARY) != 0) + return NULL; + + m = GetModuleHandle(NULL); + return (FARPROC) m; +} + +decltype(__pfnDliNotifyHook2) __pfnDliNotifyHook2 = load_exe_hook; + +#pragma managed(pop) + +#endif diff --git a/node_modules/node-gyp/test/common.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/common.js similarity index 100% rename from node_modules/node-gyp/test/common.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/common.js diff --git a/node_modules/node-gyp/test/fixtures/VS_2017_BuildTools_minimal.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_BuildTools_minimal.txt similarity index 100% rename from node_modules/node-gyp/test/fixtures/VS_2017_BuildTools_minimal.txt rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_BuildTools_minimal.txt diff --git a/node_modules/node-gyp/test/fixtures/VS_2017_Community_workload.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Community_workload.txt similarity index 100% rename from node_modules/node-gyp/test/fixtures/VS_2017_Community_workload.txt rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Community_workload.txt diff --git a/node_modules/node-gyp/test/fixtures/VS_2017_Express.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Express.txt similarity index 100% rename from node_modules/node-gyp/test/fixtures/VS_2017_Express.txt rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Express.txt diff --git a/node_modules/node-gyp/test/fixtures/VS_2017_Unusable.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Unusable.txt similarity index 100% rename from node_modules/node-gyp/test/fixtures/VS_2017_Unusable.txt rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Unusable.txt diff --git a/node_modules/node-gyp/test/fixtures/VS_2019_BuildTools_minimal.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_BuildTools_minimal.txt similarity index 100% rename from node_modules/node-gyp/test/fixtures/VS_2019_BuildTools_minimal.txt rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_BuildTools_minimal.txt diff --git a/node_modules/node-gyp/test/fixtures/VS_2019_Community_workload.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Community_workload.txt similarity index 100% rename from node_modules/node-gyp/test/fixtures/VS_2019_Community_workload.txt rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Community_workload.txt diff --git a/node_modules/node-gyp/test/fixtures/VS_2019_Preview.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Preview.txt similarity index 100% rename from node_modules/node-gyp/test/fixtures/VS_2019_Preview.txt rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Preview.txt diff --git a/node_modules/node-gyp/test/fixtures/VS_2022_Community_workload.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2022_Community_workload.txt similarity index 100% rename from node_modules/node-gyp/test/fixtures/VS_2022_Community_workload.txt rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2022_Community_workload.txt diff --git a/node_modules/node-gyp/test/fixtures/certs.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/certs.js similarity index 66% rename from node_modules/node-gyp/test/fixtures/certs.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/certs.js index 766e54b5ed390..f03f1de0d7f7b 100644 --- a/node_modules/node-gyp/test/fixtures/certs.js +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/certs.js @@ -54,55 +54,56 @@ GbN8uKxIfyMjqZKaujPR ` module.exports['server.key'] = ` ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAvPM99BkYrBcTM355dhz4XzhSDRGxa9qttUlBSgEsbu2UjsRm -XjDS+60XXd66tWpPwLeUd2uvlC/ltv5ekv+EBu35j1KfA1+K1rtFzb1i40kMCsns -OoXjgpsN2wvkxMdFkT2bkqKCS6X0xzlWea1t4poKh9iG7n3otk4RzPNawfwQ9W5n -o9/8i6AUwDbuK4dhAId/Inw2aKrMyQ+AiSvsDM2wUMq+pV7nP46f7MhR4xiGz14z -ATFdjM3Oo/1NKrr0WgVM6i0eNAtuIDqIs8YE7SfODe/SzpJySxewutfYi62OaLh/ -hmWByj/pF5SoNMLyJHxn4GyKK+Qle9NJAThLiwIDAQABAoIBAQCZs4h/Cvct7etZ -pRUqxnAoDQl5xh28LXvGj1uD1qaNacfBxvO6xR6rSedLHcZlkqBjlTI5XqjJ85h6 -njrSevWsKWMrejsNpGetO1OSA+/wEVixYgY+qPEkKftAZ1Fl3O+zMRlfU8CHxuzy -Lqsweap8fW/5h2JjmJp3ydPjE0aNqpQ+0LtYBBawKDIe2zPNOmTPwz3D8qJNQJKU -Qdj08dO/vPZncllPagGvpqhfv4hMyNChr71eBbEFsi3O5VJxfZyj+fQG0DGocr/y -sV54HtYk5j06wMxZFLQtaJn+1pOXquZMNwodSPnbrR/+CI1SZeB8N6VyqqOdmrDz -5NbfGJiRAoGBAPrCuQxJwgc2MzpEtrXA4+1uuV8QWGy3+wNKxKw4lgyC7peXXrVK -l9FkOOAPr8puPRABgDS9t6vo59BAP3Wrx0oJ9PA/Qn03WYLfJMepWqlK7ni9kS04 -5owRTduK7P190sp0m6iicsnchGSSOchECwB5UmtHysEFiuY0T+0pdNbjAoGBAMDl -57lwZDfNTGGDxLQYVzbrXgKcD60DW9MhvH3uso6cw5NYs3tmENCh9D6YrCNN4PmL -zdp4dKbOFoGJdy22TK31nrezUuNKSK+QKH2gsmNVI+a5QokNO1Cfk+PMLoOR5du2 -nwyVvzdaBwuXU4fhmwvLv/SCFNEJ0EgUILeMETE5AoGBAIwLXf9v3e3bJkb/gy8E -mAbNVLez0D5/ja9r/WTVgW9hXFDLF/iVvS4TE/SGrj2WzYF35RsPbVmUDIrwpsBX -/EfsQaA/JCn8VIBTkR31Bg4QLBjAfijMY22MaHgZIXv83lF1SE2o1ATKpCHqzFx9 -K8vK9e22PZUJPGaOhqjEA13TAoGAEPipSJFw38/6NmInfkjd84EFxmkAoBI5k/vV -36aOoyl7s40MTYEPXavCF3fLPVfuwUXhmKUcbkiXhlIX4De3y15e1n66fjDc8EVY -qqTmzQKCpBwMlI5Ld65yjoo6VW0SsiABIlRSfIY5NHXd7YiV4ZXNj6+aMUIRxyWu -Mzfpk1ECgYBZw8lML+F8XbcmCLGYuicf0V/wgFaJr8nnPeW7AiQrv13Ju1ItEaC8 -Tz8F7OfC+FoUb0MGjXHKquDVBDs4xSuS+Ol+rlZEK68ALpm8sUgp6YjARYiXlprs -6o4kN0P5F+DVU2SP6fo9zKLCxaTH9VAQ9C3VUViGAFLBt4DVDmj77g== ------END RSA PRIVATE KEY----- +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDpxqKqzq8PuOuo +M09X1gdh6V1nMmJ6Oqk/d8ZSAHhGBTjB5BBILtrxJPAdsNCRc8gPCtSuAzu9r0ct +D2znJjto8HO3a0s/4mlqMQ8iSvfH0c8nGLPxRXg0C9tR0VOyqJrqAPn9X6utxVQj +H2jLjZngZllhqlxIUxYuXO7MZfC2MQ4DRsp6GaJTftcOxTxevMdT6lK0yl3mDn0W +DyV9aWR5oCVXKIRK7jmF9bi9ETHwJHffFrduaaKYLQ/UOEtNek/pJsz0DNO0ePkm +DAt0GQkX3hmKd0VRgGEtaO+MAGbrDucPuDylMkC1GJm1lq6+6rkyQRNoAd8/yOJD +GihBJmLPAgMBAAECggEBAL3+WM/3IGHnyWavJMnfQaq6rdWkJlLugAT8BCs7BITr +04AJKY5wvjID8j4/KJM+BRbsl4NBT3lPDcq6YajO8rPL0E/+nG60RTYv3vvg79Xv +V6uPsRbifdnW1Q1+0cY+r4CFAKeC7JVS7ZmJ+nKMh8XPiM8OVOfW1w0hLFbkdqiq +UetA5H0oiJr0rFWh9Gfzc0avpmawXmZJqK8lKWB1rt2teu3bQWqn20dGr2IyCipz +KlGh3QImYogjqWEqPyowPGxnq8KWQ40Pjx61dy6cqYrw77yxLHGR8Az+TlRQZf/K +BeT3UkXCU5BTyC3PKZJpcYB/GMB8GBKRdNK+8H3OXskCgYEA963tUnLoiCwJjxvv +gIiMY5mIUAMnTDsCxSYekfkDvt4qdttn/+Y8/5/lXMSlCt+WZcXH0V8gmVOMqfHB +QRXWpi0uJnl9sUllb80Mw5PnS317UlJIbkro3crVUhIbrn9tKVFP1GO9xszNda8E +MkHV8FGmSaihXGnA8KEkTKg1CisCgYEA8aEjATIpDXyxQM4M9B1S0jI/nHOrg2lr +dMKQWJVruuvwrrZl6CFNIm2/PBXyHjCXqROXs7aXkE3vfRSypYNKBZl7BX08c0nE +koMVXwhGbSbUXjFx5bcUKaG/2eOK+ZV4ivNQokq1iIK+WKINAfP69ewzD7EAgbBg +KY7owSxka+0CgYB4Urh+W3B35tzl9y5NBQkewdGk/UM0F17rI++p/o1BRnDeuQw3 +F0T+8lDc1nNPavuHiaPfJRWTJzGoxdeapN9Yb46CBnd3jy6GN9lBkjLFS7qDbZHe +cunaBdXIPx/Pj/waHHRpu+LQF2KhD1s8hxtF2oSsOA3b9UxUGhSmYPkTbQKBgEP8 +muTTQEnTM+yQDYUCWzNZgBx9T10CZIHN3N+P62gEywvdtn7CH/n39z7ozd9AvOuN +37lpPuwTgbcoA7weXM2Gid7ZhhDKSM0QpQrAQVClBEwcjXedM8cjA+BC7e+b5vbx +z1ZavwlSAEzgC9jo1Uws0ZEwtHvJLMWEuGjiHL9hAoGAWEbj2cxhpCKTK3C8Qf+C +BscBwAZKmUasdWQBUzRFpR1UAO3fFBatjMPwrFYnt+ZgiCXTGFcoEa7mjoP/r5Mh +j1nRCoPQVcbmB1B9AtiaEa1AA+BqYF1r2aErbcsGrCV5OHU7TYFk1dep1SAQP/0W +9MQ+1Af5ttYSFYlJLnWJo4M= +-----END PRIVATE KEY----- ` module.exports['server.crt'] = ` -----BEGIN CERTIFICATE----- -MIIDNzCCAh8CFBg1Ph5t5rBlAbCrEn/PexNy9WunMA0GCSqGSIb3DQEBCwUAMF0x -CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEQMA4GA1UECgwHTm9kZS5qczERMA8G -A1UECwwIbm9kZS1neXAxHDAaBgNVBAMME25vZGUtZ3lwLm5vZGVqcy5vcmcwHhcN -MjIwNTExMDQyMjI0WhcNMjMwOTIzMDQyMjI0WjBTMQswCQYDVQQGEwJVUzELMAkG -A1UECAwCQ0ExEDAOBgNVBAoMB05vZGUuanMxETAPBgNVBAsMCG5vZGUtZ3lwMRIw -EAYDVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQC88z30GRisFxMzfnl2HPhfOFINEbFr2q21SUFKASxu7ZSOxGZeMNL7rRdd3rq1 -ak/At5R3a6+UL+W2/l6S/4QG7fmPUp8DX4rWu0XNvWLjSQwKyew6heOCmw3bC+TE -x0WRPZuSooJLpfTHOVZ5rW3imgqH2Ibufei2ThHM81rB/BD1bmej3/yLoBTANu4r -h2EAh38ifDZoqszJD4CJK+wMzbBQyr6lXuc/jp/syFHjGIbPXjMBMV2Mzc6j/U0q -uvRaBUzqLR40C24gOoizxgTtJ84N79LOknJLF7C619iLrY5ouH+GZYHKP+kXlKg0 -wvIkfGfgbIor5CV700kBOEuLAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAEhaNEye -JsE4eG1xaGmHq7w9eV0neOaZ58XCuF1sSEMIy9uMnl3aOdctxh/1SYkqJyMct79q -Ra2UZ6mauRlOeqdHb+HZKrFYYUOtd1HOWWJ44Gaya2EQMiTbd/Ns9Th2KTbTOCbL -CHFNska9Ty2ioT7VcrVuIEXFPMua5T4lnCkNJQla800pHHOak2baN/c66Io+8XI2 -xiqaVrLT3qvpzdiiEjo4POeRnWMIgJJshy77Am5JlhaJiAqP1AHfh/tYpliGkjXF -8DSgSoLHSQfalJ4VQvP4XLc/XnmF5Zt6bvwUxCllEBFRneU74bW7/euYX/TpYobr -Y+YM7fGiCqwHdUs= +MIIDPjCCAiagAwIBAgIJALrth9K8D7HIMA0GCSqGSIb3DQEBCwUAMF0xCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTEQMA4GA1UECgwHTm9kZS5qczERMA8GA1UECwwI +bm9kZS1neXAxHDAaBgNVBAMME25vZGUtZ3lwLm5vZGVqcy5vcmcwHhcNMjMwOTI4 +MDUxODM2WhcNMzMwOTI1MDUxODM2WjBgMQswCQYDVQQGEwJVUzETMBEGA1UECAwK +Q2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEQMA4GA1UECgwHTm9k +ZS5qczESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEA6caiqs6vD7jrqDNPV9YHYeldZzJiejqpP3fGUgB4RgU4weQQSC7a +8STwHbDQkXPIDwrUrgM7va9HLQ9s5yY7aPBzt2tLP+JpajEPIkr3x9HPJxiz8UV4 +NAvbUdFTsqia6gD5/V+rrcVUIx9oy42Z4GZZYapcSFMWLlzuzGXwtjEOA0bKehmi +U37XDsU8XrzHU+pStMpd5g59Fg8lfWlkeaAlVyiESu45hfW4vREx8CR33xa3bmmi +mC0P1DhLTXpP6SbM9AzTtHj5JgwLdBkJF94ZindFUYBhLWjvjABm6w7nD7g8pTJA +tRiZtZauvuq5MkETaAHfP8jiQxooQSZizwIDAQABMA0GCSqGSIb3DQEBCwUAA4IB +AQBwgEyrqJOV8SC7PVTtEOqfSyrM7lJjVcmwXEIFPVCPxXnDtLS9+OaQe9ybjOR/ +Bi/AvZK4gwsV9G5Bvbl0/sphYEKYLEpP76jhdETcBwhaEgK3itumoREeriut4bZI +OM6b1O45CoD67Lm87CUwLOdcNzPu4k7mat+xog5aFwaQuRjLBmmZcjl41QjVr9ti +La4PCMh7NwVMtHRqbYvgq785PsKAh+j4FSX1sj9NRzRPoJJ2qsre1Qn5tL/i6ovj +6s+3GxOQ5I1UzJX22PZFu003a582ha1CEFM0VaeDzzwbGNcV5SP+g2nw55zx9YRR +Rg8nGmjRuRtbs+/XAre2eQ5p -----END CERTIFICATE----- ` diff --git a/node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi similarity index 100% rename from node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi diff --git a/node_modules/node-gyp/test/fixtures/test-charmap.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/test-charmap.py similarity index 100% rename from node_modules/node-gyp/test/fixtures/test-charmap.py rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/test-charmap.py diff --git a/node_modules/node-gyp/test/process-exec-sync.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/process-exec-sync.js similarity index 100% rename from node_modules/node-gyp/test/process-exec-sync.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/process-exec-sync.js diff --git a/node_modules/node-gyp/test/reporter.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/reporter.js similarity index 100% rename from node_modules/node-gyp/test/reporter.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/reporter.js diff --git a/node_modules/node-gyp/test/simple-proxy.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/simple-proxy.js similarity index 100% rename from node_modules/node-gyp/test/simple-proxy.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/simple-proxy.js diff --git a/node_modules/node-gyp/test/test-addon.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-addon.js similarity index 100% rename from node_modules/node-gyp/test/test-addon.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-addon.js diff --git a/node_modules/node-gyp/test/test-configure-python.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-configure-python.js similarity index 100% rename from node_modules/node-gyp/test/test-configure-python.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-configure-python.js diff --git a/node_modules/node-gyp/test/test-create-config-gypi.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-create-config-gypi.js similarity index 100% rename from node_modules/node-gyp/test/test-create-config-gypi.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-create-config-gypi.js diff --git a/node_modules/node-gyp/test/test-download.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-download.js similarity index 100% rename from node_modules/node-gyp/test/test-download.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-download.js diff --git a/node_modules/node-gyp/test/test-find-accessible-sync.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-accessible-sync.js similarity index 100% rename from node_modules/node-gyp/test/test-find-accessible-sync.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-accessible-sync.js diff --git a/node_modules/node-gyp/test/test-find-node-directory.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-node-directory.js similarity index 100% rename from node_modules/node-gyp/test/test-find-node-directory.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-node-directory.js diff --git a/node_modules/node-gyp/test/test-find-python.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-python.js similarity index 100% rename from node_modules/node-gyp/test/test-find-python.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-python.js diff --git a/node_modules/node-gyp/test/test-find-visualstudio.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-visualstudio.js similarity index 100% rename from node_modules/node-gyp/test/test-find-visualstudio.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-visualstudio.js diff --git a/node_modules/node-gyp/test/test-install.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-install.js similarity index 97% rename from node_modules/node-gyp/test/test-install.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-install.js index 235acf5231396..08e130dfb6a44 100644 --- a/node_modules/node-gyp/test/test-install.js +++ b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-install.js @@ -15,6 +15,8 @@ const streamPipeline = util.promisify(stream.pipeline) log.level = 'error' // we expect a warning +const TIMEOUT = 20 * 60 * 1000 + describe('install', function () { it('EACCES retry once', async () => { const fs = { @@ -86,7 +88,7 @@ describe('install', function () { } it('parallel installs (ensure=true)', async function () { - this.timeout(600000) + this.timeout(TIMEOUT) const fs = require('graceful-fs') const devDir = await util.promisify(fs.mkdtemp)(path.join(os.tmpdir(), 'node-gyp-test-')) @@ -101,7 +103,7 @@ describe('install', function () { }) it('parallel installs (ensure=false)', async function () { - this.timeout(600000) + this.timeout(TIMEOUT) const fs = require('graceful-fs') const devDir = await util.promisify(fs.mkdtemp)(path.join(os.tmpdir(), 'node-gyp-test-')) @@ -116,7 +118,7 @@ describe('install', function () { }) it('parallel installs (tarball)', async function () { - this.timeout(600000) + this.timeout(TIMEOUT) const fs = require('graceful-fs') const devDir = await util.promisify(fs.mkdtemp)(path.join(os.tmpdir(), 'node-gyp-test-')) diff --git a/node_modules/node-gyp/test/test-options.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-options.js similarity index 100% rename from node_modules/node-gyp/test/test-options.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-options.js diff --git a/node_modules/node-gyp/test/test-process-release.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-process-release.js similarity index 100% rename from node_modules/node-gyp/test/test-process-release.js rename to node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-process-release.js diff --git a/node_modules/node-gyp/update-gyp.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/update-gyp.py similarity index 100% rename from node_modules/node-gyp/update-gyp.py rename to node_modules/@npmcli/run-script/node_modules/node-gyp/update-gyp.py diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/LICENSE b/node_modules/@npmcli/run-script/node_modules/nopt/LICENSE similarity index 90% rename from node_modules/node-gyp/node_modules/cacache/node_modules/minipass/LICENSE rename to node_modules/@npmcli/run-script/node_modules/nopt/LICENSE index 97f8e32ed82e4..19129e315fe59 100644 --- a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/LICENSE +++ b/node_modules/@npmcli/run-script/node_modules/nopt/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) 2017-2023 npm, Inc., Isaac Z. Schlueter, and Contributors +Copyright (c) Isaac Z. Schlueter and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/node_modules/node-gyp/node_modules/nopt/bin/nopt.js b/node_modules/@npmcli/run-script/node_modules/nopt/bin/nopt.js similarity index 100% rename from node_modules/node-gyp/node_modules/nopt/bin/nopt.js rename to node_modules/@npmcli/run-script/node_modules/nopt/bin/nopt.js diff --git a/node_modules/node-gyp/node_modules/nopt/lib/nopt.js b/node_modules/@npmcli/run-script/node_modules/nopt/lib/nopt.js similarity index 100% rename from node_modules/node-gyp/node_modules/nopt/lib/nopt.js rename to node_modules/@npmcli/run-script/node_modules/nopt/lib/nopt.js diff --git a/node_modules/node-gyp/node_modules/nopt/package.json b/node_modules/@npmcli/run-script/node_modules/nopt/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/nopt/package.json rename to node_modules/@npmcli/run-script/node_modules/nopt/package.json diff --git a/node_modules/@npmcli/run-script/node_modules/npmlog/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/npmlog/LICENSE.md new file mode 100644 index 0000000000000..5fc208ff122e0 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/npmlog/LICENSE.md @@ -0,0 +1,20 @@ + + +ISC License + +Copyright npm, Inc. + +Permission to use, copy, modify, and/or distribute this +software for any purpose with or without fee is hereby +granted, provided that the above copyright notice and this +permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO +EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE +USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/node-gyp/node_modules/npmlog/lib/log.js b/node_modules/@npmcli/run-script/node_modules/npmlog/lib/log.js similarity index 100% rename from node_modules/node-gyp/node_modules/npmlog/lib/log.js rename to node_modules/@npmcli/run-script/node_modules/npmlog/lib/log.js diff --git a/node_modules/node-gyp/node_modules/npmlog/package.json b/node_modules/@npmcli/run-script/node_modules/npmlog/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/npmlog/package.json rename to node_modules/@npmcli/run-script/node_modules/npmlog/package.json diff --git a/node_modules/node-gyp/node_modules/readable-stream/CONTRIBUTING.md b/node_modules/@npmcli/run-script/node_modules/readable-stream/CONTRIBUTING.md similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/CONTRIBUTING.md rename to node_modules/@npmcli/run-script/node_modules/readable-stream/CONTRIBUTING.md diff --git a/node_modules/node-gyp/node_modules/readable-stream/GOVERNANCE.md b/node_modules/@npmcli/run-script/node_modules/readable-stream/GOVERNANCE.md similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/GOVERNANCE.md rename to node_modules/@npmcli/run-script/node_modules/readable-stream/GOVERNANCE.md diff --git a/node_modules/node-gyp/node_modules/readable-stream/LICENSE b/node_modules/@npmcli/run-script/node_modules/readable-stream/LICENSE similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/LICENSE rename to node_modules/@npmcli/run-script/node_modules/readable-stream/LICENSE diff --git a/node_modules/node-gyp/node_modules/readable-stream/errors-browser.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/errors-browser.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/errors-browser.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/errors-browser.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/errors.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/errors.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/errors.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/errors.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/experimentalWarning.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/experimentalWarning.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/experimentalWarning.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/experimentalWarning.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_duplex.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/_stream_duplex.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_duplex.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_passthrough.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/_stream_passthrough.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_passthrough.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_readable.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/_stream_readable.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_readable.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_transform.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/_stream_transform.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_transform.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_writable.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/_stream_writable.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_writable.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/async_iterator.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/async_iterator.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/async_iterator.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/async_iterator.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/buffer_list.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/buffer_list.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/buffer_list.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/buffer_list.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/destroy.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/destroy.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/destroy.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/destroy.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/end-of-stream.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/end-of-stream.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/end-of-stream.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/end-of-stream.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/from-browser.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from-browser.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/from-browser.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from-browser.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/from.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/from.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/pipeline.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/pipeline.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/pipeline.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/pipeline.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/state.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/state.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/state.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/state.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/stream-browser.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream-browser.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/stream-browser.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream-browser.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/stream.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/lib/internal/streams/stream.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/package.json b/node_modules/@npmcli/run-script/node_modules/readable-stream/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/package.json rename to node_modules/@npmcli/run-script/node_modules/readable-stream/package.json diff --git a/node_modules/node-gyp/node_modules/readable-stream/readable-browser.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/readable-browser.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/readable-browser.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/readable-browser.js diff --git a/node_modules/node-gyp/node_modules/readable-stream/readable.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/readable.js similarity index 100% rename from node_modules/node-gyp/node_modules/readable-stream/readable.js rename to node_modules/@npmcli/run-script/node_modules/readable-stream/readable.js diff --git a/node_modules/node-gyp/node_modules/signal-exit/LICENSE.txt b/node_modules/@npmcli/run-script/node_modules/signal-exit/LICENSE.txt similarity index 100% rename from node_modules/node-gyp/node_modules/signal-exit/LICENSE.txt rename to node_modules/@npmcli/run-script/node_modules/signal-exit/LICENSE.txt diff --git a/node_modules/node-gyp/node_modules/signal-exit/index.js b/node_modules/@npmcli/run-script/node_modules/signal-exit/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/signal-exit/index.js rename to node_modules/@npmcli/run-script/node_modules/signal-exit/index.js diff --git a/node_modules/node-gyp/node_modules/signal-exit/package.json b/node_modules/@npmcli/run-script/node_modules/signal-exit/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/signal-exit/package.json rename to node_modules/@npmcli/run-script/node_modules/signal-exit/package.json diff --git a/node_modules/node-gyp/node_modules/signal-exit/signals.js b/node_modules/@npmcli/run-script/node_modules/signal-exit/signals.js similarity index 100% rename from node_modules/node-gyp/node_modules/signal-exit/signals.js rename to node_modules/@npmcli/run-script/node_modules/signal-exit/signals.js diff --git a/node_modules/@npmcli/run-script/node_modules/ssri/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/ssri/LICENSE.md new file mode 100644 index 0000000000000..e335388869f50 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/ssri/LICENSE.md @@ -0,0 +1,16 @@ +ISC License + +Copyright 2021 (c) npm, Inc. + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted, provided that the +above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER DISCLAIMS +ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE +USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/ssri/lib/index.js b/node_modules/@npmcli/run-script/node_modules/ssri/lib/index.js new file mode 100644 index 0000000000000..1443137cbc708 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/ssri/lib/index.js @@ -0,0 +1,524 @@ +'use strict' + +const crypto = require('crypto') +const MiniPass = require('minipass') + +const SPEC_ALGORITHMS = ['sha256', 'sha384', 'sha512'] + +// TODO: this should really be a hardcoded list of algorithms we support, +// rather than [a-z0-9]. +const BASE64_REGEX = /^[a-z0-9+/]+(?:=?=?)$/i +const SRI_REGEX = /^([a-z0-9]+)-([^?]+)([?\S*]*)$/ +const STRICT_SRI_REGEX = /^([a-z0-9]+)-([A-Za-z0-9+/=]{44,88})(\?[\x21-\x7E]*)?$/ +const VCHAR_REGEX = /^[\x21-\x7E]+$/ + +const defaultOpts = { + algorithms: ['sha512'], + error: false, + options: [], + pickAlgorithm: getPrioritizedHash, + sep: ' ', + single: false, + strict: false, +} + +const ssriOpts = (opts = {}) => ({ ...defaultOpts, ...opts }) + +const getOptString = options => !options || !options.length + ? '' + : `?${options.join('?')}` + +const _onEnd = Symbol('_onEnd') +const _getOptions = Symbol('_getOptions') +const _emittedSize = Symbol('_emittedSize') +const _emittedIntegrity = Symbol('_emittedIntegrity') +const _emittedVerified = Symbol('_emittedVerified') + +class IntegrityStream extends MiniPass { + constructor (opts) { + super() + this.size = 0 + this.opts = opts + + // may be overridden later, but set now for class consistency + this[_getOptions]() + + // options used for calculating stream. can't be changed. + const { algorithms = defaultOpts.algorithms } = opts + this.algorithms = Array.from( + new Set(algorithms.concat(this.algorithm ? [this.algorithm] : [])) + ) + this.hashes = this.algorithms.map(crypto.createHash) + } + + [_getOptions] () { + const { + integrity, + size, + options, + } = { ...defaultOpts, ...this.opts } + + // For verification + this.sri = integrity ? parse(integrity, this.opts) : null + this.expectedSize = size + this.goodSri = this.sri ? !!Object.keys(this.sri).length : false + this.algorithm = this.goodSri ? this.sri.pickAlgorithm(this.opts) : null + this.digests = this.goodSri ? this.sri[this.algorithm] : null + this.optString = getOptString(options) + } + + on (ev, handler) { + if (ev === 'size' && this[_emittedSize]) { + return handler(this[_emittedSize]) + } + + if (ev === 'integrity' && this[_emittedIntegrity]) { + return handler(this[_emittedIntegrity]) + } + + if (ev === 'verified' && this[_emittedVerified]) { + return handler(this[_emittedVerified]) + } + + return super.on(ev, handler) + } + + emit (ev, data) { + if (ev === 'end') { + this[_onEnd]() + } + return super.emit(ev, data) + } + + write (data) { + this.size += data.length + this.hashes.forEach(h => h.update(data)) + return super.write(data) + } + + [_onEnd] () { + if (!this.goodSri) { + this[_getOptions]() + } + const newSri = parse(this.hashes.map((h, i) => { + return `${this.algorithms[i]}-${h.digest('base64')}${this.optString}` + }).join(' '), this.opts) + // Integrity verification mode + const match = this.goodSri && newSri.match(this.sri, this.opts) + if (typeof this.expectedSize === 'number' && this.size !== this.expectedSize) { + /* eslint-disable-next-line max-len */ + const err = new Error(`stream size mismatch when checking ${this.sri}.\n Wanted: ${this.expectedSize}\n Found: ${this.size}`) + err.code = 'EBADSIZE' + err.found = this.size + err.expected = this.expectedSize + err.sri = this.sri + this.emit('error', err) + } else if (this.sri && !match) { + /* eslint-disable-next-line max-len */ + const err = new Error(`${this.sri} integrity checksum failed when using ${this.algorithm}: wanted ${this.digests} but got ${newSri}. (${this.size} bytes)`) + err.code = 'EINTEGRITY' + err.found = newSri + err.expected = this.digests + err.algorithm = this.algorithm + err.sri = this.sri + this.emit('error', err) + } else { + this[_emittedSize] = this.size + this.emit('size', this.size) + this[_emittedIntegrity] = newSri + this.emit('integrity', newSri) + if (match) { + this[_emittedVerified] = match + this.emit('verified', match) + } + } + } +} + +class Hash { + get isHash () { + return true + } + + constructor (hash, opts) { + opts = ssriOpts(opts) + const strict = !!opts.strict + this.source = hash.trim() + + // set default values so that we make V8 happy to + // always see a familiar object template. + this.digest = '' + this.algorithm = '' + this.options = [] + + // 3.1. Integrity metadata (called "Hash" by ssri) + // https://w3c.github.io/webappsec-subresource-integrity/#integrity-metadata-description + const match = this.source.match( + strict + ? STRICT_SRI_REGEX + : SRI_REGEX + ) + if (!match) { + return + } + if (strict && !SPEC_ALGORITHMS.some(a => a === match[1])) { + return + } + this.algorithm = match[1] + this.digest = match[2] + + const rawOpts = match[3] + if (rawOpts) { + this.options = rawOpts.slice(1).split('?') + } + } + + hexDigest () { + return this.digest && Buffer.from(this.digest, 'base64').toString('hex') + } + + toJSON () { + return this.toString() + } + + toString (opts) { + opts = ssriOpts(opts) + if (opts.strict) { + // Strict mode enforces the standard as close to the foot of the + // letter as it can. + if (!( + // The spec has very restricted productions for algorithms. + // https://www.w3.org/TR/CSP2/#source-list-syntax + SPEC_ALGORITHMS.some(x => x === this.algorithm) && + // Usually, if someone insists on using a "different" base64, we + // leave it as-is, since there's multiple standards, and the + // specified is not a URL-safe variant. + // https://www.w3.org/TR/CSP2/#base64_value + this.digest.match(BASE64_REGEX) && + // Option syntax is strictly visual chars. + // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-option-expression + // https://tools.ietf.org/html/rfc5234#appendix-B.1 + this.options.every(opt => opt.match(VCHAR_REGEX)) + )) { + return '' + } + } + const options = this.options && this.options.length + ? `?${this.options.join('?')}` + : '' + return `${this.algorithm}-${this.digest}${options}` + } +} + +class Integrity { + get isIntegrity () { + return true + } + + toJSON () { + return this.toString() + } + + isEmpty () { + return Object.keys(this).length === 0 + } + + toString (opts) { + opts = ssriOpts(opts) + let sep = opts.sep || ' ' + if (opts.strict) { + // Entries must be separated by whitespace, according to spec. + sep = sep.replace(/\S+/g, ' ') + } + return Object.keys(this).map(k => { + return this[k].map(hash => { + return Hash.prototype.toString.call(hash, opts) + }).filter(x => x.length).join(sep) + }).filter(x => x.length).join(sep) + } + + concat (integrity, opts) { + opts = ssriOpts(opts) + const other = typeof integrity === 'string' + ? integrity + : stringify(integrity, opts) + return parse(`${this.toString(opts)} ${other}`, opts) + } + + hexDigest () { + return parse(this, { single: true }).hexDigest() + } + + // add additional hashes to an integrity value, but prevent + // *changing* an existing integrity hash. + merge (integrity, opts) { + opts = ssriOpts(opts) + const other = parse(integrity, opts) + for (const algo in other) { + if (this[algo]) { + if (!this[algo].find(hash => + other[algo].find(otherhash => + hash.digest === otherhash.digest))) { + throw new Error('hashes do not match, cannot update integrity') + } + } else { + this[algo] = other[algo] + } + } + } + + match (integrity, opts) { + opts = ssriOpts(opts) + const other = parse(integrity, opts) + const algo = other.pickAlgorithm(opts) + return ( + this[algo] && + other[algo] && + this[algo].find(hash => + other[algo].find(otherhash => + hash.digest === otherhash.digest + ) + ) + ) || false + } + + pickAlgorithm (opts) { + opts = ssriOpts(opts) + const pickAlgorithm = opts.pickAlgorithm + const keys = Object.keys(this) + return keys.reduce((acc, algo) => { + return pickAlgorithm(acc, algo) || acc + }) + } +} + +module.exports.parse = parse +function parse (sri, opts) { + if (!sri) { + return null + } + opts = ssriOpts(opts) + if (typeof sri === 'string') { + return _parse(sri, opts) + } else if (sri.algorithm && sri.digest) { + const fullSri = new Integrity() + fullSri[sri.algorithm] = [sri] + return _parse(stringify(fullSri, opts), opts) + } else { + return _parse(stringify(sri, opts), opts) + } +} + +function _parse (integrity, opts) { + // 3.4.3. Parse metadata + // https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata + if (opts.single) { + return new Hash(integrity, opts) + } + const hashes = integrity.trim().split(/\s+/).reduce((acc, string) => { + const hash = new Hash(string, opts) + if (hash.algorithm && hash.digest) { + const algo = hash.algorithm + if (!acc[algo]) { + acc[algo] = [] + } + acc[algo].push(hash) + } + return acc + }, new Integrity()) + return hashes.isEmpty() ? null : hashes +} + +module.exports.stringify = stringify +function stringify (obj, opts) { + opts = ssriOpts(opts) + if (obj.algorithm && obj.digest) { + return Hash.prototype.toString.call(obj, opts) + } else if (typeof obj === 'string') { + return stringify(parse(obj, opts), opts) + } else { + return Integrity.prototype.toString.call(obj, opts) + } +} + +module.exports.fromHex = fromHex +function fromHex (hexDigest, algorithm, opts) { + opts = ssriOpts(opts) + const optString = getOptString(opts.options) + return parse( + `${algorithm}-${ + Buffer.from(hexDigest, 'hex').toString('base64') + }${optString}`, opts + ) +} + +module.exports.fromData = fromData +function fromData (data, opts) { + opts = ssriOpts(opts) + const algorithms = opts.algorithms + const optString = getOptString(opts.options) + return algorithms.reduce((acc, algo) => { + const digest = crypto.createHash(algo).update(data).digest('base64') + const hash = new Hash( + `${algo}-${digest}${optString}`, + opts + ) + /* istanbul ignore else - it would be VERY strange if the string we + * just calculated with an algo did not have an algo or digest. + */ + if (hash.algorithm && hash.digest) { + const hashAlgo = hash.algorithm + if (!acc[hashAlgo]) { + acc[hashAlgo] = [] + } + acc[hashAlgo].push(hash) + } + return acc + }, new Integrity()) +} + +module.exports.fromStream = fromStream +function fromStream (stream, opts) { + opts = ssriOpts(opts) + const istream = integrityStream(opts) + return new Promise((resolve, reject) => { + stream.pipe(istream) + stream.on('error', reject) + istream.on('error', reject) + let sri + istream.on('integrity', s => { + sri = s + }) + istream.on('end', () => resolve(sri)) + istream.on('data', () => {}) + }) +} + +module.exports.checkData = checkData +function checkData (data, sri, opts) { + opts = ssriOpts(opts) + sri = parse(sri, opts) + if (!sri || !Object.keys(sri).length) { + if (opts.error) { + throw Object.assign( + new Error('No valid integrity hashes to check against'), { + code: 'EINTEGRITY', + } + ) + } else { + return false + } + } + const algorithm = sri.pickAlgorithm(opts) + const digest = crypto.createHash(algorithm).update(data).digest('base64') + const newSri = parse({ algorithm, digest }) + const match = newSri.match(sri, opts) + if (match || !opts.error) { + return match + } else if (typeof opts.size === 'number' && (data.length !== opts.size)) { + /* eslint-disable-next-line max-len */ + const err = new Error(`data size mismatch when checking ${sri}.\n Wanted: ${opts.size}\n Found: ${data.length}`) + err.code = 'EBADSIZE' + err.found = data.length + err.expected = opts.size + err.sri = sri + throw err + } else { + /* eslint-disable-next-line max-len */ + const err = new Error(`Integrity checksum failed when using ${algorithm}: Wanted ${sri}, but got ${newSri}. (${data.length} bytes)`) + err.code = 'EINTEGRITY' + err.found = newSri + err.expected = sri + err.algorithm = algorithm + err.sri = sri + throw err + } +} + +module.exports.checkStream = checkStream +function checkStream (stream, sri, opts) { + opts = ssriOpts(opts) + opts.integrity = sri + sri = parse(sri, opts) + if (!sri || !Object.keys(sri).length) { + return Promise.reject(Object.assign( + new Error('No valid integrity hashes to check against'), { + code: 'EINTEGRITY', + } + )) + } + const checker = integrityStream(opts) + return new Promise((resolve, reject) => { + stream.pipe(checker) + stream.on('error', reject) + checker.on('error', reject) + let verified + checker.on('verified', s => { + verified = s + }) + checker.on('end', () => resolve(verified)) + checker.on('data', () => {}) + }) +} + +module.exports.integrityStream = integrityStream +function integrityStream (opts = {}) { + return new IntegrityStream(opts) +} + +module.exports.create = createIntegrity +function createIntegrity (opts) { + opts = ssriOpts(opts) + const algorithms = opts.algorithms + const optString = getOptString(opts.options) + + const hashes = algorithms.map(crypto.createHash) + + return { + update: function (chunk, enc) { + hashes.forEach(h => h.update(chunk, enc)) + return this + }, + digest: function (enc) { + const integrity = algorithms.reduce((acc, algo) => { + const digest = hashes.shift().digest('base64') + const hash = new Hash( + `${algo}-${digest}${optString}`, + opts + ) + /* istanbul ignore else - it would be VERY strange if the hash we + * just calculated with an algo did not have an algo or digest. + */ + if (hash.algorithm && hash.digest) { + const hashAlgo = hash.algorithm + if (!acc[hashAlgo]) { + acc[hashAlgo] = [] + } + acc[hashAlgo].push(hash) + } + return acc + }, new Integrity()) + + return integrity + }, + } +} + +const NODE_HASHES = new Set(crypto.getHashes()) + +// This is a Best Effort™ at a reasonable priority for hash algos +const DEFAULT_PRIORITY = [ + 'md5', 'whirlpool', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512', + // TODO - it's unclear _which_ of these Node will actually use as its name + // for the algorithm, so we guesswork it based on the OpenSSL names. + 'sha3', + 'sha3-256', 'sha3-384', 'sha3-512', + 'sha3_256', 'sha3_384', 'sha3_512', +].filter(algo => NODE_HASHES.has(algo)) + +function getPrioritizedHash (algo1, algo2) { + /* eslint-disable-next-line max-len */ + return DEFAULT_PRIORITY.indexOf(algo1.toLowerCase()) >= DEFAULT_PRIORITY.indexOf(algo2.toLowerCase()) + ? algo1 + : algo2 +} diff --git a/node_modules/@npmcli/run-script/node_modules/ssri/package.json b/node_modules/@npmcli/run-script/node_modules/ssri/package.json new file mode 100644 index 0000000000000..91c1f919788cd --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/ssri/package.json @@ -0,0 +1,63 @@ +{ + "name": "ssri", + "version": "9.0.1", + "description": "Standard Subresource Integrity library -- parses, serializes, generates, and verifies integrity metadata according to the SRI spec.", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "scripts": { + "prerelease": "npm t", + "postrelease": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "posttest": "npm run lint", + "test": "tap", + "coverage": "tap", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "preversion": "npm test", + "postversion": "npm publish", + "snap": "tap" + }, + "tap": { + "check-coverage": true + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/ssri.git" + }, + "keywords": [ + "w3c", + "web", + "security", + "integrity", + "checksum", + "hashing", + "subresource integrity", + "sri", + "sri hash", + "sri string", + "sri generator", + "html" + ], + "author": "GitHub Inc.", + "license": "ISC", + "dependencies": { + "minipass": "^3.1.1" + }, + "devDependencies": { + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "3.5.0", + "tap": "^16.0.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.5.0" + } +} diff --git a/node_modules/@npmcli/run-script/node_modules/unique-filename/LICENSE b/node_modules/@npmcli/run-script/node_modules/unique-filename/LICENSE new file mode 100644 index 0000000000000..69619c125ea7e --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/unique-filename/LICENSE @@ -0,0 +1,5 @@ +Copyright npm, Inc + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/unique-filename/lib/index.js b/node_modules/@npmcli/run-script/node_modules/unique-filename/lib/index.js new file mode 100644 index 0000000000000..d067d2e709809 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/unique-filename/lib/index.js @@ -0,0 +1,7 @@ +var path = require('path') + +var uniqueSlug = require('unique-slug') + +module.exports = function (filepath, prefix, uniq) { + return path.join(filepath, (prefix ? prefix + '-' : '') + uniqueSlug(uniq)) +} diff --git a/node_modules/@npmcli/run-script/node_modules/unique-filename/package.json b/node_modules/@npmcli/run-script/node_modules/unique-filename/package.json new file mode 100644 index 0000000000000..bfdec2c3722a0 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/unique-filename/package.json @@ -0,0 +1,48 @@ +{ + "name": "unique-filename", + "version": "2.0.1", + "description": "Generate a unique filename for use in temporary directories or caches.", + "main": "lib/index.js", + "scripts": { + "test": "tap", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "snap": "tap", + "posttest": "npm run lint" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/unique-filename.git" + }, + "keywords": [], + "author": "GitHub Inc.", + "license": "ISC", + "bugs": { + "url": "https://github.com/iarna/unique-filename/issues" + }, + "homepage": "https://github.com/iarna/unique-filename", + "devDependencies": { + "@npmcli/eslint-config": "^3.1.0", + "@npmcli/template-oss": "3.5.0", + "tap": "^16.3.0" + }, + "dependencies": { + "unique-slug": "^3.0.0" + }, + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.5.0" + } +} diff --git a/node_modules/@npmcli/run-script/node_modules/unique-slug/LICENSE b/node_modules/@npmcli/run-script/node_modules/unique-slug/LICENSE new file mode 100644 index 0000000000000..7953647e7760b --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/unique-slug/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright npm, Inc + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/unique-slug/lib/index.js b/node_modules/@npmcli/run-script/node_modules/unique-slug/lib/index.js new file mode 100644 index 0000000000000..1bac84d95d730 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/unique-slug/lib/index.js @@ -0,0 +1,11 @@ +'use strict' +var MurmurHash3 = require('imurmurhash') + +module.exports = function (uniq) { + if (uniq) { + var hash = new MurmurHash3(uniq) + return ('00000000' + hash.result().toString(16)).slice(-8) + } else { + return (Math.random().toString(16) + '0000000').slice(2, 10) + } +} diff --git a/node_modules/@npmcli/run-script/node_modules/unique-slug/package.json b/node_modules/@npmcli/run-script/node_modules/unique-slug/package.json new file mode 100644 index 0000000000000..3194408f27fda --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/unique-slug/package.json @@ -0,0 +1,44 @@ +{ + "name": "unique-slug", + "version": "3.0.0", + "description": "Generate a unique character string suitible for use in files and URLs.", + "main": "lib/index.js", + "scripts": { + "test": "tap", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "snap": "tap", + "posttest": "npm run lint" + }, + "keywords": [], + "author": "GitHub Inc.", + "license": "ISC", + "devDependencies": { + "@npmcli/eslint-config": "^3.1.0", + "@npmcli/template-oss": "3.5.0", + "tap": "^16.3.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/unique-slug.git" + }, + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "3.5.0" + } +} diff --git a/node_modules/infer-owner/LICENSE b/node_modules/infer-owner/LICENSE new file mode 100644 index 0000000000000..20a4762540923 --- /dev/null +++ b/node_modules/infer-owner/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) npm, Inc. and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/infer-owner/index.js b/node_modules/infer-owner/index.js new file mode 100644 index 0000000000000..a7bddcbd2288b --- /dev/null +++ b/node_modules/infer-owner/index.js @@ -0,0 +1,71 @@ +const cache = new Map() +const fs = require('fs') +const { dirname, resolve } = require('path') + + +const lstat = path => new Promise((res, rej) => + fs.lstat(path, (er, st) => er ? rej(er) : res(st))) + +const inferOwner = path => { + path = resolve(path) + if (cache.has(path)) + return Promise.resolve(cache.get(path)) + + const statThen = st => { + const { uid, gid } = st + cache.set(path, { uid, gid }) + return { uid, gid } + } + const parent = dirname(path) + const parentTrap = parent === path ? null : er => { + return inferOwner(parent).then((owner) => { + cache.set(path, owner) + return owner + }) + } + return lstat(path).then(statThen, parentTrap) +} + +const inferOwnerSync = path => { + path = resolve(path) + if (cache.has(path)) + return cache.get(path) + + const parent = dirname(path) + + // avoid obscuring call site by re-throwing + // "catch" the error by returning from a finally, + // only if we're not at the root, and the parent call works. + let threw = true + try { + const st = fs.lstatSync(path) + threw = false + const { uid, gid } = st + cache.set(path, { uid, gid }) + return { uid, gid } + } finally { + if (threw && parent !== path) { + const owner = inferOwnerSync(parent) + cache.set(path, owner) + return owner // eslint-disable-line no-unsafe-finally + } + } +} + +const inflight = new Map() +module.exports = path => { + path = resolve(path) + if (inflight.has(path)) + return Promise.resolve(inflight.get(path)) + const p = inferOwner(path).then(owner => { + inflight.delete(path) + return owner + }) + inflight.set(path, p) + return p +} +module.exports.sync = inferOwnerSync +module.exports.clearCache = () => { + cache.clear() + inflight.clear() +} diff --git a/node_modules/infer-owner/package.json b/node_modules/infer-owner/package.json new file mode 100644 index 0000000000000..c4b2b6e6df206 --- /dev/null +++ b/node_modules/infer-owner/package.json @@ -0,0 +1,26 @@ +{ + "name": "infer-owner", + "version": "1.0.4", + "description": "Infer the owner of a path based on the owner of its nearest existing parent", + "author": "Isaac Z. Schlueter (https://izs.me)", + "license": "ISC", + "scripts": { + "test": "tap -J test/*.js --100", + "snap": "TAP_SNAPSHOT=1 tap -J test/*.js --100", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags" + }, + "devDependencies": { + "mutate-fs": "^2.1.1", + "tap": "^12.4.2" + }, + "main": "index.js", + "repository": "https://github.com/npm/infer-owner", + "publishConfig": { + "access": "public" + }, + "files": [ + "index.js" + ] +} diff --git a/node_modules/node-gyp/CONTRIBUTING.md b/node_modules/node-gyp/CONTRIBUTING.md index c1c50eab4e58b..5b977898f104b 100644 --- a/node_modules/node-gyp/CONTRIBUTING.md +++ b/node_modules/node-gyp/CONTRIBUTING.md @@ -3,7 +3,7 @@ ## Code of Conduct Please read the -[Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md) +[Code of Conduct](https://github.com/nodejs/admin/blob/main/CODE_OF_CONDUCT.md) which explains the minimum behavior expectations for node-gyp contributors. diff --git a/node_modules/node-gyp/bin/node-gyp.js b/node_modules/node-gyp/bin/node-gyp.js index 8652ea21eceeb..f8317b47b3414 100755 --- a/node_modules/node-gyp/bin/node-gyp.js +++ b/node_modules/node-gyp/bin/node-gyp.js @@ -6,7 +6,7 @@ process.title = 'node-gyp' const envPaths = require('env-paths') const gyp = require('../') -const log = require('npmlog') +const log = require('../lib/log') const os = require('os') /** @@ -14,11 +14,11 @@ const os = require('os') */ const prog = gyp() -var completed = false +let completed = false prog.parseArgv(process.argv) prog.devDir = prog.opts.devdir -var homeDir = os.homedir() +const homeDir = os.homedir() if (prog.devDir) { prog.devDir = prog.devDir.replace(/^~/, homeDir) } else if (homeDir) { @@ -32,9 +32,9 @@ if (prog.devDir) { if (prog.todo.length === 0) { if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) { - console.log('v%s', prog.version) + log.stdout('v%s', prog.version) } else { - console.log('%s', prog.usage()) + log.stdout('%s', prog.usage()) } process.exit(0) } @@ -48,11 +48,11 @@ log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, * Change dir if -C/--directory was passed. */ -var dir = prog.opts.directory +const dir = prog.opts.directory if (dir) { - var fs = require('fs') + const fs = require('fs') try { - var stat = fs.statSync(dir) + const stat = fs.statSync(dir) if (stat.isDirectory()) { log.info('chdir', dir) process.chdir(dir) @@ -68,8 +68,8 @@ if (dir) { } } -function run () { - var command = prog.todo.shift() +async function run () { + const command = prog.todo.shift() if (!command) { // done! completed = true @@ -77,30 +77,28 @@ function run () { return } - prog.commands[command.name](command.args, function (err) { - if (err) { - log.error(command.name + ' error') - log.error('stack', err.stack) - errorMessage() - log.error('not ok') - return process.exit(1) - } + try { + const args = await prog.commands[command.name](command.args) ?? [] + if (command.name === 'list') { - var versions = arguments[1] - if (versions.length > 0) { - versions.forEach(function (version) { - console.log(version) - }) + if (args.length) { + args.forEach((version) => log.stdout(version)) } else { - console.log('No node development files installed. Use `node-gyp install` to install a version.') + log.stdout('No node development files installed. Use `node-gyp install` to install a version.') } - } else if (arguments.length >= 2) { - console.log.apply(console, [].slice.call(arguments, 1)) + } else if (args.length >= 1) { + log.stdout(...args.slice(1)) } // now run the next command in the queue - process.nextTick(run) - }) + return run() + } catch (err) { + log.error(command.name + ' error') + log.error('stack', err.stack) + errorMessage() + log.error('not ok') + return process.exit(1) + } } process.on('exit', function (code) { @@ -120,7 +118,7 @@ process.on('uncaughtException', function (err) { function errorMessage () { // copied from npm's lib/utils/error-handler.js - var os = require('os') + const os = require('os') log.error('System', os.type() + ' ' + os.release()) log.error('command', process.argv .map(JSON.stringify).join(' ')) diff --git a/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py b/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py index d6b189760cef9..bc0e93d07f890 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py @@ -285,19 +285,17 @@ def Write(self, writer=gyp.common.WriteOnDiff): "\tEndProjectSection\r\n" ) - if isinstance(e, MSVSFolder): - if e.items: - f.write("\tProjectSection(SolutionItems) = preProject\r\n") - for i in e.items: - f.write(f"\t\t{i} = {i}\r\n") - f.write("\tEndProjectSection\r\n") - - if isinstance(e, MSVSProject): - if e.dependencies: - f.write("\tProjectSection(ProjectDependencies) = postProject\r\n") - for d in e.dependencies: - f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n") - f.write("\tEndProjectSection\r\n") + if isinstance(e, MSVSFolder) and e.items: + f.write("\tProjectSection(SolutionItems) = preProject\r\n") + for i in e.items: + f.write(f"\t\t{i} = {i}\r\n") + f.write("\tEndProjectSection\r\n") + + if isinstance(e, MSVSProject) and e.dependencies: + f.write("\tProjectSection(ProjectDependencies) = postProject\r\n") + for d in e.dependencies: + f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n") + f.write("\tEndProjectSection\r\n") f.write("EndProject\r\n") @@ -353,7 +351,7 @@ def Write(self, writer=gyp.common.WriteOnDiff): # Folder mappings # Omit this section if there are no folders - if any([e.entries for e in all_entries if isinstance(e, MSVSFolder)]): + if any(e.entries for e in all_entries if isinstance(e, MSVSFolder)): f.write("\tGlobalSection(NestedProjects) = preSolution\r\n") for e in all_entries: if not isinstance(e, MSVSFolder): diff --git a/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py b/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py index f0cfabe834909..629f3f61b4819 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py @@ -79,7 +79,7 @@ def __init__(self, project_path, version, name, guid=None, platforms=None): self.files_section = ["Files"] # Keep a dict keyed on filename to speed up access. - self.files_dict = dict() + self.files_dict = {} def AddToolFile(self, path): """Adds a tool file to the project. diff --git a/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py b/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py index e89a971a3bb4f..93633dbca133c 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py @@ -141,7 +141,7 @@ class _Boolean(_Type): """Boolean settings, can have the values 'false' or 'true'.""" def _Validate(self, value): - if value != "true" and value != "false": + if value not in {"true", "false"}: raise ValueError("expected bool; got %r" % value) def ValidateMSVS(self, value): diff --git a/node_modules/node-gyp/gyp/pylib/gyp/__init__.py b/node_modules/node-gyp/gyp/pylib/gyp/__init__.py index 2aa39d0318860..d6cc01307d997 100755 --- a/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/__init__.py @@ -108,7 +108,9 @@ def Load( if default_variables["GENERATOR"] == "ninja": default_variables.setdefault( "PRODUCT_DIR_ABS", - os.path.join(output_dir, "out", default_variables["build_type"]), + os.path.join( + output_dir, "out", default_variables.get("build_type", "default") + ), ) else: default_variables.setdefault( @@ -622,7 +624,7 @@ def gyp_main(args): if options.generator_flags: gen_flags += options.generator_flags generator_flags = NameValueListToDict(gen_flags) - if DEBUG_GENERAL in gyp.debug.keys(): + if DEBUG_GENERAL in gyp.debug: DebugOutput(DEBUG_GENERAL, "generator_flags: %s", generator_flags) # Generate all requested formats (use a set in case we got one format request diff --git a/node_modules/node-gyp/gyp/pylib/gyp/common.py b/node_modules/node-gyp/gyp/pylib/gyp/common.py index d77adee8afd55..b73a0c55b1e34 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/common.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/common.py @@ -144,20 +144,16 @@ def RelativePath(path, relative_to, follow_path_symlink=True): # symlink, this option has no effect. # Convert to normalized (and therefore absolute paths). - if follow_path_symlink: - path = os.path.realpath(path) - else: - path = os.path.abspath(path) + path = os.path.realpath(path) if follow_path_symlink else os.path.abspath(path) relative_to = os.path.realpath(relative_to) # On Windows, we can't create a relative path to a different drive, so just # use the absolute path. - if sys.platform == "win32": - if ( - os.path.splitdrive(path)[0].lower() - != os.path.splitdrive(relative_to)[0].lower() - ): - return path + if sys.platform == "win32" and ( + os.path.splitdrive(path)[0].lower() + != os.path.splitdrive(relative_to)[0].lower() + ): + return path # Split the paths into components. path_split = path.split(os.path.sep) @@ -277,10 +273,7 @@ def EncodePOSIXShellArgument(argument): if not isinstance(argument, str): argument = str(argument) - if _quote.search(argument): - quote = '"' - else: - quote = "" + quote = '"' if _quote.search(argument) else "" encoded = quote + re.sub(_escape, r"\\\1", argument) + quote diff --git a/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py b/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py index bda1a47468ae2..02567b251446d 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py @@ -121,7 +121,11 @@ def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False, if win32 and os.linesep != "\r\n": xml_string = xml_string.replace("\n", "\r\n") - default_encoding = locale.getdefaultlocale()[1] + try: # getdefaultlocale() was removed in Python 3.11 + default_encoding = locale.getdefaultlocale()[1] + except AttributeError: + default_encoding = locale.getencoding() + if default_encoding and default_encoding.upper() != encoding.upper(): xml_string = xml_string.encode(encoding) diff --git a/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py b/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py index 342f693a329d2..2d9b15210dc12 100755 --- a/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py @@ -76,6 +76,8 @@ def test_EasyXml_complex(self): '\'Debug|Win32\'" Label="Configuration">' "Application" "Unicode" + "SpectreLoadCF" + "14.36.32532" "" "" ) @@ -99,6 +101,8 @@ def test_EasyXml_complex(self): }, ["ConfigurationType", "Application"], ["CharacterSet", "Unicode"], + ["SpectreMitigation", "SpectreLoadCF"], + ["VCToolsVersion", "14.36.32532"], ], ] ) diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py index f15df00c36373..1334f2fca9967 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py @@ -379,7 +379,7 @@ def _GenerateTargets(data, target_list, target_dicts, toplevel_dir, files, build target.is_executable = target_type == "executable" target.is_static_library = target_type == "static_library" target.is_or_has_linked_ancestor = ( - target_type == "executable" or target_type == "shared_library" + target_type in {"executable", "shared_library"} ) build_file = gyp.common.ParseQualifiedTarget(target_name)[0] @@ -433,14 +433,14 @@ def _GetUnqualifiedToTargetMapping(all_targets, to_find): if not to_find: return {}, [] to_find = set(to_find) - for target_name in all_targets.keys(): + for target_name in all_targets: extracted = gyp.common.ParseQualifiedTarget(target_name) if len(extracted) > 1 and extracted[1] in to_find: to_find.remove(extracted[1]) result[extracted[1]] = all_targets[target_name] if not to_find: return result, [] - return result, [x for x in to_find] + return result, list(to_find) def _DoesTargetDependOnMatchingTargets(target): @@ -451,8 +451,8 @@ def _DoesTargetDependOnMatchingTargets(target): if target.match_status == MATCH_STATUS_DOESNT_MATCH: return False if ( - target.match_status == MATCH_STATUS_MATCHES - or target.match_status == MATCH_STATUS_MATCHES_BY_DEPENDENCY + target.match_status in {MATCH_STATUS_MATCHES, + MATCH_STATUS_MATCHES_BY_DEPENDENCY} ): return True for dep in target.deps: @@ -683,11 +683,9 @@ def find_matching_test_target_names(self): ) test_target_names_contains_all = "all" in self._test_target_names if test_target_names_contains_all: - test_targets = [ - x for x in (set(test_targets_no_all) | set(self._root_targets)) - ] + test_targets = list(set(test_targets_no_all) | set(self._root_targets)) else: - test_targets = [x for x in test_targets_no_all] + test_targets = list(test_targets_no_all) print("supplied test_targets") for target_name in self._test_target_names: print("\t", target_name) @@ -702,9 +700,9 @@ def find_matching_test_target_names(self): if matching_test_targets_contains_all: # Remove any of the targets for all that were not explicitly supplied, # 'all' is subsequentely added to the matching names below. - matching_test_targets = [ - x for x in (set(matching_test_targets) & set(test_targets_no_all)) - ] + matching_test_targets = list( + set(matching_test_targets) & set(test_targets_no_all) + ) print("matched test_targets") for target in matching_test_targets: print("\t", target.name) @@ -729,9 +727,7 @@ def find_matching_compile_target_names(self): self._supplied_target_names_no_all(), self._unqualified_mapping ) if "all" in self._supplied_target_names(): - supplied_targets = [ - x for x in (set(supplied_targets) | set(self._root_targets)) - ] + supplied_targets = list(set(supplied_targets) | set(self._root_targets)) print("Supplied test_targets & compile_targets") for target in supplied_targets: print("\t", target.name) diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py index cdf1a4832cf1a..d3c97c666db07 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py @@ -697,7 +697,7 @@ def ComputeOutputParts(self, spec): target, ) - if self.type != "static_library" and self.type != "shared_library": + if self.type not in {"static_library", "shared_library"}: target_prefix = spec.get("product_prefix", target_prefix) target = spec.get("product_name", target) product_ext = spec.get("product_extension") diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py index c95d18415cdb3..320a891aa8adc 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py @@ -103,7 +103,7 @@ def NormjoinPathForceCMakeSource(base_path, rel_path): """ if os.path.isabs(rel_path): return rel_path - if any([rel_path.startswith(var) for var in FULL_PATH_VARS]): + if any(rel_path.startswith(var) for var in FULL_PATH_VARS): return rel_path # TODO: do we need to check base_path for absolute variables as well? return os.path.join( @@ -328,7 +328,7 @@ def WriteActions(target_name, actions, extra_sources, extra_deps, path_to_gyp, o def NormjoinRulePathForceCMakeSource(base_path, rel_path, rule_source): if rel_path.startswith(("${RULE_INPUT_PATH}", "${RULE_INPUT_DIRNAME}")): - if any([rule_source.startswith(var) for var in FULL_PATH_VARS]): + if any(rule_source.startswith(var) for var in FULL_PATH_VARS): return rel_path return NormjoinPathForceCMakeSource(base_path, rel_path) @@ -929,10 +929,7 @@ def WriteTarget( product_prefix = spec.get("product_prefix", default_product_prefix) product_name = spec.get("product_name", default_product_name) product_ext = spec.get("product_extension") - if product_ext: - product_ext = "." + product_ext - else: - product_ext = default_product_ext + product_ext = "." + product_ext if product_ext else default_product_ext SetTargetProperty(output, cmake_target_name, "PREFIX", product_prefix) SetTargetProperty( diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py index f330a04dea4c5..0ffa3bb5980fe 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py @@ -34,7 +34,7 @@ def IsMac(params): - return "mac" == gyp.common.GetFlavor(params) + return gyp.common.GetFlavor(params) == "mac" def CalculateVariables(default_variables, params): @@ -93,7 +93,7 @@ def resolve(filename): gyp.common.EncodePOSIXShellArgument(file), ) ) - commands.append(dict(command=command, directory=output_dir, file=file)) + commands.append({"command": command, "directory": output_dir, "file": file}) def GenerateOutput(target_list, target_dicts, data, params): @@ -108,7 +108,10 @@ def GenerateOutput(target_list, target_dicts, data, params): cwd = os.path.dirname(build_file) AddCommandsForTarget(cwd, target, params, per_config_commands) - output_dir = params["generator_flags"].get("output_dir", "out") + try: + output_dir = params["options"].generator_output + except (AttributeError, KeyError): + output_dir = params["generator_flags"].get("output_dir", "out") for configuration_name, commands in per_config_commands.items(): filename = os.path.join(output_dir, configuration_name, "compile_commands.json") gyp.common.EnsureDirExists(filename) diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py index a851b4db757ed..52aeae6050990 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py @@ -248,10 +248,7 @@ def GetAllDefines(target_list, target_dicts, data, config_name, params, compiler continue cpp_line_parts = cpp_line.split(" ", 2) key = cpp_line_parts[1] - if len(cpp_line_parts) >= 3: - val = cpp_line_parts[2] - else: - val = "1" + val = cpp_line_parts[2] if len(cpp_line_parts) >= 3 else "1" all_defines[key] = val return all_defines diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py index f1d01a629d435..1b9974948e4de 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py @@ -681,10 +681,7 @@ def WriteRootHeaderSuffixRules(writer): def Compilable(filename): """Return true if the file is compilable (should be in OBJS).""" - for res in (filename.endswith(e) for e in COMPILABLE_EXTENSIONS): - if res: - return True - return False + return any(res for res in (filename.endswith(e) for e in COMPILABLE_EXTENSIONS)) def Linkable(filename): @@ -778,7 +775,7 @@ def __init__(self, generator_flags, flavor): self.suffix_rules_objdir2 = {} # Generate suffix rules for all compilable extensions. - for ext in COMPILABLE_EXTENSIONS.keys(): + for ext in COMPILABLE_EXTENSIONS: # Suffix rules for source folder. self.suffix_rules_srcdir.update( { @@ -1066,7 +1063,7 @@ def WriteActions( # libraries, but until everything is made cross-compile safe, also use # target libraries. # TODO(piman): when everything is cross-compile safe, remove lib.target - if self.flavor == "zos" or self.flavor == "aix": + if self.flavor in {"zos", "aix"}: self.WriteLn( "cmd_%s = LIBPATH=$(builddir)/lib.host:" "$(builddir)/lib.target:$$LIBPATH; " @@ -1992,10 +1989,7 @@ def WriteTarget( and self.toolset == "target" ): # On mac, products are created in install_path immediately. - assert install_path == self.output, "{} != {}".format( - install_path, - self.output, - ) + assert install_path == self.output, f"{install_path} != {self.output}" # Point the target alias to the final binary output. self.WriteMakeRule( @@ -2034,7 +2028,7 @@ def WriteTarget( installable_deps.append( self.GetUnversionedSidedeckFromSidedeck(install_path) ) - if self.output != self.alias and self.alias != self.target: + if self.alias not in (self.output, self.target): self.WriteMakeRule( [self.alias], installable_deps, diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py index fd95005784798..13b0794b4dccc 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py @@ -164,7 +164,7 @@ def _FixPath(path, separator="\\"): fixpath_prefix and path and not os.path.isabs(path) - and not path[0] == "$" + and path[0] != "$" and not _IsWindowsAbsPath(path) ): path = os.path.join(fixpath_prefix, path) @@ -281,9 +281,9 @@ def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False): else: value = [i.replace("/", "\\") for i in value] if not tools.get(tool_name): - tools[tool_name] = dict() + tools[tool_name] = {} tool = tools[tool_name] - if "CompileAsWinRT" == setting: + if setting == "CompileAsWinRT": return if tool.get(setting): if only_if_unset: @@ -412,10 +412,7 @@ def _BuildCommandLineForRuleRaw( return input_dir_preamble + cmd else: # Convert cat --> type to mimic unix. - if cmd[0] == "cat": - command = ["type"] - else: - command = [cmd[0].replace("/", "\\")] + command = ["type"] if cmd[0] == "cat" else [cmd[0].replace("/", "\\")] # Add call before command to ensure that commands can be tied together one # after the other without aborting in Incredibuild, since IB makes a bat # file out of the raw command string, and some commands (like python) are @@ -438,6 +435,7 @@ def _BuildCommandLineForRuleRaw( # Support a mode for using cmd directly. # Convert any paths to native form (first element is used directly). # TODO(quote): regularize quoting path names throughout the module + command[1] = '"%s"' % command[1] arguments = ['"%s"' % i for i in arguments] # Collapse into a single command. return input_dir_preamble + " ".join(command + arguments) @@ -687,7 +685,7 @@ def _GenerateExternalRules(rules, output_dir, spec, sources, options, actions_to all_outputs.update(OrderedSet(outputs)) # Only use one target from each rule as the dependency for # 'all' so we don't try to build each rule multiple times. - first_outputs.append(list(outputs)[0]) + first_outputs.append(next(iter(outputs))) # Get the unique output directories for this rule. output_dirs = [os.path.split(i)[0] for i in outputs] for od in output_dirs: @@ -756,7 +754,7 @@ def _EscapeEnvironmentVariableExpansion(s): Returns: The escaped string. - """ # noqa: E731,E123,E501 + """ s = s.replace("%", "%%") return s @@ -1189,7 +1187,7 @@ def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config): precompiled_header = config.get("msvs_precompiled_header") # Prepare the list of tools as a dictionary. - tools = dict() + tools = {} # Add in user specified msvs_settings. msvs_settings = config.get("msvs_settings", {}) MSVSSettings.ValidateMSVSSettings(msvs_settings) @@ -1384,10 +1382,7 @@ def _GetDefines(config): """ defines = [] for d in config.get("defines", []): - if type(d) == list: - fd = "=".join([str(dpart) for dpart in d]) - else: - fd = str(d) + fd = "=".join([str(dpart) for dpart in d]) if isinstance(d, list) else str(d) defines.append(fd) return defines @@ -1578,10 +1573,10 @@ def _AdjustSourcesAndConvertToFilterHierarchy( # such as ../../src/modules/module1 etc. if version.UsesVcxproj(): while ( - all([isinstance(s, MSVSProject.Filter) for s in sources]) + all(isinstance(s, MSVSProject.Filter) for s in sources) and len({s.name for s in sources}) == 1 ): - assert all([len(s.contents) == 1 for s in sources]) + assert all(len(s.contents) == 1 for s in sources) sources = [s.contents[0] for s in sources] else: while len(sources) == 1 and isinstance(sources[0], MSVSProject.Filter): @@ -1598,10 +1593,7 @@ def _IdlFilesHandledNonNatively(spec, sources): if rule["extension"] == "idl" and int(rule.get("msvs_external_rule", 0)): using_idl = True break - if using_idl: - excluded_idl = [i for i in sources if i.endswith(".idl")] - else: - excluded_idl = [] + excluded_idl = [i for i in sources if i.endswith(".idl")] if using_idl else [] return excluded_idl @@ -1819,7 +1811,7 @@ def _GetPathDict(root, path): parent, folder = os.path.split(path) parent_dict = _GetPathDict(root, parent) if folder not in parent_dict: - parent_dict[folder] = dict() + parent_dict[folder] = {} return parent_dict[folder] @@ -3013,18 +3005,26 @@ def _GetMSBuildConfigurationDetails(spec, build_file): msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file) condition = _GetConfigurationCondition(name, settings, spec) character_set = msbuild_attributes.get("CharacterSet") + vctools_version = msbuild_attributes.get("VCToolsVersion") config_type = msbuild_attributes.get("ConfigurationType") _AddConditionalProperty(properties, condition, "ConfigurationType", config_type) + spectre_mitigation = msbuild_attributes.get('SpectreMitigation') + if spectre_mitigation: + _AddConditionalProperty(properties, condition, "SpectreMitigation", + spectre_mitigation) if config_type == "Driver": _AddConditionalProperty(properties, condition, "DriverType", "WDM") _AddConditionalProperty( properties, condition, "TargetVersion", _ConfigTargetVersion(settings) ) - if character_set: - if "msvs_enable_winrt" not in spec: - _AddConditionalProperty( - properties, condition, "CharacterSet", character_set - ) + if character_set and "msvs_enable_winrt" not in spec: + _AddConditionalProperty( + properties, condition, "CharacterSet", character_set + ) + if vctools_version and "msvs_enable_winrt" not in spec: + _AddConditionalProperty( + properties, condition, "VCToolsVersion", vctools_version + ) return _GetMSBuildPropertyGroup(spec, "Configuration", properties) @@ -3104,6 +3104,10 @@ def _ConvertMSVSBuildAttributes(spec, config, build_file): msbuild_attributes[a] = _ConvertMSVSCharacterSet(msvs_attributes[a]) elif a == "ConfigurationType": msbuild_attributes[a] = _ConvertMSVSConfigurationType(msvs_attributes[a]) + elif a == "SpectreMitigation": + msbuild_attributes[a] = msvs_attributes[a] + elif a == "VCToolsVersion": + msbuild_attributes[a] = msvs_attributes[a] else: print("Warning: Do not know how to convert MSVS attribute " + a) return msbuild_attributes @@ -3326,15 +3330,14 @@ def _GetMSBuildToolSettingsSections(spec, configurations): for tool_name, tool_settings in sorted(msbuild_settings.items()): # Skip the tool named '' which is a holder of global settings handled # by _GetMSBuildConfigurationGlobalProperties. - if tool_name: - if tool_settings: - tool = [tool_name] - for name, value in sorted(tool_settings.items()): - formatted_value = _GetValueFormattedForMSBuild( - tool_name, name, value - ) - tool.append([name, formatted_value]) - group.append(tool) + if tool_name and tool_settings: + tool = [tool_name] + for name, value in sorted(tool_settings.items()): + formatted_value = _GetValueFormattedForMSBuild( + tool_name, name, value + ) + tool.append([name, formatted_value]) + group.append(tool) groups.append(group) return groups @@ -3462,10 +3465,7 @@ def _GetValueFormattedForMSBuild(tool_name, name, value): "Link": ["AdditionalOptions"], "Lib": ["AdditionalOptions"], } - if tool_name in exceptions and name in exceptions[tool_name]: - char = " " - else: - char = ";" + char = " " if name in exceptions.get(tool_name, []) else ";" formatted_value = char.join( [MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in value] ) diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py index ca04ee13a1c1b..8ba341e96d3f0 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py @@ -1815,10 +1815,7 @@ def ComputeOutputFileName(self, spec, type=None): "executable": default_variables["EXECUTABLE_SUFFIX"], } extension = spec.get("product_extension") - if extension: - extension = "." + extension - else: - extension = DEFAULT_EXTENSION.get(type, "") + extension = "." + extension if extension else DEFAULT_EXTENSION.get(type, "") if "product_name" in spec: # If we were given an explicit name, use that. @@ -2533,7 +2530,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name description="SOLINK $lib", restat=True, command=mtime_preserving_solink_base - % {"suffix": "@$link_file_list"}, # noqa: E501 + % {"suffix": "@$link_file_list"}, rspfile="$link_file_list", rspfile_content=( "-Wl,--whole-archive $in $solibs -Wl," "--no-whole-archive $libs" diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py index 2f4d17e514e43..1ac672c3876bd 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py @@ -439,7 +439,7 @@ def Finalize2(self, xcode_targets, xcode_target_to_target_dict): # it opens the project file, which will result in unnecessary diffs. # TODO(mark): This is evil because it relies on internal knowledge of # PBXProject._other_pbxprojects. - for other_pbxproject in self.project._other_pbxprojects.keys(): + for other_pbxproject in self.project._other_pbxprojects: self.project.AddOrGetProjectReference(other_pbxproject) self.project.SortRemoteProductReferences() @@ -1118,10 +1118,7 @@ def GenerateOutput(target_list, target_dicts, data, params): for concrete_output_index, concrete_output in enumerate( concrete_outputs ): - if concrete_output_index == 0: - bol = "" - else: - bol = " " + bol = "" if concrete_output_index == 0 else " " makefile.write(f"{bol}{concrete_output} \\\n") concrete_output_dir = posixpath.dirname(concrete_output) diff --git a/node_modules/node-gyp/gyp/pylib/gyp/input.py b/node_modules/node-gyp/gyp/pylib/gyp/input.py index d9699a0a50218..8f39519dee51f 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/input.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/input.py @@ -16,9 +16,9 @@ import sys import threading import traceback -from distutils.version import StrictVersion from gyp.common import GypError from gyp.common import OrderedSet +from packaging.version import Version # A list of types that are treated as linkable. linkable_types = [ @@ -225,7 +225,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, includes, is_target, check return data[build_file_path] if os.path.exists(build_file_path): - build_file_contents = open(build_file_path, encoding='utf-8').read() + build_file_contents = open(build_file_path, encoding="utf-8").read() else: raise GypError(f"{build_file_path} not found (cwd: {os.getcwd()})") @@ -870,10 +870,7 @@ def ExpandVariables(input, phase, variables, build_file): # This works around actions/rules which have more inputs than will # fit on the command line. if file_list: - if type(contents) is list: - contents_list = contents - else: - contents_list = contents.split(" ") + contents_list = contents if type(contents) is list else contents.split(" ") replacement = contents_list[0] if os.path.isabs(replacement): raise GypError('| cannot handle absolute paths, got "%s"' % replacement) @@ -1183,7 +1180,7 @@ def EvalSingleCondition(cond_expr, true_dict, false_dict, phase, variables, buil else: ast_code = compile(cond_expr_expanded, "", "eval") cached_conditions_asts[cond_expr_expanded] = ast_code - env = {"__builtins__": {}, "v": StrictVersion} + env = {"__builtins__": {}, "v": Version} if eval(ast_code, env, variables): return true_dict return false_dict @@ -1579,14 +1576,12 @@ def ExpandWildcardDependencies(targets, data): continue dependency_target_name = dependency_target_dict["target_name"] if ( - dependency_target != "*" - and dependency_target != dependency_target_name + dependency_target not in {"*", dependency_target_name} ): continue dependency_target_toolset = dependency_target_dict["toolset"] if ( - dependency_toolset != "*" - and dependency_toolset != dependency_target_toolset + dependency_toolset not in {"*", dependency_target_toolset} ): continue dependency = gyp.common.QualifiedTarget( @@ -1630,15 +1625,14 @@ def RemoveSelfDependencies(targets): dependencies = target_dict.get(dependency_key, []) if dependencies: for t in dependencies: - if t == target_name: - if ( - targets[t] - .get("variables", {}) - .get("prune_self_dependency", 0) - ): - target_dict[dependency_key] = Filter( - dependencies, target_name - ) + if t == target_name and ( + targets[t] + .get("variables", {}) + .get("prune_self_dependency", 0) + ): + target_dict[dependency_key] = Filter( + dependencies, target_name + ) def RemoveLinkDependenciesFromNoneTargets(targets): @@ -2238,10 +2232,7 @@ def is_in_set_or_list(x, s, items): singleton = False if type(item) in (str, int): # The cheap and easy case. - if is_paths: - to_item = MakePathRelative(to_file, fro_file, item) - else: - to_item = item + to_item = MakePathRelative(to_file, fro_file, item) if is_paths else item if not (type(item) is str and item.startswith("-")): # Any string that doesn't begin with a "-" is a singleton - it can @@ -2467,10 +2458,7 @@ def SetUpConfigurations(target, target_dict): new_configuration_dict = {} for (key, target_val) in target_dict.items(): key_ext = key[-1:] - if key_ext in key_suffixes: - key_base = key[:-1] - else: - key_base = key + key_base = key[:-1] if key_ext in key_suffixes else key if key_base not in non_configuration_keys: new_configuration_dict[key] = gyp.simple_copy.deepcopy(target_val) @@ -2482,7 +2470,7 @@ def SetUpConfigurations(target, target_dict): merged_configurations[configuration] = new_configuration_dict # Put the new configurations back into the target dict as a configuration. - for configuration in merged_configurations.keys(): + for configuration in merged_configurations: target_dict["configurations"][configuration] = merged_configurations[ configuration ] @@ -2499,19 +2487,16 @@ def SetUpConfigurations(target, target_dict): delete_keys = [] for key in target_dict: key_ext = key[-1:] - if key_ext in key_suffixes: - key_base = key[:-1] - else: - key_base = key + key_base = key[:-1] if key_ext in key_suffixes else key if key_base not in non_configuration_keys: delete_keys.append(key) for key in delete_keys: del target_dict[key] # Check the configurations to see if they contain invalid keys. - for configuration in target_dict["configurations"].keys(): + for configuration in target_dict["configurations"]: configuration_dict = target_dict["configurations"][configuration] - for key in configuration_dict.keys(): + for key in configuration_dict: if key in invalid_configuration_keys: raise GypError( "%s not allowed in the %s configuration, found in " @@ -2554,7 +2539,7 @@ def ProcessListFiltersInDict(name, the_dict): del_lists = [] for key, value in the_dict.items(): operation = key[-1] - if operation != "!" and operation != "/": + if operation not in {"!", "/"}: continue if type(value) is not list: diff --git a/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py b/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py index 5b9c2712e091b..38fa21dd66669 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py @@ -93,7 +93,7 @@ def _AddPrefix(element, prefix): if element is None: return element # Note, not Iterable because we don't want to handle strings like that. - if isinstance(element, list) or isinstance(element, tuple): + if isinstance(element, (list, tuple)): return [prefix + e for e in element] else: return prefix + element @@ -105,7 +105,7 @@ def _DoRemapping(element, map): if map is not None and element is not None: if not callable(map): map = map.get # Assume it's a dict, otherwise a callable to do the remap. - if isinstance(element, list) or isinstance(element, tuple): + if isinstance(element, (list, tuple)): element = filter(None, [map(elem) for elem in element]) else: element = map(element) @@ -117,7 +117,7 @@ def _AppendOrReturn(append, element): then add |element| to it, adding each item in |element| if it's a list or tuple.""" if append is not None and element is not None: - if isinstance(element, list) or isinstance(element, tuple): + if isinstance(element, (list, tuple)): append.extend(element) else: append.append(element) @@ -183,7 +183,7 @@ def ExtractSharedMSVSSystemIncludes(configs, generator_flags): expanded_system_includes = OrderedSet( [ExpandMacros(include, env) for include in all_system_includes] ) - if any(["$" in include for include in expanded_system_includes]): + if any("$" in include for include in expanded_system_includes): # Some path relies on target-specific variables, bail. return None @@ -255,10 +255,7 @@ def GetVSMacroEnv(self, base_to_build=None, config=None): """Get a dict of variables mapping internal VS macro names to their gyp equivalents.""" target_arch = self.GetArch(config) - if target_arch == "x86": - target_platform = "Win32" - else: - target_platform = target_arch + target_platform = "Win32" if target_arch == "x86" else target_arch target_name = self.spec.get("product_prefix", "") + self.spec.get( "product_name", self.spec["target_name"] ) @@ -738,10 +735,7 @@ def GetLdflags( # TODO(scottmg): This should sort of be somewhere else (not really a flag). ld("AdditionalDependencies", prefix="") - if self.GetArch(config) == "x86": - safeseh_default = "true" - else: - safeseh_default = None + safeseh_default = "true" if self.GetArch(config) == "x86" else None ld( "ImageHasSafeExceptionHandlers", map={"false": ":NO", "true": ""}, @@ -960,15 +954,12 @@ def GetRuleShellFlags(self, rule): def _HasExplicitRuleForExtension(self, spec, extension): """Determine if there's an explicit rule for a particular extension.""" - for rule in spec.get("rules", []): - if rule["extension"] == extension: - return True - return False + return any(rule["extension"] == extension for rule in spec.get("rules", [])) def _HasExplicitIdlActions(self, spec): """Determine if an action should not run midl for .idl files.""" return any( - [action.get("explicit_idl_action", 0) for action in spec.get("actions", [])] + action.get("explicit_idl_action", 0) for action in spec.get("actions", []) ) def HasExplicitIdlRulesOrActions(self, spec): diff --git a/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py b/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py index 638eee4002941..171d7295747fc 100755 --- a/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py @@ -219,11 +219,10 @@ def ExecLinkWithManifests( our_manifest = "%(out)s.manifest" % variables # Load and normalize the manifests. mt.exe sometimes removes whitespace, # and sometimes doesn't unfortunately. - with open(our_manifest) as our_f: - with open(assert_manifest) as assert_f: - translator = str.maketrans('', '', string.whitespace) - our_data = our_f.read().translate(translator) - assert_data = assert_f.read().translate(translator) + with open(our_manifest) as our_f, open(assert_manifest) as assert_f: + translator = str.maketrans("", "", string.whitespace) + our_data = our_f.read().translate(translator) + assert_data = assert_f.read().translate(translator) if our_data != assert_data: os.unlink(out) diff --git a/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py b/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py index a75d8eeab7bda..29caf1ce7fbb9 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py @@ -685,10 +685,7 @@ def GetCflags(self, configname, arch=None): if platform_root: cflags.append("-F" + platform_root + "/Developer/Library/Frameworks/") - if sdk_root: - framework_root = sdk_root - else: - framework_root = "" + framework_root = sdk_root if sdk_root else "" config = self.spec["configurations"][self.configname] framework_dirs = config.get("mac_framework_dirs", []) for directory in framework_dirs: @@ -1248,10 +1245,7 @@ def _AdjustLibrary(self, library, config_name=None): l_flag = "-framework " + os.path.splitext(os.path.basename(library))[0] else: m = self.library_re.match(library) - if m: - l_flag = "-l" + m.group(1) - else: - l_flag = library + l_flag = "-l" + m.group(1) if m else library sdk_root = self._SdkPath(config_name) if not sdk_root: @@ -1545,7 +1539,7 @@ def CLTVersion(): except GypError: continue - regex = re.compile(r'Command Line Tools for Xcode\s+(?P\S+)') + regex = re.compile(r"Command Line Tools for Xcode\s+(?P\S+)") try: output = GetStdout(["/usr/sbin/softwareupdate", "--history"]) return re.search(regex, output).groupdict()["version"] diff --git a/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py b/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py index 4e0ec5e8828f7..33c667c266bf6 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py @@ -971,7 +971,7 @@ def __init__(self, properties=None, id=None, parent=None): if "path" in self._properties and "name" not in self._properties: path = self._properties["path"] name = posixpath.basename(path) - if name != "" and path != name: + if name not in ("", path): self.SetProperty("name", name) if "path" in self._properties and ( @@ -2355,9 +2355,8 @@ def __init__( # property was supplied, set "productName" if it is not present. Also set # the "PRODUCT_NAME" build setting in each configuration, but only if # the setting is not present in any build configuration. - if "name" in self._properties: - if "productName" not in self._properties: - self.SetProperty("productName", self._properties["name"]) + if "name" in self._properties and "productName" not in self._properties: + self.SetProperty("productName", self._properties["name"]) if "productName" in self._properties: if "buildConfigurationList" in self._properties: @@ -2547,13 +2546,12 @@ def __init__( force_extension = suffix[1:] if ( - self._properties["productType"] - == "com.apple.product-type-bundle.unit.test" - or self._properties["productType"] - == "com.apple.product-type-bundle.ui-testing" - ): - if force_extension is None: - force_extension = suffix[1:] + self._properties["productType"] in { + "com.apple.product-type-bundle.unit.test", + "com.apple.product-type-bundle.ui-testing" + } + ) and force_extension is None: + force_extension = suffix[1:] if force_extension is not None: # If it's a wrapper (bundle), set WRAPPER_EXTENSION. @@ -2636,10 +2634,13 @@ def HeadersPhase(self): # frameworks phases, if any. insert_at = len(self._properties["buildPhases"]) for index, phase in enumerate(self._properties["buildPhases"]): - if ( - isinstance(phase, PBXResourcesBuildPhase) - or isinstance(phase, PBXSourcesBuildPhase) - or isinstance(phase, PBXFrameworksBuildPhase) + if isinstance( + phase, + ( + PBXResourcesBuildPhase, + PBXSourcesBuildPhase, + PBXFrameworksBuildPhase, + ), ): insert_at = index break @@ -2658,9 +2659,7 @@ def ResourcesPhase(self): # phases, if any. insert_at = len(self._properties["buildPhases"]) for index, phase in enumerate(self._properties["buildPhases"]): - if isinstance(phase, PBXSourcesBuildPhase) or isinstance( - phase, PBXFrameworksBuildPhase - ): + if isinstance(phase, (PBXSourcesBuildPhase, PBXFrameworksBuildPhase)): insert_at = index break @@ -2701,8 +2700,10 @@ def AddDependency(self, other): other._properties["productType"] == static_library_type or ( ( - other._properties["productType"] == shared_library_type - or other._properties["productType"] == framework_type + other._properties["productType"] in { + shared_library_type, + framework_type + } ) and ( (not other.HasBuildSetting("MACH_O_TYPE")) diff --git a/node_modules/node-gyp/gyp/pylib/packaging/LICENSE b/node_modules/node-gyp/gyp/pylib/packaging/LICENSE new file mode 100644 index 0000000000000..6f62d44e4ef73 --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/LICENSE @@ -0,0 +1,3 @@ +This software is made available under the terms of *either* of the licenses +found in LICENSE.APACHE or LICENSE.BSD. Contributions to this software is made +under the terms of *both* these licenses. diff --git a/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE b/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE new file mode 100644 index 0000000000000..f433b1a53f5b8 --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD b/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD new file mode 100644 index 0000000000000..42ce7b75c92fb --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD @@ -0,0 +1,23 @@ +Copyright (c) Donald Stufft and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/node-gyp/gyp/pylib/packaging/__init__.py b/node_modules/node-gyp/gyp/pylib/packaging/__init__.py new file mode 100644 index 0000000000000..5fd91838316fb --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/__init__.py @@ -0,0 +1,15 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +__title__ = "packaging" +__summary__ = "Core utilities for Python packages" +__uri__ = "https://github.com/pypa/packaging" + +__version__ = "23.3.dev0" + +__author__ = "Donald Stufft and individual contributors" +__email__ = "donald@stufft.io" + +__license__ = "BSD-2-Clause or Apache-2.0" +__copyright__ = "2014 %s" % __author__ diff --git a/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py b/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py new file mode 100644 index 0000000000000..6fb19b30bb53c --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py @@ -0,0 +1,108 @@ +""" +ELF file parser. + +This provides a class ``ELFFile`` that parses an ELF executable in a similar +interface to ``ZipFile``. Only the read interface is implemented. + +Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca +ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html +""" + +import enum +import os +import struct +from typing import IO, Optional, Tuple + + +class ELFInvalid(ValueError): + pass + + +class EIClass(enum.IntEnum): + C32 = 1 + C64 = 2 + + +class EIData(enum.IntEnum): + Lsb = 1 + Msb = 2 + + +class EMachine(enum.IntEnum): + I386 = 3 + S390 = 22 + Arm = 40 + X8664 = 62 + AArc64 = 183 + + +class ELFFile: + """ + Representation of an ELF executable. + """ + + def __init__(self, f: IO[bytes]) -> None: + self._f = f + + try: + ident = self._read("16B") + except struct.error: + raise ELFInvalid("unable to parse identification") + magic = bytes(ident[:4]) + if magic != b"\x7fELF": + raise ELFInvalid(f"invalid magic: {magic!r}") + + self.capacity = ident[4] # Format for program header (bitness). + self.encoding = ident[5] # Data structure encoding (endianness). + + try: + # e_fmt: Format for program header. + # p_fmt: Format for section header. + # p_idx: Indexes to find p_type, p_offset, and p_filesz. + e_fmt, self._p_fmt, self._p_idx = { + (1, 1): ("HHIIIIIHHH", ">IIIIIIII", (0, 1, 4)), # 32-bit MSB. + (2, 1): ("HHIQQQIHHH", ">IIQQQQQQ", (0, 2, 5)), # 64-bit MSB. + }[(self.capacity, self.encoding)] + except KeyError: + raise ELFInvalid( + f"unrecognized capacity ({self.capacity}) or " + f"encoding ({self.encoding})" + ) + + try: + ( + _, + self.machine, # Architecture type. + _, + _, + self._e_phoff, # Offset of program header. + _, + self.flags, # Processor-specific flags. + _, + self._e_phentsize, # Size of section. + self._e_phnum, # Number of sections. + ) = self._read(e_fmt) + except struct.error as e: + raise ELFInvalid("unable to parse machine and section information") from e + + def _read(self, fmt: str) -> Tuple[int, ...]: + return struct.unpack(fmt, self._f.read(struct.calcsize(fmt))) + + @property + def interpreter(self) -> Optional[str]: + """ + The path recorded in the ``PT_INTERP`` section header. + """ + for index in range(self._e_phnum): + self._f.seek(self._e_phoff + self._e_phentsize * index) + try: + data = self._read(self._p_fmt) + except struct.error: + continue + if data[self._p_idx[0]] != 3: # Not PT_INTERP. + continue + self._f.seek(data[self._p_idx[1]]) + return os.fsdecode(self._f.read(data[self._p_idx[2]])).strip("\0") + return None diff --git a/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py b/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py new file mode 100644 index 0000000000000..3705d50db9193 --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py @@ -0,0 +1,252 @@ +import collections +import contextlib +import functools +import os +import re +import sys +import warnings +from typing import Dict, Generator, Iterator, NamedTuple, Optional, Sequence, Tuple + +from ._elffile import EIClass, EIData, ELFFile, EMachine + +EF_ARM_ABIMASK = 0xFF000000 +EF_ARM_ABI_VER5 = 0x05000000 +EF_ARM_ABI_FLOAT_HARD = 0x00000400 + + +# `os.PathLike` not a generic type until Python 3.9, so sticking with `str` +# as the type for `path` until then. +@contextlib.contextmanager +def _parse_elf(path: str) -> Generator[Optional[ELFFile], None, None]: + try: + with open(path, "rb") as f: + yield ELFFile(f) + except (OSError, TypeError, ValueError): + yield None + + +def _is_linux_armhf(executable: str) -> bool: + # hard-float ABI can be detected from the ELF header of the running + # process + # https://static.docs.arm.com/ihi0044/g/aaelf32.pdf + with _parse_elf(executable) as f: + return ( + f is not None + and f.capacity == EIClass.C32 + and f.encoding == EIData.Lsb + and f.machine == EMachine.Arm + and f.flags & EF_ARM_ABIMASK == EF_ARM_ABI_VER5 + and f.flags & EF_ARM_ABI_FLOAT_HARD == EF_ARM_ABI_FLOAT_HARD + ) + + +def _is_linux_i686(executable: str) -> bool: + with _parse_elf(executable) as f: + return ( + f is not None + and f.capacity == EIClass.C32 + and f.encoding == EIData.Lsb + and f.machine == EMachine.I386 + ) + + +def _have_compatible_abi(executable: str, archs: Sequence[str]) -> bool: + if "armv7l" in archs: + return _is_linux_armhf(executable) + if "i686" in archs: + return _is_linux_i686(executable) + allowed_archs = {"x86_64", "aarch64", "ppc64", "ppc64le", "s390x", "loongarch64"} + return any(arch in allowed_archs for arch in archs) + + +# If glibc ever changes its major version, we need to know what the last +# minor version was, so we can build the complete list of all versions. +# For now, guess what the highest minor version might be, assume it will +# be 50 for testing. Once this actually happens, update the dictionary +# with the actual value. +_LAST_GLIBC_MINOR: Dict[int, int] = collections.defaultdict(lambda: 50) + + +class _GLibCVersion(NamedTuple): + major: int + minor: int + + +def _glibc_version_string_confstr() -> Optional[str]: + """ + Primary implementation of glibc_version_string using os.confstr. + """ + # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely + # to be broken or missing. This strategy is used in the standard library + # platform module. + # https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183 + try: + # Should be a string like "glibc 2.17". + version_string: str = getattr(os, "confstr")("CS_GNU_LIBC_VERSION") + assert version_string is not None + _, version = version_string.rsplit() + except (AssertionError, AttributeError, OSError, ValueError): + # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)... + return None + return version + + +def _glibc_version_string_ctypes() -> Optional[str]: + """ + Fallback implementation of glibc_version_string using ctypes. + """ + try: + import ctypes + except ImportError: + return None + + # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen + # manpage says, "If filename is NULL, then the returned handle is for the + # main program". This way we can let the linker do the work to figure out + # which libc our process is actually using. + # + # We must also handle the special case where the executable is not a + # dynamically linked executable. This can occur when using musl libc, + # for example. In this situation, dlopen() will error, leading to an + # OSError. Interestingly, at least in the case of musl, there is no + # errno set on the OSError. The single string argument used to construct + # OSError comes from libc itself and is therefore not portable to + # hard code here. In any case, failure to call dlopen() means we + # can proceed, so we bail on our attempt. + try: + process_namespace = ctypes.CDLL(None) + except OSError: + return None + + try: + gnu_get_libc_version = process_namespace.gnu_get_libc_version + except AttributeError: + # Symbol doesn't exist -> therefore, we are not linked to + # glibc. + return None + + # Call gnu_get_libc_version, which returns a string like "2.5" + gnu_get_libc_version.restype = ctypes.c_char_p + version_str: str = gnu_get_libc_version() + # py2 / py3 compatibility: + if not isinstance(version_str, str): + version_str = version_str.decode("ascii") + + return version_str + + +def _glibc_version_string() -> Optional[str]: + """Returns glibc version string, or None if not using glibc.""" + return _glibc_version_string_confstr() or _glibc_version_string_ctypes() + + +def _parse_glibc_version(version_str: str) -> Tuple[int, int]: + """Parse glibc version. + + We use a regexp instead of str.split because we want to discard any + random junk that might come after the minor version -- this might happen + in patched/forked versions of glibc (e.g. Linaro's version of glibc + uses version strings like "2.20-2014.11"). See gh-3588. + """ + m = re.match(r"(?P[0-9]+)\.(?P[0-9]+)", version_str) + if not m: + warnings.warn( + f"Expected glibc version with 2 components major.minor," + f" got: {version_str}", + RuntimeWarning, + ) + return -1, -1 + return int(m.group("major")), int(m.group("minor")) + + +@functools.lru_cache() +def _get_glibc_version() -> Tuple[int, int]: + version_str = _glibc_version_string() + if version_str is None: + return (-1, -1) + return _parse_glibc_version(version_str) + + +# From PEP 513, PEP 600 +def _is_compatible(arch: str, version: _GLibCVersion) -> bool: + sys_glibc = _get_glibc_version() + if sys_glibc < version: + return False + # Check for presence of _manylinux module. + try: + import _manylinux # noqa + except ImportError: + return True + if hasattr(_manylinux, "manylinux_compatible"): + result = _manylinux.manylinux_compatible(version[0], version[1], arch) + if result is not None: + return bool(result) + return True + if version == _GLibCVersion(2, 5): + if hasattr(_manylinux, "manylinux1_compatible"): + return bool(_manylinux.manylinux1_compatible) + if version == _GLibCVersion(2, 12): + if hasattr(_manylinux, "manylinux2010_compatible"): + return bool(_manylinux.manylinux2010_compatible) + if version == _GLibCVersion(2, 17): + if hasattr(_manylinux, "manylinux2014_compatible"): + return bool(_manylinux.manylinux2014_compatible) + return True + + +_LEGACY_MANYLINUX_MAP = { + # CentOS 7 w/ glibc 2.17 (PEP 599) + (2, 17): "manylinux2014", + # CentOS 6 w/ glibc 2.12 (PEP 571) + (2, 12): "manylinux2010", + # CentOS 5 w/ glibc 2.5 (PEP 513) + (2, 5): "manylinux1", +} + + +def platform_tags(archs: Sequence[str]) -> Iterator[str]: + """Generate manylinux tags compatible to the current platform. + + :param archs: Sequence of compatible architectures. + The first one shall be the closest to the actual architecture and be the part of + platform tag after the ``linux_`` prefix, e.g. ``x86_64``. + The ``linux_`` prefix is assumed as a prerequisite for the current platform to + be manylinux-compatible. + + :returns: An iterator of compatible manylinux tags. + """ + if not _have_compatible_abi(sys.executable, archs): + return + # Oldest glibc to be supported regardless of architecture is (2, 17). + too_old_glibc2 = _GLibCVersion(2, 16) + if set(archs) & {"x86_64", "i686"}: + # On x86/i686 also oldest glibc to be supported is (2, 5). + too_old_glibc2 = _GLibCVersion(2, 4) + current_glibc = _GLibCVersion(*_get_glibc_version()) + glibc_max_list = [current_glibc] + # We can assume compatibility across glibc major versions. + # https://sourceware.org/bugzilla/show_bug.cgi?id=24636 + # + # Build a list of maximum glibc versions so that we can + # output the canonical list of all glibc from current_glibc + # down to too_old_glibc2, including all intermediary versions. + for glibc_major in range(current_glibc.major - 1, 1, -1): + glibc_minor = _LAST_GLIBC_MINOR[glibc_major] + glibc_max_list.append(_GLibCVersion(glibc_major, glibc_minor)) + for arch in archs: + for glibc_max in glibc_max_list: + if glibc_max.major == too_old_glibc2.major: + min_minor = too_old_glibc2.minor + else: + # For other glibc major versions oldest supported is (x, 0). + min_minor = -1 + for glibc_minor in range(glibc_max.minor, min_minor, -1): + glibc_version = _GLibCVersion(glibc_max.major, glibc_minor) + tag = "manylinux_{}_{}".format(*glibc_version) + if _is_compatible(arch, glibc_version): + yield f"{tag}_{arch}" + # Handle the legacy manylinux1, manylinux2010, manylinux2014 tags. + if glibc_version in _LEGACY_MANYLINUX_MAP: + legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version] + if _is_compatible(arch, glibc_version): + yield f"{legacy_tag}_{arch}" diff --git a/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py b/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py new file mode 100644 index 0000000000000..86419df9d7087 --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py @@ -0,0 +1,83 @@ +"""PEP 656 support. + +This module implements logic to detect if the currently running Python is +linked against musl, and what musl version is used. +""" + +import functools +import re +import subprocess +import sys +from typing import Iterator, NamedTuple, Optional, Sequence + +from ._elffile import ELFFile + + +class _MuslVersion(NamedTuple): + major: int + minor: int + + +def _parse_musl_version(output: str) -> Optional[_MuslVersion]: + lines = [n for n in (n.strip() for n in output.splitlines()) if n] + if len(lines) < 2 or lines[0][:4] != "musl": + return None + m = re.match(r"Version (\d+)\.(\d+)", lines[1]) + if not m: + return None + return _MuslVersion(major=int(m.group(1)), minor=int(m.group(2))) + + +@functools.lru_cache() +def _get_musl_version(executable: str) -> Optional[_MuslVersion]: + """Detect currently-running musl runtime version. + + This is done by checking the specified executable's dynamic linking + information, and invoking the loader to parse its output for a version + string. If the loader is musl, the output would be something like:: + + musl libc (x86_64) + Version 1.2.2 + Dynamic Program Loader + """ + try: + with open(executable, "rb") as f: + ld = ELFFile(f).interpreter + except (OSError, TypeError, ValueError): + return None + if ld is None or "musl" not in ld: + return None + proc = subprocess.run([ld], stderr=subprocess.PIPE, text=True) + return _parse_musl_version(proc.stderr) + + +def platform_tags(archs: Sequence[str]) -> Iterator[str]: + """Generate musllinux tags compatible to the current platform. + + :param archs: Sequence of compatible architectures. + The first one shall be the closest to the actual architecture and be the part of + platform tag after the ``linux_`` prefix, e.g. ``x86_64``. + The ``linux_`` prefix is assumed as a prerequisite for the current platform to + be musllinux-compatible. + + :returns: An iterator of compatible musllinux tags. + """ + sys_musl = _get_musl_version(sys.executable) + if sys_musl is None: # Python not dynamically linked against musl. + return + for arch in archs: + for minor in range(sys_musl.minor, -1, -1): + yield f"musllinux_{sys_musl.major}_{minor}_{arch}" + + +if __name__ == "__main__": # pragma: no cover + import sysconfig + + plat = sysconfig.get_platform() + assert plat.startswith("linux-"), "not linux" + + print("plat:", plat) + print("musl:", _get_musl_version(sys.executable)) + print("tags:", end=" ") + for t in platform_tags(re.sub(r"[.-]", "_", plat.split("-", 1)[-1])): + print(t, end="\n ") diff --git a/node_modules/node-gyp/gyp/pylib/packaging/_parser.py b/node_modules/node-gyp/gyp/pylib/packaging/_parser.py new file mode 100644 index 0000000000000..4576981c2dd75 --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/_parser.py @@ -0,0 +1,359 @@ +"""Handwritten parser of dependency specifiers. + +The docstring for each __parse_* function contains ENBF-inspired grammar representing +the implementation. +""" + +import ast +from typing import Any, List, NamedTuple, Optional, Tuple, Union + +from ._tokenizer import DEFAULT_RULES, Tokenizer + + +class Node: + def __init__(self, value: str) -> None: + self.value = value + + def __str__(self) -> str: + return self.value + + def __repr__(self) -> str: + return f"<{self.__class__.__name__}('{self}')>" + + def serialize(self) -> str: + raise NotImplementedError + + +class Variable(Node): + def serialize(self) -> str: + return str(self) + + +class Value(Node): + def serialize(self) -> str: + return f'"{self}"' + + +class Op(Node): + def serialize(self) -> str: + return str(self) + + +MarkerVar = Union[Variable, Value] +MarkerItem = Tuple[MarkerVar, Op, MarkerVar] +# MarkerAtom = Union[MarkerItem, List["MarkerAtom"]] +# MarkerList = List[Union["MarkerList", MarkerAtom, str]] +# mypy does not support recursive type definition +# https://github.com/python/mypy/issues/731 +MarkerAtom = Any +MarkerList = List[Any] + + +class ParsedRequirement(NamedTuple): + name: str + url: str + extras: List[str] + specifier: str + marker: Optional[MarkerList] + + +# -------------------------------------------------------------------------------------- +# Recursive descent parser for dependency specifier +# -------------------------------------------------------------------------------------- +def parse_requirement(source: str) -> ParsedRequirement: + return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES)) + + +def _parse_requirement(tokenizer: Tokenizer) -> ParsedRequirement: + """ + requirement = WS? IDENTIFIER WS? extras WS? requirement_details + """ + tokenizer.consume("WS") + + name_token = tokenizer.expect( + "IDENTIFIER", expected="package name at the start of dependency specifier" + ) + name = name_token.text + tokenizer.consume("WS") + + extras = _parse_extras(tokenizer) + tokenizer.consume("WS") + + url, specifier, marker = _parse_requirement_details(tokenizer) + tokenizer.expect("END", expected="end of dependency specifier") + + return ParsedRequirement(name, url, extras, specifier, marker) + + +def _parse_requirement_details( + tokenizer: Tokenizer, +) -> Tuple[str, str, Optional[MarkerList]]: + """ + requirement_details = AT URL (WS requirement_marker?)? + | specifier WS? (requirement_marker)? + """ + + specifier = "" + url = "" + marker = None + + if tokenizer.check("AT"): + tokenizer.read() + tokenizer.consume("WS") + + url_start = tokenizer.position + url = tokenizer.expect("URL", expected="URL after @").text + if tokenizer.check("END", peek=True): + return (url, specifier, marker) + + tokenizer.expect("WS", expected="whitespace after URL") + + # The input might end after whitespace. + if tokenizer.check("END", peek=True): + return (url, specifier, marker) + + marker = _parse_requirement_marker( + tokenizer, span_start=url_start, after="URL and whitespace" + ) + else: + specifier_start = tokenizer.position + specifier = _parse_specifier(tokenizer) + tokenizer.consume("WS") + + if tokenizer.check("END", peek=True): + return (url, specifier, marker) + + marker = _parse_requirement_marker( + tokenizer, + span_start=specifier_start, + after=( + "version specifier" + if specifier + else "name and no valid version specifier" + ), + ) + + return (url, specifier, marker) + + +def _parse_requirement_marker( + tokenizer: Tokenizer, *, span_start: int, after: str +) -> MarkerList: + """ + requirement_marker = SEMICOLON marker WS? + """ + + if not tokenizer.check("SEMICOLON"): + tokenizer.raise_syntax_error( + f"Expected end or semicolon (after {after})", + span_start=span_start, + ) + tokenizer.read() + + marker = _parse_marker(tokenizer) + tokenizer.consume("WS") + + return marker + + +def _parse_extras(tokenizer: Tokenizer) -> List[str]: + """ + extras = (LEFT_BRACKET wsp* extras_list? wsp* RIGHT_BRACKET)? + """ + if not tokenizer.check("LEFT_BRACKET", peek=True): + return [] + + with tokenizer.enclosing_tokens( + "LEFT_BRACKET", + "RIGHT_BRACKET", + around="extras", + ): + tokenizer.consume("WS") + extras = _parse_extras_list(tokenizer) + tokenizer.consume("WS") + + return extras + + +def _parse_extras_list(tokenizer: Tokenizer) -> List[str]: + """ + extras_list = identifier (wsp* ',' wsp* identifier)* + """ + extras: List[str] = [] + + if not tokenizer.check("IDENTIFIER"): + return extras + + extras.append(tokenizer.read().text) + + while True: + tokenizer.consume("WS") + if tokenizer.check("IDENTIFIER", peek=True): + tokenizer.raise_syntax_error("Expected comma between extra names") + elif not tokenizer.check("COMMA"): + break + + tokenizer.read() + tokenizer.consume("WS") + + extra_token = tokenizer.expect("IDENTIFIER", expected="extra name after comma") + extras.append(extra_token.text) + + return extras + + +def _parse_specifier(tokenizer: Tokenizer) -> str: + """ + specifier = LEFT_PARENTHESIS WS? version_many WS? RIGHT_PARENTHESIS + | WS? version_many WS? + """ + with tokenizer.enclosing_tokens( + "LEFT_PARENTHESIS", + "RIGHT_PARENTHESIS", + around="version specifier", + ): + tokenizer.consume("WS") + parsed_specifiers = _parse_version_many(tokenizer) + tokenizer.consume("WS") + + return parsed_specifiers + + +def _parse_version_many(tokenizer: Tokenizer) -> str: + """ + version_many = (SPECIFIER (WS? COMMA WS? SPECIFIER)*)? + """ + parsed_specifiers = "" + while tokenizer.check("SPECIFIER"): + span_start = tokenizer.position + parsed_specifiers += tokenizer.read().text + if tokenizer.check("VERSION_PREFIX_TRAIL", peek=True): + tokenizer.raise_syntax_error( + ".* suffix can only be used with `==` or `!=` operators", + span_start=span_start, + span_end=tokenizer.position + 1, + ) + if tokenizer.check("VERSION_LOCAL_LABEL_TRAIL", peek=True): + tokenizer.raise_syntax_error( + "Local version label can only be used with `==` or `!=` operators", + span_start=span_start, + span_end=tokenizer.position, + ) + tokenizer.consume("WS") + if not tokenizer.check("COMMA"): + break + parsed_specifiers += tokenizer.read().text + tokenizer.consume("WS") + + return parsed_specifiers + + +# -------------------------------------------------------------------------------------- +# Recursive descent parser for marker expression +# -------------------------------------------------------------------------------------- +def parse_marker(source: str) -> MarkerList: + return _parse_full_marker(Tokenizer(source, rules=DEFAULT_RULES)) + + +def _parse_full_marker(tokenizer: Tokenizer) -> MarkerList: + retval = _parse_marker(tokenizer) + tokenizer.expect("END", expected="end of marker expression") + return retval + + +def _parse_marker(tokenizer: Tokenizer) -> MarkerList: + """ + marker = marker_atom (BOOLOP marker_atom)+ + """ + expression = [_parse_marker_atom(tokenizer)] + while tokenizer.check("BOOLOP"): + token = tokenizer.read() + expr_right = _parse_marker_atom(tokenizer) + expression.extend((token.text, expr_right)) + return expression + + +def _parse_marker_atom(tokenizer: Tokenizer) -> MarkerAtom: + """ + marker_atom = WS? LEFT_PARENTHESIS WS? marker WS? RIGHT_PARENTHESIS WS? + | WS? marker_item WS? + """ + + tokenizer.consume("WS") + if tokenizer.check("LEFT_PARENTHESIS", peek=True): + with tokenizer.enclosing_tokens( + "LEFT_PARENTHESIS", + "RIGHT_PARENTHESIS", + around="marker expression", + ): + tokenizer.consume("WS") + marker: MarkerAtom = _parse_marker(tokenizer) + tokenizer.consume("WS") + else: + marker = _parse_marker_item(tokenizer) + tokenizer.consume("WS") + return marker + + +def _parse_marker_item(tokenizer: Tokenizer) -> MarkerItem: + """ + marker_item = WS? marker_var WS? marker_op WS? marker_var WS? + """ + tokenizer.consume("WS") + marker_var_left = _parse_marker_var(tokenizer) + tokenizer.consume("WS") + marker_op = _parse_marker_op(tokenizer) + tokenizer.consume("WS") + marker_var_right = _parse_marker_var(tokenizer) + tokenizer.consume("WS") + return (marker_var_left, marker_op, marker_var_right) + + +def _parse_marker_var(tokenizer: Tokenizer) -> MarkerVar: + """ + marker_var = VARIABLE | QUOTED_STRING + """ + if tokenizer.check("VARIABLE"): + return process_env_var(tokenizer.read().text.replace(".", "_")) + elif tokenizer.check("QUOTED_STRING"): + return process_python_str(tokenizer.read().text) + else: + tokenizer.raise_syntax_error( + message="Expected a marker variable or quoted string" + ) + + +def process_env_var(env_var: str) -> Variable: + if ( + env_var == "platform_python_implementation" + or env_var == "python_implementation" + ): + return Variable("platform_python_implementation") + else: + return Variable(env_var) + + +def process_python_str(python_str: str) -> Value: + value = ast.literal_eval(python_str) + return Value(str(value)) + + +def _parse_marker_op(tokenizer: Tokenizer) -> Op: + """ + marker_op = IN | NOT IN | OP + """ + if tokenizer.check("IN"): + tokenizer.read() + return Op("in") + elif tokenizer.check("NOT"): + tokenizer.read() + tokenizer.expect("WS", expected="whitespace after 'not'") + tokenizer.expect("IN", expected="'in' after 'not'") + return Op("not in") + elif tokenizer.check("OP"): + return Op(tokenizer.read().text) + else: + return tokenizer.raise_syntax_error( + "Expected marker operator, one of " + "<=, <, !=, ==, >=, >, ~=, ===, in, not in" + ) diff --git a/node_modules/node-gyp/gyp/pylib/packaging/_structures.py b/node_modules/node-gyp/gyp/pylib/packaging/_structures.py new file mode 100644 index 0000000000000..90a6465f9682c --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/_structures.py @@ -0,0 +1,61 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + + +class InfinityType: + def __repr__(self) -> str: + return "Infinity" + + def __hash__(self) -> int: + return hash(repr(self)) + + def __lt__(self, other: object) -> bool: + return False + + def __le__(self, other: object) -> bool: + return False + + def __eq__(self, other: object) -> bool: + return isinstance(other, self.__class__) + + def __gt__(self, other: object) -> bool: + return True + + def __ge__(self, other: object) -> bool: + return True + + def __neg__(self: object) -> "NegativeInfinityType": + return NegativeInfinity + + +Infinity = InfinityType() + + +class NegativeInfinityType: + def __repr__(self) -> str: + return "-Infinity" + + def __hash__(self) -> int: + return hash(repr(self)) + + def __lt__(self, other: object) -> bool: + return True + + def __le__(self, other: object) -> bool: + return True + + def __eq__(self, other: object) -> bool: + return isinstance(other, self.__class__) + + def __gt__(self, other: object) -> bool: + return False + + def __ge__(self, other: object) -> bool: + return False + + def __neg__(self: object) -> InfinityType: + return Infinity + + +NegativeInfinity = NegativeInfinityType() diff --git a/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py b/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py new file mode 100644 index 0000000000000..dd0d648d49a7c --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py @@ -0,0 +1,192 @@ +import contextlib +import re +from dataclasses import dataclass +from typing import Dict, Iterator, NoReturn, Optional, Tuple, Union + +from .specifiers import Specifier + + +@dataclass +class Token: + name: str + text: str + position: int + + +class ParserSyntaxError(Exception): + """The provided source text could not be parsed correctly.""" + + def __init__( + self, + message: str, + *, + source: str, + span: Tuple[int, int], + ) -> None: + self.span = span + self.message = message + self.source = source + + super().__init__() + + def __str__(self) -> str: + marker = " " * self.span[0] + "~" * (self.span[1] - self.span[0]) + "^" + return "\n ".join([self.message, self.source, marker]) + + +DEFAULT_RULES: "Dict[str, Union[str, re.Pattern[str]]]" = { + "LEFT_PARENTHESIS": r"\(", + "RIGHT_PARENTHESIS": r"\)", + "LEFT_BRACKET": r"\[", + "RIGHT_BRACKET": r"\]", + "SEMICOLON": r";", + "COMMA": r",", + "QUOTED_STRING": re.compile( + r""" + ( + ('[^']*') + | + ("[^"]*") + ) + """, + re.VERBOSE, + ), + "OP": r"(===|==|~=|!=|<=|>=|<|>)", + "BOOLOP": r"\b(or|and)\b", + "IN": r"\bin\b", + "NOT": r"\bnot\b", + "VARIABLE": re.compile( + r""" + \b( + python_version + |python_full_version + |os[._]name + |sys[._]platform + |platform_(release|system) + |platform[._](version|machine|python_implementation) + |python_implementation + |implementation_(name|version) + |extra + )\b + """, + re.VERBOSE, + ), + "SPECIFIER": re.compile( + Specifier._operator_regex_str + Specifier._version_regex_str, + re.VERBOSE | re.IGNORECASE, + ), + "AT": r"\@", + "URL": r"[^ \t]+", + "IDENTIFIER": r"\b[a-zA-Z0-9][a-zA-Z0-9._-]*\b", + "VERSION_PREFIX_TRAIL": r"\.\*", + "VERSION_LOCAL_LABEL_TRAIL": r"\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*", + "WS": r"[ \t]+", + "END": r"$", +} + + +class Tokenizer: + """Context-sensitive token parsing. + + Provides methods to examine the input stream to check whether the next token + matches. + """ + + def __init__( + self, + source: str, + *, + rules: "Dict[str, Union[str, re.Pattern[str]]]", + ) -> None: + self.source = source + self.rules: Dict[str, re.Pattern[str]] = { + name: re.compile(pattern) for name, pattern in rules.items() + } + self.next_token: Optional[Token] = None + self.position = 0 + + def consume(self, name: str) -> None: + """Move beyond provided token name, if at current position.""" + if self.check(name): + self.read() + + def check(self, name: str, *, peek: bool = False) -> bool: + """Check whether the next token has the provided name. + + By default, if the check succeeds, the token *must* be read before + another check. If `peek` is set to `True`, the token is not loaded and + would need to be checked again. + """ + assert ( + self.next_token is None + ), f"Cannot check for {name!r}, already have {self.next_token!r}" + assert name in self.rules, f"Unknown token name: {name!r}" + + expression = self.rules[name] + + match = expression.match(self.source, self.position) + if match is None: + return False + if not peek: + self.next_token = Token(name, match[0], self.position) + return True + + def expect(self, name: str, *, expected: str) -> Token: + """Expect a certain token name next, failing with a syntax error otherwise. + + The token is *not* read. + """ + if not self.check(name): + raise self.raise_syntax_error(f"Expected {expected}") + return self.read() + + def read(self) -> Token: + """Consume the next token and return it.""" + token = self.next_token + assert token is not None + + self.position += len(token.text) + self.next_token = None + + return token + + def raise_syntax_error( + self, + message: str, + *, + span_start: Optional[int] = None, + span_end: Optional[int] = None, + ) -> NoReturn: + """Raise ParserSyntaxError at the given position.""" + span = ( + self.position if span_start is None else span_start, + self.position if span_end is None else span_end, + ) + raise ParserSyntaxError( + message, + source=self.source, + span=span, + ) + + @contextlib.contextmanager + def enclosing_tokens( + self, open_token: str, close_token: str, *, around: str + ) -> Iterator[None]: + if self.check(open_token): + open_position = self.position + self.read() + else: + open_position = None + + yield + + if open_position is None: + return + + if not self.check(close_token): + self.raise_syntax_error( + f"Expected matching {close_token} for {open_token}, after {around}", + span_start=open_position, + ) + + self.read() diff --git a/node_modules/node-gyp/gyp/pylib/packaging/markers.py b/node_modules/node-gyp/gyp/pylib/packaging/markers.py new file mode 100644 index 0000000000000..8b98fca7233be --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/markers.py @@ -0,0 +1,252 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import operator +import os +import platform +import sys +from typing import Any, Callable, Dict, List, Optional, Tuple, Union + +from ._parser import ( + MarkerAtom, + MarkerList, + Op, + Value, + Variable, + parse_marker as _parse_marker, +) +from ._tokenizer import ParserSyntaxError +from .specifiers import InvalidSpecifier, Specifier +from .utils import canonicalize_name + +__all__ = [ + "InvalidMarker", + "UndefinedComparison", + "UndefinedEnvironmentName", + "Marker", + "default_environment", +] + +Operator = Callable[[str, str], bool] + + +class InvalidMarker(ValueError): + """ + An invalid marker was found, users should refer to PEP 508. + """ + + +class UndefinedComparison(ValueError): + """ + An invalid operation was attempted on a value that doesn't support it. + """ + + +class UndefinedEnvironmentName(ValueError): + """ + A name was attempted to be used that does not exist inside of the + environment. + """ + + +def _normalize_extra_values(results: Any) -> Any: + """ + Normalize extra values. + """ + if isinstance(results[0], tuple): + lhs, op, rhs = results[0] + if isinstance(lhs, Variable) and lhs.value == "extra": + normalized_extra = canonicalize_name(rhs.value) + rhs = Value(normalized_extra) + elif isinstance(rhs, Variable) and rhs.value == "extra": + normalized_extra = canonicalize_name(lhs.value) + lhs = Value(normalized_extra) + results[0] = lhs, op, rhs + return results + + +def _format_marker( + marker: Union[List[str], MarkerAtom, str], first: Optional[bool] = True +) -> str: + + assert isinstance(marker, (list, tuple, str)) + + # Sometimes we have a structure like [[...]] which is a single item list + # where the single item is itself it's own list. In that case we want skip + # the rest of this function so that we don't get extraneous () on the + # outside. + if ( + isinstance(marker, list) + and len(marker) == 1 + and isinstance(marker[0], (list, tuple)) + ): + return _format_marker(marker[0]) + + if isinstance(marker, list): + inner = (_format_marker(m, first=False) for m in marker) + if first: + return " ".join(inner) + else: + return "(" + " ".join(inner) + ")" + elif isinstance(marker, tuple): + return " ".join([m.serialize() for m in marker]) + else: + return marker + + +_operators: Dict[str, Operator] = { + "in": lambda lhs, rhs: lhs in rhs, + "not in": lambda lhs, rhs: lhs not in rhs, + "<": operator.lt, + "<=": operator.le, + "==": operator.eq, + "!=": operator.ne, + ">=": operator.ge, + ">": operator.gt, +} + + +def _eval_op(lhs: str, op: Op, rhs: str) -> bool: + try: + spec = Specifier("".join([op.serialize(), rhs])) + except InvalidSpecifier: + pass + else: + return spec.contains(lhs, prereleases=True) + + oper: Optional[Operator] = _operators.get(op.serialize()) + if oper is None: + raise UndefinedComparison(f"Undefined {op!r} on {lhs!r} and {rhs!r}.") + + return oper(lhs, rhs) + + +def _normalize(*values: str, key: str) -> Tuple[str, ...]: + # PEP 685 – Comparison of extra names for optional distribution dependencies + # https://peps.python.org/pep-0685/ + # > When comparing extra names, tools MUST normalize the names being + # > compared using the semantics outlined in PEP 503 for names + if key == "extra": + return tuple(canonicalize_name(v) for v in values) + + # other environment markers don't have such standards + return values + + +def _evaluate_markers(markers: MarkerList, environment: Dict[str, str]) -> bool: + groups: List[List[bool]] = [[]] + + for marker in markers: + assert isinstance(marker, (list, tuple, str)) + + if isinstance(marker, list): + groups[-1].append(_evaluate_markers(marker, environment)) + elif isinstance(marker, tuple): + lhs, op, rhs = marker + + if isinstance(lhs, Variable): + environment_key = lhs.value + lhs_value = environment[environment_key] + rhs_value = rhs.value + else: + lhs_value = lhs.value + environment_key = rhs.value + rhs_value = environment[environment_key] + + lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key) + groups[-1].append(_eval_op(lhs_value, op, rhs_value)) + else: + assert marker in ["and", "or"] + if marker == "or": + groups.append([]) + + return any(all(item) for item in groups) + + +def format_full_version(info: "sys._version_info") -> str: + version = "{0.major}.{0.minor}.{0.micro}".format(info) + kind = info.releaselevel + if kind != "final": + version += kind[0] + str(info.serial) + return version + + +def default_environment() -> Dict[str, str]: + iver = format_full_version(sys.implementation.version) + implementation_name = sys.implementation.name + return { + "implementation_name": implementation_name, + "implementation_version": iver, + "os_name": os.name, + "platform_machine": platform.machine(), + "platform_release": platform.release(), + "platform_system": platform.system(), + "platform_version": platform.version(), + "python_full_version": platform.python_version(), + "platform_python_implementation": platform.python_implementation(), + "python_version": ".".join(platform.python_version_tuple()[:2]), + "sys_platform": sys.platform, + } + + +class Marker: + def __init__(self, marker: str) -> None: + # Note: We create a Marker object without calling this constructor in + # packaging.requirements.Requirement. If any additional logic is + # added here, make sure to mirror/adapt Requirement. + try: + self._markers = _normalize_extra_values(_parse_marker(marker)) + # The attribute `_markers` can be described in terms of a recursive type: + # MarkerList = List[Union[Tuple[Node, ...], str, MarkerList]] + # + # For example, the following expression: + # python_version > "3.6" or (python_version == "3.6" and os_name == "unix") + # + # is parsed into: + # [ + # (, ')>, ), + # 'and', + # [ + # (, , ), + # 'or', + # (, , ) + # ] + # ] + except ParserSyntaxError as e: + raise InvalidMarker(str(e)) from e + + def __str__(self) -> str: + return _format_marker(self._markers) + + def __repr__(self) -> str: + return f"" + + def __hash__(self) -> int: + return hash((self.__class__.__name__, str(self))) + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, Marker): + return NotImplemented + + return str(self) == str(other) + + def evaluate(self, environment: Optional[Dict[str, str]] = None) -> bool: + """Evaluate a marker. + + Return the boolean from evaluating the given marker against the + environment. environment is an optional argument to override all or + part of the determined environment. + + The environment is determined from the current Python process. + """ + current_environment = default_environment() + current_environment["extra"] = "" + if environment is not None: + current_environment.update(environment) + # The API used to allow setting extra to None. We need to handle this + # case for backwards compatibility. + if current_environment["extra"] is None: + current_environment["extra"] = "" + + return _evaluate_markers(self._markers, current_environment) diff --git a/node_modules/node-gyp/gyp/pylib/packaging/metadata.py b/node_modules/node-gyp/gyp/pylib/packaging/metadata.py new file mode 100644 index 0000000000000..fb274930799da --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/metadata.py @@ -0,0 +1,825 @@ +import email.feedparser +import email.header +import email.message +import email.parser +import email.policy +import sys +import typing +from typing import ( + Any, + Callable, + Dict, + Generic, + List, + Optional, + Tuple, + Type, + Union, + cast, +) + +from . import requirements, specifiers, utils, version as version_module + +T = typing.TypeVar("T") +if sys.version_info[:2] >= (3, 8): # pragma: no cover + from typing import Literal, TypedDict +else: # pragma: no cover + if typing.TYPE_CHECKING: + from typing_extensions import Literal, TypedDict + else: + try: + from typing_extensions import Literal, TypedDict + except ImportError: + + class Literal: + def __init_subclass__(*_args, **_kwargs): + pass + + class TypedDict: + def __init_subclass__(*_args, **_kwargs): + pass + + +try: + ExceptionGroup +except NameError: # pragma: no cover + + class ExceptionGroup(Exception): # noqa: N818 + """A minimal implementation of :external:exc:`ExceptionGroup` from Python 3.11. + + If :external:exc:`ExceptionGroup` is already defined by Python itself, + that version is used instead. + """ + + message: str + exceptions: List[Exception] + + def __init__(self, message: str, exceptions: List[Exception]) -> None: + self.message = message + self.exceptions = exceptions + + def __repr__(self) -> str: + return f"{self.__class__.__name__}({self.message!r}, {self.exceptions!r})" + +else: # pragma: no cover + ExceptionGroup = ExceptionGroup + + +class InvalidMetadata(ValueError): + """A metadata field contains invalid data.""" + + field: str + """The name of the field that contains invalid data.""" + + def __init__(self, field: str, message: str) -> None: + self.field = field + super().__init__(message) + + +# The RawMetadata class attempts to make as few assumptions about the underlying +# serialization formats as possible. The idea is that as long as a serialization +# formats offer some very basic primitives in *some* way then we can support +# serializing to and from that format. +class RawMetadata(TypedDict, total=False): + """A dictionary of raw core metadata. + + Each field in core metadata maps to a key of this dictionary (when data is + provided). The key is lower-case and underscores are used instead of dashes + compared to the equivalent core metadata field. Any core metadata field that + can be specified multiple times or can hold multiple values in a single + field have a key with a plural name. See :class:`Metadata` whose attributes + match the keys of this dictionary. + + Core metadata fields that can be specified multiple times are stored as a + list or dict depending on which is appropriate for the field. Any fields + which hold multiple values in a single field are stored as a list. + + """ + + # Metadata 1.0 - PEP 241 + metadata_version: str + name: str + version: str + platforms: List[str] + summary: str + description: str + keywords: List[str] + home_page: str + author: str + author_email: str + license: str + + # Metadata 1.1 - PEP 314 + supported_platforms: List[str] + download_url: str + classifiers: List[str] + requires: List[str] + provides: List[str] + obsoletes: List[str] + + # Metadata 1.2 - PEP 345 + maintainer: str + maintainer_email: str + requires_dist: List[str] + provides_dist: List[str] + obsoletes_dist: List[str] + requires_python: str + requires_external: List[str] + project_urls: Dict[str, str] + + # Metadata 2.0 + # PEP 426 attempted to completely revamp the metadata format + # but got stuck without ever being able to build consensus on + # it and ultimately ended up withdrawn. + # + # However, a number of tools had started emitting METADATA with + # `2.0` Metadata-Version, so for historical reasons, this version + # was skipped. + + # Metadata 2.1 - PEP 566 + description_content_type: str + provides_extra: List[str] + + # Metadata 2.2 - PEP 643 + dynamic: List[str] + + # Metadata 2.3 - PEP 685 + # No new fields were added in PEP 685, just some edge case were + # tightened up to provide better interoptability. + + +_STRING_FIELDS = { + "author", + "author_email", + "description", + "description_content_type", + "download_url", + "home_page", + "license", + "maintainer", + "maintainer_email", + "metadata_version", + "name", + "requires_python", + "summary", + "version", +} + +_LIST_FIELDS = { + "classifiers", + "dynamic", + "obsoletes", + "obsoletes_dist", + "platforms", + "provides", + "provides_dist", + "provides_extra", + "requires", + "requires_dist", + "requires_external", + "supported_platforms", +} + +_DICT_FIELDS = { + "project_urls", +} + + +def _parse_keywords(data: str) -> List[str]: + """Split a string of comma-separate keyboards into a list of keywords.""" + return [k.strip() for k in data.split(",")] + + +def _parse_project_urls(data: List[str]) -> Dict[str, str]: + """Parse a list of label/URL string pairings separated by a comma.""" + urls = {} + for pair in data: + # Our logic is slightly tricky here as we want to try and do + # *something* reasonable with malformed data. + # + # The main thing that we have to worry about, is data that does + # not have a ',' at all to split the label from the Value. There + # isn't a singular right answer here, and we will fail validation + # later on (if the caller is validating) so it doesn't *really* + # matter, but since the missing value has to be an empty str + # and our return value is dict[str, str], if we let the key + # be the missing value, then they'd have multiple '' values that + # overwrite each other in a accumulating dict. + # + # The other potentional issue is that it's possible to have the + # same label multiple times in the metadata, with no solid "right" + # answer with what to do in that case. As such, we'll do the only + # thing we can, which is treat the field as unparseable and add it + # to our list of unparsed fields. + parts = [p.strip() for p in pair.split(",", 1)] + parts.extend([""] * (max(0, 2 - len(parts)))) # Ensure 2 items + + # TODO: The spec doesn't say anything about if the keys should be + # considered case sensitive or not... logically they should + # be case-preserving and case-insensitive, but doing that + # would open up more cases where we might have duplicate + # entries. + label, url = parts + if label in urls: + # The label already exists in our set of urls, so this field + # is unparseable, and we can just add the whole thing to our + # unparseable data and stop processing it. + raise KeyError("duplicate labels in project urls") + urls[label] = url + + return urls + + +def _get_payload(msg: email.message.Message, source: Union[bytes, str]) -> str: + """Get the body of the message.""" + # If our source is a str, then our caller has managed encodings for us, + # and we don't need to deal with it. + if isinstance(source, str): + payload: str = msg.get_payload() + return payload + # If our source is a bytes, then we're managing the encoding and we need + # to deal with it. + else: + bpayload: bytes = msg.get_payload(decode=True) + try: + return bpayload.decode("utf8", "strict") + except UnicodeDecodeError: + raise ValueError("payload in an invalid encoding") + + +# The various parse_FORMAT functions here are intended to be as lenient as +# possible in their parsing, while still returning a correctly typed +# RawMetadata. +# +# To aid in this, we also generally want to do as little touching of the +# data as possible, except where there are possibly some historic holdovers +# that make valid data awkward to work with. +# +# While this is a lower level, intermediate format than our ``Metadata`` +# class, some light touch ups can make a massive difference in usability. + +# Map METADATA fields to RawMetadata. +_EMAIL_TO_RAW_MAPPING = { + "author": "author", + "author-email": "author_email", + "classifier": "classifiers", + "description": "description", + "description-content-type": "description_content_type", + "download-url": "download_url", + "dynamic": "dynamic", + "home-page": "home_page", + "keywords": "keywords", + "license": "license", + "maintainer": "maintainer", + "maintainer-email": "maintainer_email", + "metadata-version": "metadata_version", + "name": "name", + "obsoletes": "obsoletes", + "obsoletes-dist": "obsoletes_dist", + "platform": "platforms", + "project-url": "project_urls", + "provides": "provides", + "provides-dist": "provides_dist", + "provides-extra": "provides_extra", + "requires": "requires", + "requires-dist": "requires_dist", + "requires-external": "requires_external", + "requires-python": "requires_python", + "summary": "summary", + "supported-platform": "supported_platforms", + "version": "version", +} +_RAW_TO_EMAIL_MAPPING = {raw: email for email, raw in _EMAIL_TO_RAW_MAPPING.items()} + + +def parse_email(data: Union[bytes, str]) -> Tuple[RawMetadata, Dict[str, List[str]]]: + """Parse a distribution's metadata stored as email headers (e.g. from ``METADATA``). + + This function returns a two-item tuple of dicts. The first dict is of + recognized fields from the core metadata specification. Fields that can be + parsed and translated into Python's built-in types are converted + appropriately. All other fields are left as-is. Fields that are allowed to + appear multiple times are stored as lists. + + The second dict contains all other fields from the metadata. This includes + any unrecognized fields. It also includes any fields which are expected to + be parsed into a built-in type but were not formatted appropriately. Finally, + any fields that are expected to appear only once but are repeated are + included in this dict. + + """ + raw: Dict[str, Union[str, List[str], Dict[str, str]]] = {} + unparsed: Dict[str, List[str]] = {} + + if isinstance(data, str): + parsed = email.parser.Parser(policy=email.policy.compat32).parsestr(data) + else: + parsed = email.parser.BytesParser(policy=email.policy.compat32).parsebytes(data) + + # We have to wrap parsed.keys() in a set, because in the case of multiple + # values for a key (a list), the key will appear multiple times in the + # list of keys, but we're avoiding that by using get_all(). + for name in frozenset(parsed.keys()): + # Header names in RFC are case insensitive, so we'll normalize to all + # lower case to make comparisons easier. + name = name.lower() + + # We use get_all() here, even for fields that aren't multiple use, + # because otherwise someone could have e.g. two Name fields, and we + # would just silently ignore it rather than doing something about it. + headers = parsed.get_all(name) or [] + + # The way the email module works when parsing bytes is that it + # unconditionally decodes the bytes as ascii using the surrogateescape + # handler. When you pull that data back out (such as with get_all() ), + # it looks to see if the str has any surrogate escapes, and if it does + # it wraps it in a Header object instead of returning the string. + # + # As such, we'll look for those Header objects, and fix up the encoding. + value = [] + # Flag if we have run into any issues processing the headers, thus + # signalling that the data belongs in 'unparsed'. + valid_encoding = True + for h in headers: + # It's unclear if this can return more types than just a Header or + # a str, so we'll just assert here to make sure. + assert isinstance(h, (email.header.Header, str)) + + # If it's a header object, we need to do our little dance to get + # the real data out of it. In cases where there is invalid data + # we're going to end up with mojibake, but there's no obvious, good + # way around that without reimplementing parts of the Header object + # ourselves. + # + # That should be fine since, if mojibacked happens, this key is + # going into the unparsed dict anyways. + if isinstance(h, email.header.Header): + # The Header object stores it's data as chunks, and each chunk + # can be independently encoded, so we'll need to check each + # of them. + chunks: List[Tuple[bytes, Optional[str]]] = [] + for bin, encoding in email.header.decode_header(h): + try: + bin.decode("utf8", "strict") + except UnicodeDecodeError: + # Enable mojibake. + encoding = "latin1" + valid_encoding = False + else: + encoding = "utf8" + chunks.append((bin, encoding)) + + # Turn our chunks back into a Header object, then let that + # Header object do the right thing to turn them into a + # string for us. + value.append(str(email.header.make_header(chunks))) + # This is already a string, so just add it. + else: + value.append(h) + + # We've processed all of our values to get them into a list of str, + # but we may have mojibake data, in which case this is an unparsed + # field. + if not valid_encoding: + unparsed[name] = value + continue + + raw_name = _EMAIL_TO_RAW_MAPPING.get(name) + if raw_name is None: + # This is a bit of a weird situation, we've encountered a key that + # we don't know what it means, so we don't know whether it's meant + # to be a list or not. + # + # Since we can't really tell one way or another, we'll just leave it + # as a list, even though it may be a single item list, because that's + # what makes the most sense for email headers. + unparsed[name] = value + continue + + # If this is one of our string fields, then we'll check to see if our + # value is a list of a single item. If it is then we'll assume that + # it was emitted as a single string, and unwrap the str from inside + # the list. + # + # If it's any other kind of data, then we haven't the faintest clue + # what we should parse it as, and we have to just add it to our list + # of unparsed stuff. + if raw_name in _STRING_FIELDS and len(value) == 1: + raw[raw_name] = value[0] + # If this is one of our list of string fields, then we can just assign + # the value, since email *only* has strings, and our get_all() call + # above ensures that this is a list. + elif raw_name in _LIST_FIELDS: + raw[raw_name] = value + # Special Case: Keywords + # The keywords field is implemented in the metadata spec as a str, + # but it conceptually is a list of strings, and is serialized using + # ", ".join(keywords), so we'll do some light data massaging to turn + # this into what it logically is. + elif raw_name == "keywords" and len(value) == 1: + raw[raw_name] = _parse_keywords(value[0]) + # Special Case: Project-URL + # The project urls is implemented in the metadata spec as a list of + # specially-formatted strings that represent a key and a value, which + # is fundamentally a mapping, however the email format doesn't support + # mappings in a sane way, so it was crammed into a list of strings + # instead. + # + # We will do a little light data massaging to turn this into a map as + # it logically should be. + elif raw_name == "project_urls": + try: + raw[raw_name] = _parse_project_urls(value) + except KeyError: + unparsed[name] = value + # Nothing that we've done has managed to parse this, so it'll just + # throw it in our unparseable data and move on. + else: + unparsed[name] = value + + # We need to support getting the Description from the message payload in + # addition to getting it from the the headers. This does mean, though, there + # is the possibility of it being set both ways, in which case we put both + # in 'unparsed' since we don't know which is right. + try: + payload = _get_payload(parsed, data) + except ValueError: + unparsed.setdefault("description", []).append( + parsed.get_payload(decode=isinstance(data, bytes)) + ) + else: + if payload: + # Check to see if we've already got a description, if so then both + # it, and this body move to unparseable. + if "description" in raw: + description_header = cast(str, raw.pop("description")) + unparsed.setdefault("description", []).extend( + [description_header, payload] + ) + elif "description" in unparsed: + unparsed["description"].append(payload) + else: + raw["description"] = payload + + # We need to cast our `raw` to a metadata, because a TypedDict only support + # literal key names, but we're computing our key names on purpose, but the + # way this function is implemented, our `TypedDict` can only have valid key + # names. + return cast(RawMetadata, raw), unparsed + + +_NOT_FOUND = object() + + +# Keep the two values in sync. +_VALID_METADATA_VERSIONS = ["1.0", "1.1", "1.2", "2.1", "2.2", "2.3"] +_MetadataVersion = Literal["1.0", "1.1", "1.2", "2.1", "2.2", "2.3"] + +_REQUIRED_ATTRS = frozenset(["metadata_version", "name", "version"]) + + +class _Validator(Generic[T]): + """Validate a metadata field. + + All _process_*() methods correspond to a core metadata field. The method is + called with the field's raw value. If the raw value is valid it is returned + in its "enriched" form (e.g. ``version.Version`` for the ``Version`` field). + If the raw value is invalid, :exc:`InvalidMetadata` is raised (with a cause + as appropriate). + """ + + name: str + raw_name: str + added: _MetadataVersion + + def __init__( + self, + *, + added: _MetadataVersion = "1.0", + ) -> None: + self.added = added + + def __set_name__(self, _owner: "Metadata", name: str) -> None: + self.name = name + self.raw_name = _RAW_TO_EMAIL_MAPPING[name] + + def __get__(self, instance: "Metadata", _owner: Type["Metadata"]) -> T: + # With Python 3.8, the caching can be replaced with functools.cached_property(). + # No need to check the cache as attribute lookup will resolve into the + # instance's __dict__ before __get__ is called. + cache = instance.__dict__ + value = instance._raw.get(self.name) + + # To make the _process_* methods easier, we'll check if the value is None + # and if this field is NOT a required attribute, and if both of those + # things are true, we'll skip the the converter. This will mean that the + # converters never have to deal with the None union. + if self.name in _REQUIRED_ATTRS or value is not None: + try: + converter: Callable[[Any], T] = getattr(self, f"_process_{self.name}") + except AttributeError: + pass + else: + value = converter(value) + + cache[self.name] = value + try: + del instance._raw[self.name] # type: ignore[misc] + except KeyError: + pass + + return cast(T, value) + + def _invalid_metadata( + self, msg: str, cause: Optional[Exception] = None + ) -> InvalidMetadata: + exc = InvalidMetadata( + self.raw_name, msg.format_map({"field": repr(self.raw_name)}) + ) + exc.__cause__ = cause + return exc + + def _process_metadata_version(self, value: str) -> _MetadataVersion: + # Implicitly makes Metadata-Version required. + if value not in _VALID_METADATA_VERSIONS: + raise self._invalid_metadata(f"{value!r} is not a valid metadata version") + return cast(_MetadataVersion, value) + + def _process_name(self, value: str) -> str: + if not value: + raise self._invalid_metadata("{field} is a required field") + # Validate the name as a side-effect. + try: + utils.canonicalize_name(value, validate=True) + except utils.InvalidName as exc: + raise self._invalid_metadata( + f"{value!r} is invalid for {{field}}", cause=exc + ) + else: + return value + + def _process_version(self, value: str) -> version_module.Version: + if not value: + raise self._invalid_metadata("{field} is a required field") + try: + return version_module.parse(value) + except version_module.InvalidVersion as exc: + raise self._invalid_metadata( + f"{value!r} is invalid for {{field}}", cause=exc + ) + + def _process_summary(self, value: str) -> str: + """Check the field contains no newlines.""" + if "\n" in value: + raise self._invalid_metadata("{field} must be a single line") + return value + + def _process_description_content_type(self, value: str) -> str: + content_types = {"text/plain", "text/x-rst", "text/markdown"} + message = email.message.EmailMessage() + message["content-type"] = value + + content_type, parameters = ( + # Defaults to `text/plain` if parsing failed. + message.get_content_type().lower(), + message["content-type"].params, + ) + # Check if content-type is valid or defaulted to `text/plain` and thus was + # not parseable. + if content_type not in content_types or content_type not in value.lower(): + raise self._invalid_metadata( + f"{{field}} must be one of {list(content_types)}, not {value!r}" + ) + + charset = parameters.get("charset", "UTF-8") + if charset != "UTF-8": + raise self._invalid_metadata( + f"{{field}} can only specify the UTF-8 charset, not {list(charset)}" + ) + + markdown_variants = {"GFM", "CommonMark"} + variant = parameters.get("variant", "GFM") # Use an acceptable default. + if content_type == "text/markdown" and variant not in markdown_variants: + raise self._invalid_metadata( + f"valid Markdown variants for {{field}} are {list(markdown_variants)}, " + f"not {variant!r}", + ) + return value + + def _process_dynamic(self, value: List[str]) -> List[str]: + for dynamic_field in map(str.lower, value): + if dynamic_field in {"name", "version", "metadata-version"}: + raise self._invalid_metadata( + f"{value!r} is not allowed as a dynamic field" + ) + elif dynamic_field not in _EMAIL_TO_RAW_MAPPING: + raise self._invalid_metadata(f"{value!r} is not a valid dynamic field") + return list(map(str.lower, value)) + + def _process_provides_extra( + self, + value: List[str], + ) -> List[utils.NormalizedName]: + normalized_names = [] + try: + for name in value: + normalized_names.append(utils.canonicalize_name(name, validate=True)) + except utils.InvalidName as exc: + raise self._invalid_metadata( + f"{name!r} is invalid for {{field}}", cause=exc + ) + else: + return normalized_names + + def _process_requires_python(self, value: str) -> specifiers.SpecifierSet: + try: + return specifiers.SpecifierSet(value) + except specifiers.InvalidSpecifier as exc: + raise self._invalid_metadata( + f"{value!r} is invalid for {{field}}", cause=exc + ) + + def _process_requires_dist( + self, + value: List[str], + ) -> List[requirements.Requirement]: + reqs = [] + try: + for req in value: + reqs.append(requirements.Requirement(req)) + except requirements.InvalidRequirement as exc: + raise self._invalid_metadata(f"{req!r} is invalid for {{field}}", cause=exc) + else: + return reqs + + +class Metadata: + """Representation of distribution metadata. + + Compared to :class:`RawMetadata`, this class provides objects representing + metadata fields instead of only using built-in types. Any invalid metadata + will cause :exc:`InvalidMetadata` to be raised (with a + :py:attr:`~BaseException.__cause__` attribute as appropriate). + """ + + _raw: RawMetadata + + @classmethod + def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> "Metadata": + """Create an instance from :class:`RawMetadata`. + + If *validate* is true, all metadata will be validated. All exceptions + related to validation will be gathered and raised as an :class:`ExceptionGroup`. + """ + ins = cls() + ins._raw = data.copy() # Mutations occur due to caching enriched values. + + if validate: + exceptions: List[Exception] = [] + try: + metadata_version = ins.metadata_version + metadata_age = _VALID_METADATA_VERSIONS.index(metadata_version) + except InvalidMetadata as metadata_version_exc: + exceptions.append(metadata_version_exc) + metadata_version = None + + # Make sure to check for the fields that are present, the required + # fields (so their absence can be reported). + fields_to_check = frozenset(ins._raw) | _REQUIRED_ATTRS + # Remove fields that have already been checked. + fields_to_check -= {"metadata_version"} + + for key in fields_to_check: + try: + if metadata_version: + # Can't use getattr() as that triggers descriptor protocol which + # will fail due to no value for the instance argument. + try: + field_metadata_version = cls.__dict__[key].added + except KeyError: + exc = InvalidMetadata(key, f"unrecognized field: {key!r}") + exceptions.append(exc) + continue + field_age = _VALID_METADATA_VERSIONS.index( + field_metadata_version + ) + if field_age > metadata_age: + field = _RAW_TO_EMAIL_MAPPING[key] + exc = InvalidMetadata( + field, + "{field} introduced in metadata version " + "{field_metadata_version}, not {metadata_version}", + ) + exceptions.append(exc) + continue + getattr(ins, key) + except InvalidMetadata as exc: + exceptions.append(exc) + + if exceptions: + raise ExceptionGroup("invalid metadata", exceptions) + + return ins + + @classmethod + def from_email( + cls, data: Union[bytes, str], *, validate: bool = True + ) -> "Metadata": + """Parse metadata from email headers. + + If *validate* is true, the metadata will be validated. All exceptions + related to validation will be gathered and raised as an :class:`ExceptionGroup`. + """ + raw, unparsed = parse_email(data) + + if validate: + exceptions: list[Exception] = [] + for unparsed_key in unparsed: + if unparsed_key in _EMAIL_TO_RAW_MAPPING: + message = f"{unparsed_key!r} has invalid data" + else: + message = f"unrecognized field: {unparsed_key!r}" + exceptions.append(InvalidMetadata(unparsed_key, message)) + + if exceptions: + raise ExceptionGroup("unparsed", exceptions) + + try: + return cls.from_raw(raw, validate=validate) + except ExceptionGroup as exc_group: + raise ExceptionGroup( + "invalid or unparsed metadata", exc_group.exceptions + ) from None + + metadata_version: _Validator[_MetadataVersion] = _Validator() + """:external:ref:`core-metadata-metadata-version` + (required; validated to be a valid metadata version)""" + name: _Validator[str] = _Validator() + """:external:ref:`core-metadata-name` + (required; validated using :func:`~packaging.utils.canonicalize_name` and its + *validate* parameter)""" + version: _Validator[version_module.Version] = _Validator() + """:external:ref:`core-metadata-version` (required)""" + dynamic: _Validator[Optional[List[str]]] = _Validator( + added="2.2", + ) + """:external:ref:`core-metadata-dynamic` + (validated against core metadata field names and lowercased)""" + platforms: _Validator[Optional[List[str]]] = _Validator() + """:external:ref:`core-metadata-platform`""" + supported_platforms: _Validator[Optional[List[str]]] = _Validator(added="1.1") + """:external:ref:`core-metadata-supported-platform`""" + summary: _Validator[Optional[str]] = _Validator() + """:external:ref:`core-metadata-summary` (validated to contain no newlines)""" + description: _Validator[Optional[str]] = _Validator() # TODO 2.1: can be in body + """:external:ref:`core-metadata-description`""" + description_content_type: _Validator[Optional[str]] = _Validator(added="2.1") + """:external:ref:`core-metadata-description-content-type` (validated)""" + keywords: _Validator[Optional[List[str]]] = _Validator() + """:external:ref:`core-metadata-keywords`""" + home_page: _Validator[Optional[str]] = _Validator() + """:external:ref:`core-metadata-home-page`""" + download_url: _Validator[Optional[str]] = _Validator(added="1.1") + """:external:ref:`core-metadata-download-url`""" + author: _Validator[Optional[str]] = _Validator() + """:external:ref:`core-metadata-author`""" + author_email: _Validator[Optional[str]] = _Validator() + """:external:ref:`core-metadata-author-email`""" + maintainer: _Validator[Optional[str]] = _Validator(added="1.2") + """:external:ref:`core-metadata-maintainer`""" + maintainer_email: _Validator[Optional[str]] = _Validator(added="1.2") + """:external:ref:`core-metadata-maintainer-email`""" + license: _Validator[Optional[str]] = _Validator() + """:external:ref:`core-metadata-license`""" + classifiers: _Validator[Optional[List[str]]] = _Validator(added="1.1") + """:external:ref:`core-metadata-classifier`""" + requires_dist: _Validator[Optional[List[requirements.Requirement]]] = _Validator( + added="1.2" + ) + """:external:ref:`core-metadata-requires-dist`""" + requires_python: _Validator[Optional[specifiers.SpecifierSet]] = _Validator( + added="1.2" + ) + """:external:ref:`core-metadata-requires-python`""" + # Because `Requires-External` allows for non-PEP 440 version specifiers, we + # don't do any processing on the values. + requires_external: _Validator[Optional[List[str]]] = _Validator(added="1.2") + """:external:ref:`core-metadata-requires-external`""" + project_urls: _Validator[Optional[Dict[str, str]]] = _Validator(added="1.2") + """:external:ref:`core-metadata-project-url`""" + # PEP 685 lets us raise an error if an extra doesn't pass `Name` validation + # regardless of metadata version. + provides_extra: _Validator[Optional[List[utils.NormalizedName]]] = _Validator( + added="2.1", + ) + """:external:ref:`core-metadata-provides-extra`""" + provides_dist: _Validator[Optional[List[str]]] = _Validator(added="1.2") + """:external:ref:`core-metadata-provides-dist`""" + obsoletes_dist: _Validator[Optional[List[str]]] = _Validator(added="1.2") + """:external:ref:`core-metadata-obsoletes-dist`""" + requires: _Validator[Optional[List[str]]] = _Validator(added="1.1") + """``Requires`` (deprecated)""" + provides: _Validator[Optional[List[str]]] = _Validator(added="1.1") + """``Provides`` (deprecated)""" + obsoletes: _Validator[Optional[List[str]]] = _Validator(added="1.1") + """``Obsoletes`` (deprecated)""" diff --git a/node_modules/node-gyp/gyp/pylib/packaging/py.typed b/node_modules/node-gyp/gyp/pylib/packaging/py.typed new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/node_modules/node-gyp/gyp/pylib/packaging/requirements.py b/node_modules/node-gyp/gyp/pylib/packaging/requirements.py new file mode 100644 index 0000000000000..0c00eba331b73 --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/requirements.py @@ -0,0 +1,90 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from typing import Any, Iterator, Optional, Set + +from ._parser import parse_requirement as _parse_requirement +from ._tokenizer import ParserSyntaxError +from .markers import Marker, _normalize_extra_values +from .specifiers import SpecifierSet +from .utils import canonicalize_name + + +class InvalidRequirement(ValueError): + """ + An invalid requirement was found, users should refer to PEP 508. + """ + + +class Requirement: + """Parse a requirement. + + Parse a given requirement string into its parts, such as name, specifier, + URL, and extras. Raises InvalidRequirement on a badly-formed requirement + string. + """ + + # TODO: Can we test whether something is contained within a requirement? + # If so how do we do that? Do we need to test against the _name_ of + # the thing as well as the version? What about the markers? + # TODO: Can we normalize the name and extra name? + + def __init__(self, requirement_string: str) -> None: + try: + parsed = _parse_requirement(requirement_string) + except ParserSyntaxError as e: + raise InvalidRequirement(str(e)) from e + + self.name: str = parsed.name + self.url: Optional[str] = parsed.url or None + self.extras: Set[str] = set(parsed.extras if parsed.extras else []) + self.specifier: SpecifierSet = SpecifierSet(parsed.specifier) + self.marker: Optional[Marker] = None + if parsed.marker is not None: + self.marker = Marker.__new__(Marker) + self.marker._markers = _normalize_extra_values(parsed.marker) + + def _iter_parts(self, name: str) -> Iterator[str]: + yield name + + if self.extras: + formatted_extras = ",".join(sorted(self.extras)) + yield f"[{formatted_extras}]" + + if self.specifier: + yield str(self.specifier) + + if self.url: + yield f"@ {self.url}" + if self.marker: + yield " " + + if self.marker: + yield f"; {self.marker}" + + def __str__(self) -> str: + return "".join(self._iter_parts(self.name)) + + def __repr__(self) -> str: + return f"" + + def __hash__(self) -> int: + return hash( + ( + self.__class__.__name__, + *self._iter_parts(canonicalize_name(self.name)), + ) + ) + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, Requirement): + return NotImplemented + + return ( + canonicalize_name(self.name) == canonicalize_name(other.name) + and self.extras == other.extras + and self.specifier == other.specifier + and self.url == other.url + and self.marker == other.marker + ) diff --git a/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py b/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py new file mode 100644 index 0000000000000..94448327ae2d4 --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py @@ -0,0 +1,1030 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. +""" +.. testsetup:: + + from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier + from packaging.version import Version +""" + +import abc +import itertools +import re +from typing import ( + Callable, + Iterable, + Iterator, + List, + Optional, + Set, + Tuple, + TypeVar, + Union, +) + +from .utils import canonicalize_version +from .version import Version + +UnparsedVersion = Union[Version, str] +UnparsedVersionVar = TypeVar("UnparsedVersionVar", bound=UnparsedVersion) +CallableOperator = Callable[[Version, str], bool] + + +def _coerce_version(version: UnparsedVersion) -> Version: + if not isinstance(version, Version): + version = Version(version) + return version + + +class InvalidSpecifier(ValueError): + """ + Raised when attempting to create a :class:`Specifier` with a specifier + string that is invalid. + + >>> Specifier("lolwat") + Traceback (most recent call last): + ... + packaging.specifiers.InvalidSpecifier: Invalid specifier: 'lolwat' + """ + + +class BaseSpecifier(metaclass=abc.ABCMeta): + @abc.abstractmethod + def __str__(self) -> str: + """ + Returns the str representation of this Specifier-like object. This + should be representative of the Specifier itself. + """ + + @abc.abstractmethod + def __hash__(self) -> int: + """ + Returns a hash value for this Specifier-like object. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Returns a boolean representing whether or not the two Specifier-like + objects are equal. + + :param other: The other object to check against. + """ + + @property + @abc.abstractmethod + def prereleases(self) -> Optional[bool]: + """Whether or not pre-releases as a whole are allowed. + + This can be set to either ``True`` or ``False`` to explicitly enable or disable + prereleases or it can be set to ``None`` (the default) to use default semantics. + """ + + @prereleases.setter + def prereleases(self, value: bool) -> None: + """Setter for :attr:`prereleases`. + + :param value: The value to set. + """ + + @abc.abstractmethod + def contains(self, item: str, prereleases: Optional[bool] = None) -> bool: + """ + Determines if the given item is contained within this specifier. + """ + + @abc.abstractmethod + def filter( + self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None + ) -> Iterator[UnparsedVersionVar]: + """ + Takes an iterable of items and filters them so that only items which + are contained within this specifier are allowed in it. + """ + + +class Specifier(BaseSpecifier): + """This class abstracts handling of version specifiers. + + .. tip:: + + It is generally not required to instantiate this manually. You should instead + prefer to work with :class:`SpecifierSet` instead, which can parse + comma-separated version specifiers (which is what package metadata contains). + """ + + _operator_regex_str = r""" + (?P(~=|==|!=|<=|>=|<|>|===)) + """ + _version_regex_str = r""" + (?P + (?: + # The identity operators allow for an escape hatch that will + # do an exact string match of the version you wish to install. + # This will not be parsed by PEP 440 and we cannot determine + # any semantic meaning from it. This operator is discouraged + # but included entirely as an escape hatch. + (?<====) # Only match for the identity operator + \s* + [^\s;)]* # The arbitrary version can be just about anything, + # we match everything except for whitespace, a + # semi-colon for marker support, and a closing paren + # since versions can be enclosed in them. + ) + | + (?: + # The (non)equality operators allow for wild card and local + # versions to be specified so we have to define these two + # operators separately to enable that. + (?<===|!=) # Only match for equals and not equals + + \s* + v? + (?:[0-9]+!)? # epoch + [0-9]+(?:\.[0-9]+)* # release + + # You cannot use a wild card and a pre-release, post-release, a dev or + # local version together so group them with a | and make them optional. + (?: + \.\* # Wild card syntax of .* + | + (?: # pre release + [-_\.]? + (alpha|beta|preview|pre|a|b|c|rc) + [-_\.]? + [0-9]* + )? + (?: # post release + (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) + )? + (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release + (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local + )? + ) + | + (?: + # The compatible operator requires at least two digits in the + # release segment. + (?<=~=) # Only match for the compatible operator + + \s* + v? + (?:[0-9]+!)? # epoch + [0-9]+(?:\.[0-9]+)+ # release (We have a + instead of a *) + (?: # pre release + [-_\.]? + (alpha|beta|preview|pre|a|b|c|rc) + [-_\.]? + [0-9]* + )? + (?: # post release + (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) + )? + (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release + ) + | + (?: + # All other operators only allow a sub set of what the + # (non)equality operators do. Specifically they do not allow + # local versions to be specified nor do they allow the prefix + # matching wild cards. + (?=": "greater_than_equal", + "<": "less_than", + ">": "greater_than", + "===": "arbitrary", + } + + def __init__(self, spec: str = "", prereleases: Optional[bool] = None) -> None: + """Initialize a Specifier instance. + + :param spec: + The string representation of a specifier which will be parsed and + normalized before use. + :param prereleases: + This tells the specifier if it should accept prerelease versions if + applicable or not. The default of ``None`` will autodetect it from the + given specifiers. + :raises InvalidSpecifier: + If the given specifier is invalid (i.e. bad syntax). + """ + match = self._regex.search(spec) + if not match: + raise InvalidSpecifier(f"Invalid specifier: '{spec}'") + + self._spec: Tuple[str, str] = ( + match.group("operator").strip(), + match.group("version").strip(), + ) + + # Store whether or not this Specifier should accept prereleases + self._prereleases = prereleases + + # https://github.com/python/mypy/pull/13475#pullrequestreview-1079784515 + @property # type: ignore[override] + def prereleases(self) -> bool: + # If there is an explicit prereleases set for this, then we'll just + # blindly use that. + if self._prereleases is not None: + return self._prereleases + + # Look at all of our specifiers and determine if they are inclusive + # operators, and if they are if they are including an explicit + # prerelease. + operator, version = self._spec + if operator in ["==", ">=", "<=", "~=", "==="]: + # The == specifier can include a trailing .*, if it does we + # want to remove before parsing. + if operator == "==" and version.endswith(".*"): + version = version[:-2] + + # Parse the version, and if it is a pre-release than this + # specifier allows pre-releases. + if Version(version).is_prerelease: + return True + + return False + + @prereleases.setter + def prereleases(self, value: bool) -> None: + self._prereleases = value + + @property + def operator(self) -> str: + """The operator of this specifier. + + >>> Specifier("==1.2.3").operator + '==' + """ + return self._spec[0] + + @property + def version(self) -> str: + """The version of this specifier. + + >>> Specifier("==1.2.3").version + '1.2.3' + """ + return self._spec[1] + + def __repr__(self) -> str: + """A representation of the Specifier that shows all internal state. + + >>> Specifier('>=1.0.0') + =1.0.0')> + >>> Specifier('>=1.0.0', prereleases=False) + =1.0.0', prereleases=False)> + >>> Specifier('>=1.0.0', prereleases=True) + =1.0.0', prereleases=True)> + """ + pre = ( + f", prereleases={self.prereleases!r}" + if self._prereleases is not None + else "" + ) + + return f"<{self.__class__.__name__}({str(self)!r}{pre})>" + + def __str__(self) -> str: + """A string representation of the Specifier that can be round-tripped. + + >>> str(Specifier('>=1.0.0')) + '>=1.0.0' + >>> str(Specifier('>=1.0.0', prereleases=False)) + '>=1.0.0' + """ + return "{}{}".format(*self._spec) + + @property + def _canonical_spec(self) -> Tuple[str, str]: + canonical_version = canonicalize_version( + self._spec[1], + strip_trailing_zero=(self._spec[0] != "~="), + ) + return self._spec[0], canonical_version + + def __hash__(self) -> int: + return hash(self._canonical_spec) + + def __eq__(self, other: object) -> bool: + """Whether or not the two Specifier-like objects are equal. + + :param other: The other object to check against. + + The value of :attr:`prereleases` is ignored. + + >>> Specifier("==1.2.3") == Specifier("== 1.2.3.0") + True + >>> (Specifier("==1.2.3", prereleases=False) == + ... Specifier("==1.2.3", prereleases=True)) + True + >>> Specifier("==1.2.3") == "==1.2.3" + True + >>> Specifier("==1.2.3") == Specifier("==1.2.4") + False + >>> Specifier("==1.2.3") == Specifier("~=1.2.3") + False + """ + if isinstance(other, str): + try: + other = self.__class__(str(other)) + except InvalidSpecifier: + return NotImplemented + elif not isinstance(other, self.__class__): + return NotImplemented + + return self._canonical_spec == other._canonical_spec + + def _get_operator(self, op: str) -> CallableOperator: + operator_callable: CallableOperator = getattr( + self, f"_compare_{self._operators[op]}" + ) + return operator_callable + + def _compare_compatible(self, prospective: Version, spec: str) -> bool: + + # Compatible releases have an equivalent combination of >= and ==. That + # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to + # implement this in terms of the other specifiers instead of + # implementing it ourselves. The only thing we need to do is construct + # the other specifiers. + + # We want everything but the last item in the version, but we want to + # ignore suffix segments. + prefix = _version_join( + list(itertools.takewhile(_is_not_suffix, _version_split(spec)))[:-1] + ) + + # Add the prefix notation to the end of our string + prefix += ".*" + + return self._get_operator(">=")(prospective, spec) and self._get_operator("==")( + prospective, prefix + ) + + def _compare_equal(self, prospective: Version, spec: str) -> bool: + + # We need special logic to handle prefix matching + if spec.endswith(".*"): + # In the case of prefix matching we want to ignore local segment. + normalized_prospective = canonicalize_version( + prospective.public, strip_trailing_zero=False + ) + # Get the normalized version string ignoring the trailing .* + normalized_spec = canonicalize_version(spec[:-2], strip_trailing_zero=False) + # Split the spec out by bangs and dots, and pretend that there is + # an implicit dot in between a release segment and a pre-release segment. + split_spec = _version_split(normalized_spec) + + # Split the prospective version out by bangs and dots, and pretend + # that there is an implicit dot in between a release segment and + # a pre-release segment. + split_prospective = _version_split(normalized_prospective) + + # 0-pad the prospective version before shortening it to get the correct + # shortened version. + padded_prospective, _ = _pad_version(split_prospective, split_spec) + + # Shorten the prospective version to be the same length as the spec + # so that we can determine if the specifier is a prefix of the + # prospective version or not. + shortened_prospective = padded_prospective[: len(split_spec)] + + return shortened_prospective == split_spec + else: + # Convert our spec string into a Version + spec_version = Version(spec) + + # If the specifier does not have a local segment, then we want to + # act as if the prospective version also does not have a local + # segment. + if not spec_version.local: + prospective = Version(prospective.public) + + return prospective == spec_version + + def _compare_not_equal(self, prospective: Version, spec: str) -> bool: + return not self._compare_equal(prospective, spec) + + def _compare_less_than_equal(self, prospective: Version, spec: str) -> bool: + + # NB: Local version identifiers are NOT permitted in the version + # specifier, so local version labels can be universally removed from + # the prospective version. + return Version(prospective.public) <= Version(spec) + + def _compare_greater_than_equal(self, prospective: Version, spec: str) -> bool: + + # NB: Local version identifiers are NOT permitted in the version + # specifier, so local version labels can be universally removed from + # the prospective version. + return Version(prospective.public) >= Version(spec) + + def _compare_less_than(self, prospective: Version, spec_str: str) -> bool: + + # Convert our spec to a Version instance, since we'll want to work with + # it as a version. + spec = Version(spec_str) + + # Check to see if the prospective version is less than the spec + # version. If it's not we can short circuit and just return False now + # instead of doing extra unneeded work. + if not prospective < spec: + return False + + # This special case is here so that, unless the specifier itself + # includes is a pre-release version, that we do not accept pre-release + # versions for the version mentioned in the specifier (e.g. <3.1 should + # not match 3.1.dev0, but should match 3.0.dev0). + if not spec.is_prerelease and prospective.is_prerelease: + if Version(prospective.base_version) == Version(spec.base_version): + return False + + # If we've gotten to here, it means that prospective version is both + # less than the spec version *and* it's not a pre-release of the same + # version in the spec. + return True + + def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool: + + # Convert our spec to a Version instance, since we'll want to work with + # it as a version. + spec = Version(spec_str) + + # Check to see if the prospective version is greater than the spec + # version. If it's not we can short circuit and just return False now + # instead of doing extra unneeded work. + if not prospective > spec: + return False + + # This special case is here so that, unless the specifier itself + # includes is a post-release version, that we do not accept + # post-release versions for the version mentioned in the specifier + # (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0). + if not spec.is_postrelease and prospective.is_postrelease: + if Version(prospective.base_version) == Version(spec.base_version): + return False + + # Ensure that we do not allow a local version of the version mentioned + # in the specifier, which is technically greater than, to match. + if prospective.local is not None: + if Version(prospective.base_version) == Version(spec.base_version): + return False + + # If we've gotten to here, it means that prospective version is both + # greater than the spec version *and* it's not a pre-release of the + # same version in the spec. + return True + + def _compare_arbitrary(self, prospective: Version, spec: str) -> bool: + return str(prospective).lower() == str(spec).lower() + + def __contains__(self, item: Union[str, Version]) -> bool: + """Return whether or not the item is contained in this specifier. + + :param item: The item to check for. + + This is used for the ``in`` operator and behaves the same as + :meth:`contains` with no ``prereleases`` argument passed. + + >>> "1.2.3" in Specifier(">=1.2.3") + True + >>> Version("1.2.3") in Specifier(">=1.2.3") + True + >>> "1.0.0" in Specifier(">=1.2.3") + False + >>> "1.3.0a1" in Specifier(">=1.2.3") + False + >>> "1.3.0a1" in Specifier(">=1.2.3", prereleases=True) + True + """ + return self.contains(item) + + def contains( + self, item: UnparsedVersion, prereleases: Optional[bool] = None + ) -> bool: + """Return whether or not the item is contained in this specifier. + + :param item: + The item to check for, which can be a version string or a + :class:`Version` instance. + :param prereleases: + Whether or not to match prereleases with this Specifier. If set to + ``None`` (the default), it uses :attr:`prereleases` to determine + whether or not prereleases are allowed. + + >>> Specifier(">=1.2.3").contains("1.2.3") + True + >>> Specifier(">=1.2.3").contains(Version("1.2.3")) + True + >>> Specifier(">=1.2.3").contains("1.0.0") + False + >>> Specifier(">=1.2.3").contains("1.3.0a1") + False + >>> Specifier(">=1.2.3", prereleases=True).contains("1.3.0a1") + True + >>> Specifier(">=1.2.3").contains("1.3.0a1", prereleases=True) + True + """ + + # Determine if prereleases are to be allowed or not. + if prereleases is None: + prereleases = self.prereleases + + # Normalize item to a Version, this allows us to have a shortcut for + # "2.0" in Specifier(">=2") + normalized_item = _coerce_version(item) + + # Determine if we should be supporting prereleases in this specifier + # or not, if we do not support prereleases than we can short circuit + # logic if this version is a prereleases. + if normalized_item.is_prerelease and not prereleases: + return False + + # Actually do the comparison to determine if this item is contained + # within this Specifier or not. + operator_callable: CallableOperator = self._get_operator(self.operator) + return operator_callable(normalized_item, self.version) + + def filter( + self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None + ) -> Iterator[UnparsedVersionVar]: + """Filter items in the given iterable, that match the specifier. + + :param iterable: + An iterable that can contain version strings and :class:`Version` instances. + The items in the iterable will be filtered according to the specifier. + :param prereleases: + Whether or not to allow prereleases in the returned iterator. If set to + ``None`` (the default), it will be intelligently decide whether to allow + prereleases or not (based on the :attr:`prereleases` attribute, and + whether the only versions matching are prereleases). + + This method is smarter than just ``filter(Specifier().contains, [...])`` + because it implements the rule from :pep:`440` that a prerelease item + SHOULD be accepted if no other versions match the given specifier. + + >>> list(Specifier(">=1.2.3").filter(["1.2", "1.3", "1.5a1"])) + ['1.3'] + >>> list(Specifier(">=1.2.3").filter(["1.2", "1.2.3", "1.3", Version("1.4")])) + ['1.2.3', '1.3', ] + >>> list(Specifier(">=1.2.3").filter(["1.2", "1.5a1"])) + ['1.5a1'] + >>> list(Specifier(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True)) + ['1.3', '1.5a1'] + >>> list(Specifier(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"])) + ['1.3', '1.5a1'] + """ + + yielded = False + found_prereleases = [] + + kw = {"prereleases": prereleases if prereleases is not None else True} + + # Attempt to iterate over all the values in the iterable and if any of + # them match, yield them. + for version in iterable: + parsed_version = _coerce_version(version) + + if self.contains(parsed_version, **kw): + # If our version is a prerelease, and we were not set to allow + # prereleases, then we'll store it for later in case nothing + # else matches this specifier. + if parsed_version.is_prerelease and not ( + prereleases or self.prereleases + ): + found_prereleases.append(version) + # Either this is not a prerelease, or we should have been + # accepting prereleases from the beginning. + else: + yielded = True + yield version + + # Now that we've iterated over everything, determine if we've yielded + # any values, and if we have not and we have any prereleases stored up + # then we will go ahead and yield the prereleases. + if not yielded and found_prereleases: + for version in found_prereleases: + yield version + + +_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$") + + +def _version_split(version: str) -> List[str]: + """Split version into components. + + The split components are intended for version comparison. The logic does + not attempt to retain the original version string, so joining the + components back with :func:`_version_join` may not produce the original + version string. + """ + result: List[str] = [] + + epoch, _, rest = version.rpartition("!") + result.append(epoch or "0") + + for item in rest.split("."): + match = _prefix_regex.search(item) + if match: + result.extend(match.groups()) + else: + result.append(item) + return result + + +def _version_join(components: List[str]) -> str: + """Join split version components into a version string. + + This function assumes the input came from :func:`_version_split`, where the + first component must be the epoch (either empty or numeric), and all other + components numeric. + """ + epoch, *rest = components + return f"{epoch}!{'.'.join(rest)}" + + +def _is_not_suffix(segment: str) -> bool: + return not any( + segment.startswith(prefix) for prefix in ("dev", "a", "b", "rc", "post") + ) + + +def _pad_version(left: List[str], right: List[str]) -> Tuple[List[str], List[str]]: + left_split, right_split = [], [] + + # Get the release segment of our versions + left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left))) + right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right))) + + # Get the rest of our versions + left_split.append(left[len(left_split[0]) :]) + right_split.append(right[len(right_split[0]) :]) + + # Insert our padding + left_split.insert(1, ["0"] * max(0, len(right_split[0]) - len(left_split[0]))) + right_split.insert(1, ["0"] * max(0, len(left_split[0]) - len(right_split[0]))) + + return (list(itertools.chain(*left_split)), list(itertools.chain(*right_split))) + + +class SpecifierSet(BaseSpecifier): + """This class abstracts handling of a set of version specifiers. + + It can be passed a single specifier (``>=3.0``), a comma-separated list of + specifiers (``>=3.0,!=3.1``), or no specifier at all. + """ + + def __init__( + self, specifiers: str = "", prereleases: Optional[bool] = None + ) -> None: + """Initialize a SpecifierSet instance. + + :param specifiers: + The string representation of a specifier or a comma-separated list of + specifiers which will be parsed and normalized before use. + :param prereleases: + This tells the SpecifierSet if it should accept prerelease versions if + applicable or not. The default of ``None`` will autodetect it from the + given specifiers. + + :raises InvalidSpecifier: + If the given ``specifiers`` are not parseable than this exception will be + raised. + """ + + # Split on `,` to break each individual specifier into it's own item, and + # strip each item to remove leading/trailing whitespace. + split_specifiers = [s.strip() for s in specifiers.split(",") if s.strip()] + + # Parsed each individual specifier, attempting first to make it a + # Specifier. + parsed: Set[Specifier] = set() + for specifier in split_specifiers: + parsed.add(Specifier(specifier)) + + # Turn our parsed specifiers into a frozen set and save them for later. + self._specs = frozenset(parsed) + + # Store our prereleases value so we can use it later to determine if + # we accept prereleases or not. + self._prereleases = prereleases + + @property + def prereleases(self) -> Optional[bool]: + # If we have been given an explicit prerelease modifier, then we'll + # pass that through here. + if self._prereleases is not None: + return self._prereleases + + # If we don't have any specifiers, and we don't have a forced value, + # then we'll just return None since we don't know if this should have + # pre-releases or not. + if not self._specs: + return None + + # Otherwise we'll see if any of the given specifiers accept + # prereleases, if any of them do we'll return True, otherwise False. + return any(s.prereleases for s in self._specs) + + @prereleases.setter + def prereleases(self, value: bool) -> None: + self._prereleases = value + + def __repr__(self) -> str: + """A representation of the specifier set that shows all internal state. + + Note that the ordering of the individual specifiers within the set may not + match the input string. + + >>> SpecifierSet('>=1.0.0,!=2.0.0') + =1.0.0')> + >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=False) + =1.0.0', prereleases=False)> + >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=True) + =1.0.0', prereleases=True)> + """ + pre = ( + f", prereleases={self.prereleases!r}" + if self._prereleases is not None + else "" + ) + + return f"" + + def __str__(self) -> str: + """A string representation of the specifier set that can be round-tripped. + + Note that the ordering of the individual specifiers within the set may not + match the input string. + + >>> str(SpecifierSet(">=1.0.0,!=1.0.1")) + '!=1.0.1,>=1.0.0' + >>> str(SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False)) + '!=1.0.1,>=1.0.0' + """ + return ",".join(sorted(str(s) for s in self._specs)) + + def __hash__(self) -> int: + return hash(self._specs) + + def __and__(self, other: Union["SpecifierSet", str]) -> "SpecifierSet": + """Return a SpecifierSet which is a combination of the two sets. + + :param other: The other object to combine with. + + >>> SpecifierSet(">=1.0.0,!=1.0.1") & '<=2.0.0,!=2.0.1' + =1.0.0')> + >>> SpecifierSet(">=1.0.0,!=1.0.1") & SpecifierSet('<=2.0.0,!=2.0.1') + =1.0.0')> + """ + if isinstance(other, str): + other = SpecifierSet(other) + elif not isinstance(other, SpecifierSet): + return NotImplemented + + specifier = SpecifierSet() + specifier._specs = frozenset(self._specs | other._specs) + + if self._prereleases is None and other._prereleases is not None: + specifier._prereleases = other._prereleases + elif self._prereleases is not None and other._prereleases is None: + specifier._prereleases = self._prereleases + elif self._prereleases == other._prereleases: + specifier._prereleases = self._prereleases + else: + raise ValueError( + "Cannot combine SpecifierSets with True and False prerelease " + "overrides." + ) + + return specifier + + def __eq__(self, other: object) -> bool: + """Whether or not the two SpecifierSet-like objects are equal. + + :param other: The other object to check against. + + The value of :attr:`prereleases` is ignored. + + >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.1") + True + >>> (SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False) == + ... SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True)) + True + >>> SpecifierSet(">=1.0.0,!=1.0.1") == ">=1.0.0,!=1.0.1" + True + >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0") + False + >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.2") + False + """ + if isinstance(other, (str, Specifier)): + other = SpecifierSet(str(other)) + elif not isinstance(other, SpecifierSet): + return NotImplemented + + return self._specs == other._specs + + def __len__(self) -> int: + """Returns the number of specifiers in this specifier set.""" + return len(self._specs) + + def __iter__(self) -> Iterator[Specifier]: + """ + Returns an iterator over all the underlying :class:`Specifier` instances + in this specifier set. + + >>> sorted(SpecifierSet(">=1.0.0,!=1.0.1"), key=str) + [, =1.0.0')>] + """ + return iter(self._specs) + + def __contains__(self, item: UnparsedVersion) -> bool: + """Return whether or not the item is contained in this specifier. + + :param item: The item to check for. + + This is used for the ``in`` operator and behaves the same as + :meth:`contains` with no ``prereleases`` argument passed. + + >>> "1.2.3" in SpecifierSet(">=1.0.0,!=1.0.1") + True + >>> Version("1.2.3") in SpecifierSet(">=1.0.0,!=1.0.1") + True + >>> "1.0.1" in SpecifierSet(">=1.0.0,!=1.0.1") + False + >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1") + False + >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True) + True + """ + return self.contains(item) + + def contains( + self, + item: UnparsedVersion, + prereleases: Optional[bool] = None, + installed: Optional[bool] = None, + ) -> bool: + """Return whether or not the item is contained in this SpecifierSet. + + :param item: + The item to check for, which can be a version string or a + :class:`Version` instance. + :param prereleases: + Whether or not to match prereleases with this SpecifierSet. If set to + ``None`` (the default), it uses :attr:`prereleases` to determine + whether or not prereleases are allowed. + + >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.2.3") + True + >>> SpecifierSet(">=1.0.0,!=1.0.1").contains(Version("1.2.3")) + True + >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.0.1") + False + >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1") + False + >>> SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True).contains("1.3.0a1") + True + >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1", prereleases=True) + True + """ + # Ensure that our item is a Version instance. + if not isinstance(item, Version): + item = Version(item) + + # Determine if we're forcing a prerelease or not, if we're not forcing + # one for this particular filter call, then we'll use whatever the + # SpecifierSet thinks for whether or not we should support prereleases. + if prereleases is None: + prereleases = self.prereleases + + # We can determine if we're going to allow pre-releases by looking to + # see if any of the underlying items supports them. If none of them do + # and this item is a pre-release then we do not allow it and we can + # short circuit that here. + # Note: This means that 1.0.dev1 would not be contained in something + # like >=1.0.devabc however it would be in >=1.0.debabc,>0.0.dev0 + if not prereleases and item.is_prerelease: + return False + + if installed and item.is_prerelease: + item = Version(item.base_version) + + # We simply dispatch to the underlying specs here to make sure that the + # given version is contained within all of them. + # Note: This use of all() here means that an empty set of specifiers + # will always return True, this is an explicit design decision. + return all(s.contains(item, prereleases=prereleases) for s in self._specs) + + def filter( + self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None + ) -> Iterator[UnparsedVersionVar]: + """Filter items in the given iterable, that match the specifiers in this set. + + :param iterable: + An iterable that can contain version strings and :class:`Version` instances. + The items in the iterable will be filtered according to the specifier. + :param prereleases: + Whether or not to allow prereleases in the returned iterator. If set to + ``None`` (the default), it will be intelligently decide whether to allow + prereleases or not (based on the :attr:`prereleases` attribute, and + whether the only versions matching are prereleases). + + This method is smarter than just ``filter(SpecifierSet(...).contains, [...])`` + because it implements the rule from :pep:`440` that a prerelease item + SHOULD be accepted if no other versions match the given specifier. + + >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", "1.5a1"])) + ['1.3'] + >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", Version("1.4")])) + ['1.3', ] + >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.5a1"])) + [] + >>> list(SpecifierSet(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True)) + ['1.3', '1.5a1'] + >>> list(SpecifierSet(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"])) + ['1.3', '1.5a1'] + + An "empty" SpecifierSet will filter items based on the presence of prerelease + versions in the set. + + >>> list(SpecifierSet("").filter(["1.3", "1.5a1"])) + ['1.3'] + >>> list(SpecifierSet("").filter(["1.5a1"])) + ['1.5a1'] + >>> list(SpecifierSet("", prereleases=True).filter(["1.3", "1.5a1"])) + ['1.3', '1.5a1'] + >>> list(SpecifierSet("").filter(["1.3", "1.5a1"], prereleases=True)) + ['1.3', '1.5a1'] + """ + # Determine if we're forcing a prerelease or not, if we're not forcing + # one for this particular filter call, then we'll use whatever the + # SpecifierSet thinks for whether or not we should support prereleases. + if prereleases is None: + prereleases = self.prereleases + + # If we have any specifiers, then we want to wrap our iterable in the + # filter method for each one, this will act as a logical AND amongst + # each specifier. + if self._specs: + for spec in self._specs: + iterable = spec.filter(iterable, prereleases=bool(prereleases)) + return iter(iterable) + # If we do not have any specifiers, then we need to have a rough filter + # which will filter out any pre-releases, unless there are no final + # releases. + else: + filtered: List[UnparsedVersionVar] = [] + found_prereleases: List[UnparsedVersionVar] = [] + + for item in iterable: + parsed_version = _coerce_version(item) + + # Store any item which is a pre-release for later unless we've + # already found a final version or we are accepting prereleases + if parsed_version.is_prerelease and not prereleases: + if not filtered: + found_prereleases.append(item) + else: + filtered.append(item) + + # If we've found no items except for pre-releases, then we'll go + # ahead and use the pre-releases + if not filtered and found_prereleases and prereleases is None: + return iter(found_prereleases) + + return iter(filtered) diff --git a/node_modules/node-gyp/gyp/pylib/packaging/tags.py b/node_modules/node-gyp/gyp/pylib/packaging/tags.py new file mode 100644 index 0000000000000..37f33b1ef849e --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/tags.py @@ -0,0 +1,553 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import logging +import platform +import struct +import subprocess +import sys +import sysconfig +from importlib.machinery import EXTENSION_SUFFIXES +from typing import ( + Dict, + FrozenSet, + Iterable, + Iterator, + List, + Optional, + Sequence, + Tuple, + Union, + cast, +) + +from . import _manylinux, _musllinux + +logger = logging.getLogger(__name__) + +PythonVersion = Sequence[int] +MacVersion = Tuple[int, int] + +INTERPRETER_SHORT_NAMES: Dict[str, str] = { + "python": "py", # Generic. + "cpython": "cp", + "pypy": "pp", + "ironpython": "ip", + "jython": "jy", +} + + +_32_BIT_INTERPRETER = struct.calcsize("P") == 4 + + +class Tag: + """ + A representation of the tag triple for a wheel. + + Instances are considered immutable and thus are hashable. Equality checking + is also supported. + """ + + __slots__ = ["_interpreter", "_abi", "_platform", "_hash"] + + def __init__(self, interpreter: str, abi: str, platform: str) -> None: + self._interpreter = interpreter.lower() + self._abi = abi.lower() + self._platform = platform.lower() + # The __hash__ of every single element in a Set[Tag] will be evaluated each time + # that a set calls its `.disjoint()` method, which may be called hundreds of + # times when scanning a page of links for packages with tags matching that + # Set[Tag]. Pre-computing the value here produces significant speedups for + # downstream consumers. + self._hash = hash((self._interpreter, self._abi, self._platform)) + + @property + def interpreter(self) -> str: + return self._interpreter + + @property + def abi(self) -> str: + return self._abi + + @property + def platform(self) -> str: + return self._platform + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Tag): + return NotImplemented + + return ( + (self._hash == other._hash) # Short-circuit ASAP for perf reasons. + and (self._platform == other._platform) + and (self._abi == other._abi) + and (self._interpreter == other._interpreter) + ) + + def __hash__(self) -> int: + return self._hash + + def __str__(self) -> str: + return f"{self._interpreter}-{self._abi}-{self._platform}" + + def __repr__(self) -> str: + return f"<{self} @ {id(self)}>" + + +def parse_tag(tag: str) -> FrozenSet[Tag]: + """ + Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances. + + Returning a set is required due to the possibility that the tag is a + compressed tag set. + """ + tags = set() + interpreters, abis, platforms = tag.split("-") + for interpreter in interpreters.split("."): + for abi in abis.split("."): + for platform_ in platforms.split("."): + tags.add(Tag(interpreter, abi, platform_)) + return frozenset(tags) + + +def _get_config_var(name: str, warn: bool = False) -> Union[int, str, None]: + value: Union[int, str, None] = sysconfig.get_config_var(name) + if value is None and warn: + logger.debug( + "Config variable '%s' is unset, Python ABI tag may be incorrect", name + ) + return value + + +def _normalize_string(string: str) -> str: + return string.replace(".", "_").replace("-", "_").replace(" ", "_") + + +def _abi3_applies(python_version: PythonVersion) -> bool: + """ + Determine if the Python version supports abi3. + + PEP 384 was first implemented in Python 3.2. + """ + return len(python_version) > 1 and tuple(python_version) >= (3, 2) + + +def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> List[str]: + py_version = tuple(py_version) # To allow for version comparison. + abis = [] + version = _version_nodot(py_version[:2]) + debug = pymalloc = ucs4 = "" + with_debug = _get_config_var("Py_DEBUG", warn) + has_refcount = hasattr(sys, "gettotalrefcount") + # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled + # extension modules is the best option. + # https://github.com/pypa/pip/issues/3383#issuecomment-173267692 + has_ext = "_d.pyd" in EXTENSION_SUFFIXES + if with_debug or (with_debug is None and (has_refcount or has_ext)): + debug = "d" + if py_version < (3, 8): + with_pymalloc = _get_config_var("WITH_PYMALLOC", warn) + if with_pymalloc or with_pymalloc is None: + pymalloc = "m" + if py_version < (3, 3): + unicode_size = _get_config_var("Py_UNICODE_SIZE", warn) + if unicode_size == 4 or ( + unicode_size is None and sys.maxunicode == 0x10FFFF + ): + ucs4 = "u" + elif debug: + # Debug builds can also load "normal" extension modules. + # We can also assume no UCS-4 or pymalloc requirement. + abis.append(f"cp{version}") + abis.insert( + 0, + "cp{version}{debug}{pymalloc}{ucs4}".format( + version=version, debug=debug, pymalloc=pymalloc, ucs4=ucs4 + ), + ) + return abis + + +def cpython_tags( + python_version: Optional[PythonVersion] = None, + abis: Optional[Iterable[str]] = None, + platforms: Optional[Iterable[str]] = None, + *, + warn: bool = False, +) -> Iterator[Tag]: + """ + Yields the tags for a CPython interpreter. + + The tags consist of: + - cp-- + - cp-abi3- + - cp-none- + - cp-abi3- # Older Python versions down to 3.2. + + If python_version only specifies a major version then user-provided ABIs and + the 'none' ABItag will be used. + + If 'abi3' or 'none' are specified in 'abis' then they will be yielded at + their normal position and not at the beginning. + """ + if not python_version: + python_version = sys.version_info[:2] + + interpreter = f"cp{_version_nodot(python_version[:2])}" + + if abis is None: + if len(python_version) > 1: + abis = _cpython_abis(python_version, warn) + else: + abis = [] + abis = list(abis) + # 'abi3' and 'none' are explicitly handled later. + for explicit_abi in ("abi3", "none"): + try: + abis.remove(explicit_abi) + except ValueError: + pass + + platforms = list(platforms or platform_tags()) + for abi in abis: + for platform_ in platforms: + yield Tag(interpreter, abi, platform_) + if _abi3_applies(python_version): + yield from (Tag(interpreter, "abi3", platform_) for platform_ in platforms) + yield from (Tag(interpreter, "none", platform_) for platform_ in platforms) + + if _abi3_applies(python_version): + for minor_version in range(python_version[1] - 1, 1, -1): + for platform_ in platforms: + interpreter = "cp{version}".format( + version=_version_nodot((python_version[0], minor_version)) + ) + yield Tag(interpreter, "abi3", platform_) + + +def _generic_abi() -> List[str]: + """ + Return the ABI tag based on EXT_SUFFIX. + """ + # The following are examples of `EXT_SUFFIX`. + # We want to keep the parts which are related to the ABI and remove the + # parts which are related to the platform: + # - linux: '.cpython-310-x86_64-linux-gnu.so' => cp310 + # - mac: '.cpython-310-darwin.so' => cp310 + # - win: '.cp310-win_amd64.pyd' => cp310 + # - win: '.pyd' => cp37 (uses _cpython_abis()) + # - pypy: '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73 + # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib' + # => graalpy_38_native + + ext_suffix = _get_config_var("EXT_SUFFIX", warn=True) + if not isinstance(ext_suffix, str) or ext_suffix[0] != ".": + raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')") + parts = ext_suffix.split(".") + if len(parts) < 3: + # CPython3.7 and earlier uses ".pyd" on Windows. + return _cpython_abis(sys.version_info[:2]) + soabi = parts[1] + if soabi.startswith("cpython"): + # non-windows + abi = "cp" + soabi.split("-")[1] + elif soabi.startswith("cp"): + # windows + abi = soabi.split("-")[0] + elif soabi.startswith("pypy"): + abi = "-".join(soabi.split("-")[:2]) + elif soabi.startswith("graalpy"): + abi = "-".join(soabi.split("-")[:3]) + elif soabi: + # pyston, ironpython, others? + abi = soabi + else: + return [] + return [_normalize_string(abi)] + + +def generic_tags( + interpreter: Optional[str] = None, + abis: Optional[Iterable[str]] = None, + platforms: Optional[Iterable[str]] = None, + *, + warn: bool = False, +) -> Iterator[Tag]: + """ + Yields the tags for a generic interpreter. + + The tags consist of: + - -- + + The "none" ABI will be added if it was not explicitly provided. + """ + if not interpreter: + interp_name = interpreter_name() + interp_version = interpreter_version(warn=warn) + interpreter = "".join([interp_name, interp_version]) + if abis is None: + abis = _generic_abi() + else: + abis = list(abis) + platforms = list(platforms or platform_tags()) + if "none" not in abis: + abis.append("none") + for abi in abis: + for platform_ in platforms: + yield Tag(interpreter, abi, platform_) + + +def _py_interpreter_range(py_version: PythonVersion) -> Iterator[str]: + """ + Yields Python versions in descending order. + + After the latest version, the major-only version will be yielded, and then + all previous versions of that major version. + """ + if len(py_version) > 1: + yield f"py{_version_nodot(py_version[:2])}" + yield f"py{py_version[0]}" + if len(py_version) > 1: + for minor in range(py_version[1] - 1, -1, -1): + yield f"py{_version_nodot((py_version[0], minor))}" + + +def compatible_tags( + python_version: Optional[PythonVersion] = None, + interpreter: Optional[str] = None, + platforms: Optional[Iterable[str]] = None, +) -> Iterator[Tag]: + """ + Yields the sequence of tags that are compatible with a specific version of Python. + + The tags consist of: + - py*-none- + - -none-any # ... if `interpreter` is provided. + - py*-none-any + """ + if not python_version: + python_version = sys.version_info[:2] + platforms = list(platforms or platform_tags()) + for version in _py_interpreter_range(python_version): + for platform_ in platforms: + yield Tag(version, "none", platform_) + if interpreter: + yield Tag(interpreter, "none", "any") + for version in _py_interpreter_range(python_version): + yield Tag(version, "none", "any") + + +def _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str: + if not is_32bit: + return arch + + if arch.startswith("ppc"): + return "ppc" + + return "i386" + + +def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> List[str]: + formats = [cpu_arch] + if cpu_arch == "x86_64": + if version < (10, 4): + return [] + formats.extend(["intel", "fat64", "fat32"]) + + elif cpu_arch == "i386": + if version < (10, 4): + return [] + formats.extend(["intel", "fat32", "fat"]) + + elif cpu_arch == "ppc64": + # TODO: Need to care about 32-bit PPC for ppc64 through 10.2? + if version > (10, 5) or version < (10, 4): + return [] + formats.append("fat64") + + elif cpu_arch == "ppc": + if version > (10, 6): + return [] + formats.extend(["fat32", "fat"]) + + if cpu_arch in {"arm64", "x86_64"}: + formats.append("universal2") + + if cpu_arch in {"x86_64", "i386", "ppc64", "ppc", "intel"}: + formats.append("universal") + + return formats + + +def mac_platforms( + version: Optional[MacVersion] = None, arch: Optional[str] = None +) -> Iterator[str]: + """ + Yields the platform tags for a macOS system. + + The `version` parameter is a two-item tuple specifying the macOS version to + generate platform tags for. The `arch` parameter is the CPU architecture to + generate platform tags for. Both parameters default to the appropriate value + for the current system. + """ + version_str, _, cpu_arch = platform.mac_ver() + if version is None: + version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2]))) + if version == (10, 16): + # When built against an older macOS SDK, Python will report macOS 10.16 + # instead of the real version. + version_str = subprocess.run( + [ + sys.executable, + "-sS", + "-c", + "import platform; print(platform.mac_ver()[0])", + ], + check=True, + env={"SYSTEM_VERSION_COMPAT": "0"}, + stdout=subprocess.PIPE, + text=True, + ).stdout + version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2]))) + else: + version = version + if arch is None: + arch = _mac_arch(cpu_arch) + else: + arch = arch + + if (10, 0) <= version and version < (11, 0): + # Prior to Mac OS 11, each yearly release of Mac OS bumped the + # "minor" version number. The major version was always 10. + for minor_version in range(version[1], -1, -1): + compat_version = 10, minor_version + binary_formats = _mac_binary_formats(compat_version, arch) + for binary_format in binary_formats: + yield "macosx_{major}_{minor}_{binary_format}".format( + major=10, minor=minor_version, binary_format=binary_format + ) + + if version >= (11, 0): + # Starting with Mac OS 11, each yearly release bumps the major version + # number. The minor versions are now the midyear updates. + for major_version in range(version[0], 10, -1): + compat_version = major_version, 0 + binary_formats = _mac_binary_formats(compat_version, arch) + for binary_format in binary_formats: + yield "macosx_{major}_{minor}_{binary_format}".format( + major=major_version, minor=0, binary_format=binary_format + ) + + if version >= (11, 0): + # Mac OS 11 on x86_64 is compatible with binaries from previous releases. + # Arm64 support was introduced in 11.0, so no Arm binaries from previous + # releases exist. + # + # However, the "universal2" binary format can have a + # macOS version earlier than 11.0 when the x86_64 part of the binary supports + # that version of macOS. + if arch == "x86_64": + for minor_version in range(16, 3, -1): + compat_version = 10, minor_version + binary_formats = _mac_binary_formats(compat_version, arch) + for binary_format in binary_formats: + yield "macosx_{major}_{minor}_{binary_format}".format( + major=compat_version[0], + minor=compat_version[1], + binary_format=binary_format, + ) + else: + for minor_version in range(16, 3, -1): + compat_version = 10, minor_version + binary_format = "universal2" + yield "macosx_{major}_{minor}_{binary_format}".format( + major=compat_version[0], + minor=compat_version[1], + binary_format=binary_format, + ) + + +def _linux_platforms(is_32bit: bool = _32_BIT_INTERPRETER) -> Iterator[str]: + linux = _normalize_string(sysconfig.get_platform()) + if not linux.startswith("linux_"): + # we should never be here, just yield the sysconfig one and return + yield linux + return + if is_32bit: + if linux == "linux_x86_64": + linux = "linux_i686" + elif linux == "linux_aarch64": + linux = "linux_armv8l" + _, arch = linux.split("_", 1) + archs = {"armv8l": ["armv8l", "armv7l"]}.get(arch, [arch]) + yield from _manylinux.platform_tags(archs) + yield from _musllinux.platform_tags(archs) + for arch in archs: + yield f"linux_{arch}" + + +def _generic_platforms() -> Iterator[str]: + yield _normalize_string(sysconfig.get_platform()) + + +def platform_tags() -> Iterator[str]: + """ + Provides the platform tags for this installation. + """ + if platform.system() == "Darwin": + return mac_platforms() + elif platform.system() == "Linux": + return _linux_platforms() + else: + return _generic_platforms() + + +def interpreter_name() -> str: + """ + Returns the name of the running interpreter. + + Some implementations have a reserved, two-letter abbreviation which will + be returned when appropriate. + """ + name = sys.implementation.name + return INTERPRETER_SHORT_NAMES.get(name) or name + + +def interpreter_version(*, warn: bool = False) -> str: + """ + Returns the version of the running interpreter. + """ + version = _get_config_var("py_version_nodot", warn=warn) + if version: + version = str(version) + else: + version = _version_nodot(sys.version_info[:2]) + return version + + +def _version_nodot(version: PythonVersion) -> str: + return "".join(map(str, version)) + + +def sys_tags(*, warn: bool = False) -> Iterator[Tag]: + """ + Returns the sequence of tag triples for the running interpreter. + + The order of the sequence corresponds to priority order for the + interpreter, from most to least important. + """ + + interp_name = interpreter_name() + if interp_name == "cp": + yield from cpython_tags(warn=warn) + else: + yield from generic_tags() + + if interp_name == "pp": + interp = "pp3" + elif interp_name == "cp": + interp = "cp" + interpreter_version(warn=warn) + else: + interp = None + yield from compatible_tags(interpreter=interp) diff --git a/node_modules/node-gyp/gyp/pylib/packaging/utils.py b/node_modules/node-gyp/gyp/pylib/packaging/utils.py new file mode 100644 index 0000000000000..c2c2f75aa8062 --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/utils.py @@ -0,0 +1,172 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import re +from typing import FrozenSet, NewType, Tuple, Union, cast + +from .tags import Tag, parse_tag +from .version import InvalidVersion, Version + +BuildTag = Union[Tuple[()], Tuple[int, str]] +NormalizedName = NewType("NormalizedName", str) + + +class InvalidName(ValueError): + """ + An invalid distribution name; users should refer to the packaging user guide. + """ + + +class InvalidWheelFilename(ValueError): + """ + An invalid wheel filename was found, users should refer to PEP 427. + """ + + +class InvalidSdistFilename(ValueError): + """ + An invalid sdist filename was found, users should refer to the packaging user guide. + """ + + +# Core metadata spec for `Name` +_validate_regex = re.compile( + r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", re.IGNORECASE +) +_canonicalize_regex = re.compile(r"[-_.]+") +_normalized_regex = re.compile(r"^([a-z0-9]|[a-z0-9]([a-z0-9-](?!--))*[a-z0-9])$") +# PEP 427: The build number must start with a digit. +_build_tag_regex = re.compile(r"(\d+)(.*)") + + +def canonicalize_name(name: str, *, validate: bool = False) -> NormalizedName: + if validate and not _validate_regex.match(name): + raise InvalidName(f"name is invalid: {name!r}") + # This is taken from PEP 503. + value = _canonicalize_regex.sub("-", name).lower() + return cast(NormalizedName, value) + + +def is_normalized_name(name: str) -> bool: + return _normalized_regex.match(name) is not None + + +def canonicalize_version( + version: Union[Version, str], *, strip_trailing_zero: bool = True +) -> str: + """ + This is very similar to Version.__str__, but has one subtle difference + with the way it handles the release segment. + """ + if isinstance(version, str): + try: + parsed = Version(version) + except InvalidVersion: + # Legacy versions cannot be normalized + return version + else: + parsed = version + + parts = [] + + # Epoch + if parsed.epoch != 0: + parts.append(f"{parsed.epoch}!") + + # Release segment + release_segment = ".".join(str(x) for x in parsed.release) + if strip_trailing_zero: + # NB: This strips trailing '.0's to normalize + release_segment = re.sub(r"(\.0)+$", "", release_segment) + parts.append(release_segment) + + # Pre-release + if parsed.pre is not None: + parts.append("".join(str(x) for x in parsed.pre)) + + # Post-release + if parsed.post is not None: + parts.append(f".post{parsed.post}") + + # Development release + if parsed.dev is not None: + parts.append(f".dev{parsed.dev}") + + # Local version segment + if parsed.local is not None: + parts.append(f"+{parsed.local}") + + return "".join(parts) + + +def parse_wheel_filename( + filename: str, +) -> Tuple[NormalizedName, Version, BuildTag, FrozenSet[Tag]]: + if not filename.endswith(".whl"): + raise InvalidWheelFilename( + f"Invalid wheel filename (extension must be '.whl'): {filename}" + ) + + filename = filename[:-4] + dashes = filename.count("-") + if dashes not in (4, 5): + raise InvalidWheelFilename( + f"Invalid wheel filename (wrong number of parts): {filename}" + ) + + parts = filename.split("-", dashes - 2) + name_part = parts[0] + # See PEP 427 for the rules on escaping the project name. + if "__" in name_part or re.match(r"^[\w\d._]*$", name_part, re.UNICODE) is None: + raise InvalidWheelFilename(f"Invalid project name: {filename}") + name = canonicalize_name(name_part) + + try: + version = Version(parts[1]) + except InvalidVersion as e: + raise InvalidWheelFilename( + f"Invalid wheel filename (invalid version): {filename}" + ) from e + + if dashes == 5: + build_part = parts[2] + build_match = _build_tag_regex.match(build_part) + if build_match is None: + raise InvalidWheelFilename( + f"Invalid build number: {build_part} in '{filename}'" + ) + build = cast(BuildTag, (int(build_match.group(1)), build_match.group(2))) + else: + build = () + tags = parse_tag(parts[-1]) + return (name, version, build, tags) + + +def parse_sdist_filename(filename: str) -> Tuple[NormalizedName, Version]: + if filename.endswith(".tar.gz"): + file_stem = filename[: -len(".tar.gz")] + elif filename.endswith(".zip"): + file_stem = filename[: -len(".zip")] + else: + raise InvalidSdistFilename( + f"Invalid sdist filename (extension must be '.tar.gz' or '.zip'):" + f" {filename}" + ) + + # We are requiring a PEP 440 version, which cannot contain dashes, + # so we split on the last dash. + name_part, sep, version_part = file_stem.rpartition("-") + if not sep: + raise InvalidSdistFilename(f"Invalid sdist filename: {filename}") + + name = canonicalize_name(name_part) + + try: + version = Version(version_part) + except InvalidVersion as e: + raise InvalidSdistFilename( + f"Invalid sdist filename (invalid version): {filename}" + ) from e + + return (name, version) diff --git a/node_modules/node-gyp/gyp/pylib/packaging/version.py b/node_modules/node-gyp/gyp/pylib/packaging/version.py new file mode 100644 index 0000000000000..5faab9bd0dcf2 --- /dev/null +++ b/node_modules/node-gyp/gyp/pylib/packaging/version.py @@ -0,0 +1,563 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. +""" +.. testsetup:: + + from packaging.version import parse, Version +""" + +import itertools +import re +from typing import Any, Callable, NamedTuple, Optional, SupportsInt, Tuple, Union + +from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType + +__all__ = ["VERSION_PATTERN", "parse", "Version", "InvalidVersion"] + +LocalType = Tuple[Union[int, str], ...] + +CmpPrePostDevType = Union[InfinityType, NegativeInfinityType, Tuple[str, int]] +CmpLocalType = Union[ + NegativeInfinityType, + Tuple[Union[Tuple[int, str], Tuple[NegativeInfinityType, Union[int, str]]], ...], +] +CmpKey = Tuple[ + int, + Tuple[int, ...], + CmpPrePostDevType, + CmpPrePostDevType, + CmpPrePostDevType, + CmpLocalType, +] +VersionComparisonMethod = Callable[[CmpKey, CmpKey], bool] + + +class _Version(NamedTuple): + epoch: int + release: Tuple[int, ...] + dev: Optional[Tuple[str, int]] + pre: Optional[Tuple[str, int]] + post: Optional[Tuple[str, int]] + local: Optional[LocalType] + + +def parse(version: str) -> "Version": + """Parse the given version string. + + >>> parse('1.0.dev1') + + + :param version: The version string to parse. + :raises InvalidVersion: When the version string is not a valid version. + """ + return Version(version) + + +class InvalidVersion(ValueError): + """Raised when a version string is not a valid version. + + >>> Version("invalid") + Traceback (most recent call last): + ... + packaging.version.InvalidVersion: Invalid version: 'invalid' + """ + + +class _BaseVersion: + _key: Tuple[Any, ...] + + def __hash__(self) -> int: + return hash(self._key) + + # Please keep the duplicated `isinstance` check + # in the six comparisons hereunder + # unless you find a way to avoid adding overhead function calls. + def __lt__(self, other: "_BaseVersion") -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key < other._key + + def __le__(self, other: "_BaseVersion") -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key <= other._key + + def __eq__(self, other: object) -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key == other._key + + def __ge__(self, other: "_BaseVersion") -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key >= other._key + + def __gt__(self, other: "_BaseVersion") -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key > other._key + + def __ne__(self, other: object) -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key != other._key + + +# Deliberately not anchored to the start and end of the string, to make it +# easier for 3rd party code to reuse +_VERSION_PATTERN = r""" + v? + (?: + (?:(?P[0-9]+)!)? # epoch + (?P[0-9]+(?:\.[0-9]+)*) # release segment + (?P
                                          # pre-release
+            [-_\.]?
+            (?Palpha|a|beta|b|preview|pre|c|rc)
+            [-_\.]?
+            (?P[0-9]+)?
+        )?
+        (?P                                         # post release
+            (?:-(?P[0-9]+))
+            |
+            (?:
+                [-_\.]?
+                (?Ppost|rev|r)
+                [-_\.]?
+                (?P[0-9]+)?
+            )
+        )?
+        (?P                                          # dev release
+            [-_\.]?
+            (?Pdev)
+            [-_\.]?
+            (?P[0-9]+)?
+        )?
+    )
+    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
+"""
+
+VERSION_PATTERN = _VERSION_PATTERN
+"""
+A string containing the regular expression used to match a valid version.
+
+The pattern is not anchored at either end, and is intended for embedding in larger
+expressions (for example, matching a version number as part of a file name). The
+regular expression should be compiled with the ``re.VERBOSE`` and ``re.IGNORECASE``
+flags set.
+
+:meta hide-value:
+"""
+
+
+class Version(_BaseVersion):
+    """This class abstracts handling of a project's versions.
+
+    A :class:`Version` instance is comparison aware and can be compared and
+    sorted using the standard Python interfaces.
+
+    >>> v1 = Version("1.0a5")
+    >>> v2 = Version("1.0")
+    >>> v1
+    
+    >>> v2
+    
+    >>> v1 < v2
+    True
+    >>> v1 == v2
+    False
+    >>> v1 > v2
+    False
+    >>> v1 >= v2
+    False
+    >>> v1 <= v2
+    True
+    """
+
+    _regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)
+    _key: CmpKey
+
+    def __init__(self, version: str) -> None:
+        """Initialize a Version object.
+
+        :param version:
+            The string representation of a version which will be parsed and normalized
+            before use.
+        :raises InvalidVersion:
+            If the ``version`` does not conform to PEP 440 in any way then this
+            exception will be raised.
+        """
+
+        # Validate the version and parse it into pieces
+        match = self._regex.search(version)
+        if not match:
+            raise InvalidVersion(f"Invalid version: '{version}'")
+
+        # Store the parsed out pieces of the version
+        self._version = _Version(
+            epoch=int(match.group("epoch")) if match.group("epoch") else 0,
+            release=tuple(int(i) for i in match.group("release").split(".")),
+            pre=_parse_letter_version(match.group("pre_l"), match.group("pre_n")),
+            post=_parse_letter_version(
+                match.group("post_l"), match.group("post_n1") or match.group("post_n2")
+            ),
+            dev=_parse_letter_version(match.group("dev_l"), match.group("dev_n")),
+            local=_parse_local_version(match.group("local")),
+        )
+
+        # Generate a key which will be used for sorting
+        self._key = _cmpkey(
+            self._version.epoch,
+            self._version.release,
+            self._version.pre,
+            self._version.post,
+            self._version.dev,
+            self._version.local,
+        )
+
+    def __repr__(self) -> str:
+        """A representation of the Version that shows all internal state.
+
+        >>> Version('1.0.0')
+        
+        """
+        return f""
+
+    def __str__(self) -> str:
+        """A string representation of the version that can be rounded-tripped.
+
+        >>> str(Version("1.0a5"))
+        '1.0a5'
+        """
+        parts = []
+
+        # Epoch
+        if self.epoch != 0:
+            parts.append(f"{self.epoch}!")
+
+        # Release segment
+        parts.append(".".join(str(x) for x in self.release))
+
+        # Pre-release
+        if self.pre is not None:
+            parts.append("".join(str(x) for x in self.pre))
+
+        # Post-release
+        if self.post is not None:
+            parts.append(f".post{self.post}")
+
+        # Development release
+        if self.dev is not None:
+            parts.append(f".dev{self.dev}")
+
+        # Local version segment
+        if self.local is not None:
+            parts.append(f"+{self.local}")
+
+        return "".join(parts)
+
+    @property
+    def epoch(self) -> int:
+        """The epoch of the version.
+
+        >>> Version("2.0.0").epoch
+        0
+        >>> Version("1!2.0.0").epoch
+        1
+        """
+        return self._version.epoch
+
+    @property
+    def release(self) -> Tuple[int, ...]:
+        """The components of the "release" segment of the version.
+
+        >>> Version("1.2.3").release
+        (1, 2, 3)
+        >>> Version("2.0.0").release
+        (2, 0, 0)
+        >>> Version("1!2.0.0.post0").release
+        (2, 0, 0)
+
+        Includes trailing zeroes but not the epoch or any pre-release / development /
+        post-release suffixes.
+        """
+        return self._version.release
+
+    @property
+    def pre(self) -> Optional[Tuple[str, int]]:
+        """The pre-release segment of the version.
+
+        >>> print(Version("1.2.3").pre)
+        None
+        >>> Version("1.2.3a1").pre
+        ('a', 1)
+        >>> Version("1.2.3b1").pre
+        ('b', 1)
+        >>> Version("1.2.3rc1").pre
+        ('rc', 1)
+        """
+        return self._version.pre
+
+    @property
+    def post(self) -> Optional[int]:
+        """The post-release number of the version.
+
+        >>> print(Version("1.2.3").post)
+        None
+        >>> Version("1.2.3.post1").post
+        1
+        """
+        return self._version.post[1] if self._version.post else None
+
+    @property
+    def dev(self) -> Optional[int]:
+        """The development number of the version.
+
+        >>> print(Version("1.2.3").dev)
+        None
+        >>> Version("1.2.3.dev1").dev
+        1
+        """
+        return self._version.dev[1] if self._version.dev else None
+
+    @property
+    def local(self) -> Optional[str]:
+        """The local version segment of the version.
+
+        >>> print(Version("1.2.3").local)
+        None
+        >>> Version("1.2.3+abc").local
+        'abc'
+        """
+        if self._version.local:
+            return ".".join(str(x) for x in self._version.local)
+        else:
+            return None
+
+    @property
+    def public(self) -> str:
+        """The public portion of the version.
+
+        >>> Version("1.2.3").public
+        '1.2.3'
+        >>> Version("1.2.3+abc").public
+        '1.2.3'
+        >>> Version("1.2.3+abc.dev1").public
+        '1.2.3'
+        """
+        return str(self).split("+", 1)[0]
+
+    @property
+    def base_version(self) -> str:
+        """The "base version" of the version.
+
+        >>> Version("1.2.3").base_version
+        '1.2.3'
+        >>> Version("1.2.3+abc").base_version
+        '1.2.3'
+        >>> Version("1!1.2.3+abc.dev1").base_version
+        '1!1.2.3'
+
+        The "base version" is the public version of the project without any pre or post
+        release markers.
+        """
+        parts = []
+
+        # Epoch
+        if self.epoch != 0:
+            parts.append(f"{self.epoch}!")
+
+        # Release segment
+        parts.append(".".join(str(x) for x in self.release))
+
+        return "".join(parts)
+
+    @property
+    def is_prerelease(self) -> bool:
+        """Whether this version is a pre-release.
+
+        >>> Version("1.2.3").is_prerelease
+        False
+        >>> Version("1.2.3a1").is_prerelease
+        True
+        >>> Version("1.2.3b1").is_prerelease
+        True
+        >>> Version("1.2.3rc1").is_prerelease
+        True
+        >>> Version("1.2.3dev1").is_prerelease
+        True
+        """
+        return self.dev is not None or self.pre is not None
+
+    @property
+    def is_postrelease(self) -> bool:
+        """Whether this version is a post-release.
+
+        >>> Version("1.2.3").is_postrelease
+        False
+        >>> Version("1.2.3.post1").is_postrelease
+        True
+        """
+        return self.post is not None
+
+    @property
+    def is_devrelease(self) -> bool:
+        """Whether this version is a development release.
+
+        >>> Version("1.2.3").is_devrelease
+        False
+        >>> Version("1.2.3.dev1").is_devrelease
+        True
+        """
+        return self.dev is not None
+
+    @property
+    def major(self) -> int:
+        """The first item of :attr:`release` or ``0`` if unavailable.
+
+        >>> Version("1.2.3").major
+        1
+        """
+        return self.release[0] if len(self.release) >= 1 else 0
+
+    @property
+    def minor(self) -> int:
+        """The second item of :attr:`release` or ``0`` if unavailable.
+
+        >>> Version("1.2.3").minor
+        2
+        >>> Version("1").minor
+        0
+        """
+        return self.release[1] if len(self.release) >= 2 else 0
+
+    @property
+    def micro(self) -> int:
+        """The third item of :attr:`release` or ``0`` if unavailable.
+
+        >>> Version("1.2.3").micro
+        3
+        >>> Version("1").micro
+        0
+        """
+        return self.release[2] if len(self.release) >= 3 else 0
+
+
+def _parse_letter_version(
+    letter: Optional[str], number: Union[str, bytes, SupportsInt, None]
+) -> Optional[Tuple[str, int]]:
+
+    if letter:
+        # We consider there to be an implicit 0 in a pre-release if there is
+        # not a numeral associated with it.
+        if number is None:
+            number = 0
+
+        # We normalize any letters to their lower case form
+        letter = letter.lower()
+
+        # We consider some words to be alternate spellings of other words and
+        # in those cases we want to normalize the spellings to our preferred
+        # spelling.
+        if letter == "alpha":
+            letter = "a"
+        elif letter == "beta":
+            letter = "b"
+        elif letter in ["c", "pre", "preview"]:
+            letter = "rc"
+        elif letter in ["rev", "r"]:
+            letter = "post"
+
+        return letter, int(number)
+    if not letter and number:
+        # We assume if we are given a number, but we are not given a letter
+        # then this is using the implicit post release syntax (e.g. 1.0-1)
+        letter = "post"
+
+        return letter, int(number)
+
+    return None
+
+
+_local_version_separators = re.compile(r"[\._-]")
+
+
+def _parse_local_version(local: Optional[str]) -> Optional[LocalType]:
+    """
+    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
+    """
+    if local is not None:
+        return tuple(
+            part.lower() if not part.isdigit() else int(part)
+            for part in _local_version_separators.split(local)
+        )
+    return None
+
+
+def _cmpkey(
+    epoch: int,
+    release: Tuple[int, ...],
+    pre: Optional[Tuple[str, int]],
+    post: Optional[Tuple[str, int]],
+    dev: Optional[Tuple[str, int]],
+    local: Optional[LocalType],
+) -> CmpKey:
+
+    # When we compare a release version, we want to compare it with all of the
+    # trailing zeros removed. So we'll use a reverse the list, drop all the now
+    # leading zeros until we come to something non zero, then take the rest
+    # re-reverse it back into the correct order and make it a tuple and use
+    # that for our sorting key.
+    _release = tuple(
+        reversed(list(itertools.dropwhile(lambda x: x == 0, reversed(release))))
+    )
+
+    # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
+    # We'll do this by abusing the pre segment, but we _only_ want to do this
+    # if there is not a pre or a post segment. If we have one of those then
+    # the normal sorting rules will handle this case correctly.
+    if pre is None and post is None and dev is not None:
+        _pre: CmpPrePostDevType = NegativeInfinity
+    # Versions without a pre-release (except as noted above) should sort after
+    # those with one.
+    elif pre is None:
+        _pre = Infinity
+    else:
+        _pre = pre
+
+    # Versions without a post segment should sort before those with one.
+    if post is None:
+        _post: CmpPrePostDevType = NegativeInfinity
+
+    else:
+        _post = post
+
+    # Versions without a development segment should sort after those with one.
+    if dev is None:
+        _dev: CmpPrePostDevType = Infinity
+
+    else:
+        _dev = dev
+
+    if local is None:
+        # Versions without a local segment should sort before those with one.
+        _local: CmpLocalType = NegativeInfinity
+    else:
+        # Versions with a local segment need that segment parsed to implement
+        # the sorting rules in PEP440.
+        # - Alpha numeric segments sort before numeric segments
+        # - Alpha numeric segments sort lexicographically
+        # - Numeric segments sort numerically
+        # - Shorter versions sort before longer versions when the prefixes
+        #   match exactly
+        _local = tuple(
+            (i, "") if isinstance(i, int) else (NegativeInfinity, i) for i in local
+        )
+
+    return epoch, _release, _pre, _post, _dev, _local
diff --git a/node_modules/node-gyp/gyp/pyproject.toml b/node_modules/node-gyp/gyp/pyproject.toml
index d8a5451520cc3..0c25d0b3c1a06 100644
--- a/node_modules/node-gyp/gyp/pyproject.toml
+++ b/node_modules/node-gyp/gyp/pyproject.toml
@@ -4,14 +4,16 @@ build-backend = "setuptools.build_meta"
 
 [project]
 name = "gyp-next"
-version = "0.14.0"
+version = "0.16.1"
 authors = [
   { name="Node.js contributors", email="ryzokuken@disroot.org" },
 ]
 description = "A fork of the GYP build system for use in the Node.js projects"
 readme = "README.md"
 license = { file="LICENSE" }
-requires-python = ">=3.6"
+requires-python = ">=3.8"
+# The Python module "packaging" is vendored in the "pylib/packaging" directory to support Python >= 3.12.
+# dependencies = ["packaging>=23.1"]  # Uncomment this line if the vendored version is removed.
 classifiers = [
     "Development Status :: 3 - Alpha",
     "Environment :: Console",
@@ -20,15 +22,14 @@ classifiers = [
     "Natural Language :: English",
     "Programming Language :: Python",
     "Programming Language :: Python :: 3",
-    "Programming Language :: Python :: 3.6",
-    "Programming Language :: Python :: 3.7",
     "Programming Language :: Python :: 3.8",
     "Programming Language :: Python :: 3.9",
     "Programming Language :: Python :: 3.10",
+    "Programming Language :: Python :: 3.11",
 ]
 
 [project.optional-dependencies]
-dev = ["flake8", "pytest"]
+dev = ["flake8", "ruff", "pytest"]
 
 [project.scripts]
 gyp = "gyp:script_main"
@@ -36,6 +37,83 @@ gyp = "gyp:script_main"
 [project.urls]
 "Homepage" = "https://github.com/nodejs/gyp-next"
 
+[tool.ruff]
+select = [
+  "C4",   # flake8-comprehensions
+  "C90",  # McCabe cyclomatic complexity
+  "DTZ",  # flake8-datetimez
+  "E",    # pycodestyle
+  "F",    # Pyflakes
+  "G",    # flake8-logging-format
+  "ICN",  # flake8-import-conventions
+  "INT",  # flake8-gettext
+  "PL",   # Pylint
+  "PYI",  # flake8-pyi
+  "RSE",  # flake8-raise
+  "RUF",  # Ruff-specific rules
+  "T10",  # flake8-debugger
+  "TCH",  # flake8-type-checking
+  "TID",  # flake8-tidy-imports
+  "UP",   # pyupgrade
+  "W",    # pycodestyle
+  "YTT",  # flake8-2020
+  # "A",    # flake8-builtins
+  # "ANN",  # flake8-annotations
+  # "ARG",  # flake8-unused-arguments
+  # "B",    # flake8-bugbear
+  # "BLE",  # flake8-blind-except
+  # "COM",  # flake8-commas
+  # "D",    # pydocstyle
+  # "DJ",   # flake8-django
+  # "EM",   # flake8-errmsg
+  # "ERA",  # eradicate
+  # "EXE",  # flake8-executable
+  # "FBT",  # flake8-boolean-trap
+  # "I",    # isort
+  # "INP",  # flake8-no-pep420
+  # "ISC",  # flake8-implicit-str-concat
+  # "N",    # pep8-naming
+  # "NPY",  # NumPy-specific rules
+  # "PD",   # pandas-vet
+  # "PGH",  # pygrep-hooks
+  # "PIE",  # flake8-pie
+  # "PT",   # flake8-pytest-style
+  # "PTH",  # flake8-use-pathlib
+  # "Q",    # flake8-quotes
+  # "RET",  # flake8-return
+  # "S",    # flake8-bandit
+  # "SIM",  # flake8-simplify
+  # "SLF",  # flake8-self
+  # "T20",  # flake8-print
+  # "TRY",  # tryceratops
+]
+ignore = [
+  "E721",
+  "PLC1901",
+  "PLR0402",
+  "PLR1714",
+  "PLR2004",
+  "PLR5501",
+  "PLW0603",
+  "PLW2901",
+  "PYI024",
+  "RUF005",
+  "RUF012",
+  "UP031",
+]
+extend-exclude = ["pylib/packaging"]
+line-length = 88
+target-version = "py37"
+
+[tool.ruff.mccabe]
+max-complexity = 101
+
+[tool.ruff.pylint]
+max-args = 11
+max-branches = 108
+max-returns = 10
+max-statements = 286
+
 [tool.setuptools]
 package-dir = {"" = "pylib"}
 packages = ["gyp", "gyp.generator"]
diff --git a/node_modules/node-gyp/lib/build.js b/node_modules/node-gyp/lib/build.js
index ea1f90652a05d..6b8d84d3ede34 100644
--- a/node_modules/node-gyp/lib/build.js
+++ b/node_modules/node-gyp/lib/build.js
@@ -1,14 +1,14 @@
 'use strict'
 
-const fs = require('graceful-fs')
+const fs = require('graceful-fs').promises
 const path = require('path')
-const glob = require('glob')
-const log = require('npmlog')
+const { glob } = require('glob')
+const log = require('./log')
 const which = require('which')
 const win = process.platform === 'win32'
 
-function build (gyp, argv, callback) {
-  var platformMake = 'make'
+async function build (gyp, argv) {
+  let platformMake = 'make'
   if (process.platform === 'aix') {
     platformMake = 'gmake'
   } else if (process.platform === 'os400') {
@@ -21,113 +21,107 @@ function build (gyp, argv, callback) {
     })
   }
 
-  var makeCommand = gyp.opts.make || process.env.MAKE || platformMake
-  var command = win ? 'msbuild' : makeCommand
-  var jobs = gyp.opts.jobs || process.env.JOBS
-  var buildType
-  var config
-  var arch
-  var nodeDir
-  var guessedSolution
+  const makeCommand = gyp.opts.make || process.env.MAKE || platformMake
+  let command = win ? 'msbuild' : makeCommand
+  const jobs = gyp.opts.jobs || process.env.JOBS
+  let buildType
+  let config
+  let arch
+  let nodeDir
+  let guessedSolution
+  let python
+  let buildBinsDir
 
-  loadConfigGypi()
+  await loadConfigGypi()
 
   /**
    * Load the "config.gypi" file that was generated during "configure".
    */
 
-  function loadConfigGypi () {
-    var configPath = path.resolve('build', 'config.gypi')
-
-    fs.readFile(configPath, 'utf8', function (err, data) {
-      if (err) {
-        if (err.code === 'ENOENT') {
-          callback(new Error('You must run `node-gyp configure` first!'))
-        } else {
-          callback(err)
-        }
-        return
+  async function loadConfigGypi () {
+    let data
+    try {
+      const configPath = path.resolve('build', 'config.gypi')
+      data = await fs.readFile(configPath, 'utf8')
+    } catch (err) {
+      if (err.code === 'ENOENT') {
+        throw new Error('You must run `node-gyp configure` first!')
+      } else {
+        throw err
       }
-      config = JSON.parse(data.replace(/#.+\n/, ''))
+    }
 
-      // get the 'arch', 'buildType', and 'nodeDir' vars from the config
-      buildType = config.target_defaults.default_configuration
-      arch = config.variables.target_arch
-      nodeDir = config.variables.nodedir
+    config = JSON.parse(data.replace(/#.+\n/, ''))
 
-      if ('debug' in gyp.opts) {
-        buildType = gyp.opts.debug ? 'Debug' : 'Release'
-      }
-      if (!buildType) {
-        buildType = 'Release'
-      }
+    // get the 'arch', 'buildType', and 'nodeDir' vars from the config
+    buildType = config.target_defaults.default_configuration
+    arch = config.variables.target_arch
+    nodeDir = config.variables.nodedir
+    python = config.variables.python
 
-      log.verbose('build type', buildType)
-      log.verbose('architecture', arch)
-      log.verbose('node dev dir', nodeDir)
+    if ('debug' in gyp.opts) {
+      buildType = gyp.opts.debug ? 'Debug' : 'Release'
+    }
+    if (!buildType) {
+      buildType = 'Release'
+    }
 
-      if (win) {
-        findSolutionFile()
-      } else {
-        doWhich()
-      }
-    })
+    log.verbose('build type', buildType)
+    log.verbose('architecture', arch)
+    log.verbose('node dev dir', nodeDir)
+    log.verbose('python', python)
+
+    if (win) {
+      await findSolutionFile()
+    } else {
+      await doWhich()
+    }
   }
 
   /**
    * On Windows, find the first build/*.sln file.
    */
 
-  function findSolutionFile () {
-    glob('build/*.sln', function (err, files) {
-      if (err) {
-        return callback(err)
-      }
-      if (files.length === 0) {
-        return callback(new Error('Could not find *.sln file. Did you run "configure"?'))
-      }
-      guessedSolution = files[0]
-      log.verbose('found first Solution file', guessedSolution)
-      doWhich()
-    })
+  async function findSolutionFile () {
+    const files = await glob('build/*.sln')
+    if (files.length === 0) {
+      throw new Error('Could not find *.sln file. Did you run "configure"?')
+    }
+    guessedSolution = files[0]
+    log.verbose('found first Solution file', guessedSolution)
+    await doWhich()
   }
 
   /**
    * Uses node-which to locate the msbuild / make executable.
    */
 
-  function doWhich () {
+  async function doWhich () {
     // On Windows use msbuild provided by node-gyp configure
     if (win) {
       if (!config.variables.msbuild_path) {
-        return callback(new Error(
-          'MSBuild is not set, please run `node-gyp configure`.'))
+        throw new Error('MSBuild is not set, please run `node-gyp configure`.')
       }
       command = config.variables.msbuild_path
       log.verbose('using MSBuild:', command)
-      doBuild()
+      await doBuild()
       return
     }
+
     // First make sure we have the build command in the PATH
-    which(command, function (err, execPath) {
-      if (err) {
-        // Some other error or 'make' not found on Unix, report that to the user
-        callback(err)
-        return
-      }
-      log.verbose('`which` succeeded for `' + command + '`', execPath)
-      doBuild()
-    })
+    const execPath = await which(command)
+    log.verbose('`which` succeeded for `' + command + '`', execPath)
+    await doBuild()
   }
 
   /**
    * Actually spawn the process and compile the module.
    */
 
-  function doBuild () {
+  async function doBuild () {
     // Enable Verbose build
-    var verbose = log.levels[log.level] <= log.levels.verbose
-    var j
+    const verbose = log.logger.isVisible('verbose')
+    let j
 
     if (!win && verbose) {
       argv.push('V=1')
@@ -147,10 +141,12 @@ function build (gyp, argv, callback) {
       // Convert .gypi config target_arch to MSBuild /Platform
       // Since there are many ways to state '32-bit Intel', default to it.
       // N.B. msbuild's Condition string equality tests are case-insensitive.
-      var archLower = arch.toLowerCase()
-      var p = archLower === 'x64' ? 'x64'
-        : (archLower === 'arm' ? 'ARM'
-          : (archLower === 'arm64' ? 'ARM64' : 'Win32'))
+      const archLower = arch.toLowerCase()
+      const p = archLower === 'x64'
+        ? 'x64'
+        : (archLower === 'arm'
+            ? 'ARM'
+            : (archLower === 'arm64' ? 'ARM64' : 'Win32'))
       argv.push('/p:Configuration=' + buildType + ';Platform=' + p)
       if (jobs) {
         j = parseInt(jobs, 10)
@@ -179,7 +175,7 @@ function build (gyp, argv, callback) {
 
     if (win) {
       // did the user specify their own .sln file?
-      var hasSln = argv.some(function (arg) {
+      const hasSln = argv.some(function (arg) {
         return path.extname(arg) === '.sln'
       })
       if (!hasSln) {
@@ -189,23 +185,34 @@ function build (gyp, argv, callback) {
 
     if (!win) {
       // Add build-time dependency symlinks (such as Python) to PATH
-      const buildBinsDir = path.resolve('build', 'node_gyp_bins')
+      buildBinsDir = path.resolve('build', 'node_gyp_bins')
       process.env.PATH = `${buildBinsDir}:${process.env.PATH}`
-      log.verbose('bin symlinks', `adding symlinks (such as Python), at "${buildBinsDir}", to PATH`)
+      await fs.mkdir(buildBinsDir, { recursive: true })
+      const symlinkDestination = path.join(buildBinsDir, 'python3')
+      try {
+        await fs.unlink(symlinkDestination)
+      } catch (err) {
+        if (err.code !== 'ENOENT') throw err
+      }
+      await fs.symlink(python, symlinkDestination)
+      log.verbose('bin symlinks', `created symlink to "${python}" in "${buildBinsDir}" and added to PATH`)
     }
 
-    var proc = gyp.spawn(command, argv)
-    proc.on('exit', onExit)
-  }
+    const proc = gyp.spawn(command, argv)
+    await new Promise((resolve, reject) => proc.on('exit', async (code, signal) => {
+      if (buildBinsDir) {
+        // Clean up the build-time dependency symlinks:
+        await fs.rm(buildBinsDir, { recursive: true })
+      }
 
-  function onExit (code, signal) {
-    if (code !== 0) {
-      return callback(new Error('`' + command + '` failed with exit code: ' + code))
-    }
-    if (signal) {
-      return callback(new Error('`' + command + '` got signal: ' + signal))
-    }
-    callback()
+      if (code !== 0) {
+        return reject(new Error('`' + command + '` failed with exit code: ' + code))
+      }
+      if (signal) {
+        return reject(new Error('`' + command + '` got signal: ' + signal))
+      }
+      resolve()
+    }))
   }
 }
 
diff --git a/node_modules/node-gyp/lib/clean.js b/node_modules/node-gyp/lib/clean.js
index dbfa4dbb99d3c..523f8016caece 100644
--- a/node_modules/node-gyp/lib/clean.js
+++ b/node_modules/node-gyp/lib/clean.js
@@ -1,14 +1,14 @@
 'use strict'
 
-const rm = require('rimraf')
-const log = require('npmlog')
+const fs = require('graceful-fs').promises
+const log = require('./log')
 
-function clean (gyp, argv, callback) {
+async function clean (gyp, argv) {
   // Remove the 'build' dir
-  var buildDir = 'build'
+  const buildDir = 'build'
 
   log.verbose('clean', 'removing "%s" directory', buildDir)
-  rm(buildDir, callback)
+  await fs.rm(buildDir, { recursive: true, force: true })
 }
 
 module.exports = clean
diff --git a/node_modules/node-gyp/lib/configure.js b/node_modules/node-gyp/lib/configure.js
index 1ca3ade70935e..38fd2b971845f 100644
--- a/node_modules/node-gyp/lib/configure.js
+++ b/node_modules/node-gyp/lib/configure.js
@@ -1,47 +1,35 @@
 'use strict'
 
-const fs = require('graceful-fs')
+const { promises: fs } = require('graceful-fs')
 const path = require('path')
-const log = require('npmlog')
+const log = require('./log')
 const os = require('os')
 const processRelease = require('./process-release')
 const win = process.platform === 'win32'
 const findNodeDirectory = require('./find-node-directory')
-const createConfigGypi = require('./create-config-gypi')
-const msgFormat = require('util').format
-var findPython = require('./find-python')
-if (win) {
-  var findVisualStudio = require('./find-visualstudio')
-}
-
-function configure (gyp, argv, callback) {
-  var python
-  var buildDir = path.resolve('build')
-  var buildBinsDir = path.join(buildDir, 'node_gyp_bins')
-  var configNames = ['config.gypi', 'common.gypi']
-  var configs = []
-  var nodeDir
-  var release = processRelease(argv, gyp, process.version, process.release)
-
-  findPython(gyp.opts.python, function (err, found) {
-    if (err) {
-      callback(err)
-    } else {
-      python = found
-      getNodeDir()
-    }
-  })
-
-  function getNodeDir () {
+const { createConfigGypi } = require('./create-config-gypi')
+const { format: msgFormat, findAccessibleSync } = require('util')
+const { findPython } = require('./find-python')
+const { findVisualStudio } = win ? require('./find-visualstudio') : {}
+
+async function configure (gyp, argv) {
+  const buildDir = path.resolve('build')
+  const configNames = ['config.gypi', 'common.gypi']
+  const configs = []
+  let nodeDir
+  const release = processRelease(argv, gyp, process.version, process.release)
+
+  const python = await findPython(gyp.opts.python)
+  return getNodeDir()
+
+  async function getNodeDir () {
     // 'python' should be set by now
     process.env.PYTHON = python
 
     if (gyp.opts.nodedir) {
       // --nodedir was specified. use that for the dev files
       nodeDir = gyp.opts.nodedir.replace(/^~/, os.homedir())
-
       log.verbose('get node dir', 'compiling against specified --nodedir dev files: %s', nodeDir)
-      createBuildDir()
     } else {
       // if no --nodedir specified, ensure node dependencies are installed
       if ('v' + release.version !== process.version) {
@@ -54,108 +42,66 @@ function configure (gyp, argv, callback) {
 
       if (!release.semver) {
         // could not parse the version string with semver
-        return callback(new Error('Invalid version number: ' + release.version))
+        throw new Error('Invalid version number: ' + release.version)
       }
 
       // If the tarball option is set, always remove and reinstall the headers
       // into devdir. Otherwise only install if they're not already there.
       gyp.opts.ensure = !gyp.opts.tarball
 
-      gyp.commands.install([release.version], function (err) {
-        if (err) {
-          return callback(err)
-        }
-        log.verbose('get node dir', 'target node version installed:', release.versionDir)
-        nodeDir = path.resolve(gyp.devDir, release.versionDir)
-        createBuildDir()
-      })
-    }
-  }
+      await gyp.commands.install([release.version])
 
-  function createBuildDir () {
-    log.verbose('build dir', 'attempting to create "build" dir: %s', buildDir)
+      log.verbose('get node dir', 'target node version installed:', release.versionDir)
+      nodeDir = path.resolve(gyp.devDir, release.versionDir)
+    }
 
-    const deepestBuildDirSubdirectory = win ? buildDir : buildBinsDir
-    fs.mkdir(deepestBuildDirSubdirectory, { recursive: true }, function (err, isNew) {
-      if (err) {
-        return callback(err)
-      }
-      log.verbose(
-        'build dir', '"build" dir needed to be created?', isNew ? 'Yes' : 'No'
-      )
-      if (win) {
-        findVisualStudio(release.semver, gyp.opts.msvs_version,
-          createConfigFile)
-      } else {
-        createPythonSymlink()
-        createConfigFile()
-      }
-    })
+    return createBuildDir()
   }
 
-  function createPythonSymlink () {
-    const symlinkDestination = path.join(buildBinsDir, 'python3')
-
-    log.verbose('python symlink', `creating symlink to "${python}" at "${symlinkDestination}"`)
+  async function createBuildDir () {
+    log.verbose('build dir', 'attempting to create "build" dir: %s', buildDir)
 
-    fs.unlink(symlinkDestination, function (err) {
-      if (err && err.code !== 'ENOENT') {
-        log.verbose('python symlink', 'error when attempting to remove existing symlink')
-        log.verbose('python symlink', err.stack, 'errno: ' + err.errno)
-      }
-      fs.symlink(python, symlinkDestination, function (err) {
-        if (err) {
-          log.verbose('python symlink', 'error when attempting to create Python symlink')
-          log.verbose('python symlink', err.stack, 'errno: ' + err.errno)
-        }
-      })
-    })
+    const isNew = await fs.mkdir(buildDir, { recursive: true })
+    log.verbose(
+      'build dir', '"build" dir needed to be created?', isNew ? 'Yes' : 'No'
+    )
+    const vsInfo = win ? await findVisualStudio(release.semver, gyp.opts['msvs-version']) : null
+    return createConfigFile(vsInfo)
   }
 
-  function createConfigFile (err, vsInfo) {
-    if (err) {
-      return callback(err)
-    }
-    if (process.platform === 'win32') {
+  async function createConfigFile (vsInfo) {
+    if (win) {
       process.env.GYP_MSVS_VERSION = Math.min(vsInfo.versionYear, 2015)
       process.env.GYP_MSVS_OVERRIDE_PATH = vsInfo.path
     }
-    createConfigGypi({ gyp, buildDir, nodeDir, vsInfo }).then(configPath => {
-      configs.push(configPath)
-      findConfigs()
-    }).catch(err => {
-      callback(err)
-    })
+    const configPath = await createConfigGypi({ gyp, buildDir, nodeDir, vsInfo, python })
+    configs.push(configPath)
+    return findConfigs()
   }
 
-  function findConfigs () {
-    var name = configNames.shift()
+  async function findConfigs () {
+    const name = configNames.shift()
     if (!name) {
       return runGyp()
     }
-    var fullPath = path.resolve(name)
 
+    const fullPath = path.resolve(name)
     log.verbose(name, 'checking for gypi file: %s', fullPath)
-    fs.stat(fullPath, function (err) {
-      if (err) {
-        if (err.code === 'ENOENT') {
-          findConfigs() // check next gypi filename
-        } else {
-          callback(err)
-        }
-      } else {
-        log.verbose(name, 'found gypi file')
-        configs.push(fullPath)
-        findConfigs()
+    try {
+      await fs.stat(fullPath)
+      log.verbose(name, 'found gypi file')
+      configs.push(fullPath)
+    } catch (err) {
+      // ENOENT will check next gypi filename
+      if (err.code !== 'ENOENT') {
+        throw err
       }
-    })
-  }
-
-  function runGyp (err) {
-    if (err) {
-      return callback(err)
     }
 
+    return findConfigs()
+  }
+
+  async function runGyp () {
     if (!~argv.indexOf('-f') && !~argv.indexOf('--format')) {
       if (win) {
         log.verbose('gyp', 'gyp format was not specified; forcing "msvs"')
@@ -175,11 +121,13 @@ function configure (gyp, argv, callback) {
 
     // For AIX and z/OS we need to set up the path to the exports file
     // which contains the symbols needed for linking.
-    var nodeExpFile
+    let nodeExpFile
+    let nodeRootDir
+    let candidates
+    let logprefix = 'find exports file'
     if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') {
-      var ext = process.platform === 'os390' ? 'x' : 'exp'
-      var nodeRootDir = findNodeDirectory()
-      var candidates
+      const ext = process.platform === 'os390' ? 'x' : 'exp'
+      nodeRootDir = findNodeDirectory()
 
       if (process.platform === 'aix' || process.platform === 'os400') {
         candidates = [
@@ -202,24 +150,23 @@ function configure (gyp, argv, callback) {
         })
       }
 
-      var logprefix = 'find exports file'
       nodeExpFile = findAccessibleSync(logprefix, nodeRootDir, candidates)
       if (nodeExpFile !== undefined) {
         log.verbose(logprefix, 'Found exports file: %s', nodeExpFile)
       } else {
-        var msg = msgFormat('Could not find node.%s file in %s', ext, nodeRootDir)
+        const msg = msgFormat('Could not find node.%s file in %s', ext, nodeRootDir)
         log.error(logprefix, 'Could not find exports file')
-        return callback(new Error(msg))
+        throw new Error(msg)
       }
     }
 
     // For z/OS we need to set up the path to zoslib include directory,
     // which contains headers included in v8config.h.
-    var zoslibIncDir
+    let zoslibIncDir
     if (process.platform === 'os390') {
       logprefix = "find zoslib's zos-base.h:"
       let msg
-      var zoslibIncPath = process.env.ZOSLIB_INCLUDES
+      let zoslibIncPath = process.env.ZOSLIB_INCLUDES
       if (zoslibIncPath) {
         zoslibIncPath = findAccessibleSync(logprefix, zoslibIncPath, ['zos-base.h'])
         if (zoslibIncPath === undefined) {
@@ -247,114 +194,88 @@ function configure (gyp, argv, callback) {
       } else if (release.version.split('.')[0] >= 16) {
         // zoslib is only shipped in Node v16 and above.
         log.error(logprefix, msg)
-        return callback(new Error(msg))
+        throw new Error(msg)
       }
     }
 
     // this logic ported from the old `gyp_addon` python file
-    var gypScript = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py')
-    var addonGypi = path.resolve(__dirname, '..', 'addon.gypi')
-    var commonGypi = path.resolve(nodeDir, 'include/node/common.gypi')
-    fs.stat(commonGypi, function (err) {
-      if (err) {
-        commonGypi = path.resolve(nodeDir, 'common.gypi')
-      }
+    const gypScript = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py')
+    const addonGypi = path.resolve(__dirname, '..', 'addon.gypi')
+    let commonGypi = path.resolve(nodeDir, 'include/node/common.gypi')
+    try {
+      await fs.stat(commonGypi)
+    } catch (err) {
+      commonGypi = path.resolve(nodeDir, 'common.gypi')
+    }
 
-      var outputDir = 'build'
-      if (win) {
-        // Windows expects an absolute path
-        outputDir = buildDir
-      }
-      var nodeGypDir = path.resolve(__dirname, '..')
-
-      var nodeLibFile = path.join(nodeDir,
-        !gyp.opts.nodedir ? '<(target_arch)' : '$(Configuration)',
-        release.name + '.lib')
-
-      argv.push('-I', addonGypi)
-      argv.push('-I', commonGypi)
-      argv.push('-Dlibrary=shared_library')
-      argv.push('-Dvisibility=default')
-      argv.push('-Dnode_root_dir=' + nodeDir)
-      if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') {
-        argv.push('-Dnode_exp_file=' + nodeExpFile)
-        if (process.platform === 'os390' && zoslibIncDir) {
-          argv.push('-Dzoslib_include_dir=' + zoslibIncDir)
-        }
-      }
-      argv.push('-Dnode_gyp_dir=' + nodeGypDir)
+    let outputDir = 'build'
+    if (win) {
+      // Windows expects an absolute path
+      outputDir = buildDir
+    }
+    const nodeGypDir = path.resolve(__dirname, '..')
 
-      // Do this to keep Cygwin environments happy, else the unescaped '\' gets eaten up,
-      // resulting in bad paths, Ex c:parentFolderfolderanotherFolder instead of c:\parentFolder\folder\anotherFolder
-      if (win) {
-        nodeLibFile = nodeLibFile.replace(/\\/g, '\\\\')
-      }
-      argv.push('-Dnode_lib_file=' + nodeLibFile)
-      argv.push('-Dmodule_root_dir=' + process.cwd())
-      argv.push('-Dnode_engine=' +
-        (gyp.opts.node_engine || process.jsEngine || 'v8'))
-      argv.push('--depth=.')
-      argv.push('--no-parallel')
+    let nodeLibFile = path.join(nodeDir,
+      !gyp.opts.nodedir ? '<(target_arch)' : '$(Configuration)',
+      release.name + '.lib')
 
-      // tell gyp to write the Makefile/Solution files into output_dir
-      argv.push('--generator-output', outputDir)
+    argv.push('-I', addonGypi)
+    argv.push('-I', commonGypi)
+    argv.push('-Dlibrary=shared_library')
+    argv.push('-Dvisibility=default')
+    argv.push('-Dnode_root_dir=' + nodeDir)
+    if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') {
+      argv.push('-Dnode_exp_file=' + nodeExpFile)
+      if (process.platform === 'os390' && zoslibIncDir) {
+        argv.push('-Dzoslib_include_dir=' + zoslibIncDir)
+      }
+    }
+    argv.push('-Dnode_gyp_dir=' + nodeGypDir)
 
-      // tell make to write its output into the same dir
-      argv.push('-Goutput_dir=.')
+    // Do this to keep Cygwin environments happy, else the unescaped '\' gets eaten up,
+    // resulting in bad paths, Ex c:parentFolderfolderanotherFolder instead of c:\parentFolder\folder\anotherFolder
+    if (win) {
+      nodeLibFile = nodeLibFile.replace(/\\/g, '\\\\')
+    }
+    argv.push('-Dnode_lib_file=' + nodeLibFile)
+    argv.push('-Dmodule_root_dir=' + process.cwd())
+    argv.push('-Dnode_engine=' +
+        (gyp.opts.node_engine || process.jsEngine || 'v8'))
+    argv.push('--depth=.')
+    argv.push('--no-parallel')
 
-      // enforce use of the "binding.gyp" file
-      argv.unshift('binding.gyp')
+    // tell gyp to write the Makefile/Solution files into output_dir
+    argv.push('--generator-output', outputDir)
 
-      // execute `gyp` from the current target nodedir
-      argv.unshift(gypScript)
+    // tell make to write its output into the same dir
+    argv.push('-Goutput_dir=.')
 
-      // make sure python uses files that came with this particular node package
-      var pypath = [path.join(__dirname, '..', 'gyp', 'pylib')]
-      if (process.env.PYTHONPATH) {
-        pypath.push(process.env.PYTHONPATH)
-      }
-      process.env.PYTHONPATH = pypath.join(win ? ';' : ':')
+    // enforce use of the "binding.gyp" file
+    argv.unshift('binding.gyp')
 
-      var cp = gyp.spawn(python, argv)
-      cp.on('exit', onCpExit)
-    })
-  }
+    // execute `gyp` from the current target nodedir
+    argv.unshift(gypScript)
 
-  function onCpExit (code) {
-    if (code !== 0) {
-      callback(new Error('`gyp` failed with exit code: ' + code))
-    } else {
-      // we're done
-      callback()
+    // make sure python uses files that came with this particular node package
+    const pypath = [path.join(__dirname, '..', 'gyp', 'pylib')]
+    if (process.env.PYTHONPATH) {
+      pypath.push(process.env.PYTHONPATH)
     }
-  }
-}
+    process.env.PYTHONPATH = pypath.join(win ? ';' : ':')
 
-/**
- * Returns the first file or directory from an array of candidates that is
- * readable by the current user, or undefined if none of the candidates are
- * readable.
- */
-function findAccessibleSync (logprefix, dir, candidates) {
-  for (var next = 0; next < candidates.length; next++) {
-    var candidate = path.resolve(dir, candidates[next])
-    try {
-      var fd = fs.openSync(candidate, 'r')
-    } catch (e) {
-      // this candidate was not found or not readable, do nothing
-      log.silly(logprefix, 'Could not open %s: %s', candidate, e.message)
-      continue
-    }
-    fs.closeSync(fd)
-    log.silly(logprefix, 'Found readable %s', candidate)
-    return candidate
+    await new Promise((resolve, reject) => {
+      const cp = gyp.spawn(python, argv)
+      cp.on('exit', (code) => {
+        if (code !== 0) {
+          reject(new Error('`gyp` failed with exit code: ' + code))
+        } else {
+          // we're done
+          resolve()
+        }
+      })
+    })
   }
-
-  return undefined
 }
 
 module.exports = configure
-module.exports.test = {
-  findAccessibleSync: findAccessibleSync
-}
 module.exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module'
diff --git a/node_modules/node-gyp/lib/create-config-gypi.js b/node_modules/node-gyp/lib/create-config-gypi.js
index ced4911502733..d598dea6e2e7f 100644
--- a/node_modules/node-gyp/lib/create-config-gypi.js
+++ b/node_modules/node-gyp/lib/create-config-gypi.js
@@ -1,7 +1,7 @@
 'use strict'
 
-const fs = require('graceful-fs')
-const log = require('npmlog')
+const fs = require('graceful-fs').promises
+const log = require('./log')
 const path = require('path')
 
 function parseConfigGypi (config) {
@@ -24,7 +24,7 @@ async function getBaseConfigGypi ({ gyp, nodeDir }) {
   if (shouldReadConfigGypi && nodeDir) {
     try {
       const baseConfigGypiPath = path.resolve(nodeDir, 'include/node/config.gypi')
-      const baseConfigGypi = await fs.promises.readFile(baseConfigGypiPath)
+      const baseConfigGypi = await fs.readFile(baseConfigGypiPath)
       return parseConfigGypi(baseConfigGypi.toString())
     } catch (err) {
       log.warn('read config.gypi', err.message)
@@ -35,7 +35,7 @@ async function getBaseConfigGypi ({ gyp, nodeDir }) {
   return JSON.parse(JSON.stringify(process.config))
 }
 
-async function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo }) {
+async function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo, python }) {
   const config = await getBaseConfigGypi({ gyp, nodeDir })
   if (!config.target_defaults) {
     config.target_defaults = {}
@@ -75,6 +75,9 @@ async function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo }) {
   // set the node development directory
   variables.nodedir = nodeDir
 
+  // set the configured Python path
+  variables.python = python
+
   // disable -T "thin" static archives by default
   variables.standalone_static_library = gyp.opts.thin ? 0 : 1
 
@@ -112,13 +115,13 @@ async function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo }) {
   return config
 }
 
-async function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo }) {
+async function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo, python }) {
   const configFilename = 'config.gypi'
   const configPath = path.resolve(buildDir, configFilename)
 
   log.verbose('build/' + configFilename, 'creating config file')
 
-  const config = await getCurrentConfigGypi({ gyp, nodeDir, vsInfo })
+  const config = await getCurrentConfigGypi({ gyp, nodeDir, vsInfo, python })
 
   // ensures that any boolean values in config.gypi get stringified
   function boolsToString (k, v) {
@@ -135,13 +138,13 @@ async function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo }) {
 
   const json = JSON.stringify(config, boolsToString, 2)
   log.verbose('build/' + configFilename, 'writing out config file: %s', configPath)
-  await fs.promises.writeFile(configPath, [prefix, json, ''].join('\n'))
+  await fs.writeFile(configPath, [prefix, json, ''].join('\n'))
 
   return configPath
 }
 
-module.exports = createConfigGypi
-module.exports.test = {
-  parseConfigGypi: parseConfigGypi,
-  getCurrentConfigGypi: getCurrentConfigGypi
+module.exports = {
+  createConfigGypi,
+  parseConfigGypi,
+  getCurrentConfigGypi
 }
diff --git a/node_modules/node-gyp/lib/download.js b/node_modules/node-gyp/lib/download.js
new file mode 100644
index 0000000000000..ed0aa37f44116
--- /dev/null
+++ b/node_modules/node-gyp/lib/download.js
@@ -0,0 +1,39 @@
+const fetch = require('make-fetch-happen')
+const { promises: fs } = require('graceful-fs')
+const log = require('./log')
+
+async function download (gyp, url) {
+  log.http('GET', url)
+
+  const requestOpts = {
+    headers: {
+      'User-Agent': `node-gyp v${gyp.version} (node ${process.version})`,
+      Connection: 'keep-alive'
+    },
+    proxy: gyp.opts.proxy,
+    noProxy: gyp.opts.noproxy
+  }
+
+  const cafile = gyp.opts.cafile
+  if (cafile) {
+    requestOpts.ca = await readCAFile(cafile)
+  }
+
+  const res = await fetch(url, requestOpts)
+  log.http(res.status, res.url)
+
+  return res
+}
+
+async function readCAFile (filename) {
+  // The CA file can contain multiple certificates so split on certificate
+  // boundaries.  [\S\s]*? is used to match everything including newlines.
+  const ca = await fs.readFile(filename, 'utf8')
+  const re = /(-----BEGIN CERTIFICATE-----[\S\s]*?-----END CERTIFICATE-----)/g
+  return ca.match(re)
+}
+
+module.exports = {
+  download,
+  readCAFile
+}
diff --git a/node_modules/node-gyp/lib/find-node-directory.js b/node_modules/node-gyp/lib/find-node-directory.js
index 0dd781a6cfae8..8838b81d33899 100644
--- a/node_modules/node-gyp/lib/find-node-directory.js
+++ b/node_modules/node-gyp/lib/find-node-directory.js
@@ -1,7 +1,7 @@
 'use strict'
 
 const path = require('path')
-const log = require('npmlog')
+const log = require('./log')
 
 function findNodeDirectory (scriptLocation, processObj) {
   // set dirname and process if not passed in
@@ -14,10 +14,10 @@ function findNodeDirectory (scriptLocation, processObj) {
   }
 
   // Have a look to see what is above us, to try and work out where we are
-  var npmParentDirectory = path.join(scriptLocation, '../../../..')
+  const npmParentDirectory = path.join(scriptLocation, '../../../..')
   log.verbose('node-gyp root', 'npm_parent_directory is ' +
               path.basename(npmParentDirectory))
-  var nodeRootDir = ''
+  let nodeRootDir = ''
 
   log.verbose('node-gyp root', 'Finding node root directory')
   if (path.basename(npmParentDirectory) === 'deps') {
@@ -41,8 +41,8 @@ function findNodeDirectory (scriptLocation, processObj) {
   } else {
     // We don't know where we are, try working it out from the location
     // of the node binary
-    var nodeDir = path.dirname(processObj.execPath)
-    var directoryUp = path.basename(nodeDir)
+    const nodeDir = path.dirname(processObj.execPath)
+    const directoryUp = path.basename(nodeDir)
     if (directoryUp === 'bin') {
       nodeRootDir = path.join(nodeDir, '..')
     } else if (directoryUp === 'Release' || directoryUp === 'Debug') {
diff --git a/node_modules/node-gyp/lib/find-python.js b/node_modules/node-gyp/lib/find-python.js
index a445e825b9d7e..615da57bb8572 100644
--- a/node_modules/node-gyp/lib/find-python.js
+++ b/node_modules/node-gyp/lib/find-python.js
@@ -1,11 +1,15 @@
 'use strict'
 
-const log = require('npmlog')
+const log = require('./log')
 const semver = require('semver')
-const cp = require('child_process')
-const extend = require('util')._extend // eslint-disable-line
+const { execFile } = require('./util')
 const win = process.platform === 'win32'
-const logWithPrefix = require('./util').logWithPrefix
+
+function getOsUserInfo () {
+  try {
+    return require('os').userInfo().username
+  } catch {}
+}
 
 const systemDrive = process.env.SystemDrive || 'C:'
 const username = process.env.USERNAME || process.env.USER || getOsUserInfo()
@@ -15,7 +19,7 @@ const programFiles = process.env.ProgramW6432 || process.env.ProgramFiles || `${
 const programFilesX86 = process.env['ProgramFiles(x86)'] || `${programFiles} (x86)`
 
 const winDefaultLocationsArray = []
-for (const majorMinor of ['39', '38', '37', '36']) {
+for (const majorMinor of ['311', '310', '39', '38']) {
   if (foundLocalAppData) {
     winDefaultLocationsArray.push(
       `${localAppData}\\Programs\\Python\\Python${majorMinor}\\python.exe`,
@@ -33,45 +37,39 @@ for (const majorMinor of ['39', '38', '37', '36']) {
   }
 }
 
-function getOsUserInfo () {
-  try {
-    return require('os').userInfo().username
-  } catch (e) {}
-}
-
-function PythonFinder (configPython, callback) {
-  this.callback = callback
-  this.configPython = configPython
-  this.errorLog = []
-}
+class PythonFinder {
+  static findPython = (...args) => new PythonFinder(...args).findPython()
 
-PythonFinder.prototype = {
-  log: logWithPrefix(log, 'find Python'),
-  argsExecutable: ['-c', 'import sys; print(sys.executable);'],
-  argsVersion: ['-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
-  semverRange: '>=3.6.0',
+  log = log.withPrefix('find Python')
+  argsExecutable = ['-c', 'import sys; print(sys.executable);']
+  argsVersion = ['-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);']
+  semverRange = '>=3.6.0'
 
   // These can be overridden for testing:
-  execFile: cp.execFile,
-  env: process.env,
-  win: win,
-  pyLauncher: 'py.exe',
-  winDefaultLocations: winDefaultLocationsArray,
+  execFile = execFile
+  env = process.env
+  win = win
+  pyLauncher = 'py.exe'
+  winDefaultLocations = winDefaultLocationsArray
+
+  constructor (configPython) {
+    this.configPython = configPython
+    this.errorLog = []
+  }
 
   // Logs a message at verbose level, but also saves it to be displayed later
   // at error level if an error occurs. This should help diagnose the problem.
-  addLog: function addLog (message) {
+  addLog (message) {
     this.log.verbose(message)
     this.errorLog.push(message)
-  },
+  }
 
   // Find Python by trying a sequence of possibilities.
   // Ignore errors, keep trying until Python is found.
-  findPython: function findPython () {
-    const SKIP = 0; const FAIL = 1
-    var toCheck = getChecks.apply(this)
-
-    function getChecks () {
+  async findPython () {
+    const SKIP = 0
+    const FAIL = 1
+    const toCheck = (() => {
       if (this.env.NODE_GYP_FORCE_PYTHON) {
         return [{
           before: () => {
@@ -80,12 +78,11 @@ PythonFinder.prototype = {
             this.addLog('- process.env.NODE_GYP_FORCE_PYTHON is ' +
               `"${this.env.NODE_GYP_FORCE_PYTHON}"`)
           },
-          check: this.checkCommand,
-          arg: this.env.NODE_GYP_FORCE_PYTHON
+          check: () => this.checkCommand(this.env.NODE_GYP_FORCE_PYTHON)
         }]
       }
 
-      var checks = [
+      const checks = [
         {
           before: () => {
             if (!this.configPython) {
@@ -98,8 +95,7 @@ PythonFinder.prototype = {
             this.addLog('- "--python=" or "npm config get python" is ' +
               `"${this.configPython}"`)
           },
-          check: this.checkCommand,
-          arg: this.configPython
+          check: () => this.checkCommand(this.configPython)
         },
         {
           before: () => {
@@ -112,78 +108,69 @@ PythonFinder.prototype = {
               'variable PYTHON')
             this.addLog(`- process.env.PYTHON is "${this.env.PYTHON}"`)
           },
-          check: this.checkCommand,
-          arg: this.env.PYTHON
-        },
+          check: () => this.checkCommand(this.env.PYTHON)
+        }
+      ]
+
+      if (this.win) {
+        checks.push({
+          before: () => {
+            this.addLog(
+              'checking if the py launcher can be used to find Python 3')
+          },
+          check: () => this.checkPyLauncher()
+        })
+      }
+
+      checks.push(...[
         {
           before: () => { this.addLog('checking if "python3" can be used') },
-          check: this.checkCommand,
-          arg: 'python3'
+          check: () => this.checkCommand('python3')
         },
         {
           before: () => { this.addLog('checking if "python" can be used') },
-          check: this.checkCommand,
-          arg: 'python'
+          check: () => this.checkCommand('python')
         }
-      ]
+      ])
 
       if (this.win) {
-        for (var i = 0; i < this.winDefaultLocations.length; ++i) {
+        for (let i = 0; i < this.winDefaultLocations.length; ++i) {
           const location = this.winDefaultLocations[i]
           checks.push({
-            before: () => {
-              this.addLog('checking if Python is ' +
-                `${location}`)
-            },
-            check: this.checkExecPath,
-            arg: location
+            before: () => this.addLog(`checking if Python is ${location}`),
+            check: () => this.checkExecPath(location)
           })
         }
-        checks.push({
-          before: () => {
-            this.addLog(
-              'checking if the py launcher can be used to find Python 3')
-          },
-          check: this.checkPyLauncher
-        })
       }
 
       return checks
-    }
-
-    function runChecks (err) {
-      this.log.silly('runChecks: err = %j', (err && err.stack) || err)
+    })()
 
-      const check = toCheck.shift()
-      if (!check) {
-        return this.fail()
-      }
-
-      const before = check.before.apply(this)
+    for (const check of toCheck) {
+      const before = check.before()
       if (before === SKIP) {
-        return runChecks.apply(this)
+        continue
       }
       if (before === FAIL) {
         return this.fail()
       }
-
-      const args = [runChecks.bind(this)]
-      if (check.arg) {
-        args.unshift(check.arg)
+      try {
+        return await check.check()
+      } catch (err) {
+        this.log.silly('runChecks: err = %j', (err && err.stack) || err)
       }
-      check.check.apply(this, args)
     }
 
-    runChecks.apply(this)
-  },
+    return this.fail()
+  }
 
   // Check if command is a valid Python to use.
   // Will exit the Python finder on success.
   // If on Windows, run in a CMD shell to support BAT/CMD launchers.
-  checkCommand: function checkCommand (command, errorCallback) {
-    var exec = command
-    var args = this.argsExecutable
-    var shell = false
+  async checkCommand (command) {
+    let exec = command
+    let args = this.argsExecutable
+    let shell = false
     if (this.win) {
       // Arguments have to be manually quoted
       exec = `"${exec}"`
@@ -192,19 +179,19 @@ PythonFinder.prototype = {
     }
 
     this.log.verbose(`- executing "${command}" to get executable path`)
-    this.run(exec, args, shell, function (err, execPath) {
-      // Possible outcomes:
-      // - Error: not in PATH, not executable or execution fails
-      // - Gibberish: the next command to check version will fail
-      // - Absolute path to executable
-      if (err) {
-        this.addLog(`- "${command}" is not in PATH or produced an error`)
-        return errorCallback(err)
-      }
+    // Possible outcomes:
+    // - Error: not in PATH, not executable or execution fails
+    // - Gibberish: the next command to check version will fail
+    // - Absolute path to executable
+    try {
+      const execPath = await this.run(exec, args, shell)
       this.addLog(`- executable path is "${execPath}"`)
-      this.checkExecPath(execPath, errorCallback)
-    }.bind(this))
-  },
+      return this.checkExecPath(execPath)
+    } catch (err) {
+      this.addLog(`- "${command}" is not in PATH or produced an error`)
+      throw err
+    }
+  }
 
   // Check if the py launcher can find a valid Python to use.
   // Will exit the Python finder on success.
@@ -216,97 +203,86 @@ PythonFinder.prototype = {
   // the first command line argument. Since "py.exe -3" would be an invalid
   // executable for "execFile", we have to use the launcher to figure out
   // where the actual "python.exe" executable is located.
-  checkPyLauncher: function checkPyLauncher (errorCallback) {
-    this.log.verbose(
-      `- executing "${this.pyLauncher}" to get Python 3 executable path`)
-    this.run(this.pyLauncher, ['-3', ...this.argsExecutable], false,
-      function (err, execPath) {
-      // Possible outcomes: same as checkCommand
-        if (err) {
-          this.addLog(
-            `- "${this.pyLauncher}" is not in PATH or produced an error`)
-          return errorCallback(err)
-        }
-        this.addLog(`- executable path is "${execPath}"`)
-        this.checkExecPath(execPath, errorCallback)
-      }.bind(this))
-  },
+  async checkPyLauncher () {
+    this.log.verbose(`- executing "${this.pyLauncher}" to get Python 3 executable path`)
+    // Possible outcomes: same as checkCommand
+    try {
+      const execPath = await this.run(this.pyLauncher, ['-3', ...this.argsExecutable], false)
+      this.addLog(`- executable path is "${execPath}"`)
+      return this.checkExecPath(execPath)
+    } catch (err) {
+      this.addLog(`- "${this.pyLauncher}" is not in PATH or produced an error`)
+      throw err
+    }
+  }
 
   // Check if a Python executable is the correct version to use.
   // Will exit the Python finder on success.
-  checkExecPath: function checkExecPath (execPath, errorCallback) {
+  async checkExecPath (execPath) {
     this.log.verbose(`- executing "${execPath}" to get version`)
-    this.run(execPath, this.argsVersion, false, function (err, version) {
-      // Possible outcomes:
-      // - Error: executable can not be run (likely meaning the command wasn't
-      //   a Python executable and the previous command produced gibberish)
-      // - Gibberish: somehow the last command produced an executable path,
-      //   this will fail when verifying the version
-      // - Version of the Python executable
-      if (err) {
-        this.addLog(`- "${execPath}" could not be run`)
-        return errorCallback(err)
-      }
+    // Possible outcomes:
+    // - Error: executable can not be run (likely meaning the command wasn't
+    //   a Python executable and the previous command produced gibberish)
+    // - Gibberish: somehow the last command produced an executable path,
+    //   this will fail when verifying the version
+    // - Version of the Python executable
+    try {
+      const version = await this.run(execPath, this.argsVersion, false)
       this.addLog(`- version is "${version}"`)
 
       const range = new semver.Range(this.semverRange)
-      var valid = false
+      let valid = false
       try {
         valid = range.test(version)
       } catch (err) {
         this.log.silly('range.test() threw:\n%s', err.stack)
         this.addLog(`- "${execPath}" does not have a valid version`)
         this.addLog('- is it a Python executable?')
-        return errorCallback(err)
+        throw err
       }
-
       if (!valid) {
         this.addLog(`- version is ${version} - should be ${this.semverRange}`)
         this.addLog('- THIS VERSION OF PYTHON IS NOT SUPPORTED')
-        return errorCallback(new Error(
-          `Found unsupported Python version ${version}`))
+        throw new Error(`Found unsupported Python version ${version}`)
       }
-      this.succeed(execPath, version)
-    }.bind(this))
-  },
+      return this.succeed(execPath, version)
+    } catch (err) {
+      this.addLog(`- "${execPath}" could not be run`)
+      throw err
+    }
+  }
 
   // Run an executable or shell command, trimming the output.
-  run: function run (exec, args, shell, callback) {
-    var env = extend({}, this.env)
+  async run (exec, args, shell) {
+    const env = Object.assign({}, this.env)
     env.TERM = 'dumb'
-    const opts = { env: env, shell: shell }
+    const opts = { env, shell }
 
     this.log.silly('execFile: exec = %j', exec)
     this.log.silly('execFile: args = %j', args)
     this.log.silly('execFile: opts = %j', opts)
     try {
-      this.execFile(exec, args, opts, execFileCallback.bind(this))
-    } catch (err) {
-      this.log.silly('execFile: threw:\n%s', err.stack)
-      return callback(err)
-    }
-
-    function execFileCallback (err, stdout, stderr) {
+      const [err, stdout, stderr] = await this.execFile(exec, args, opts)
       this.log.silly('execFile result: err = %j', (err && err.stack) || err)
       this.log.silly('execFile result: stdout = %j', stdout)
       this.log.silly('execFile result: stderr = %j', stderr)
-      if (err) {
-        return callback(err)
-      }
-      const execPath = stdout.trim()
-      callback(null, execPath)
+      return stdout.trim()
+    } catch (err) {
+      this.log.silly('execFile: threw:\n%s', err.stack)
+      throw err
     }
-  },
+  }
 
-  succeed: function succeed (execPath, version) {
+  succeed (execPath, version) {
     this.log.info(`using Python version ${version} found at "${execPath}"`)
-    process.nextTick(this.callback.bind(null, null, execPath))
-  },
+    return execPath
+  }
 
-  fail: function fail () {
+  fail () {
     const errorLog = this.errorLog.join('\n')
 
-    const pathExample = this.win ? 'C:\\Path\\To\\python.exe'
+    const pathExample = this.win
+      ? 'C:\\Path\\To\\python.exe'
       : '/path/to/pythonexecutable'
     // For Windows 80 col console, use up to the column before the one marked
     // with X (total 79 chars including logger prefix, 58 chars usable here):
@@ -327,18 +303,8 @@ PythonFinder.prototype = {
     ].join('\n')
 
     this.log.error(`\n${errorLog}\n\n${info}\n`)
-    process.nextTick(this.callback.bind(null, new Error(
-      'Could not find any Python installation to use')))
+    throw new Error('Could not find any Python installation to use')
   }
 }
 
-function findPython (configPython, callback) {
-  var finder = new PythonFinder(configPython, callback)
-  finder.findPython()
-}
-
-module.exports = findPython
-module.exports.test = {
-  PythonFinder: PythonFinder,
-  findPython: findPython
-}
+module.exports = PythonFinder
diff --git a/node_modules/node-gyp/lib/find-visualstudio.js b/node_modules/node-gyp/lib/find-visualstudio.js
index 16f6e79559307..b57770259abde 100644
--- a/node_modules/node-gyp/lib/find-visualstudio.js
+++ b/node_modules/node-gyp/lib/find-visualstudio.js
@@ -1,39 +1,32 @@
 'use strict'
 
-const log = require('npmlog')
-const execFile = require('child_process').execFile
-const fs = require('fs')
-const path = require('path').win32
-const logWithPrefix = require('./util').logWithPrefix
-const regSearchKeys = require('./util').regSearchKeys
-
-function findVisualStudio (nodeSemver, configMsvsVersion, callback) {
-  const finder = new VisualStudioFinder(nodeSemver, configMsvsVersion,
-    callback)
-  finder.findVisualStudio()
-}
+const log = require('./log')
+const { existsSync } = require('fs')
+const { win32: path } = require('path')
+const { regSearchKeys, execFile } = require('./util')
 
-function VisualStudioFinder (nodeSemver, configMsvsVersion, callback) {
-  this.nodeSemver = nodeSemver
-  this.configMsvsVersion = configMsvsVersion
-  this.callback = callback
-  this.errorLog = []
-  this.validVersions = []
-}
+class VisualStudioFinder {
+  static findVisualStudio = (...args) => new VisualStudioFinder(...args).findVisualStudio()
+
+  log = log.withPrefix('find VS')
 
-VisualStudioFinder.prototype = {
-  log: logWithPrefix(log, 'find VS'),
+  regSearchKeys = regSearchKeys
 
-  regSearchKeys: regSearchKeys,
+  constructor (nodeSemver, configMsvsVersion) {
+    this.nodeSemver = nodeSemver
+    this.configMsvsVersion = configMsvsVersion
+    this.errorLog = []
+    this.validVersions = []
+  }
 
   // Logs a message at verbose level, but also saves it to be displayed later
   // at error level if an error occurs. This should help diagnose the problem.
-  addLog: function addLog (message) {
+  addLog (message) {
     this.log.verbose(message)
     this.errorLog.push(message)
-  },
+  }
 
-  findVisualStudio: function findVisualStudio () {
+  async findVisualStudio () {
     this.configVersionYear = null
     this.configPath = null
     if (this.configMsvsVersion) {
@@ -60,32 +53,30 @@ VisualStudioFinder.prototype = {
       this.addLog('VCINSTALLDIR not set, not running in VS Command Prompt')
     }
 
-    this.findVisualStudio2017OrNewer((info) => {
+    const checks = [
+      () => this.findVisualStudio2017OrNewer(),
+      () => this.findVisualStudio2015(),
+      () => this.findVisualStudio2013()
+    ]
+
+    for (const check of checks) {
+      const info = await check()
       if (info) {
         return this.succeed(info)
       }
-      this.findVisualStudio2015((info) => {
-        if (info) {
-          return this.succeed(info)
-        }
-        this.findVisualStudio2013((info) => {
-          if (info) {
-            return this.succeed(info)
-          }
-          this.fail()
-        })
-      })
-    })
-  },
+    }
+
+    return this.fail()
+  }
 
-  succeed: function succeed (info) {
+  succeed (info) {
     this.log.info(`using VS${info.versionYear} (${info.version}) found at:` +
                   `\n"${info.path}"` +
                   '\nrun with --verbose for detailed information')
-    process.nextTick(this.callback.bind(null, null, info))
-  },
+    return info
+  }
 
-  fail: function fail () {
+  fail () {
     if (this.configMsvsVersion && this.envVcInstallDir) {
       this.errorLog.push(
         'msvs_version does not match this VS Command Prompt or the',
@@ -119,17 +110,16 @@ VisualStudioFinder.prototype = {
     ].join('\n')
 
     this.log.error(`\n${errorLog}\n\n${infoLog}\n`)
-    process.nextTick(this.callback.bind(null, new Error(
-      'Could not find any Visual Studio installation to use')))
-  },
+    throw new Error('Could not find any Visual Studio installation to use')
+  }
 
   // Invoke the PowerShell script to get information about Visual Studio 2017
   // or newer installations
-  findVisualStudio2017OrNewer: function findVisualStudio2017OrNewer (cb) {
-    var ps = path.join(process.env.SystemRoot, 'System32',
+  async findVisualStudio2017OrNewer () {
+    const ps = path.join(process.env.SystemRoot, 'System32',
       'WindowsPowerShell', 'v1.0', 'powershell.exe')
-    var csFile = path.join(__dirname, 'Find-VisualStudio.cs')
-    var psArgs = [
+    const csFile = path.join(__dirname, 'Find-VisualStudio.cs')
+    const psArgs = [
       '-ExecutionPolicy',
       'Unrestricted',
       '-NoProfile',
@@ -138,22 +128,19 @@ VisualStudioFinder.prototype = {
     ]
 
     this.log.silly('Running', ps, psArgs)
-    var child = execFile(ps, psArgs, { encoding: 'utf8' },
-      (err, stdout, stderr) => {
-        this.parseData(err, stdout, stderr, cb)
-      })
-    child.stdin.end()
-  },
+    const [err, stdout, stderr] = await execFile(ps, psArgs, { encoding: 'utf8' })
+    return this.parseData(err, stdout, stderr)
+  }
 
   // Parse the output of the PowerShell script and look for an installation
   // of Visual Studio 2017 or newer to use
-  parseData: function parseData (err, stdout, stderr, cb) {
+  parseData (err, stdout, stderr) {
     this.log.silly('PS stderr = %j', stderr)
 
     const failPowershell = () => {
       this.addLog(
         'could not use PowerShell to find Visual Studio 2017 or newer, try re-running with \'--loglevel silly\' for more details')
-      cb(null)
+      return null
     }
 
     if (err) {
@@ -161,7 +148,7 @@ VisualStudioFinder.prototype = {
       return failPowershell()
     }
 
-    var vsInfo
+    let vsInfo
     try {
       vsInfo = JSON.parse(stdout)
     } catch (e) {
@@ -178,7 +165,7 @@ VisualStudioFinder.prototype = {
     vsInfo = vsInfo.map((info) => {
       this.log.silly(`processing installation: "${info.path}"`)
       info.path = path.resolve(info.path)
-      var ret = this.getVersionInfo(info)
+      const ret = this.getVersionInfo(info)
       ret.path = info.path
       ret.msBuild = this.getMSBuild(info, ret.versionYear)
       ret.toolset = this.getToolset(info, ret.versionYear)
@@ -199,7 +186,7 @@ VisualStudioFinder.prototype = {
     // Sort to place newer versions first
     vsInfo.sort((a, b) => b.versionYear - a.versionYear)
 
-    for (var i = 0; i < vsInfo.length; ++i) {
+    for (let i = 0; i < vsInfo.length; ++i) {
       const info = vsInfo[i]
       this.addLog(`checking VS${info.versionYear} (${info.version}) found ` +
                   `at:\n"${info.path}"`)
@@ -229,23 +216,23 @@ VisualStudioFinder.prototype = {
         continue
       }
 
-      return cb(info)
+      return info
     }
 
     this.addLog(
       'could not find a version of Visual Studio 2017 or newer to use')
-    cb(null)
-  },
+    return null
+  }
 
   // Helper - process version information
-  getVersionInfo: function getVersionInfo (info) {
+  getVersionInfo (info) {
     const match = /^(\d+)\.(\d+)\..*/.exec(info.version)
     if (!match) {
       this.log.silly('- failed to parse version:', info.version)
       return {}
     }
     this.log.silly('- version match = %j', match)
-    var ret = {
+    const ret = {
       version: info.version,
       versionMajor: parseInt(match[1], 10),
       versionMinor: parseInt(match[2], 10)
@@ -264,14 +251,14 @@ VisualStudioFinder.prototype = {
     }
     this.log.silly('- unsupported version:', ret.versionMajor)
     return {}
-  },
+  }
 
-  msBuildPathExists: function msBuildPathExists (path) {
-    return fs.existsSync(path)
-  },
+  msBuildPathExists (path) {
+    return existsSync(path)
+  }
 
   // Helper - process MSBuild information
-  getMSBuild: function getMSBuild (info, versionYear) {
+  getMSBuild (info, versionYear) {
     const pkg = 'Microsoft.VisualStudio.VC.MSBuild.Base'
     const msbuildPath = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'MSBuild.exe')
     const msbuildPathArm64 = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'arm64', 'MSBuild.exe')
@@ -295,10 +282,10 @@ VisualStudioFinder.prototype = {
       return msbuildPath
     }
     return null
-  },
+  }
 
   // Helper - process toolset information
-  getToolset: function getToolset (info, versionYear) {
+  getToolset (info, versionYear) {
     const pkg = 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64'
     const express = 'Microsoft.VisualStudio.WDExpress'
 
@@ -319,15 +306,15 @@ VisualStudioFinder.prototype = {
     }
     this.log.silly('- invalid versionYear:', versionYear)
     return null
-  },
+  }
 
   // Helper - process Windows SDK information
-  getSDK: function getSDK (info) {
+  getSDK (info) {
     const win8SDK = 'Microsoft.VisualStudio.Component.Windows81SDK'
     const win10SDKPrefix = 'Microsoft.VisualStudio.Component.Windows10SDK.'
     const win11SDKPrefix = 'Microsoft.VisualStudio.Component.Windows11SDK.'
 
-    var Win10or11SDKVer = 0
+    let Win10or11SDKVer = 0
     info.packages.forEach((pkg) => {
       if (!pkg.startsWith(win10SDKPrefix) && !pkg.startsWith(win11SDKPrefix)) {
         return
@@ -354,14 +341,14 @@ VisualStudioFinder.prototype = {
       return '8.1'
     }
     return null
-  },
+  }
 
   // Find an installation of Visual Studio 2015 to use
-  findVisualStudio2015: function findVisualStudio2015 (cb) {
+  async findVisualStudio2015 () {
     if (this.nodeSemver.major >= 19) {
       this.addLog(
         'not looking for VS2015 as it is only supported up to Node.js 18')
-      return cb(null)
+      return null
     }
     return this.findOldVS({
       version: '14.0',
@@ -369,15 +356,15 @@ VisualStudioFinder.prototype = {
       versionMinor: 0,
       versionYear: 2015,
       toolset: 'v140'
-    }, cb)
-  },
+    })
+  }
 
   // Find an installation of Visual Studio 2013 to use
-  findVisualStudio2013: function findVisualStudio2013 (cb) {
+  async findVisualStudio2013 () {
     if (this.nodeSemver.major >= 9) {
       this.addLog(
         'not looking for VS2013 as it is only supported up to Node.js 8')
-      return cb(null)
+      return null
     }
     return this.findOldVS({
       version: '12.0',
@@ -385,55 +372,52 @@ VisualStudioFinder.prototype = {
       versionMinor: 0,
       versionYear: 2013,
       toolset: 'v120'
-    }, cb)
-  },
+    })
+  }
 
   // Helper - common code for VS2013 and VS2015
-  findOldVS: function findOldVS (info, cb) {
+  async findOldVS (info) {
     const regVC7 = ['HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7',
       'HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7']
     const regMSBuild = 'HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions'
 
     this.addLog(`looking for Visual Studio ${info.versionYear}`)
-    this.regSearchKeys(regVC7, info.version, [], (err, res) => {
-      if (err) {
-        this.addLog('- not found')
-        return cb(null)
-      }
-
+    try {
+      let res = await this.regSearchKeys(regVC7, info.version, [])
       const vsPath = path.resolve(res, '..')
       this.addLog(`- found in "${vsPath}"`)
-
       const msBuildRegOpts = process.arch === 'ia32' ? [] : ['/reg:32']
-      this.regSearchKeys([`${regMSBuild}\\${info.version}`],
-        'MSBuildToolsPath', msBuildRegOpts, (err, res) => {
-          if (err) {
-            this.addLog(
-              '- could not find MSBuild in registry for this version')
-            return cb(null)
-          }
-
-          const msBuild = path.join(res, 'MSBuild.exe')
-          this.addLog(`- MSBuild in "${msBuild}"`)
-
-          if (!this.checkConfigVersion(info.versionYear, vsPath)) {
-            return cb(null)
-          }
-
-          info.path = vsPath
-          info.msBuild = msBuild
-          info.sdk = null
-          cb(info)
-        })
-    })
-  },
+
+      try {
+        res = await this.regSearchKeys([`${regMSBuild}\\${info.version}`], 'MSBuildToolsPath', msBuildRegOpts)
+      } catch (err) {
+        this.addLog('- could not find MSBuild in registry for this version')
+        return null
+      }
+
+      const msBuild = path.join(res, 'MSBuild.exe')
+      this.addLog(`- MSBuild in "${msBuild}"`)
+
+      if (!this.checkConfigVersion(info.versionYear, vsPath)) {
+        return null
+      }
+
+      info.path = vsPath
+      info.msBuild = msBuild
+      info.sdk = null
+      return info
+    } catch (err) {
+      this.addLog('- not found')
+      return null
+    }
+  }
 
   // After finding a usable version of Visual Studio:
   // - add it to validVersions to be displayed at the end if a specific
   //   version was requested and not found;
   // - check if this is the version that was requested.
   // - check if this matches the Visual Studio Command Prompt
-  checkConfigVersion: function checkConfigVersion (versionYear, vsPath) {
+  checkConfigVersion (versionYear, vsPath) {
     this.validVersions.push(versionYear)
     this.validVersions.push(vsPath)
 
@@ -456,8 +440,4 @@ VisualStudioFinder.prototype = {
   }
 }
 
-module.exports = findVisualStudio
-module.exports.test = {
-  VisualStudioFinder: VisualStudioFinder,
-  findVisualStudio: findVisualStudio
-}
+module.exports = VisualStudioFinder
diff --git a/node_modules/node-gyp/lib/install.js b/node_modules/node-gyp/lib/install.js
index 1eb9f14c6742a..7196a316296fb 100644
--- a/node_modules/node-gyp/lib/install.js
+++ b/node_modules/node-gyp/lib/install.js
@@ -1,26 +1,21 @@
 'use strict'
 
-const fs = require('graceful-fs')
+const { createWriteStream, promises: fs } = require('graceful-fs')
 const os = require('os')
 const { backOff } = require('exponential-backoff')
-const rm = require('rimraf')
 const tar = require('tar')
 const path = require('path')
-const util = require('util')
-const stream = require('stream')
+const { Transform, promises: { pipeline } } = require('stream')
 const crypto = require('crypto')
-const log = require('npmlog')
+const log = require('./log')
 const semver = require('semver')
-const fetch = require('make-fetch-happen')
+const { download } = require('./download')
 const processRelease = require('./process-release')
-const win = process.platform === 'win32'
-const streamPipeline = util.promisify(stream.pipeline)
 
-/**
- * @param {typeof import('graceful-fs')} fs
- */
+const win = process.platform === 'win32'
 
-async function install (fs, gyp, argv) {
+async function install (gyp, argv) {
+  log.stdout()
   const release = processRelease(argv, gyp, process.version, process.release)
   // Detecting target_arch based on logic from create-cnfig-gyp.js. Used on Windows only.
   const arch = win ? (gyp.opts.target_arch || gyp.opts.arch || process.arch || 'ia32') : ''
@@ -60,7 +55,7 @@ async function install (fs, gyp, argv) {
   if (gyp.opts.ensure) {
     log.verbose('install', '--ensure was passed, so won\'t reinstall if already installed')
     try {
-      await fs.promises.stat(devDir)
+      await fs.stat(devDir)
     } catch (err) {
       if (err.code === 'ENOENT') {
         log.verbose('install', 'version not already installed, continuing with install', release.version)
@@ -78,7 +73,7 @@ async function install (fs, gyp, argv) {
     const installVersionFile = path.resolve(devDir, 'installVersion')
     let installVersion = 0
     try {
-      const ver = await fs.promises.readFile(installVersionFile, 'ascii')
+      const ver = await fs.readFile(installVersionFile, 'ascii')
       installVersion = parseInt(ver, 10) || 0
     } catch (err) {
       if (err.code !== 'ENOENT') {
@@ -100,7 +95,7 @@ async function install (fs, gyp, argv) {
       log.verbose('on Windows; need to check node.lib')
       const nodeLibPath = path.resolve(devDir, arch, 'node.lib')
       try {
-        await fs.promises.stat(nodeLibPath)
+        await fs.stat(nodeLibPath)
       } catch (err) {
         if (err.code === 'ENOENT') {
           log.verbose('install', `version not already installed for ${arch}, continuing with install`, release.version)
@@ -126,12 +121,12 @@ async function install (fs, gyp, argv) {
 
   async function copyDirectory (src, dest) {
     try {
-      await fs.promises.stat(src)
+      await fs.stat(src)
     } catch {
       throw new Error(`Missing source directory for copy: ${src}`)
     }
-    await fs.promises.mkdir(dest, { recursive: true })
-    const entries = await fs.promises.readdir(src, { withFileTypes: true })
+    await fs.mkdir(dest, { recursive: true })
+    const entries = await fs.readdir(src, { withFileTypes: true })
     for (const entry of entries) {
       if (entry.isDirectory()) {
         await copyDirectory(path.join(src, entry.name), path.join(dest, entry.name))
@@ -140,12 +135,12 @@ async function install (fs, gyp, argv) {
         // Windows so use an exponential backoff to resolve collisions
         await backOff(async () => {
           try {
-            await fs.promises.copyFile(path.join(src, entry.name), path.join(dest, entry.name))
+            await fs.copyFile(path.join(src, entry.name), path.join(dest, entry.name))
           } catch (err) {
             // if ensure, check if file already exists and that's good enough
             if (gyp.opts.ensure && err.code === 'EBUSY') {
               try {
-                await fs.promises.stat(path.join(dest, entry.name))
+                await fs.stat(path.join(dest, entry.name))
                 return
               } catch {}
             }
@@ -163,7 +158,7 @@ async function install (fs, gyp, argv) {
 
     // first create the dir for the node dev files
     try {
-      const created = await fs.promises.mkdir(devDir, { recursive: true })
+      const created = await fs.mkdir(devDir, { recursive: true })
 
       if (created) {
         log.verbose('created devDir', created)
@@ -208,7 +203,7 @@ async function install (fs, gyp, argv) {
     // on Windows there can be file errors from tar if parallel installs
     // are happening (not uncommon with multiple native modules) so
     // extract the tarball to a temp directory first and then copy over
-    const tarExtractDir = win ? await fs.promises.mkdtemp(path.join(os.tmpdir(), 'node-gyp-tmp-')) : devDir
+    const tarExtractDir = win ? await fs.mkdtemp(path.join(os.tmpdir(), 'node-gyp-tmp-')) : devDir
 
     try {
       if (shouldDownloadTarball) {
@@ -228,7 +223,7 @@ async function install (fs, gyp, argv) {
               throw new Error(`${res.status} response downloading ${release.tarballUrl}`)
             }
 
-            await streamPipeline(
+            await pipeline(
               res.body,
               // content checksum
               new ShaSum((_, checksum) => {
@@ -267,7 +262,7 @@ async function install (fs, gyp, argv) {
       // need to download node.lib
         ...(win ? [downloadNodeLib()] : []),
         // write the "installVersion" file
-        fs.promises.writeFile(installVersionPath, gyp.package.installVersion + '\n'),
+        fs.writeFile(installVersionPath, gyp.package.installVersion + '\n'),
         // Only download SHASUMS.txt if we downloaded something in need of SHA verification
         ...(!tarPath || win ? [downloadShasums()] : [])
       ])
@@ -289,7 +284,7 @@ async function install (fs, gyp, argv) {
       if (tarExtractDir !== devDir) {
         try {
           // try to cleanup temp dir
-          await util.promisify(rm)(tarExtractDir)
+          await fs.rm(tarExtractDir, { recursive: true })
         } catch {
           log.warn('failed to clean up temp tarball extract directory')
         }
@@ -329,7 +324,7 @@ async function install (fs, gyp, argv) {
       log.verbose(name, 'dir', dir)
       log.verbose(name, 'url', libUrl)
 
-      await fs.promises.mkdir(dir, { recursive: true })
+      await fs.mkdir(dir, { recursive: true })
       log.verbose('streaming', name, 'to:', targetLibPath)
 
       const res = await download(gyp, libUrl)
@@ -339,13 +334,13 @@ async function install (fs, gyp, argv) {
         throw new Error(`${res.status} status code downloading ${name}`)
       }
 
-      return streamPipeline(
+      return pipeline(
         res.body,
         new ShaSum((_, checksum) => {
           contentShasums[libPath] = checksum
           log.verbose('content checksum', libPath, checksum)
         }),
-        fs.createWriteStream(targetLibPath)
+        createWriteStream(targetLibPath)
       )
     } // downloadNodeLib()
   } // go()
@@ -363,7 +358,7 @@ async function install (fs, gyp, argv) {
   async function rollback (err) {
     log.warn('install', 'got an error, rolling back install')
     // roll-back the install if anything went wrong
-    await util.promisify(gyp.commands.remove)([release.versionDir])
+    await gyp.commands.remove([release.versionDir])
     throw err
   }
 
@@ -394,11 +389,11 @@ async function install (fs, gyp, argv) {
       log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space')
       gyp.todo.push({ name: 'remove', args: argv })
     }
-    return util.promisify(gyp.commands.install)([noretry].concat(argv))
+    return gyp.commands.install([noretry].concat(argv))
   }
 }
 
-class ShaSum extends stream.Transform {
+class ShaSum extends Transform {
   constructor (callback) {
     super()
     this._callback = callback
@@ -416,43 +411,5 @@ class ShaSum extends stream.Transform {
   }
 }
 
-async function download (gyp, url) {
-  log.http('GET', url)
-
-  const requestOpts = {
-    headers: {
-      'User-Agent': `node-gyp v${gyp.version} (node ${process.version})`,
-      Connection: 'keep-alive'
-    },
-    proxy: gyp.opts.proxy,
-    noProxy: gyp.opts.noproxy
-  }
-
-  const cafile = gyp.opts.cafile
-  if (cafile) {
-    requestOpts.ca = await readCAFile(cafile)
-  }
-
-  const res = await fetch(url, requestOpts)
-  log.http(res.status, res.url)
-
-  return res
-}
-
-async function readCAFile (filename) {
-  // The CA file can contain multiple certificates so split on certificate
-  // boundaries.  [\S\s]*? is used to match everything including newlines.
-  const ca = await fs.promises.readFile(filename, 'utf8')
-  const re = /(-----BEGIN CERTIFICATE-----[\S\s]*?-----END CERTIFICATE-----)/g
-  return ca.match(re)
-}
-
-module.exports = function (gyp, argv, callback) {
-  install(fs, gyp, argv).then(callback.bind(undefined, null), callback)
-}
-module.exports.test = {
-  download,
-  install,
-  readCAFile
-}
+module.exports = install
 module.exports.usage = 'Install node development files for the specified node version.'
diff --git a/node_modules/node-gyp/lib/list.js b/node_modules/node-gyp/lib/list.js
index 405ebc0d88959..36889ad4f71e2 100644
--- a/node_modules/node-gyp/lib/list.js
+++ b/node_modules/node-gyp/lib/list.js
@@ -1,26 +1,25 @@
 'use strict'
 
-const fs = require('graceful-fs')
-const log = require('npmlog')
+const fs = require('graceful-fs').promises
+const log = require('./log')
 
-function list (gyp, args, callback) {
-  var devDir = gyp.devDir
+async function list (gyp, args) {
+  const devDir = gyp.devDir
   log.verbose('list', 'using node-gyp dir:', devDir)
 
-  fs.readdir(devDir, onreaddir)
-
-  function onreaddir (err, versions) {
-    if (err && err.code !== 'ENOENT') {
-      return callback(err)
+  let versions = []
+  try {
+    const dir = await fs.readdir(devDir)
+    if (Array.isArray(dir)) {
+      versions = dir.filter((v) => v !== 'current')
     }
-
-    if (Array.isArray(versions)) {
-      versions = versions.filter(function (v) { return v !== 'current' })
-    } else {
-      versions = []
+  } catch (err) {
+    if (err && err.code !== 'ENOENT') {
+      throw err
     }
-    callback(null, versions)
   }
+
+  return versions
 }
 
 module.exports = list
diff --git a/node_modules/node-gyp/lib/log.js b/node_modules/node-gyp/lib/log.js
new file mode 100644
index 0000000000000..6841719abab5a
--- /dev/null
+++ b/node_modules/node-gyp/lib/log.js
@@ -0,0 +1,169 @@
+'use strict'
+
+const procLog = require('proc-log')
+const { format } = require('util')
+
+// helper to emit log messages with a predefined prefix
+const logLevels = Object.keys(procLog).filter((k) => typeof procLog[k] === 'function')
+const withPrefix = (prefix) => logLevels.reduce((acc, level) => {
+  acc[level] = (...args) => procLog[level](prefix, ...args)
+  return acc
+}, {})
+
+// very basic ansi color generator
+const COLORS = {
+  wrap: (str, colors) => {
+    const codes = colors.filter(c => typeof c === 'number')
+    return `\x1b[${codes.join(';')}m${str}\x1b[0m`
+  },
+  inverse: 7,
+  fg: {
+    black: 30,
+    red: 31,
+    green: 32,
+    yellow: 33,
+    blue: 34,
+    magenta: 35,
+    cyan: 36,
+    white: 37
+  },
+  bg: {
+    black: 40,
+    red: 41,
+    green: 42,
+    yellow: 43,
+    blue: 44,
+    magenta: 45,
+    cyan: 46,
+    white: 47
+  }
+}
+
+class Logger {
+  #buffer = []
+  #paused = null
+  #level = null
+  #stream = null
+
+  // ordered from loudest to quietest
+  #levels = [{
+    id: 'silly',
+    display: 'sill',
+    style: { inverse: true }
+  }, {
+    id: 'verbose',
+    display: 'verb',
+    style: { fg: 'cyan', bg: 'black' }
+  }, {
+    id: 'info',
+    style: { fg: 'green' }
+  }, {
+    id: 'http',
+    style: { fg: 'green', bg: 'black' }
+  }, {
+    id: 'notice',
+    style: { fg: 'cyan', bg: 'black' }
+  }, {
+    id: 'warn',
+    display: 'WARN',
+    style: { fg: 'black', bg: 'yellow' }
+  }, {
+    id: 'error',
+    display: 'ERR!',
+    style: { fg: 'red', bg: 'black' }
+  }]
+
+  constructor (stream) {
+    process.on('log', (...args) => this.#onLog(...args))
+    this.#levels = new Map(this.#levels.map((level, index) => [level.id, { ...level, index }]))
+    this.level = 'info'
+    this.stream = stream
+    procLog.pause()
+  }
+
+  get stream () {
+    return this.#stream
+  }
+
+  set stream (stream) {
+    this.#stream = stream
+  }
+
+  get level () {
+    return this.#levels.get(this.#level) ?? null
+  }
+
+  set level (level) {
+    this.#level = this.#levels.get(level)?.id ?? null
+  }
+
+  isVisible (level) {
+    return this.level?.index <= this.#levels.get(level)?.index ?? -1
+  }
+
+  #onLog (...args) {
+    const [level] = args
+
+    if (level === 'pause') {
+      this.#paused = true
+      return
+    }
+
+    if (level === 'resume') {
+      this.#paused = false
+      this.#buffer.forEach((b) => this.#log(...b))
+      this.#buffer.length = 0
+      return
+    }
+
+    if (this.#paused) {
+      this.#buffer.push(args)
+      return
+    }
+
+    this.#log(...args)
+  }
+
+  #color (str, { fg, bg, inverse }) {
+    if (!this.#stream?.isTTY) {
+      return str
+    }
+
+    return COLORS.wrap(str, [
+      COLORS.fg[fg],
+      COLORS.bg[bg],
+      inverse && COLORS.inverse
+    ])
+  }
+
+  #log (levelId, msgPrefix, ...args) {
+    if (!this.isVisible(levelId) || typeof this.#stream?.write !== 'function') {
+      return
+    }
+
+    const level = this.#levels.get(levelId)
+
+    const prefixParts = [
+      this.#color('gyp', { fg: 'white', bg: 'black' }),
+      this.#color(level.display ?? level.id, level.style)
+    ]
+    if (msgPrefix) {
+      prefixParts.push(this.#color(msgPrefix, { fg: 'magenta' }))
+    }
+
+    const prefix = prefixParts.join(' ').trim() + ' '
+    const lines = format(...args).split(/\r?\n/).map(l => prefix + l.trim())
+
+    this.#stream.write(lines.join('\n') + '\n')
+  }
+}
+
+// used to suppress logs in tests
+const NULL_LOGGER = !!process.env.NODE_GYP_NULL_LOGGER
+
+module.exports = {
+  logger: new Logger(NULL_LOGGER ? null : process.stderr),
+  stdout: NULL_LOGGER ? () => {} : (...args) => console.log(...args),
+  withPrefix,
+  ...procLog
+}
diff --git a/node_modules/node-gyp/lib/node-gyp.js b/node_modules/node-gyp/lib/node-gyp.js
index e492ec1026d9d..5e25bf996f8b2 100644
--- a/node_modules/node-gyp/lib/node-gyp.js
+++ b/node_modules/node-gyp/lib/node-gyp.js
@@ -2,10 +2,10 @@
 
 const path = require('path')
 const nopt = require('nopt')
-const log = require('npmlog')
+const log = require('./log')
 const childProcess = require('child_process')
-const EE = require('events').EventEmitter
-const inherits = require('util').inherits
+const { EventEmitter } = require('events')
+
 const commands = [
   // Module build commands
   'build',
@@ -17,199 +17,172 @@ const commands = [
   'list',
   'remove'
 ]
-const aliases = {
-  ls: 'list',
-  rm: 'remove'
-}
-
-// differentiate node-gyp's logs from npm's
-log.heading = 'gyp'
-
-function gyp () {
-  return new Gyp()
-}
 
-function Gyp () {
-  var self = this
+class Gyp extends EventEmitter {
+  /**
+   * Export the contents of the package.json.
+   */
+  package = require('../package.json')
+
+  /**
+   * nopt configuration definitions
+   */
+  configDefs = {
+    help: Boolean, // everywhere
+    arch: String, // 'configure'
+    cafile: String, // 'install'
+    debug: Boolean, // 'build'
+    directory: String, // bin
+    make: String, // 'build'
+    'msvs-version': String, // 'configure'
+    ensure: Boolean, // 'install'
+    solution: String, // 'build' (windows only)
+    proxy: String, // 'install'
+    noproxy: String, // 'install'
+    devdir: String, // everywhere
+    nodedir: String, // 'configure'
+    loglevel: String, // everywhere
+    python: String, // 'configure'
+    'dist-url': String, // 'install'
+    tarball: String, // 'install'
+    jobs: String, // 'build'
+    thin: String, // 'configure'
+    'force-process-config': Boolean // 'configure'
+  }
 
-  this.devDir = ''
-  this.commands = {}
+  /**
+   * nopt shorthands
+   */
+  shorthands = {
+    release: '--no-debug',
+    C: '--directory',
+    debug: '--debug',
+    j: '--jobs',
+    silly: '--loglevel=silly',
+    verbose: '--loglevel=verbose',
+    silent: '--loglevel=silent'
+  }
 
-  commands.forEach(function (command) {
-    self.commands[command] = function (argv, callback) {
-      log.verbose('command', command, argv)
-      return require('./' + command)(self, argv, callback)
-    }
-  })
-}
-inherits(Gyp, EE)
-exports.Gyp = Gyp
-var proto = Gyp.prototype
-
-/**
- * Export the contents of the package.json.
- */
-
-proto.package = require('../package.json')
-
-/**
- * nopt configuration definitions
- */
-
-proto.configDefs = {
-  help: Boolean, // everywhere
-  arch: String, // 'configure'
-  cafile: String, // 'install'
-  debug: Boolean, // 'build'
-  directory: String, // bin
-  make: String, // 'build'
-  msvs_version: String, // 'configure'
-  ensure: Boolean, // 'install'
-  solution: String, // 'build' (windows only)
-  proxy: String, // 'install'
-  noproxy: String, // 'install'
-  devdir: String, // everywhere
-  nodedir: String, // 'configure'
-  loglevel: String, // everywhere
-  python: String, // 'configure'
-  'dist-url': String, // 'install'
-  tarball: String, // 'install'
-  jobs: String, // 'build'
-  thin: String, // 'configure'
-  'force-process-config': Boolean // 'configure'
-}
+  /**
+   * expose the command aliases for the bin file to use.
+   */
+  aliases = {
+    ls: 'list',
+    rm: 'remove'
+  }
 
-/**
- * nopt shorthands
- */
-
-proto.shorthands = {
-  release: '--no-debug',
-  C: '--directory',
-  debug: '--debug',
-  j: '--jobs',
-  silly: '--loglevel=silly',
-  verbose: '--loglevel=verbose',
-  silent: '--loglevel=silent'
-}
+  constructor (...args) {
+    super(...args)
 
-/**
- * expose the command aliases for the bin file to use.
- */
+    this.devDir = ''
 
-proto.aliases = aliases
+    this.commands = commands.reduce((acc, command) => {
+      acc[command] = (argv) => require('./' + command)(this, argv)
+      return acc
+    }, {})
 
-/**
- * Parses the given argv array and sets the 'opts',
- * 'argv' and 'command' properties.
- */
+    Object.defineProperty(this, 'version', {
+      enumerable: true,
+      get: function () { return this.package.version }
+    })
+  }
 
-proto.parseArgv = function parseOpts (argv) {
-  this.opts = nopt(this.configDefs, this.shorthands, argv)
-  this.argv = this.opts.argv.remain.slice()
+  /**
+   * Parses the given argv array and sets the 'opts',
+   * 'argv' and 'command' properties.
+   */
+  parseArgv (argv) {
+    this.opts = nopt(this.configDefs, this.shorthands, argv)
+    this.argv = this.opts.argv.remain.slice()
 
-  var commands = this.todo = []
+    const commands = this.todo = []
 
-  // create a copy of the argv array with aliases mapped
-  argv = this.argv.map(function (arg) {
+    // create a copy of the argv array with aliases mapped
+    argv = this.argv.map((arg) => {
     // is this an alias?
-    if (arg in this.aliases) {
-      arg = this.aliases[arg]
-    }
-    return arg
-  }, this)
-
-  // process the mapped args into "command" objects ("name" and "args" props)
-  argv.slice().forEach(function (arg) {
-    if (arg in this.commands) {
-      var args = argv.splice(0, argv.indexOf(arg))
-      argv.shift()
-      if (commands.length > 0) {
-        commands[commands.length - 1].args = args
+      if (arg in this.aliases) {
+        arg = this.aliases[arg]
+      }
+      return arg
+    })
+
+    // process the mapped args into "command" objects ("name" and "args" props)
+    argv.slice().forEach((arg) => {
+      if (arg in this.commands) {
+        const args = argv.splice(0, argv.indexOf(arg))
+        argv.shift()
+        if (commands.length > 0) {
+          commands[commands.length - 1].args = args
+        }
+        commands.push({ name: arg, args: [] })
       }
-      commands.push({ name: arg, args: [] })
+    })
+    if (commands.length > 0) {
+      commands[commands.length - 1].args = argv.splice(0)
     }
-  }, this)
-  if (commands.length > 0) {
-    commands[commands.length - 1].args = argv.splice(0)
-  }
 
-  // support for inheriting config env variables from npm
-  var npmConfigPrefix = 'npm_config_'
-  Object.keys(process.env).forEach(function (name) {
-    if (name.indexOf(npmConfigPrefix) !== 0) {
-      return
-    }
-    var val = process.env[name]
-    if (name === npmConfigPrefix + 'loglevel') {
-      log.level = val
-    } else {
+    // support for inheriting config env variables from npm
+    const npmConfigPrefix = 'npm_config_'
+    Object.keys(process.env).forEach((name) => {
+      if (name.indexOf(npmConfigPrefix) !== 0) {
+        return
+      }
+      const val = process.env[name]
+      if (name === npmConfigPrefix + 'loglevel') {
+        log.logger.level = val
+      } else {
       // add the user-defined options to the config
-      name = name.substring(npmConfigPrefix.length)
-      // gyp@741b7f1 enters an infinite loop when it encounters
-      // zero-length options so ensure those don't get through.
-      if (name) {
+        name = name.substring(npmConfigPrefix.length)
+        // gyp@741b7f1 enters an infinite loop when it encounters
+        // zero-length options so ensure those don't get through.
+        if (name) {
         // convert names like force_process_config to force-process-config
-        if (name.includes('_')) {
-          name = name.replace(/_/g, '-')
+          if (name.includes('_')) {
+            name = name.replace(/_/g, '-')
+          }
+          this.opts[name] = val
         }
-        this.opts[name] = val
       }
-    }
-  }, this)
+    })
 
-  if (this.opts.loglevel) {
-    log.level = this.opts.loglevel
+    if (this.opts.loglevel) {
+      log.logger.level = this.opts.loglevel
+    }
+    log.resume()
   }
-  log.resume()
-}
-
-/**
- * Spawns a child process and emits a 'spawn' event.
- */
 
-proto.spawn = function spawn (command, args, opts) {
-  if (!opts) {
-    opts = {}
-  }
-  if (!opts.silent && !opts.stdio) {
-    opts.stdio = [0, 1, 2]
+  /**
+   * Spawns a child process and emits a 'spawn' event.
+   */
+  spawn (command, args, opts) {
+    if (!opts) {
+      opts = {}
+    }
+    if (!opts.silent && !opts.stdio) {
+      opts.stdio = [0, 1, 2]
+    }
+    const cp = childProcess.spawn(command, args, opts)
+    log.info('spawn', command)
+    log.info('spawn args', args)
+    return cp
   }
-  var cp = childProcess.spawn(command, args, opts)
-  log.info('spawn', command)
-  log.info('spawn args', args)
-  return cp
-}
 
-/**
- * Returns the usage instructions for node-gyp.
- */
-
-proto.usage = function usage () {
-  var str = [
-    '',
-    '  Usage: node-gyp  [options]',
-    '',
-    '  where  is one of:',
-    commands.map(function (c) {
-      return '    - ' + c + ' - ' + require('./' + c).usage
-    }).join('\n'),
-    '',
-    'node-gyp@' + this.version + '  ' + path.resolve(__dirname, '..'),
-    'node@' + process.versions.node
-  ].join('\n')
-  return str
+  /**
+   * Returns the usage instructions for node-gyp.
+   */
+  usage () {
+    return [
+      '',
+      '  Usage: node-gyp  [options]',
+      '',
+      '  where  is one of:',
+      commands.map((c) => '    - ' + c + ' - ' + require('./' + c).usage).join('\n'),
+      '',
+      'node-gyp@' + this.version + '  ' + path.resolve(__dirname, '..'),
+      'node@' + process.versions.node
+    ].join('\n')
+  }
 }
 
-/**
- * Version number getter.
- */
-
-Object.defineProperty(proto, 'version', {
-  get: function () {
-    return this.package.version
-  },
-  enumerable: true
-})
-
-module.exports = exports = gyp
+module.exports = () => new Gyp()
+module.exports.Gyp = Gyp
diff --git a/node_modules/node-gyp/lib/process-release.js b/node_modules/node-gyp/lib/process-release.js
index 95b55e4426dee..c9a319dfadd2b 100644
--- a/node_modules/node-gyp/lib/process-release.js
+++ b/node_modules/node-gyp/lib/process-release.js
@@ -1,11 +1,11 @@
-/* eslint-disable node/no-deprecated-api */
+/* eslint-disable n/no-deprecated-api */
 
 'use strict'
 
 const semver = require('semver')
 const url = require('url')
 const path = require('path')
-const log = require('npmlog')
+const log = require('./log')
 
 // versions where -headers.tar.gz started shipping
 const headersTarballRange = '>= 3.0.0 || ~0.12.10 || ~0.10.42'
@@ -17,29 +17,28 @@ const bitsreV3 = /\/win-(x86|ia32|x64)\// // io.js v3.x.x shipped with "ia32" bu
 // file names. Inputs come from command-line switches (--target, --dist-url),
 // `process.version` and `process.release` where it exists.
 function processRelease (argv, gyp, defaultVersion, defaultRelease) {
-  var version = (semver.valid(argv[0]) && argv[0]) || gyp.opts.target || defaultVersion
-  var versionSemver = semver.parse(version)
-  var overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl
-  var isDefaultVersion
-  var isNamedForLegacyIojs
-  var name
-  var distBaseUrl
-  var baseUrl
-  var libUrl32
-  var libUrl64
-  var libUrlArm64
-  var tarballUrl
-  var canGetHeaders
+  let version = (semver.valid(argv[0]) && argv[0]) || gyp.opts.target || defaultVersion
+  const versionSemver = semver.parse(version)
+  let overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl
+  let isNamedForLegacyIojs
+  let name
+  let distBaseUrl
+  let baseUrl
+  let libUrl32
+  let libUrl64
+  let libUrlArm64
+  let tarballUrl
+  let canGetHeaders
 
   if (!versionSemver) {
     // not a valid semver string, nothing we can do
-    return { version: version }
+    return { version }
   }
   // flatten version into String
   version = versionSemver.version
 
   // defaultVersion should come from process.version so ought to be valid semver
-  isDefaultVersion = version === semver.parse(defaultVersion).version
+  const isDefaultVersion = version === semver.parse(defaultVersion).version
 
   // can't use process.release if we're using --target=x.y.z
   if (!isDefaultVersion) {
@@ -101,11 +100,11 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) {
   }
 
   return {
-    version: version,
+    version,
     semver: versionSemver,
-    name: name,
-    baseUrl: baseUrl,
-    tarballUrl: tarballUrl,
+    name,
+    baseUrl,
+    tarballUrl,
     shasumsUrl: url.resolve(baseUrl, 'SHASUMS256.txt'),
     versionDir: (name !== 'node' ? name + '-' : '') + version,
     ia32: {
@@ -128,8 +127,8 @@ function normalizePath (p) {
 }
 
 function resolveLibUrl (name, defaultUrl, arch, versionMajor) {
-  var base = url.resolve(defaultUrl, './')
-  var hasLibUrl = bitsre.test(defaultUrl) || (versionMajor === 3 && bitsreV3.test(defaultUrl))
+  const base = url.resolve(defaultUrl, './')
+  const hasLibUrl = bitsre.test(defaultUrl) || (versionMajor === 3 && bitsreV3.test(defaultUrl))
 
   if (!hasLibUrl) {
     // let's assume it's a baseUrl then
diff --git a/node_modules/node-gyp/lib/rebuild.js b/node_modules/node-gyp/lib/rebuild.js
index a1c5b27cbe56a..609817665e2db 100644
--- a/node_modules/node-gyp/lib/rebuild.js
+++ b/node_modules/node-gyp/lib/rebuild.js
@@ -1,12 +1,11 @@
 'use strict'
 
-function rebuild (gyp, argv, callback) {
+async function rebuild (gyp, argv) {
   gyp.todo.push(
     { name: 'clean', args: [] }
     , { name: 'configure', args: argv }
     , { name: 'build', args: [] }
   )
-  process.nextTick(callback)
 }
 
 module.exports = rebuild
diff --git a/node_modules/node-gyp/lib/remove.js b/node_modules/node-gyp/lib/remove.js
index 8c945e5659001..7efdb01a662e7 100644
--- a/node_modules/node-gyp/lib/remove.js
+++ b/node_modules/node-gyp/lib/remove.js
@@ -1,46 +1,43 @@
 'use strict'
 
-const fs = require('fs')
-const rm = require('rimraf')
+const fs = require('graceful-fs').promises
 const path = require('path')
-const log = require('npmlog')
+const log = require('./log')
 const semver = require('semver')
 
-function remove (gyp, argv, callback) {
-  var devDir = gyp.devDir
+async function remove (gyp, argv) {
+  const devDir = gyp.devDir
   log.verbose('remove', 'using node-gyp dir:', devDir)
 
   // get the user-specified version to remove
-  var version = argv[0] || gyp.opts.target
+  let version = argv[0] || gyp.opts.target
   log.verbose('remove', 'removing target version:', version)
 
   if (!version) {
-    return callback(new Error('You must specify a version number to remove. Ex: "' + process.version + '"'))
+    throw new Error('You must specify a version number to remove. Ex: "' + process.version + '"')
   }
 
-  var versionSemver = semver.parse(version)
+  const versionSemver = semver.parse(version)
   if (versionSemver) {
     // flatten the version Array into a String
     version = versionSemver.version
   }
 
-  var versionPath = path.resolve(gyp.devDir, version)
+  const versionPath = path.resolve(gyp.devDir, version)
   log.verbose('remove', 'removing development files for version:', version)
 
   // first check if its even installed
-  fs.stat(versionPath, function (err) {
-    if (err) {
-      if (err.code === 'ENOENT') {
-        callback(null, 'version was already uninstalled: ' + version)
-      } else {
-        callback(err)
-      }
-      return
+  try {
+    await fs.stat(versionPath)
+  } catch (err) {
+    if (err.code === 'ENOENT') {
+      return 'version was already uninstalled: ' + version
     }
-    // Go ahead and delete the dir
-    rm(versionPath, callback)
-  })
+    throw err
+  }
+
+  await fs.rm(versionPath, { recursive: true, force: true })
 }
 
-module.exports = exports = remove
+module.exports = remove
 module.exports.usage = 'Removes the node development files for the specified version'
diff --git a/node_modules/node-gyp/lib/util.js b/node_modules/node-gyp/lib/util.js
index 3e23c628e6ad7..3f6aeeb7dcb43 100644
--- a/node_modules/node-gyp/lib/util.js
+++ b/node_modules/node-gyp/lib/util.js
@@ -1,64 +1,81 @@
 'use strict'
 
-const log = require('npmlog')
-const execFile = require('child_process').execFile
+const cp = require('child_process')
 const path = require('path')
+const { openSync, closeSync } = require('graceful-fs')
+const log = require('./log')
 
-function logWithPrefix (log, prefix) {
-  function setPrefix (logFunction) {
-    return (...args) => logFunction.apply(null, [ prefix, ...args ]) // eslint-disable-line
-  }
-  return {
-    silly: setPrefix(log.silly),
-    verbose: setPrefix(log.verbose),
-    info: setPrefix(log.info),
-    warn: setPrefix(log.warn),
-    error: setPrefix(log.error)
-  }
-}
+const execFile = async (...args) => new Promise((resolve) => {
+  const child = cp.execFile(...args, (...a) => resolve(a))
+  child.stdin.end()
+})
 
-function regGetValue (key, value, addOpts, cb) {
+async function regGetValue (key, value, addOpts) {
   const outReValue = value.replace(/\W/g, '.')
   const outRe = new RegExp(`^\\s+${outReValue}\\s+REG_\\w+\\s+(\\S.*)$`, 'im')
   const reg = path.join(process.env.SystemRoot, 'System32', 'reg.exe')
   const regArgs = ['query', key, '/v', value].concat(addOpts)
 
   log.silly('reg', 'running', reg, regArgs)
-  const child = execFile(reg, regArgs, { encoding: 'utf8' },
-    function (err, stdout, stderr) {
-      log.silly('reg', 'reg.exe stdout = %j', stdout)
-      if (err || stderr.trim() !== '') {
-        log.silly('reg', 'reg.exe err = %j', err && (err.stack || err))
-        log.silly('reg', 'reg.exe stderr = %j', stderr)
-        return cb(err, stderr)
-      }
+  const [err, stdout, stderr] = await execFile(reg, regArgs, { encoding: 'utf8' })
 
-      const result = outRe.exec(stdout)
-      if (!result) {
-        log.silly('reg', 'error parsing stdout')
-        return cb(new Error('Could not parse output of reg.exe'))
-      }
-      log.silly('reg', 'found: %j', result[1])
-      cb(null, result[1])
-    })
-  child.stdin.end()
+  log.silly('reg', 'reg.exe stdout = %j', stdout)
+  if (err || stderr.trim() !== '') {
+    log.silly('reg', 'reg.exe err = %j', err && (err.stack || err))
+    log.silly('reg', 'reg.exe stderr = %j', stderr)
+    if (err) {
+      throw err
+    }
+    throw new Error(stderr)
+  }
+
+  const result = outRe.exec(stdout)
+  if (!result) {
+    log.silly('reg', 'error parsing stdout')
+    throw new Error('Could not parse output of reg.exe')
+  }
+
+  log.silly('reg', 'found: %j', result[1])
+  return result[1]
+}
+
+async function regSearchKeys (keys, value, addOpts) {
+  for (const key of keys) {
+    try {
+      return await regGetValue(key, value, addOpts)
+    } catch {
+      continue
+    }
+  }
 }
 
-function regSearchKeys (keys, value, addOpts, cb) {
-  var i = 0
-  const search = () => {
-    log.silly('reg-search', 'looking for %j in %j', value, keys[i])
-    regGetValue(keys[i], value, addOpts, (err, res) => {
-      ++i
-      if (err && i < keys.length) { return search() }
-      cb(err, res)
-    })
+/**
+ * Returns the first file or directory from an array of candidates that is
+ * readable by the current user, or undefined if none of the candidates are
+ * readable.
+ */
+function findAccessibleSync (logprefix, dir, candidates) {
+  for (let next = 0; next < candidates.length; next++) {
+    const candidate = path.resolve(dir, candidates[next])
+    let fd
+    try {
+      fd = openSync(candidate, 'r')
+    } catch (e) {
+      // this candidate was not found or not readable, do nothing
+      log.silly(logprefix, 'Could not open %s: %s', candidate, e.message)
+      continue
+    }
+    closeSync(fd)
+    log.silly(logprefix, 'Found readable %s', candidate)
+    return candidate
   }
-  search()
+
+  return undefined
 }
 
 module.exports = {
-  logWithPrefix: logWithPrefix,
-  regGetValue: regGetValue,
-  regSearchKeys: regSearchKeys
+  execFile,
+  regGetValue,
+  regSearchKeys,
+  findAccessibleSync
 }
diff --git a/node_modules/node-gyp/node_modules/cacache/lib/util/glob.js b/node_modules/node-gyp/node_modules/cacache/lib/util/glob.js
deleted file mode 100644
index 8500c1c16a429..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/lib/util/glob.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict'
-
-const { glob } = require('glob')
-const path = require('path')
-
-const globify = (pattern) => pattern.split(path.win32.sep).join(path.posix.sep)
-module.exports = (path, options) => glob(globify(path), options)
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/package.json b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/package.json
deleted file mode 100644
index c15df94a3582b..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "version": "10.3.3",
-  "type": "commonjs"
-}
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/bin.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/bin.js
deleted file mode 100755
index 4a8a88f2734d2..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/bin.js
+++ /dev/null
@@ -1,270 +0,0 @@
-#!/usr/bin/env node
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const foreground_child_1 = require("foreground-child");
-const fs_1 = require("fs");
-const jackspeak_1 = require("jackspeak");
-const package_json_1 = require("../package.json");
-const index_js_1 = require("./index.js");
-const j = (0, jackspeak_1.jack)({
-    usage: 'glob [options] [ [ ...]]',
-})
-    .description(`
-    Glob v${package_json_1.version}
-
-    Expand the positional glob expression arguments into any matching file
-    system paths found.
-  `)
-    .opt({
-    cmd: {
-        short: 'c',
-        hint: 'command',
-        description: `Run the command provided, passing the glob expression
-                    matches as arguments.`,
-    },
-})
-    .opt({
-    default: {
-        short: 'p',
-        hint: 'pattern',
-        description: `If no positional arguments are provided, glob will use
-                    this pattern`,
-    },
-})
-    .flag({
-    all: {
-        short: 'A',
-        description: `By default, the glob cli command will not expand any
-                    arguments that are an exact match to a file on disk.
-
-                    This prevents double-expanding, in case the shell expands
-                    an argument whose filename is a glob expression.
-
-                    For example, if 'app/*.ts' would match 'app/[id].ts', then
-                    on Windows powershell or cmd.exe, 'glob app/*.ts' will
-                    expand to 'app/[id].ts', as expected. However, in posix
-                    shells such as bash or zsh, the shell will first expand
-                    'app/*.ts' to a list of filenames. Then glob will look
-                    for a file matching 'app/[id].ts' (ie, 'app/i.ts' or
-                    'app/d.ts'), which is unexpected.
-
-                    Setting '--all' prevents this behavior, causing glob
-                    to treat ALL patterns as glob expressions to be expanded,
-                    even if they are an exact match to a file on disk.
-
-                    When setting this option, be sure to enquote arguments
-                    so that the shell will not expand them prior to passing
-                    them to the glob command process.
-      `,
-    },
-    absolute: {
-        short: 'a',
-        description: 'Expand to absolute paths',
-    },
-    'dot-relative': {
-        short: 'd',
-        description: `Prepend './' on relative matches`,
-    },
-    mark: {
-        short: 'm',
-        description: `Append a / on any directories matched`,
-    },
-    posix: {
-        short: 'x',
-        description: `Always resolve to posix style paths, using '/' as the
-                    directory separator, even on Windows. Drive letter
-                    absolute matches on Windows will be expanded to their
-                    full resolved UNC maths, eg instead of 'C:\\foo\\bar',
-                    it will expand to '//?/C:/foo/bar'.
-      `,
-    },
-    follow: {
-        short: 'f',
-        description: `Follow symlinked directories when expanding '**'`,
-    },
-    realpath: {
-        short: 'R',
-        description: `Call 'fs.realpath' on all of the results. In the case
-                    of an entry that cannot be resolved, the entry is
-                    omitted. This incurs a slight performance penalty, of
-                    course, because of the added system calls.`,
-    },
-    stat: {
-        short: 's',
-        description: `Call 'fs.lstat' on all entries, whether required or not
-                    to determine if it's a valid match.`,
-    },
-    'match-base': {
-        short: 'b',
-        description: `Perform a basename-only match if the pattern does not
-                    contain any slash characters. That is, '*.js' would be
-                    treated as equivalent to '**/*.js', matching js files
-                    in all directories.
-      `,
-    },
-    dot: {
-        description: `Allow patterns to match files/directories that start
-                    with '.', even if the pattern does not start with '.'
-      `,
-    },
-    nobrace: {
-        description: 'Do not expand {...} patterns',
-    },
-    nocase: {
-        description: `Perform a case-insensitive match. This defaults to
-                    'true' on macOS and Windows platforms, and false on
-                    all others.
-
-                    Note: 'nocase' should only be explicitly set when it is
-                    known that the filesystem's case sensitivity differs
-                    from the platform default. If set 'true' on
-                    case-insensitive file systems, then the walk may return
-                    more or less results than expected.
-      `,
-    },
-    nodir: {
-        description: `Do not match directories, only files.
-
-                    Note: to *only* match directories, append a '/' at the
-                    end of the pattern.
-      `,
-    },
-    noext: {
-        description: `Do not expand extglob patterns, such as '+(a|b)'`,
-    },
-    noglobstar: {
-        description: `Do not expand '**' against multiple path portions.
-                    Ie, treat it as a normal '*' instead.`,
-    },
-    'windows-path-no-escape': {
-        description: `Use '\\' as a path separator *only*, and *never* as an
-                    escape character. If set, all '\\' characters are
-                    replaced with '/' in the pattern.`,
-    },
-})
-    .num({
-    'max-depth': {
-        short: 'D',
-        description: `Maximum depth to traverse from the current
-                    working directory`,
-    },
-})
-    .opt({
-    cwd: {
-        short: 'C',
-        description: 'Current working directory to execute/match in',
-        default: process.cwd(),
-    },
-    root: {
-        short: 'r',
-        description: `A string path resolved against the 'cwd', which is
-                    used as the starting point for absolute patterns that
-                    start with '/' (but not drive letters or UNC paths
-                    on Windows).
-
-                    Note that this *doesn't* necessarily limit the walk to
-                    the 'root' directory, and doesn't affect the cwd
-                    starting point for non-absolute patterns. A pattern
-                    containing '..' will still be able to traverse out of
-                    the root directory, if it is not an actual root directory
-                    on the filesystem, and any non-absolute patterns will
-                    still be matched in the 'cwd'.
-
-                    To start absolute and non-absolute patterns in the same
-                    path, you can use '--root=' to set it to the empty
-                    string. However, be aware that on Windows systems, a
-                    pattern like 'x:/*' or '//host/share/*' will *always*
-                    start in the 'x:/' or '//host/share/' directory,
-                    regardless of the --root setting.
-      `,
-    },
-    platform: {
-        description: `Defaults to the value of 'process.platform' if
-                    available, or 'linux' if not. Setting --platform=win32
-                    on non-Windows systems may cause strange behavior!`,
-        validate: v => new Set([
-            'aix',
-            'android',
-            'darwin',
-            'freebsd',
-            'haiku',
-            'linux',
-            'openbsd',
-            'sunos',
-            'win32',
-            'cygwin',
-            'netbsd',
-        ]).has(v),
-    },
-})
-    .optList({
-    ignore: {
-        short: 'i',
-        description: `Glob patterns to ignore`,
-    },
-})
-    .flag({
-    debug: {
-        short: 'v',
-        description: `Output a huge amount of noisy debug information about
-                    patterns as they are parsed and used to match files.`,
-    },
-})
-    .flag({
-    help: {
-        short: 'h',
-        description: 'Show this usage information',
-    },
-});
-try {
-    const { positionals, values } = j.parse();
-    if (values.help) {
-        console.log(j.usage());
-        process.exit(0);
-    }
-    if (positionals.length === 0 && !values.default)
-        throw 'No patterns provided';
-    if (positionals.length === 0 && values.default)
-        positionals.push(values.default);
-    const patterns = values.all
-        ? positionals
-        : positionals.filter(p => !(0, fs_1.existsSync)(p));
-    const matches = values.all ? [] : positionals.filter(p => (0, fs_1.existsSync)(p));
-    const stream = (0, index_js_1.globStream)(patterns, {
-        absolute: values.absolute,
-        cwd: values.cwd,
-        dot: values.dot,
-        dotRelative: values['dot-relative'],
-        follow: values.follow,
-        ignore: values.ignore,
-        mark: values.mark,
-        matchBase: values['match-base'],
-        maxDepth: values['max-depth'],
-        nobrace: values.nobrace,
-        nocase: values.nocase,
-        nodir: values.nodir,
-        noext: values.noext,
-        noglobstar: values.noglobstar,
-        platform: values.platform,
-        realpath: values.realpath,
-        root: values.root,
-        stat: values.stat,
-        debug: values.debug,
-        posix: values.posix,
-    });
-    const cmd = values.cmd;
-    if (!cmd) {
-        matches.forEach(m => console.log(m));
-        stream.on('data', f => console.log(f));
-    }
-    else {
-        stream.on('data', f => matches.push(f));
-        stream.on('end', () => (0, foreground_child_1.foregroundChild)(cmd, matches, { shell: true }));
-    }
-}
-catch (e) {
-    console.error(j.usage());
-    console.error(e instanceof Error ? e.message : String(e));
-    process.exit(1);
-}
-//# sourceMappingURL=bin.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/glob.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/glob.js
deleted file mode 100644
index eb37c6b9a6601..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/glob.js
+++ /dev/null
@@ -1,238 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.Glob = void 0;
-const minimatch_1 = require("minimatch");
-const path_scurry_1 = require("path-scurry");
-const url_1 = require("url");
-const pattern_js_1 = require("./pattern.js");
-const walker_js_1 = require("./walker.js");
-// if no process global, just call it linux.
-// so we default to case-sensitive, / separators
-const defaultPlatform = typeof process === 'object' &&
-    process &&
-    typeof process.platform === 'string'
-    ? process.platform
-    : 'linux';
-/**
- * An object that can perform glob pattern traversals.
- */
-class Glob {
-    absolute;
-    cwd;
-    root;
-    dot;
-    dotRelative;
-    follow;
-    ignore;
-    magicalBraces;
-    mark;
-    matchBase;
-    maxDepth;
-    nobrace;
-    nocase;
-    nodir;
-    noext;
-    noglobstar;
-    pattern;
-    platform;
-    realpath;
-    scurry;
-    stat;
-    signal;
-    windowsPathsNoEscape;
-    withFileTypes;
-    /**
-     * The options provided to the constructor.
-     */
-    opts;
-    /**
-     * An array of parsed immutable {@link Pattern} objects.
-     */
-    patterns;
-    /**
-     * All options are stored as properties on the `Glob` object.
-     *
-     * See {@link GlobOptions} for full options descriptions.
-     *
-     * Note that a previous `Glob` object can be passed as the
-     * `GlobOptions` to another `Glob` instantiation to re-use settings
-     * and caches with a new pattern.
-     *
-     * Traversal functions can be called multiple times to run the walk
-     * again.
-     */
-    constructor(pattern, opts) {
-        /* c8 ignore start */
-        if (!opts)
-            throw new TypeError('glob options required');
-        /* c8 ignore stop */
-        this.withFileTypes = !!opts.withFileTypes;
-        this.signal = opts.signal;
-        this.follow = !!opts.follow;
-        this.dot = !!opts.dot;
-        this.dotRelative = !!opts.dotRelative;
-        this.nodir = !!opts.nodir;
-        this.mark = !!opts.mark;
-        if (!opts.cwd) {
-            this.cwd = '';
-        }
-        else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {
-            opts.cwd = (0, url_1.fileURLToPath)(opts.cwd);
-        }
-        this.cwd = opts.cwd || '';
-        this.root = opts.root;
-        this.magicalBraces = !!opts.magicalBraces;
-        this.nobrace = !!opts.nobrace;
-        this.noext = !!opts.noext;
-        this.realpath = !!opts.realpath;
-        this.absolute = opts.absolute;
-        this.noglobstar = !!opts.noglobstar;
-        this.matchBase = !!opts.matchBase;
-        this.maxDepth =
-            typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity;
-        this.stat = !!opts.stat;
-        this.ignore = opts.ignore;
-        if (this.withFileTypes && this.absolute !== undefined) {
-            throw new Error('cannot set absolute and withFileTypes:true');
-        }
-        if (typeof pattern === 'string') {
-            pattern = [pattern];
-        }
-        this.windowsPathsNoEscape =
-            !!opts.windowsPathsNoEscape ||
-                opts.allowWindowsEscape === false;
-        if (this.windowsPathsNoEscape) {
-            pattern = pattern.map(p => p.replace(/\\/g, '/'));
-        }
-        if (this.matchBase) {
-            if (opts.noglobstar) {
-                throw new TypeError('base matching requires globstar');
-            }
-            pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`));
-        }
-        this.pattern = pattern;
-        this.platform = opts.platform || defaultPlatform;
-        this.opts = { ...opts, platform: this.platform };
-        if (opts.scurry) {
-            this.scurry = opts.scurry;
-            if (opts.nocase !== undefined &&
-                opts.nocase !== opts.scurry.nocase) {
-                throw new Error('nocase option contradicts provided scurry option');
-            }
-        }
-        else {
-            const Scurry = opts.platform === 'win32'
-                ? path_scurry_1.PathScurryWin32
-                : opts.platform === 'darwin'
-                    ? path_scurry_1.PathScurryDarwin
-                    : opts.platform
-                        ? path_scurry_1.PathScurryPosix
-                        : path_scurry_1.PathScurry;
-            this.scurry = new Scurry(this.cwd, {
-                nocase: opts.nocase,
-                fs: opts.fs,
-            });
-        }
-        this.nocase = this.scurry.nocase;
-        // If you do nocase:true on a case-sensitive file system, then
-        // we need to use regexps instead of strings for non-magic
-        // path portions, because statting `aBc` won't return results
-        // for the file `AbC` for example.
-        const nocaseMagicOnly = this.platform === 'darwin' || this.platform === 'win32';
-        const mmo = {
-            // default nocase based on platform
-            ...opts,
-            dot: this.dot,
-            matchBase: this.matchBase,
-            nobrace: this.nobrace,
-            nocase: this.nocase,
-            nocaseMagicOnly,
-            nocomment: true,
-            noext: this.noext,
-            nonegate: true,
-            optimizationLevel: 2,
-            platform: this.platform,
-            windowsPathsNoEscape: this.windowsPathsNoEscape,
-            debug: !!this.opts.debug,
-        };
-        const mms = this.pattern.map(p => new minimatch_1.Minimatch(p, mmo));
-        const [matchSet, globParts] = mms.reduce((set, m) => {
-            set[0].push(...m.set);
-            set[1].push(...m.globParts);
-            return set;
-        }, [[], []]);
-        this.patterns = matchSet.map((set, i) => {
-            return new pattern_js_1.Pattern(set, globParts[i], 0, this.platform);
-        });
-    }
-    async walk() {
-        // Walkers always return array of Path objects, so we just have to
-        // coerce them into the right shape.  It will have already called
-        // realpath() if the option was set to do so, so we know that's cached.
-        // start out knowing the cwd, at least
-        return [
-            ...(await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
-                ...this.opts,
-                maxDepth: this.maxDepth !== Infinity
-                    ? this.maxDepth + this.scurry.cwd.depth()
-                    : Infinity,
-                platform: this.platform,
-                nocase: this.nocase,
-            }).walk()),
-        ];
-    }
-    walkSync() {
-        return [
-            ...new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
-                ...this.opts,
-                maxDepth: this.maxDepth !== Infinity
-                    ? this.maxDepth + this.scurry.cwd.depth()
-                    : Infinity,
-                platform: this.platform,
-                nocase: this.nocase,
-            }).walkSync(),
-        ];
-    }
-    stream() {
-        return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
-            ...this.opts,
-            maxDepth: this.maxDepth !== Infinity
-                ? this.maxDepth + this.scurry.cwd.depth()
-                : Infinity,
-            platform: this.platform,
-            nocase: this.nocase,
-        }).stream();
-    }
-    streamSync() {
-        return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
-            ...this.opts,
-            maxDepth: this.maxDepth !== Infinity
-                ? this.maxDepth + this.scurry.cwd.depth()
-                : Infinity,
-            platform: this.platform,
-            nocase: this.nocase,
-        }).streamSync();
-    }
-    /**
-     * Default sync iteration function. Returns a Generator that
-     * iterates over the results.
-     */
-    iterateSync() {
-        return this.streamSync()[Symbol.iterator]();
-    }
-    [Symbol.iterator]() {
-        return this.iterateSync();
-    }
-    /**
-     * Default async iteration function. Returns an AsyncGenerator that
-     * iterates over the results.
-     */
-    iterate() {
-        return this.stream()[Symbol.asyncIterator]();
-    }
-    [Symbol.asyncIterator]() {
-        return this.iterate();
-    }
-}
-exports.Glob = Glob;
-//# sourceMappingURL=glob.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/has-magic.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/has-magic.js
deleted file mode 100644
index 0918bd57e0f1c..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/has-magic.js
+++ /dev/null
@@ -1,27 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.hasMagic = void 0;
-const minimatch_1 = require("minimatch");
-/**
- * Return true if the patterns provided contain any magic glob characters,
- * given the options provided.
- *
- * Brace expansion is not considered "magic" unless the `magicalBraces` option
- * is set, as brace expansion just turns one string into an array of strings.
- * So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and
- * `'xby'` both do not contain any magic glob characters, and it's treated the
- * same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`
- * is in the options, brace expansion _is_ treated as a pattern having magic.
- */
-const hasMagic = (pattern, options = {}) => {
-    if (!Array.isArray(pattern)) {
-        pattern = [pattern];
-    }
-    for (const p of pattern) {
-        if (new minimatch_1.Minimatch(p, options).hasMagic())
-            return true;
-    }
-    return false;
-};
-exports.hasMagic = hasMagic;
-//# sourceMappingURL=has-magic.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/ignore.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/ignore.js
deleted file mode 100644
index 0cbcca335e1cc..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/ignore.js
+++ /dev/null
@@ -1,103 +0,0 @@
-"use strict";
-// give it a pattern, and it'll be able to tell you if
-// a given path should be ignored.
-// Ignoring a path ignores its children if the pattern ends in /**
-// Ignores are always parsed in dot:true mode
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.Ignore = void 0;
-const minimatch_1 = require("minimatch");
-const pattern_js_1 = require("./pattern.js");
-const defaultPlatform = typeof process === 'object' &&
-    process &&
-    typeof process.platform === 'string'
-    ? process.platform
-    : 'linux';
-/**
- * Class used to process ignored patterns
- */
-class Ignore {
-    relative;
-    relativeChildren;
-    absolute;
-    absoluteChildren;
-    constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform, }) {
-        this.relative = [];
-        this.absolute = [];
-        this.relativeChildren = [];
-        this.absoluteChildren = [];
-        const mmopts = {
-            dot: true,
-            nobrace,
-            nocase,
-            noext,
-            noglobstar,
-            optimizationLevel: 2,
-            platform,
-            nocomment: true,
-            nonegate: true,
-        };
-        // this is a little weird, but it gives us a clean set of optimized
-        // minimatch matchers, without getting tripped up if one of them
-        // ends in /** inside a brace section, and it's only inefficient at
-        // the start of the walk, not along it.
-        // It'd be nice if the Pattern class just had a .test() method, but
-        // handling globstars is a bit of a pita, and that code already lives
-        // in minimatch anyway.
-        // Another way would be if maybe Minimatch could take its set/globParts
-        // as an option, and then we could at least just use Pattern to test
-        // for absolute-ness.
-        // Yet another way, Minimatch could take an array of glob strings, and
-        // a cwd option, and do the right thing.
-        for (const ign of ignored) {
-            const mm = new minimatch_1.Minimatch(ign, mmopts);
-            for (let i = 0; i < mm.set.length; i++) {
-                const parsed = mm.set[i];
-                const globParts = mm.globParts[i];
-                const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform);
-                const m = new minimatch_1.Minimatch(p.globString(), mmopts);
-                const children = globParts[globParts.length - 1] === '**';
-                const absolute = p.isAbsolute();
-                if (absolute)
-                    this.absolute.push(m);
-                else
-                    this.relative.push(m);
-                if (children) {
-                    if (absolute)
-                        this.absoluteChildren.push(m);
-                    else
-                        this.relativeChildren.push(m);
-                }
-            }
-        }
-    }
-    ignored(p) {
-        const fullpath = p.fullpath();
-        const fullpaths = `${fullpath}/`;
-        const relative = p.relative() || '.';
-        const relatives = `${relative}/`;
-        for (const m of this.relative) {
-            if (m.match(relative) || m.match(relatives))
-                return true;
-        }
-        for (const m of this.absolute) {
-            if (m.match(fullpath) || m.match(fullpaths))
-                return true;
-        }
-        return false;
-    }
-    childrenIgnored(p) {
-        const fullpath = p.fullpath() + '/';
-        const relative = (p.relative() || '.') + '/';
-        for (const m of this.relativeChildren) {
-            if (m.match(relative))
-                return true;
-        }
-        for (const m of this.absoluteChildren) {
-            if (m.match(fullpath))
-                true;
-        }
-        return false;
-    }
-}
-exports.Ignore = Ignore;
-//# sourceMappingURL=ignore.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/index.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/index.js
deleted file mode 100644
index 71c31c03dd339..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/index.js
+++ /dev/null
@@ -1,68 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.glob = exports.hasMagic = exports.Glob = exports.unescape = exports.escape = exports.sync = exports.iterate = exports.iterateSync = exports.stream = exports.streamSync = exports.globIterate = exports.globIterateSync = exports.globSync = exports.globStream = exports.globStreamSync = void 0;
-const minimatch_1 = require("minimatch");
-const glob_js_1 = require("./glob.js");
-const has_magic_js_1 = require("./has-magic.js");
-function globStreamSync(pattern, options = {}) {
-    return new glob_js_1.Glob(pattern, options).streamSync();
-}
-exports.globStreamSync = globStreamSync;
-function globStream(pattern, options = {}) {
-    return new glob_js_1.Glob(pattern, options).stream();
-}
-exports.globStream = globStream;
-function globSync(pattern, options = {}) {
-    return new glob_js_1.Glob(pattern, options).walkSync();
-}
-exports.globSync = globSync;
-async function glob_(pattern, options = {}) {
-    return new glob_js_1.Glob(pattern, options).walk();
-}
-function globIterateSync(pattern, options = {}) {
-    return new glob_js_1.Glob(pattern, options).iterateSync();
-}
-exports.globIterateSync = globIterateSync;
-function globIterate(pattern, options = {}) {
-    return new glob_js_1.Glob(pattern, options).iterate();
-}
-exports.globIterate = globIterate;
-// aliases: glob.sync.stream() glob.stream.sync() glob.sync() etc
-exports.streamSync = globStreamSync;
-exports.stream = Object.assign(globStream, { sync: globStreamSync });
-exports.iterateSync = globIterateSync;
-exports.iterate = Object.assign(globIterate, {
-    sync: globIterateSync,
-});
-exports.sync = Object.assign(globSync, {
-    stream: globStreamSync,
-    iterate: globIterateSync,
-});
-/* c8 ignore start */
-var minimatch_2 = require("minimatch");
-Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return minimatch_2.escape; } });
-Object.defineProperty(exports, "unescape", { enumerable: true, get: function () { return minimatch_2.unescape; } });
-var glob_js_2 = require("./glob.js");
-Object.defineProperty(exports, "Glob", { enumerable: true, get: function () { return glob_js_2.Glob; } });
-var has_magic_js_2 = require("./has-magic.js");
-Object.defineProperty(exports, "hasMagic", { enumerable: true, get: function () { return has_magic_js_2.hasMagic; } });
-/* c8 ignore stop */
-exports.glob = Object.assign(glob_, {
-    glob: glob_,
-    globSync,
-    sync: exports.sync,
-    globStream,
-    stream: exports.stream,
-    globStreamSync,
-    streamSync: exports.streamSync,
-    globIterate,
-    iterate: exports.iterate,
-    globIterateSync,
-    iterateSync: exports.iterateSync,
-    Glob: glob_js_1.Glob,
-    hasMagic: has_magic_js_1.hasMagic,
-    escape: minimatch_1.escape,
-    unescape: minimatch_1.unescape,
-});
-exports.glob.glob = exports.glob;
-//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/pattern.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/pattern.js
deleted file mode 100644
index 181371293d860..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/pattern.js
+++ /dev/null
@@ -1,219 +0,0 @@
-"use strict";
-// this is just a very light wrapper around 2 arrays with an offset index
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.Pattern = void 0;
-const minimatch_1 = require("minimatch");
-const isPatternList = (pl) => pl.length >= 1;
-const isGlobList = (gl) => gl.length >= 1;
-/**
- * An immutable-ish view on an array of glob parts and their parsed
- * results
- */
-class Pattern {
-    #patternList;
-    #globList;
-    #index;
-    length;
-    #platform;
-    #rest;
-    #globString;
-    #isDrive;
-    #isUNC;
-    #isAbsolute;
-    #followGlobstar = true;
-    constructor(patternList, globList, index, platform) {
-        if (!isPatternList(patternList)) {
-            throw new TypeError('empty pattern list');
-        }
-        if (!isGlobList(globList)) {
-            throw new TypeError('empty glob list');
-        }
-        if (globList.length !== patternList.length) {
-            throw new TypeError('mismatched pattern list and glob list lengths');
-        }
-        this.length = patternList.length;
-        if (index < 0 || index >= this.length) {
-            throw new TypeError('index out of range');
-        }
-        this.#patternList = patternList;
-        this.#globList = globList;
-        this.#index = index;
-        this.#platform = platform;
-        // normalize root entries of absolute patterns on initial creation.
-        if (this.#index === 0) {
-            // c: => ['c:/']
-            // C:/ => ['C:/']
-            // C:/x => ['C:/', 'x']
-            // //host/share => ['//host/share/']
-            // //host/share/ => ['//host/share/']
-            // //host/share/x => ['//host/share/', 'x']
-            // /etc => ['/', 'etc']
-            // / => ['/']
-            if (this.isUNC()) {
-                // '' / '' / 'host' / 'share'
-                const [p0, p1, p2, p3, ...prest] = this.#patternList;
-                const [g0, g1, g2, g3, ...grest] = this.#globList;
-                if (prest[0] === '') {
-                    // ends in /
-                    prest.shift();
-                    grest.shift();
-                }
-                const p = [p0, p1, p2, p3, ''].join('/');
-                const g = [g0, g1, g2, g3, ''].join('/');
-                this.#patternList = [p, ...prest];
-                this.#globList = [g, ...grest];
-                this.length = this.#patternList.length;
-            }
-            else if (this.isDrive() || this.isAbsolute()) {
-                const [p1, ...prest] = this.#patternList;
-                const [g1, ...grest] = this.#globList;
-                if (prest[0] === '') {
-                    // ends in /
-                    prest.shift();
-                    grest.shift();
-                }
-                const p = p1 + '/';
-                const g = g1 + '/';
-                this.#patternList = [p, ...prest];
-                this.#globList = [g, ...grest];
-                this.length = this.#patternList.length;
-            }
-        }
-    }
-    /**
-     * The first entry in the parsed list of patterns
-     */
-    pattern() {
-        return this.#patternList[this.#index];
-    }
-    /**
-     * true of if pattern() returns a string
-     */
-    isString() {
-        return typeof this.#patternList[this.#index] === 'string';
-    }
-    /**
-     * true of if pattern() returns GLOBSTAR
-     */
-    isGlobstar() {
-        return this.#patternList[this.#index] === minimatch_1.GLOBSTAR;
-    }
-    /**
-     * true if pattern() returns a regexp
-     */
-    isRegExp() {
-        return this.#patternList[this.#index] instanceof RegExp;
-    }
-    /**
-     * The /-joined set of glob parts that make up this pattern
-     */
-    globString() {
-        return (this.#globString =
-            this.#globString ||
-                (this.#index === 0
-                    ? this.isAbsolute()
-                        ? this.#globList[0] + this.#globList.slice(1).join('/')
-                        : this.#globList.join('/')
-                    : this.#globList.slice(this.#index).join('/')));
-    }
-    /**
-     * true if there are more pattern parts after this one
-     */
-    hasMore() {
-        return this.length > this.#index + 1;
-    }
-    /**
-     * The rest of the pattern after this part, or null if this is the end
-     */
-    rest() {
-        if (this.#rest !== undefined)
-            return this.#rest;
-        if (!this.hasMore())
-            return (this.#rest = null);
-        this.#rest = new Pattern(this.#patternList, this.#globList, this.#index + 1, this.#platform);
-        this.#rest.#isAbsolute = this.#isAbsolute;
-        this.#rest.#isUNC = this.#isUNC;
-        this.#rest.#isDrive = this.#isDrive;
-        return this.#rest;
-    }
-    /**
-     * true if the pattern represents a //unc/path/ on windows
-     */
-    isUNC() {
-        const pl = this.#patternList;
-        return this.#isUNC !== undefined
-            ? this.#isUNC
-            : (this.#isUNC =
-                this.#platform === 'win32' &&
-                    this.#index === 0 &&
-                    pl[0] === '' &&
-                    pl[1] === '' &&
-                    typeof pl[2] === 'string' &&
-                    !!pl[2] &&
-                    typeof pl[3] === 'string' &&
-                    !!pl[3]);
-    }
-    // pattern like C:/...
-    // split = ['C:', ...]
-    // XXX: would be nice to handle patterns like `c:*` to test the cwd
-    // in c: for *, but I don't know of a way to even figure out what that
-    // cwd is without actually chdir'ing into it?
-    /**
-     * True if the pattern starts with a drive letter on Windows
-     */
-    isDrive() {
-        const pl = this.#patternList;
-        return this.#isDrive !== undefined
-            ? this.#isDrive
-            : (this.#isDrive =
-                this.#platform === 'win32' &&
-                    this.#index === 0 &&
-                    this.length > 1 &&
-                    typeof pl[0] === 'string' &&
-                    /^[a-z]:$/i.test(pl[0]));
-    }
-    // pattern = '/' or '/...' or '/x/...'
-    // split = ['', ''] or ['', ...] or ['', 'x', ...]
-    // Drive and UNC both considered absolute on windows
-    /**
-     * True if the pattern is rooted on an absolute path
-     */
-    isAbsolute() {
-        const pl = this.#patternList;
-        return this.#isAbsolute !== undefined
-            ? this.#isAbsolute
-            : (this.#isAbsolute =
-                (pl[0] === '' && pl.length > 1) ||
-                    this.isDrive() ||
-                    this.isUNC());
-    }
-    /**
-     * consume the root of the pattern, and return it
-     */
-    root() {
-        const p = this.#patternList[0];
-        return typeof p === 'string' && this.isAbsolute() && this.#index === 0
-            ? p
-            : '';
-    }
-    /**
-     * Check to see if the current globstar pattern is allowed to follow
-     * a symbolic link.
-     */
-    checkFollowGlobstar() {
-        return !(this.#index === 0 ||
-            !this.isGlobstar() ||
-            !this.#followGlobstar);
-    }
-    /**
-     * Mark that the current globstar pattern is following a symbolic link
-     */
-    markFollowGlobstar() {
-        if (this.#index === 0 || !this.isGlobstar() || !this.#followGlobstar)
-            return false;
-        this.#followGlobstar = false;
-        return true;
-    }
-}
-exports.Pattern = Pattern;
-//# sourceMappingURL=pattern.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/processor.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/processor.js
deleted file mode 100644
index bd067e9b9033d..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/processor.js
+++ /dev/null
@@ -1,309 +0,0 @@
-"use strict";
-// synchronous utility for filtering entries and calculating subwalks
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.Processor = exports.SubWalks = exports.MatchRecord = exports.HasWalkedCache = void 0;
-const minimatch_1 = require("minimatch");
-/**
- * A cache of which patterns have been processed for a given Path
- */
-class HasWalkedCache {
-    store;
-    constructor(store = new Map()) {
-        this.store = store;
-    }
-    copy() {
-        return new HasWalkedCache(new Map(this.store));
-    }
-    hasWalked(target, pattern) {
-        return this.store.get(target.fullpath())?.has(pattern.globString());
-    }
-    storeWalked(target, pattern) {
-        const fullpath = target.fullpath();
-        const cached = this.store.get(fullpath);
-        if (cached)
-            cached.add(pattern.globString());
-        else
-            this.store.set(fullpath, new Set([pattern.globString()]));
-    }
-}
-exports.HasWalkedCache = HasWalkedCache;
-/**
- * A record of which paths have been matched in a given walk step,
- * and whether they only are considered a match if they are a directory,
- * and whether their absolute or relative path should be returned.
- */
-class MatchRecord {
-    store = new Map();
-    add(target, absolute, ifDir) {
-        const n = (absolute ? 2 : 0) | (ifDir ? 1 : 0);
-        const current = this.store.get(target);
-        this.store.set(target, current === undefined ? n : n & current);
-    }
-    // match, absolute, ifdir
-    entries() {
-        return [...this.store.entries()].map(([path, n]) => [
-            path,
-            !!(n & 2),
-            !!(n & 1),
-        ]);
-    }
-}
-exports.MatchRecord = MatchRecord;
-/**
- * A collection of patterns that must be processed in a subsequent step
- * for a given path.
- */
-class SubWalks {
-    store = new Map();
-    add(target, pattern) {
-        if (!target.canReaddir()) {
-            return;
-        }
-        const subs = this.store.get(target);
-        if (subs) {
-            if (!subs.find(p => p.globString() === pattern.globString())) {
-                subs.push(pattern);
-            }
-        }
-        else
-            this.store.set(target, [pattern]);
-    }
-    get(target) {
-        const subs = this.store.get(target);
-        /* c8 ignore start */
-        if (!subs) {
-            throw new Error('attempting to walk unknown path');
-        }
-        /* c8 ignore stop */
-        return subs;
-    }
-    entries() {
-        return this.keys().map(k => [k, this.store.get(k)]);
-    }
-    keys() {
-        return [...this.store.keys()].filter(t => t.canReaddir());
-    }
-}
-exports.SubWalks = SubWalks;
-/**
- * The class that processes patterns for a given path.
- *
- * Handles child entry filtering, and determining whether a path's
- * directory contents must be read.
- */
-class Processor {
-    hasWalkedCache;
-    matches = new MatchRecord();
-    subwalks = new SubWalks();
-    patterns;
-    follow;
-    dot;
-    opts;
-    constructor(opts, hasWalkedCache) {
-        this.opts = opts;
-        this.follow = !!opts.follow;
-        this.dot = !!opts.dot;
-        this.hasWalkedCache = hasWalkedCache
-            ? hasWalkedCache.copy()
-            : new HasWalkedCache();
-    }
-    processPatterns(target, patterns) {
-        this.patterns = patterns;
-        const processingSet = patterns.map(p => [target, p]);
-        // map of paths to the magic-starting subwalks they need to walk
-        // first item in patterns is the filter
-        for (let [t, pattern] of processingSet) {
-            this.hasWalkedCache.storeWalked(t, pattern);
-            const root = pattern.root();
-            const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
-            // start absolute patterns at root
-            if (root) {
-                t = t.resolve(root === '/' && this.opts.root !== undefined
-                    ? this.opts.root
-                    : root);
-                const rest = pattern.rest();
-                if (!rest) {
-                    this.matches.add(t, true, false);
-                    continue;
-                }
-                else {
-                    pattern = rest;
-                }
-            }
-            if (t.isENOENT())
-                continue;
-            let p;
-            let rest;
-            let changed = false;
-            while (typeof (p = pattern.pattern()) === 'string' &&
-                (rest = pattern.rest())) {
-                const c = t.resolve(p);
-                // we can be reasonably sure that .. is a readable dir
-                if (c.isUnknown() && p !== '..')
-                    break;
-                t = c;
-                pattern = rest;
-                changed = true;
-            }
-            p = pattern.pattern();
-            rest = pattern.rest();
-            if (changed) {
-                if (this.hasWalkedCache.hasWalked(t, pattern))
-                    continue;
-                this.hasWalkedCache.storeWalked(t, pattern);
-            }
-            // now we have either a final string for a known entry,
-            // more strings for an unknown entry,
-            // or a pattern starting with magic, mounted on t.
-            if (typeof p === 'string') {
-                // must be final entry
-                if (!rest) {
-                    const ifDir = p === '..' || p === '' || p === '.';
-                    this.matches.add(t.resolve(p), absolute, ifDir);
-                }
-                else {
-                    this.subwalks.add(t, pattern);
-                }
-                continue;
-            }
-            else if (p === minimatch_1.GLOBSTAR) {
-                // if no rest, match and subwalk pattern
-                // if rest, process rest and subwalk pattern
-                // if it's a symlink, but we didn't get here by way of a
-                // globstar match (meaning it's the first time THIS globstar
-                // has traversed a symlink), then we follow it. Otherwise, stop.
-                if (!t.isSymbolicLink() ||
-                    this.follow ||
-                    pattern.checkFollowGlobstar()) {
-                    this.subwalks.add(t, pattern);
-                }
-                const rp = rest?.pattern();
-                const rrest = rest?.rest();
-                if (!rest || ((rp === '' || rp === '.') && !rrest)) {
-                    // only HAS to be a dir if it ends in **/ or **/.
-                    // but ending in ** will match files as well.
-                    this.matches.add(t, absolute, rp === '' || rp === '.');
-                }
-                else {
-                    if (rp === '..') {
-                        // this would mean you're matching **/.. at the fs root,
-                        // and no thanks, I'm not gonna test that specific case.
-                        /* c8 ignore start */
-                        const tp = t.parent || t;
-                        /* c8 ignore stop */
-                        if (!rrest)
-                            this.matches.add(tp, absolute, true);
-                        else if (!this.hasWalkedCache.hasWalked(tp, rrest)) {
-                            this.subwalks.add(tp, rrest);
-                        }
-                    }
-                }
-            }
-            else if (p instanceof RegExp) {
-                this.subwalks.add(t, pattern);
-            }
-        }
-        return this;
-    }
-    subwalkTargets() {
-        return this.subwalks.keys();
-    }
-    child() {
-        return new Processor(this.opts, this.hasWalkedCache);
-    }
-    // return a new Processor containing the subwalks for each
-    // child entry, and a set of matches, and
-    // a hasWalkedCache that's a copy of this one
-    // then we're going to call
-    filterEntries(parent, entries) {
-        const patterns = this.subwalks.get(parent);
-        // put matches and entry walks into the results processor
-        const results = this.child();
-        for (const e of entries) {
-            for (const pattern of patterns) {
-                const absolute = pattern.isAbsolute();
-                const p = pattern.pattern();
-                const rest = pattern.rest();
-                if (p === minimatch_1.GLOBSTAR) {
-                    results.testGlobstar(e, pattern, rest, absolute);
-                }
-                else if (p instanceof RegExp) {
-                    results.testRegExp(e, p, rest, absolute);
-                }
-                else {
-                    results.testString(e, p, rest, absolute);
-                }
-            }
-        }
-        return results;
-    }
-    testGlobstar(e, pattern, rest, absolute) {
-        if (this.dot || !e.name.startsWith('.')) {
-            if (!pattern.hasMore()) {
-                this.matches.add(e, absolute, false);
-            }
-            if (e.canReaddir()) {
-                // if we're in follow mode or it's not a symlink, just keep
-                // testing the same pattern. If there's more after the globstar,
-                // then this symlink consumes the globstar. If not, then we can
-                // follow at most ONE symlink along the way, so we mark it, which
-                // also checks to ensure that it wasn't already marked.
-                if (this.follow || !e.isSymbolicLink()) {
-                    this.subwalks.add(e, pattern);
-                }
-                else if (e.isSymbolicLink()) {
-                    if (rest && pattern.checkFollowGlobstar()) {
-                        this.subwalks.add(e, rest);
-                    }
-                    else if (pattern.markFollowGlobstar()) {
-                        this.subwalks.add(e, pattern);
-                    }
-                }
-            }
-        }
-        // if the NEXT thing matches this entry, then also add
-        // the rest.
-        if (rest) {
-            const rp = rest.pattern();
-            if (typeof rp === 'string' &&
-                // dots and empty were handled already
-                rp !== '..' &&
-                rp !== '' &&
-                rp !== '.') {
-                this.testString(e, rp, rest.rest(), absolute);
-            }
-            else if (rp === '..') {
-                /* c8 ignore start */
-                const ep = e.parent || e;
-                /* c8 ignore stop */
-                this.subwalks.add(ep, rest);
-            }
-            else if (rp instanceof RegExp) {
-                this.testRegExp(e, rp, rest.rest(), absolute);
-            }
-        }
-    }
-    testRegExp(e, p, rest, absolute) {
-        if (!p.test(e.name))
-            return;
-        if (!rest) {
-            this.matches.add(e, absolute, false);
-        }
-        else {
-            this.subwalks.add(e, rest);
-        }
-    }
-    testString(e, p, rest, absolute) {
-        // should never happen?
-        if (!e.isNamed(p))
-            return;
-        if (!rest) {
-            this.matches.add(e, absolute, false);
-        }
-        else {
-            this.subwalks.add(e, rest);
-        }
-    }
-}
-exports.Processor = Processor;
-//# sourceMappingURL=processor.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/walker.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/walker.js
deleted file mode 100644
index 9651ce1164016..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/cjs/src/walker.js
+++ /dev/null
@@ -1,358 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.GlobStream = exports.GlobWalker = exports.GlobUtil = void 0;
-/**
- * Single-use utility classes to provide functionality to the {@link Glob}
- * methods.
- *
- * @module
- */
-const minipass_1 = require("minipass");
-const ignore_js_1 = require("./ignore.js");
-const processor_js_1 = require("./processor.js");
-const makeIgnore = (ignore, opts) => typeof ignore === 'string'
-    ? new ignore_js_1.Ignore([ignore], opts)
-    : Array.isArray(ignore)
-        ? new ignore_js_1.Ignore(ignore, opts)
-        : ignore;
-/**
- * basic walking utilities that all the glob walker types use
- */
-class GlobUtil {
-    path;
-    patterns;
-    opts;
-    seen = new Set();
-    paused = false;
-    aborted = false;
-    #onResume = [];
-    #ignore;
-    #sep;
-    signal;
-    maxDepth;
-    constructor(patterns, path, opts) {
-        this.patterns = patterns;
-        this.path = path;
-        this.opts = opts;
-        this.#sep = !opts.posix && opts.platform === 'win32' ? '\\' : '/';
-        if (opts.ignore) {
-            this.#ignore = makeIgnore(opts.ignore, opts);
-        }
-        // ignore, always set with maxDepth, but it's optional on the
-        // GlobOptions type
-        /* c8 ignore start */
-        this.maxDepth = opts.maxDepth || Infinity;
-        /* c8 ignore stop */
-        if (opts.signal) {
-            this.signal = opts.signal;
-            this.signal.addEventListener('abort', () => {
-                this.#onResume.length = 0;
-            });
-        }
-    }
-    #ignored(path) {
-        return this.seen.has(path) || !!this.#ignore?.ignored?.(path);
-    }
-    #childrenIgnored(path) {
-        return !!this.#ignore?.childrenIgnored?.(path);
-    }
-    // backpressure mechanism
-    pause() {
-        this.paused = true;
-    }
-    resume() {
-        /* c8 ignore start */
-        if (this.signal?.aborted)
-            return;
-        /* c8 ignore stop */
-        this.paused = false;
-        let fn = undefined;
-        while (!this.paused && (fn = this.#onResume.shift())) {
-            fn();
-        }
-    }
-    onResume(fn) {
-        if (this.signal?.aborted)
-            return;
-        /* c8 ignore start */
-        if (!this.paused) {
-            fn();
-        }
-        else {
-            /* c8 ignore stop */
-            this.#onResume.push(fn);
-        }
-    }
-    // do the requisite realpath/stat checking, and return the path
-    // to add or undefined to filter it out.
-    async matchCheck(e, ifDir) {
-        if (ifDir && this.opts.nodir)
-            return undefined;
-        let rpc;
-        if (this.opts.realpath) {
-            rpc = e.realpathCached() || (await e.realpath());
-            if (!rpc)
-                return undefined;
-            e = rpc;
-        }
-        const needStat = e.isUnknown() || this.opts.stat;
-        return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir);
-    }
-    matchCheckTest(e, ifDir) {
-        return e &&
-            (this.maxDepth === Infinity || e.depth() <= this.maxDepth) &&
-            (!ifDir || e.canReaddir()) &&
-            (!this.opts.nodir || !e.isDirectory()) &&
-            !this.#ignored(e)
-            ? e
-            : undefined;
-    }
-    matchCheckSync(e, ifDir) {
-        if (ifDir && this.opts.nodir)
-            return undefined;
-        let rpc;
-        if (this.opts.realpath) {
-            rpc = e.realpathCached() || e.realpathSync();
-            if (!rpc)
-                return undefined;
-            e = rpc;
-        }
-        const needStat = e.isUnknown() || this.opts.stat;
-        return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir);
-    }
-    matchFinish(e, absolute) {
-        if (this.#ignored(e))
-            return;
-        const abs = this.opts.absolute === undefined ? absolute : this.opts.absolute;
-        this.seen.add(e);
-        const mark = this.opts.mark && e.isDirectory() ? this.#sep : '';
-        // ok, we have what we need!
-        if (this.opts.withFileTypes) {
-            this.matchEmit(e);
-        }
-        else if (abs) {
-            const abs = this.opts.posix ? e.fullpathPosix() : e.fullpath();
-            this.matchEmit(abs + mark);
-        }
-        else {
-            const rel = this.opts.posix ? e.relativePosix() : e.relative();
-            const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep)
-                ? '.' + this.#sep
-                : '';
-            this.matchEmit(!rel ? '.' + mark : pre + rel + mark);
-        }
-    }
-    async match(e, absolute, ifDir) {
-        const p = await this.matchCheck(e, ifDir);
-        if (p)
-            this.matchFinish(p, absolute);
-    }
-    matchSync(e, absolute, ifDir) {
-        const p = this.matchCheckSync(e, ifDir);
-        if (p)
-            this.matchFinish(p, absolute);
-    }
-    walkCB(target, patterns, cb) {
-        /* c8 ignore start */
-        if (this.signal?.aborted)
-            cb();
-        /* c8 ignore stop */
-        this.walkCB2(target, patterns, new processor_js_1.Processor(this.opts), cb);
-    }
-    walkCB2(target, patterns, processor, cb) {
-        if (this.#childrenIgnored(target))
-            return cb();
-        if (this.signal?.aborted)
-            cb();
-        if (this.paused) {
-            this.onResume(() => this.walkCB2(target, patterns, processor, cb));
-            return;
-        }
-        processor.processPatterns(target, patterns);
-        // done processing.  all of the above is sync, can be abstracted out.
-        // subwalks is a map of paths to the entry filters they need
-        // matches is a map of paths to [absolute, ifDir] tuples.
-        let tasks = 1;
-        const next = () => {
-            if (--tasks === 0)
-                cb();
-        };
-        for (const [m, absolute, ifDir] of processor.matches.entries()) {
-            if (this.#ignored(m))
-                continue;
-            tasks++;
-            this.match(m, absolute, ifDir).then(() => next());
-        }
-        for (const t of processor.subwalkTargets()) {
-            if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {
-                continue;
-            }
-            tasks++;
-            const childrenCached = t.readdirCached();
-            if (t.calledReaddir())
-                this.walkCB3(t, childrenCached, processor, next);
-            else {
-                t.readdirCB((_, entries) => this.walkCB3(t, entries, processor, next), true);
-            }
-        }
-        next();
-    }
-    walkCB3(target, entries, processor, cb) {
-        processor = processor.filterEntries(target, entries);
-        let tasks = 1;
-        const next = () => {
-            if (--tasks === 0)
-                cb();
-        };
-        for (const [m, absolute, ifDir] of processor.matches.entries()) {
-            if (this.#ignored(m))
-                continue;
-            tasks++;
-            this.match(m, absolute, ifDir).then(() => next());
-        }
-        for (const [target, patterns] of processor.subwalks.entries()) {
-            tasks++;
-            this.walkCB2(target, patterns, processor.child(), next);
-        }
-        next();
-    }
-    walkCBSync(target, patterns, cb) {
-        /* c8 ignore start */
-        if (this.signal?.aborted)
-            cb();
-        /* c8 ignore stop */
-        this.walkCB2Sync(target, patterns, new processor_js_1.Processor(this.opts), cb);
-    }
-    walkCB2Sync(target, patterns, processor, cb) {
-        if (this.#childrenIgnored(target))
-            return cb();
-        if (this.signal?.aborted)
-            cb();
-        if (this.paused) {
-            this.onResume(() => this.walkCB2Sync(target, patterns, processor, cb));
-            return;
-        }
-        processor.processPatterns(target, patterns);
-        // done processing.  all of the above is sync, can be abstracted out.
-        // subwalks is a map of paths to the entry filters they need
-        // matches is a map of paths to [absolute, ifDir] tuples.
-        let tasks = 1;
-        const next = () => {
-            if (--tasks === 0)
-                cb();
-        };
-        for (const [m, absolute, ifDir] of processor.matches.entries()) {
-            if (this.#ignored(m))
-                continue;
-            this.matchSync(m, absolute, ifDir);
-        }
-        for (const t of processor.subwalkTargets()) {
-            if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {
-                continue;
-            }
-            tasks++;
-            const children = t.readdirSync();
-            this.walkCB3Sync(t, children, processor, next);
-        }
-        next();
-    }
-    walkCB3Sync(target, entries, processor, cb) {
-        processor = processor.filterEntries(target, entries);
-        let tasks = 1;
-        const next = () => {
-            if (--tasks === 0)
-                cb();
-        };
-        for (const [m, absolute, ifDir] of processor.matches.entries()) {
-            if (this.#ignored(m))
-                continue;
-            this.matchSync(m, absolute, ifDir);
-        }
-        for (const [target, patterns] of processor.subwalks.entries()) {
-            tasks++;
-            this.walkCB2Sync(target, patterns, processor.child(), next);
-        }
-        next();
-    }
-}
-exports.GlobUtil = GlobUtil;
-class GlobWalker extends GlobUtil {
-    matches;
-    constructor(patterns, path, opts) {
-        super(patterns, path, opts);
-        this.matches = new Set();
-    }
-    matchEmit(e) {
-        this.matches.add(e);
-    }
-    async walk() {
-        if (this.signal?.aborted)
-            throw this.signal.reason;
-        if (this.path.isUnknown()) {
-            await this.path.lstat();
-        }
-        await new Promise((res, rej) => {
-            this.walkCB(this.path, this.patterns, () => {
-                if (this.signal?.aborted) {
-                    rej(this.signal.reason);
-                }
-                else {
-                    res(this.matches);
-                }
-            });
-        });
-        return this.matches;
-    }
-    walkSync() {
-        if (this.signal?.aborted)
-            throw this.signal.reason;
-        if (this.path.isUnknown()) {
-            this.path.lstatSync();
-        }
-        // nothing for the callback to do, because this never pauses
-        this.walkCBSync(this.path, this.patterns, () => {
-            if (this.signal?.aborted)
-                throw this.signal.reason;
-        });
-        return this.matches;
-    }
-}
-exports.GlobWalker = GlobWalker;
-class GlobStream extends GlobUtil {
-    results;
-    constructor(patterns, path, opts) {
-        super(patterns, path, opts);
-        this.results = new minipass_1.Minipass({
-            signal: this.signal,
-            objectMode: true,
-        });
-        this.results.on('drain', () => this.resume());
-        this.results.on('resume', () => this.resume());
-    }
-    matchEmit(e) {
-        this.results.write(e);
-        if (!this.results.flowing)
-            this.pause();
-    }
-    stream() {
-        const target = this.path;
-        if (target.isUnknown()) {
-            target.lstat().then(() => {
-                this.walkCB(target, this.patterns, () => this.results.end());
-            });
-        }
-        else {
-            this.walkCB(target, this.patterns, () => this.results.end());
-        }
-        return this.results;
-    }
-    streamSync() {
-        if (this.path.isUnknown()) {
-            this.path.lstatSync();
-        }
-        this.walkCBSync(this.path, this.patterns, () => this.results.end());
-        return this.results;
-    }
-}
-exports.GlobStream = GlobStream;
-//# sourceMappingURL=walker.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/glob.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/glob.js
deleted file mode 100644
index 8ff26154427be..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/glob.js
+++ /dev/null
@@ -1,234 +0,0 @@
-import { Minimatch } from 'minimatch';
-import { PathScurry, PathScurryDarwin, PathScurryPosix, PathScurryWin32, } from 'path-scurry';
-import { fileURLToPath } from 'url';
-import { Pattern } from './pattern.js';
-import { GlobStream, GlobWalker } from './walker.js';
-// if no process global, just call it linux.
-// so we default to case-sensitive, / separators
-const defaultPlatform = typeof process === 'object' &&
-    process &&
-    typeof process.platform === 'string'
-    ? process.platform
-    : 'linux';
-/**
- * An object that can perform glob pattern traversals.
- */
-export class Glob {
-    absolute;
-    cwd;
-    root;
-    dot;
-    dotRelative;
-    follow;
-    ignore;
-    magicalBraces;
-    mark;
-    matchBase;
-    maxDepth;
-    nobrace;
-    nocase;
-    nodir;
-    noext;
-    noglobstar;
-    pattern;
-    platform;
-    realpath;
-    scurry;
-    stat;
-    signal;
-    windowsPathsNoEscape;
-    withFileTypes;
-    /**
-     * The options provided to the constructor.
-     */
-    opts;
-    /**
-     * An array of parsed immutable {@link Pattern} objects.
-     */
-    patterns;
-    /**
-     * All options are stored as properties on the `Glob` object.
-     *
-     * See {@link GlobOptions} for full options descriptions.
-     *
-     * Note that a previous `Glob` object can be passed as the
-     * `GlobOptions` to another `Glob` instantiation to re-use settings
-     * and caches with a new pattern.
-     *
-     * Traversal functions can be called multiple times to run the walk
-     * again.
-     */
-    constructor(pattern, opts) {
-        /* c8 ignore start */
-        if (!opts)
-            throw new TypeError('glob options required');
-        /* c8 ignore stop */
-        this.withFileTypes = !!opts.withFileTypes;
-        this.signal = opts.signal;
-        this.follow = !!opts.follow;
-        this.dot = !!opts.dot;
-        this.dotRelative = !!opts.dotRelative;
-        this.nodir = !!opts.nodir;
-        this.mark = !!opts.mark;
-        if (!opts.cwd) {
-            this.cwd = '';
-        }
-        else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {
-            opts.cwd = fileURLToPath(opts.cwd);
-        }
-        this.cwd = opts.cwd || '';
-        this.root = opts.root;
-        this.magicalBraces = !!opts.magicalBraces;
-        this.nobrace = !!opts.nobrace;
-        this.noext = !!opts.noext;
-        this.realpath = !!opts.realpath;
-        this.absolute = opts.absolute;
-        this.noglobstar = !!opts.noglobstar;
-        this.matchBase = !!opts.matchBase;
-        this.maxDepth =
-            typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity;
-        this.stat = !!opts.stat;
-        this.ignore = opts.ignore;
-        if (this.withFileTypes && this.absolute !== undefined) {
-            throw new Error('cannot set absolute and withFileTypes:true');
-        }
-        if (typeof pattern === 'string') {
-            pattern = [pattern];
-        }
-        this.windowsPathsNoEscape =
-            !!opts.windowsPathsNoEscape ||
-                opts.allowWindowsEscape === false;
-        if (this.windowsPathsNoEscape) {
-            pattern = pattern.map(p => p.replace(/\\/g, '/'));
-        }
-        if (this.matchBase) {
-            if (opts.noglobstar) {
-                throw new TypeError('base matching requires globstar');
-            }
-            pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`));
-        }
-        this.pattern = pattern;
-        this.platform = opts.platform || defaultPlatform;
-        this.opts = { ...opts, platform: this.platform };
-        if (opts.scurry) {
-            this.scurry = opts.scurry;
-            if (opts.nocase !== undefined &&
-                opts.nocase !== opts.scurry.nocase) {
-                throw new Error('nocase option contradicts provided scurry option');
-            }
-        }
-        else {
-            const Scurry = opts.platform === 'win32'
-                ? PathScurryWin32
-                : opts.platform === 'darwin'
-                    ? PathScurryDarwin
-                    : opts.platform
-                        ? PathScurryPosix
-                        : PathScurry;
-            this.scurry = new Scurry(this.cwd, {
-                nocase: opts.nocase,
-                fs: opts.fs,
-            });
-        }
-        this.nocase = this.scurry.nocase;
-        // If you do nocase:true on a case-sensitive file system, then
-        // we need to use regexps instead of strings for non-magic
-        // path portions, because statting `aBc` won't return results
-        // for the file `AbC` for example.
-        const nocaseMagicOnly = this.platform === 'darwin' || this.platform === 'win32';
-        const mmo = {
-            // default nocase based on platform
-            ...opts,
-            dot: this.dot,
-            matchBase: this.matchBase,
-            nobrace: this.nobrace,
-            nocase: this.nocase,
-            nocaseMagicOnly,
-            nocomment: true,
-            noext: this.noext,
-            nonegate: true,
-            optimizationLevel: 2,
-            platform: this.platform,
-            windowsPathsNoEscape: this.windowsPathsNoEscape,
-            debug: !!this.opts.debug,
-        };
-        const mms = this.pattern.map(p => new Minimatch(p, mmo));
-        const [matchSet, globParts] = mms.reduce((set, m) => {
-            set[0].push(...m.set);
-            set[1].push(...m.globParts);
-            return set;
-        }, [[], []]);
-        this.patterns = matchSet.map((set, i) => {
-            return new Pattern(set, globParts[i], 0, this.platform);
-        });
-    }
-    async walk() {
-        // Walkers always return array of Path objects, so we just have to
-        // coerce them into the right shape.  It will have already called
-        // realpath() if the option was set to do so, so we know that's cached.
-        // start out knowing the cwd, at least
-        return [
-            ...(await new GlobWalker(this.patterns, this.scurry.cwd, {
-                ...this.opts,
-                maxDepth: this.maxDepth !== Infinity
-                    ? this.maxDepth + this.scurry.cwd.depth()
-                    : Infinity,
-                platform: this.platform,
-                nocase: this.nocase,
-            }).walk()),
-        ];
-    }
-    walkSync() {
-        return [
-            ...new GlobWalker(this.patterns, this.scurry.cwd, {
-                ...this.opts,
-                maxDepth: this.maxDepth !== Infinity
-                    ? this.maxDepth + this.scurry.cwd.depth()
-                    : Infinity,
-                platform: this.platform,
-                nocase: this.nocase,
-            }).walkSync(),
-        ];
-    }
-    stream() {
-        return new GlobStream(this.patterns, this.scurry.cwd, {
-            ...this.opts,
-            maxDepth: this.maxDepth !== Infinity
-                ? this.maxDepth + this.scurry.cwd.depth()
-                : Infinity,
-            platform: this.platform,
-            nocase: this.nocase,
-        }).stream();
-    }
-    streamSync() {
-        return new GlobStream(this.patterns, this.scurry.cwd, {
-            ...this.opts,
-            maxDepth: this.maxDepth !== Infinity
-                ? this.maxDepth + this.scurry.cwd.depth()
-                : Infinity,
-            platform: this.platform,
-            nocase: this.nocase,
-        }).streamSync();
-    }
-    /**
-     * Default sync iteration function. Returns a Generator that
-     * iterates over the results.
-     */
-    iterateSync() {
-        return this.streamSync()[Symbol.iterator]();
-    }
-    [Symbol.iterator]() {
-        return this.iterateSync();
-    }
-    /**
-     * Default async iteration function. Returns an AsyncGenerator that
-     * iterates over the results.
-     */
-    iterate() {
-        return this.stream()[Symbol.asyncIterator]();
-    }
-    [Symbol.asyncIterator]() {
-        return this.iterate();
-    }
-}
-//# sourceMappingURL=glob.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/has-magic.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/has-magic.js
deleted file mode 100644
index ba2321ab868d0..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/has-magic.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import { Minimatch } from 'minimatch';
-/**
- * Return true if the patterns provided contain any magic glob characters,
- * given the options provided.
- *
- * Brace expansion is not considered "magic" unless the `magicalBraces` option
- * is set, as brace expansion just turns one string into an array of strings.
- * So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and
- * `'xby'` both do not contain any magic glob characters, and it's treated the
- * same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`
- * is in the options, brace expansion _is_ treated as a pattern having magic.
- */
-export const hasMagic = (pattern, options = {}) => {
-    if (!Array.isArray(pattern)) {
-        pattern = [pattern];
-    }
-    for (const p of pattern) {
-        if (new Minimatch(p, options).hasMagic())
-            return true;
-    }
-    return false;
-};
-//# sourceMappingURL=has-magic.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/ignore.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/ignore.js
deleted file mode 100644
index 2dbaa16a11460..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/ignore.js
+++ /dev/null
@@ -1,99 +0,0 @@
-// give it a pattern, and it'll be able to tell you if
-// a given path should be ignored.
-// Ignoring a path ignores its children if the pattern ends in /**
-// Ignores are always parsed in dot:true mode
-import { Minimatch } from 'minimatch';
-import { Pattern } from './pattern.js';
-const defaultPlatform = typeof process === 'object' &&
-    process &&
-    typeof process.platform === 'string'
-    ? process.platform
-    : 'linux';
-/**
- * Class used to process ignored patterns
- */
-export class Ignore {
-    relative;
-    relativeChildren;
-    absolute;
-    absoluteChildren;
-    constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform, }) {
-        this.relative = [];
-        this.absolute = [];
-        this.relativeChildren = [];
-        this.absoluteChildren = [];
-        const mmopts = {
-            dot: true,
-            nobrace,
-            nocase,
-            noext,
-            noglobstar,
-            optimizationLevel: 2,
-            platform,
-            nocomment: true,
-            nonegate: true,
-        };
-        // this is a little weird, but it gives us a clean set of optimized
-        // minimatch matchers, without getting tripped up if one of them
-        // ends in /** inside a brace section, and it's only inefficient at
-        // the start of the walk, not along it.
-        // It'd be nice if the Pattern class just had a .test() method, but
-        // handling globstars is a bit of a pita, and that code already lives
-        // in minimatch anyway.
-        // Another way would be if maybe Minimatch could take its set/globParts
-        // as an option, and then we could at least just use Pattern to test
-        // for absolute-ness.
-        // Yet another way, Minimatch could take an array of glob strings, and
-        // a cwd option, and do the right thing.
-        for (const ign of ignored) {
-            const mm = new Minimatch(ign, mmopts);
-            for (let i = 0; i < mm.set.length; i++) {
-                const parsed = mm.set[i];
-                const globParts = mm.globParts[i];
-                const p = new Pattern(parsed, globParts, 0, platform);
-                const m = new Minimatch(p.globString(), mmopts);
-                const children = globParts[globParts.length - 1] === '**';
-                const absolute = p.isAbsolute();
-                if (absolute)
-                    this.absolute.push(m);
-                else
-                    this.relative.push(m);
-                if (children) {
-                    if (absolute)
-                        this.absoluteChildren.push(m);
-                    else
-                        this.relativeChildren.push(m);
-                }
-            }
-        }
-    }
-    ignored(p) {
-        const fullpath = p.fullpath();
-        const fullpaths = `${fullpath}/`;
-        const relative = p.relative() || '.';
-        const relatives = `${relative}/`;
-        for (const m of this.relative) {
-            if (m.match(relative) || m.match(relatives))
-                return true;
-        }
-        for (const m of this.absolute) {
-            if (m.match(fullpath) || m.match(fullpaths))
-                return true;
-        }
-        return false;
-    }
-    childrenIgnored(p) {
-        const fullpath = p.fullpath() + '/';
-        const relative = (p.relative() || '.') + '/';
-        for (const m of this.relativeChildren) {
-            if (m.match(relative))
-                return true;
-        }
-        for (const m of this.absoluteChildren) {
-            if (m.match(fullpath))
-                true;
-        }
-        return false;
-    }
-}
-//# sourceMappingURL=ignore.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/index.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/index.js
deleted file mode 100644
index 7b270117e740a..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/index.js
+++ /dev/null
@@ -1,56 +0,0 @@
-import { escape, unescape } from 'minimatch';
-import { Glob } from './glob.js';
-import { hasMagic } from './has-magic.js';
-export function globStreamSync(pattern, options = {}) {
-    return new Glob(pattern, options).streamSync();
-}
-export function globStream(pattern, options = {}) {
-    return new Glob(pattern, options).stream();
-}
-export function globSync(pattern, options = {}) {
-    return new Glob(pattern, options).walkSync();
-}
-async function glob_(pattern, options = {}) {
-    return new Glob(pattern, options).walk();
-}
-export function globIterateSync(pattern, options = {}) {
-    return new Glob(pattern, options).iterateSync();
-}
-export function globIterate(pattern, options = {}) {
-    return new Glob(pattern, options).iterate();
-}
-// aliases: glob.sync.stream() glob.stream.sync() glob.sync() etc
-export const streamSync = globStreamSync;
-export const stream = Object.assign(globStream, { sync: globStreamSync });
-export const iterateSync = globIterateSync;
-export const iterate = Object.assign(globIterate, {
-    sync: globIterateSync,
-});
-export const sync = Object.assign(globSync, {
-    stream: globStreamSync,
-    iterate: globIterateSync,
-});
-/* c8 ignore start */
-export { escape, unescape } from 'minimatch';
-export { Glob } from './glob.js';
-export { hasMagic } from './has-magic.js';
-/* c8 ignore stop */
-export const glob = Object.assign(glob_, {
-    glob: glob_,
-    globSync,
-    sync,
-    globStream,
-    stream,
-    globStreamSync,
-    streamSync,
-    globIterate,
-    iterate,
-    globIterateSync,
-    iterateSync,
-    Glob,
-    hasMagic,
-    escape,
-    unescape,
-});
-glob.glob = glob;
-//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/package.json b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/package.json
deleted file mode 100644
index 5cc80943d565b..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "version": "10.3.3",
-  "type": "module"
-}
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/pattern.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/pattern.js
deleted file mode 100644
index 60aa415d92fd1..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/pattern.js
+++ /dev/null
@@ -1,215 +0,0 @@
-// this is just a very light wrapper around 2 arrays with an offset index
-import { GLOBSTAR } from 'minimatch';
-const isPatternList = (pl) => pl.length >= 1;
-const isGlobList = (gl) => gl.length >= 1;
-/**
- * An immutable-ish view on an array of glob parts and their parsed
- * results
- */
-export class Pattern {
-    #patternList;
-    #globList;
-    #index;
-    length;
-    #platform;
-    #rest;
-    #globString;
-    #isDrive;
-    #isUNC;
-    #isAbsolute;
-    #followGlobstar = true;
-    constructor(patternList, globList, index, platform) {
-        if (!isPatternList(patternList)) {
-            throw new TypeError('empty pattern list');
-        }
-        if (!isGlobList(globList)) {
-            throw new TypeError('empty glob list');
-        }
-        if (globList.length !== patternList.length) {
-            throw new TypeError('mismatched pattern list and glob list lengths');
-        }
-        this.length = patternList.length;
-        if (index < 0 || index >= this.length) {
-            throw new TypeError('index out of range');
-        }
-        this.#patternList = patternList;
-        this.#globList = globList;
-        this.#index = index;
-        this.#platform = platform;
-        // normalize root entries of absolute patterns on initial creation.
-        if (this.#index === 0) {
-            // c: => ['c:/']
-            // C:/ => ['C:/']
-            // C:/x => ['C:/', 'x']
-            // //host/share => ['//host/share/']
-            // //host/share/ => ['//host/share/']
-            // //host/share/x => ['//host/share/', 'x']
-            // /etc => ['/', 'etc']
-            // / => ['/']
-            if (this.isUNC()) {
-                // '' / '' / 'host' / 'share'
-                const [p0, p1, p2, p3, ...prest] = this.#patternList;
-                const [g0, g1, g2, g3, ...grest] = this.#globList;
-                if (prest[0] === '') {
-                    // ends in /
-                    prest.shift();
-                    grest.shift();
-                }
-                const p = [p0, p1, p2, p3, ''].join('/');
-                const g = [g0, g1, g2, g3, ''].join('/');
-                this.#patternList = [p, ...prest];
-                this.#globList = [g, ...grest];
-                this.length = this.#patternList.length;
-            }
-            else if (this.isDrive() || this.isAbsolute()) {
-                const [p1, ...prest] = this.#patternList;
-                const [g1, ...grest] = this.#globList;
-                if (prest[0] === '') {
-                    // ends in /
-                    prest.shift();
-                    grest.shift();
-                }
-                const p = p1 + '/';
-                const g = g1 + '/';
-                this.#patternList = [p, ...prest];
-                this.#globList = [g, ...grest];
-                this.length = this.#patternList.length;
-            }
-        }
-    }
-    /**
-     * The first entry in the parsed list of patterns
-     */
-    pattern() {
-        return this.#patternList[this.#index];
-    }
-    /**
-     * true of if pattern() returns a string
-     */
-    isString() {
-        return typeof this.#patternList[this.#index] === 'string';
-    }
-    /**
-     * true of if pattern() returns GLOBSTAR
-     */
-    isGlobstar() {
-        return this.#patternList[this.#index] === GLOBSTAR;
-    }
-    /**
-     * true if pattern() returns a regexp
-     */
-    isRegExp() {
-        return this.#patternList[this.#index] instanceof RegExp;
-    }
-    /**
-     * The /-joined set of glob parts that make up this pattern
-     */
-    globString() {
-        return (this.#globString =
-            this.#globString ||
-                (this.#index === 0
-                    ? this.isAbsolute()
-                        ? this.#globList[0] + this.#globList.slice(1).join('/')
-                        : this.#globList.join('/')
-                    : this.#globList.slice(this.#index).join('/')));
-    }
-    /**
-     * true if there are more pattern parts after this one
-     */
-    hasMore() {
-        return this.length > this.#index + 1;
-    }
-    /**
-     * The rest of the pattern after this part, or null if this is the end
-     */
-    rest() {
-        if (this.#rest !== undefined)
-            return this.#rest;
-        if (!this.hasMore())
-            return (this.#rest = null);
-        this.#rest = new Pattern(this.#patternList, this.#globList, this.#index + 1, this.#platform);
-        this.#rest.#isAbsolute = this.#isAbsolute;
-        this.#rest.#isUNC = this.#isUNC;
-        this.#rest.#isDrive = this.#isDrive;
-        return this.#rest;
-    }
-    /**
-     * true if the pattern represents a //unc/path/ on windows
-     */
-    isUNC() {
-        const pl = this.#patternList;
-        return this.#isUNC !== undefined
-            ? this.#isUNC
-            : (this.#isUNC =
-                this.#platform === 'win32' &&
-                    this.#index === 0 &&
-                    pl[0] === '' &&
-                    pl[1] === '' &&
-                    typeof pl[2] === 'string' &&
-                    !!pl[2] &&
-                    typeof pl[3] === 'string' &&
-                    !!pl[3]);
-    }
-    // pattern like C:/...
-    // split = ['C:', ...]
-    // XXX: would be nice to handle patterns like `c:*` to test the cwd
-    // in c: for *, but I don't know of a way to even figure out what that
-    // cwd is without actually chdir'ing into it?
-    /**
-     * True if the pattern starts with a drive letter on Windows
-     */
-    isDrive() {
-        const pl = this.#patternList;
-        return this.#isDrive !== undefined
-            ? this.#isDrive
-            : (this.#isDrive =
-                this.#platform === 'win32' &&
-                    this.#index === 0 &&
-                    this.length > 1 &&
-                    typeof pl[0] === 'string' &&
-                    /^[a-z]:$/i.test(pl[0]));
-    }
-    // pattern = '/' or '/...' or '/x/...'
-    // split = ['', ''] or ['', ...] or ['', 'x', ...]
-    // Drive and UNC both considered absolute on windows
-    /**
-     * True if the pattern is rooted on an absolute path
-     */
-    isAbsolute() {
-        const pl = this.#patternList;
-        return this.#isAbsolute !== undefined
-            ? this.#isAbsolute
-            : (this.#isAbsolute =
-                (pl[0] === '' && pl.length > 1) ||
-                    this.isDrive() ||
-                    this.isUNC());
-    }
-    /**
-     * consume the root of the pattern, and return it
-     */
-    root() {
-        const p = this.#patternList[0];
-        return typeof p === 'string' && this.isAbsolute() && this.#index === 0
-            ? p
-            : '';
-    }
-    /**
-     * Check to see if the current globstar pattern is allowed to follow
-     * a symbolic link.
-     */
-    checkFollowGlobstar() {
-        return !(this.#index === 0 ||
-            !this.isGlobstar() ||
-            !this.#followGlobstar);
-    }
-    /**
-     * Mark that the current globstar pattern is following a symbolic link
-     */
-    markFollowGlobstar() {
-        if (this.#index === 0 || !this.isGlobstar() || !this.#followGlobstar)
-            return false;
-        this.#followGlobstar = false;
-        return true;
-    }
-}
-//# sourceMappingURL=pattern.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/processor.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/processor.js
deleted file mode 100644
index dd2228ad6761a..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/processor.js
+++ /dev/null
@@ -1,302 +0,0 @@
-// synchronous utility for filtering entries and calculating subwalks
-import { GLOBSTAR } from 'minimatch';
-/**
- * A cache of which patterns have been processed for a given Path
- */
-export class HasWalkedCache {
-    store;
-    constructor(store = new Map()) {
-        this.store = store;
-    }
-    copy() {
-        return new HasWalkedCache(new Map(this.store));
-    }
-    hasWalked(target, pattern) {
-        return this.store.get(target.fullpath())?.has(pattern.globString());
-    }
-    storeWalked(target, pattern) {
-        const fullpath = target.fullpath();
-        const cached = this.store.get(fullpath);
-        if (cached)
-            cached.add(pattern.globString());
-        else
-            this.store.set(fullpath, new Set([pattern.globString()]));
-    }
-}
-/**
- * A record of which paths have been matched in a given walk step,
- * and whether they only are considered a match if they are a directory,
- * and whether their absolute or relative path should be returned.
- */
-export class MatchRecord {
-    store = new Map();
-    add(target, absolute, ifDir) {
-        const n = (absolute ? 2 : 0) | (ifDir ? 1 : 0);
-        const current = this.store.get(target);
-        this.store.set(target, current === undefined ? n : n & current);
-    }
-    // match, absolute, ifdir
-    entries() {
-        return [...this.store.entries()].map(([path, n]) => [
-            path,
-            !!(n & 2),
-            !!(n & 1),
-        ]);
-    }
-}
-/**
- * A collection of patterns that must be processed in a subsequent step
- * for a given path.
- */
-export class SubWalks {
-    store = new Map();
-    add(target, pattern) {
-        if (!target.canReaddir()) {
-            return;
-        }
-        const subs = this.store.get(target);
-        if (subs) {
-            if (!subs.find(p => p.globString() === pattern.globString())) {
-                subs.push(pattern);
-            }
-        }
-        else
-            this.store.set(target, [pattern]);
-    }
-    get(target) {
-        const subs = this.store.get(target);
-        /* c8 ignore start */
-        if (!subs) {
-            throw new Error('attempting to walk unknown path');
-        }
-        /* c8 ignore stop */
-        return subs;
-    }
-    entries() {
-        return this.keys().map(k => [k, this.store.get(k)]);
-    }
-    keys() {
-        return [...this.store.keys()].filter(t => t.canReaddir());
-    }
-}
-/**
- * The class that processes patterns for a given path.
- *
- * Handles child entry filtering, and determining whether a path's
- * directory contents must be read.
- */
-export class Processor {
-    hasWalkedCache;
-    matches = new MatchRecord();
-    subwalks = new SubWalks();
-    patterns;
-    follow;
-    dot;
-    opts;
-    constructor(opts, hasWalkedCache) {
-        this.opts = opts;
-        this.follow = !!opts.follow;
-        this.dot = !!opts.dot;
-        this.hasWalkedCache = hasWalkedCache
-            ? hasWalkedCache.copy()
-            : new HasWalkedCache();
-    }
-    processPatterns(target, patterns) {
-        this.patterns = patterns;
-        const processingSet = patterns.map(p => [target, p]);
-        // map of paths to the magic-starting subwalks they need to walk
-        // first item in patterns is the filter
-        for (let [t, pattern] of processingSet) {
-            this.hasWalkedCache.storeWalked(t, pattern);
-            const root = pattern.root();
-            const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
-            // start absolute patterns at root
-            if (root) {
-                t = t.resolve(root === '/' && this.opts.root !== undefined
-                    ? this.opts.root
-                    : root);
-                const rest = pattern.rest();
-                if (!rest) {
-                    this.matches.add(t, true, false);
-                    continue;
-                }
-                else {
-                    pattern = rest;
-                }
-            }
-            if (t.isENOENT())
-                continue;
-            let p;
-            let rest;
-            let changed = false;
-            while (typeof (p = pattern.pattern()) === 'string' &&
-                (rest = pattern.rest())) {
-                const c = t.resolve(p);
-                // we can be reasonably sure that .. is a readable dir
-                if (c.isUnknown() && p !== '..')
-                    break;
-                t = c;
-                pattern = rest;
-                changed = true;
-            }
-            p = pattern.pattern();
-            rest = pattern.rest();
-            if (changed) {
-                if (this.hasWalkedCache.hasWalked(t, pattern))
-                    continue;
-                this.hasWalkedCache.storeWalked(t, pattern);
-            }
-            // now we have either a final string for a known entry,
-            // more strings for an unknown entry,
-            // or a pattern starting with magic, mounted on t.
-            if (typeof p === 'string') {
-                // must be final entry
-                if (!rest) {
-                    const ifDir = p === '..' || p === '' || p === '.';
-                    this.matches.add(t.resolve(p), absolute, ifDir);
-                }
-                else {
-                    this.subwalks.add(t, pattern);
-                }
-                continue;
-            }
-            else if (p === GLOBSTAR) {
-                // if no rest, match and subwalk pattern
-                // if rest, process rest and subwalk pattern
-                // if it's a symlink, but we didn't get here by way of a
-                // globstar match (meaning it's the first time THIS globstar
-                // has traversed a symlink), then we follow it. Otherwise, stop.
-                if (!t.isSymbolicLink() ||
-                    this.follow ||
-                    pattern.checkFollowGlobstar()) {
-                    this.subwalks.add(t, pattern);
-                }
-                const rp = rest?.pattern();
-                const rrest = rest?.rest();
-                if (!rest || ((rp === '' || rp === '.') && !rrest)) {
-                    // only HAS to be a dir if it ends in **/ or **/.
-                    // but ending in ** will match files as well.
-                    this.matches.add(t, absolute, rp === '' || rp === '.');
-                }
-                else {
-                    if (rp === '..') {
-                        // this would mean you're matching **/.. at the fs root,
-                        // and no thanks, I'm not gonna test that specific case.
-                        /* c8 ignore start */
-                        const tp = t.parent || t;
-                        /* c8 ignore stop */
-                        if (!rrest)
-                            this.matches.add(tp, absolute, true);
-                        else if (!this.hasWalkedCache.hasWalked(tp, rrest)) {
-                            this.subwalks.add(tp, rrest);
-                        }
-                    }
-                }
-            }
-            else if (p instanceof RegExp) {
-                this.subwalks.add(t, pattern);
-            }
-        }
-        return this;
-    }
-    subwalkTargets() {
-        return this.subwalks.keys();
-    }
-    child() {
-        return new Processor(this.opts, this.hasWalkedCache);
-    }
-    // return a new Processor containing the subwalks for each
-    // child entry, and a set of matches, and
-    // a hasWalkedCache that's a copy of this one
-    // then we're going to call
-    filterEntries(parent, entries) {
-        const patterns = this.subwalks.get(parent);
-        // put matches and entry walks into the results processor
-        const results = this.child();
-        for (const e of entries) {
-            for (const pattern of patterns) {
-                const absolute = pattern.isAbsolute();
-                const p = pattern.pattern();
-                const rest = pattern.rest();
-                if (p === GLOBSTAR) {
-                    results.testGlobstar(e, pattern, rest, absolute);
-                }
-                else if (p instanceof RegExp) {
-                    results.testRegExp(e, p, rest, absolute);
-                }
-                else {
-                    results.testString(e, p, rest, absolute);
-                }
-            }
-        }
-        return results;
-    }
-    testGlobstar(e, pattern, rest, absolute) {
-        if (this.dot || !e.name.startsWith('.')) {
-            if (!pattern.hasMore()) {
-                this.matches.add(e, absolute, false);
-            }
-            if (e.canReaddir()) {
-                // if we're in follow mode or it's not a symlink, just keep
-                // testing the same pattern. If there's more after the globstar,
-                // then this symlink consumes the globstar. If not, then we can
-                // follow at most ONE symlink along the way, so we mark it, which
-                // also checks to ensure that it wasn't already marked.
-                if (this.follow || !e.isSymbolicLink()) {
-                    this.subwalks.add(e, pattern);
-                }
-                else if (e.isSymbolicLink()) {
-                    if (rest && pattern.checkFollowGlobstar()) {
-                        this.subwalks.add(e, rest);
-                    }
-                    else if (pattern.markFollowGlobstar()) {
-                        this.subwalks.add(e, pattern);
-                    }
-                }
-            }
-        }
-        // if the NEXT thing matches this entry, then also add
-        // the rest.
-        if (rest) {
-            const rp = rest.pattern();
-            if (typeof rp === 'string' &&
-                // dots and empty were handled already
-                rp !== '..' &&
-                rp !== '' &&
-                rp !== '.') {
-                this.testString(e, rp, rest.rest(), absolute);
-            }
-            else if (rp === '..') {
-                /* c8 ignore start */
-                const ep = e.parent || e;
-                /* c8 ignore stop */
-                this.subwalks.add(ep, rest);
-            }
-            else if (rp instanceof RegExp) {
-                this.testRegExp(e, rp, rest.rest(), absolute);
-            }
-        }
-    }
-    testRegExp(e, p, rest, absolute) {
-        if (!p.test(e.name))
-            return;
-        if (!rest) {
-            this.matches.add(e, absolute, false);
-        }
-        else {
-            this.subwalks.add(e, rest);
-        }
-    }
-    testString(e, p, rest, absolute) {
-        // should never happen?
-        if (!e.isNamed(p))
-            return;
-        if (!rest) {
-            this.matches.add(e, absolute, false);
-        }
-        else {
-            this.subwalks.add(e, rest);
-        }
-    }
-}
-//# sourceMappingURL=processor.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/walker.js b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/walker.js
deleted file mode 100644
index 6f3358b0c39a3..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/dist/mjs/walker.js
+++ /dev/null
@@ -1,352 +0,0 @@
-/**
- * Single-use utility classes to provide functionality to the {@link Glob}
- * methods.
- *
- * @module
- */
-import { Minipass } from 'minipass';
-import { Ignore } from './ignore.js';
-import { Processor } from './processor.js';
-const makeIgnore = (ignore, opts) => typeof ignore === 'string'
-    ? new Ignore([ignore], opts)
-    : Array.isArray(ignore)
-        ? new Ignore(ignore, opts)
-        : ignore;
-/**
- * basic walking utilities that all the glob walker types use
- */
-export class GlobUtil {
-    path;
-    patterns;
-    opts;
-    seen = new Set();
-    paused = false;
-    aborted = false;
-    #onResume = [];
-    #ignore;
-    #sep;
-    signal;
-    maxDepth;
-    constructor(patterns, path, opts) {
-        this.patterns = patterns;
-        this.path = path;
-        this.opts = opts;
-        this.#sep = !opts.posix && opts.platform === 'win32' ? '\\' : '/';
-        if (opts.ignore) {
-            this.#ignore = makeIgnore(opts.ignore, opts);
-        }
-        // ignore, always set with maxDepth, but it's optional on the
-        // GlobOptions type
-        /* c8 ignore start */
-        this.maxDepth = opts.maxDepth || Infinity;
-        /* c8 ignore stop */
-        if (opts.signal) {
-            this.signal = opts.signal;
-            this.signal.addEventListener('abort', () => {
-                this.#onResume.length = 0;
-            });
-        }
-    }
-    #ignored(path) {
-        return this.seen.has(path) || !!this.#ignore?.ignored?.(path);
-    }
-    #childrenIgnored(path) {
-        return !!this.#ignore?.childrenIgnored?.(path);
-    }
-    // backpressure mechanism
-    pause() {
-        this.paused = true;
-    }
-    resume() {
-        /* c8 ignore start */
-        if (this.signal?.aborted)
-            return;
-        /* c8 ignore stop */
-        this.paused = false;
-        let fn = undefined;
-        while (!this.paused && (fn = this.#onResume.shift())) {
-            fn();
-        }
-    }
-    onResume(fn) {
-        if (this.signal?.aborted)
-            return;
-        /* c8 ignore start */
-        if (!this.paused) {
-            fn();
-        }
-        else {
-            /* c8 ignore stop */
-            this.#onResume.push(fn);
-        }
-    }
-    // do the requisite realpath/stat checking, and return the path
-    // to add or undefined to filter it out.
-    async matchCheck(e, ifDir) {
-        if (ifDir && this.opts.nodir)
-            return undefined;
-        let rpc;
-        if (this.opts.realpath) {
-            rpc = e.realpathCached() || (await e.realpath());
-            if (!rpc)
-                return undefined;
-            e = rpc;
-        }
-        const needStat = e.isUnknown() || this.opts.stat;
-        return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir);
-    }
-    matchCheckTest(e, ifDir) {
-        return e &&
-            (this.maxDepth === Infinity || e.depth() <= this.maxDepth) &&
-            (!ifDir || e.canReaddir()) &&
-            (!this.opts.nodir || !e.isDirectory()) &&
-            !this.#ignored(e)
-            ? e
-            : undefined;
-    }
-    matchCheckSync(e, ifDir) {
-        if (ifDir && this.opts.nodir)
-            return undefined;
-        let rpc;
-        if (this.opts.realpath) {
-            rpc = e.realpathCached() || e.realpathSync();
-            if (!rpc)
-                return undefined;
-            e = rpc;
-        }
-        const needStat = e.isUnknown() || this.opts.stat;
-        return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir);
-    }
-    matchFinish(e, absolute) {
-        if (this.#ignored(e))
-            return;
-        const abs = this.opts.absolute === undefined ? absolute : this.opts.absolute;
-        this.seen.add(e);
-        const mark = this.opts.mark && e.isDirectory() ? this.#sep : '';
-        // ok, we have what we need!
-        if (this.opts.withFileTypes) {
-            this.matchEmit(e);
-        }
-        else if (abs) {
-            const abs = this.opts.posix ? e.fullpathPosix() : e.fullpath();
-            this.matchEmit(abs + mark);
-        }
-        else {
-            const rel = this.opts.posix ? e.relativePosix() : e.relative();
-            const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep)
-                ? '.' + this.#sep
-                : '';
-            this.matchEmit(!rel ? '.' + mark : pre + rel + mark);
-        }
-    }
-    async match(e, absolute, ifDir) {
-        const p = await this.matchCheck(e, ifDir);
-        if (p)
-            this.matchFinish(p, absolute);
-    }
-    matchSync(e, absolute, ifDir) {
-        const p = this.matchCheckSync(e, ifDir);
-        if (p)
-            this.matchFinish(p, absolute);
-    }
-    walkCB(target, patterns, cb) {
-        /* c8 ignore start */
-        if (this.signal?.aborted)
-            cb();
-        /* c8 ignore stop */
-        this.walkCB2(target, patterns, new Processor(this.opts), cb);
-    }
-    walkCB2(target, patterns, processor, cb) {
-        if (this.#childrenIgnored(target))
-            return cb();
-        if (this.signal?.aborted)
-            cb();
-        if (this.paused) {
-            this.onResume(() => this.walkCB2(target, patterns, processor, cb));
-            return;
-        }
-        processor.processPatterns(target, patterns);
-        // done processing.  all of the above is sync, can be abstracted out.
-        // subwalks is a map of paths to the entry filters they need
-        // matches is a map of paths to [absolute, ifDir] tuples.
-        let tasks = 1;
-        const next = () => {
-            if (--tasks === 0)
-                cb();
-        };
-        for (const [m, absolute, ifDir] of processor.matches.entries()) {
-            if (this.#ignored(m))
-                continue;
-            tasks++;
-            this.match(m, absolute, ifDir).then(() => next());
-        }
-        for (const t of processor.subwalkTargets()) {
-            if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {
-                continue;
-            }
-            tasks++;
-            const childrenCached = t.readdirCached();
-            if (t.calledReaddir())
-                this.walkCB3(t, childrenCached, processor, next);
-            else {
-                t.readdirCB((_, entries) => this.walkCB3(t, entries, processor, next), true);
-            }
-        }
-        next();
-    }
-    walkCB3(target, entries, processor, cb) {
-        processor = processor.filterEntries(target, entries);
-        let tasks = 1;
-        const next = () => {
-            if (--tasks === 0)
-                cb();
-        };
-        for (const [m, absolute, ifDir] of processor.matches.entries()) {
-            if (this.#ignored(m))
-                continue;
-            tasks++;
-            this.match(m, absolute, ifDir).then(() => next());
-        }
-        for (const [target, patterns] of processor.subwalks.entries()) {
-            tasks++;
-            this.walkCB2(target, patterns, processor.child(), next);
-        }
-        next();
-    }
-    walkCBSync(target, patterns, cb) {
-        /* c8 ignore start */
-        if (this.signal?.aborted)
-            cb();
-        /* c8 ignore stop */
-        this.walkCB2Sync(target, patterns, new Processor(this.opts), cb);
-    }
-    walkCB2Sync(target, patterns, processor, cb) {
-        if (this.#childrenIgnored(target))
-            return cb();
-        if (this.signal?.aborted)
-            cb();
-        if (this.paused) {
-            this.onResume(() => this.walkCB2Sync(target, patterns, processor, cb));
-            return;
-        }
-        processor.processPatterns(target, patterns);
-        // done processing.  all of the above is sync, can be abstracted out.
-        // subwalks is a map of paths to the entry filters they need
-        // matches is a map of paths to [absolute, ifDir] tuples.
-        let tasks = 1;
-        const next = () => {
-            if (--tasks === 0)
-                cb();
-        };
-        for (const [m, absolute, ifDir] of processor.matches.entries()) {
-            if (this.#ignored(m))
-                continue;
-            this.matchSync(m, absolute, ifDir);
-        }
-        for (const t of processor.subwalkTargets()) {
-            if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {
-                continue;
-            }
-            tasks++;
-            const children = t.readdirSync();
-            this.walkCB3Sync(t, children, processor, next);
-        }
-        next();
-    }
-    walkCB3Sync(target, entries, processor, cb) {
-        processor = processor.filterEntries(target, entries);
-        let tasks = 1;
-        const next = () => {
-            if (--tasks === 0)
-                cb();
-        };
-        for (const [m, absolute, ifDir] of processor.matches.entries()) {
-            if (this.#ignored(m))
-                continue;
-            this.matchSync(m, absolute, ifDir);
-        }
-        for (const [target, patterns] of processor.subwalks.entries()) {
-            tasks++;
-            this.walkCB2Sync(target, patterns, processor.child(), next);
-        }
-        next();
-    }
-}
-export class GlobWalker extends GlobUtil {
-    matches;
-    constructor(patterns, path, opts) {
-        super(patterns, path, opts);
-        this.matches = new Set();
-    }
-    matchEmit(e) {
-        this.matches.add(e);
-    }
-    async walk() {
-        if (this.signal?.aborted)
-            throw this.signal.reason;
-        if (this.path.isUnknown()) {
-            await this.path.lstat();
-        }
-        await new Promise((res, rej) => {
-            this.walkCB(this.path, this.patterns, () => {
-                if (this.signal?.aborted) {
-                    rej(this.signal.reason);
-                }
-                else {
-                    res(this.matches);
-                }
-            });
-        });
-        return this.matches;
-    }
-    walkSync() {
-        if (this.signal?.aborted)
-            throw this.signal.reason;
-        if (this.path.isUnknown()) {
-            this.path.lstatSync();
-        }
-        // nothing for the callback to do, because this never pauses
-        this.walkCBSync(this.path, this.patterns, () => {
-            if (this.signal?.aborted)
-                throw this.signal.reason;
-        });
-        return this.matches;
-    }
-}
-export class GlobStream extends GlobUtil {
-    results;
-    constructor(patterns, path, opts) {
-        super(patterns, path, opts);
-        this.results = new Minipass({
-            signal: this.signal,
-            objectMode: true,
-        });
-        this.results.on('drain', () => this.resume());
-        this.results.on('resume', () => this.resume());
-    }
-    matchEmit(e) {
-        this.results.write(e);
-        if (!this.results.flowing)
-            this.pause();
-    }
-    stream() {
-        const target = this.path;
-        if (target.isUnknown()) {
-            target.lstat().then(() => {
-                this.walkCB(target, this.patterns, () => this.results.end());
-            });
-        }
-        else {
-            this.walkCB(target, this.patterns, () => this.results.end());
-        }
-        return this.results;
-    }
-    streamSync() {
-        if (this.path.isUnknown()) {
-            this.path.lstatSync();
-        }
-        this.walkCBSync(this.path, this.patterns, () => this.results.end());
-        return this.results;
-    }
-}
-//# sourceMappingURL=walker.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/package.json b/node_modules/node-gyp/node_modules/cacache/node_modules/glob/package.json
deleted file mode 100644
index 2d25985d2bbb5..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/glob/package.json
+++ /dev/null
@@ -1,98 +0,0 @@
-{
-  "author": "Isaac Z. Schlueter  (https://blog.izs.me/)",
-  "name": "glob",
-  "description": "the most correct and second fastest glob implementation in JavaScript",
-  "version": "10.3.3",
-  "bin": "./dist/cjs/src/bin.js",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/node-glob.git"
-  },
-  "main": "./dist/cjs/src/index.js",
-  "module": "./dist/mjs/index.js",
-  "types": "./dist/mjs/index.d.ts",
-  "exports": {
-    ".": {
-      "import": {
-        "types": "./dist/mjs/index.d.ts",
-        "default": "./dist/mjs/index.js"
-      },
-      "require": {
-        "types": "./dist/cjs/src/index.d.ts",
-        "default": "./dist/cjs/src/index.js"
-      }
-    }
-  },
-  "files": [
-    "dist"
-  ],
-  "scripts": {
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "prepublishOnly": "git push origin --follow-tags",
-    "preprepare": "rm -rf dist",
-    "prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json && bash fixup.sh",
-    "pretest": "npm run prepare",
-    "presnap": "npm run prepare",
-    "test": "c8 tap",
-    "snap": "c8 tap",
-    "format": "prettier --write . --loglevel warn",
-    "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts",
-    "prepublish": "npm run benchclean",
-    "profclean": "rm -f v8.log profile.txt",
-    "test-regen": "npm run profclean && TEST_REGEN=1 node --no-warnings --loader ts-node/esm test/00-setup.ts",
-    "prebench": "npm run prepare",
-    "bench": "bash benchmark.sh",
-    "preprof": "npm run prepare",
-    "prof": "bash prof.sh",
-    "benchclean": "node benchclean.js"
-  },
-  "prettier": {
-    "semi": false,
-    "printWidth": 75,
-    "tabWidth": 2,
-    "useTabs": false,
-    "singleQuote": true,
-    "jsxSingleQuote": false,
-    "bracketSameLine": true,
-    "arrowParens": "avoid",
-    "endOfLine": "lf"
-  },
-  "dependencies": {
-    "foreground-child": "^3.1.0",
-    "jackspeak": "^2.0.3",
-    "minimatch": "^9.0.1",
-    "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0",
-    "path-scurry": "^1.10.1"
-  },
-  "devDependencies": {
-    "@types/node": "^20.3.2",
-    "@types/tap": "^15.0.7",
-    "c8": "^7.12.0",
-    "memfs": "^3.4.13",
-    "mkdirp": "^2.1.4",
-    "prettier": "^2.8.3",
-    "rimraf": "^4.1.3",
-    "tap": "^16.3.4",
-    "ts-node": "^10.9.1",
-    "typedoc": "^0.23.24",
-    "typescript": "^4.9.4"
-  },
-  "tap": {
-    "before": "test/00-setup.ts",
-    "coverage": false,
-    "node-arg": [
-      "--no-warnings",
-      "--loader",
-      "ts-node/esm"
-    ],
-    "ts": false
-  },
-  "license": "ISC",
-  "funding": {
-    "url": "https://github.com/sponsors/isaacs"
-  },
-  "engines": {
-    "node": ">=16 || 14 >=14.17"
-  }
-}
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/assert-valid-pattern.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/assert-valid-pattern.js
deleted file mode 100644
index 5fc86bbd0116c..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/assert-valid-pattern.js
+++ /dev/null
@@ -1,14 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.assertValidPattern = void 0;
-const MAX_PATTERN_LENGTH = 1024 * 64;
-const assertValidPattern = (pattern) => {
-    if (typeof pattern !== 'string') {
-        throw new TypeError('invalid pattern');
-    }
-    if (pattern.length > MAX_PATTERN_LENGTH) {
-        throw new TypeError('pattern is too long');
-    }
-};
-exports.assertValidPattern = assertValidPattern;
-//# sourceMappingURL=assert-valid-pattern.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/ast.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/ast.js
deleted file mode 100644
index a98ae79b503b1..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/ast.js
+++ /dev/null
@@ -1,589 +0,0 @@
-"use strict";
-// parse a single path portion
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.AST = void 0;
-const brace_expressions_js_1 = require("./brace-expressions.js");
-const unescape_js_1 = require("./unescape.js");
-const types = new Set(['!', '?', '+', '*', '@']);
-const isExtglobType = (c) => types.has(c);
-// Patterns that get prepended to bind to the start of either the
-// entire string, or just a single path portion, to prevent dots
-// and/or traversal patterns, when needed.
-// Exts don't need the ^ or / bit, because the root binds that already.
-const startNoTraversal = '(?!(?:^|/)\\.\\.?(?:$|/))';
-const startNoDot = '(?!\\.)';
-// characters that indicate a start of pattern needs the "no dots" bit,
-// because a dot *might* be matched. ( is not in the list, because in
-// the case of a child extglob, it will handle the prevention itself.
-const addPatternStart = new Set(['[', '.']);
-// cases where traversal is A-OK, no dot prevention needed
-const justDots = new Set(['..', '.']);
-const reSpecials = new Set('().*{}+?[]^$\\!');
-const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
-// any single thing other than /
-const qmark = '[^/]';
-// * => any number of characters
-const star = qmark + '*?';
-// use + when we need to ensure that *something* matches, because the * is
-// the only thing in the path portion.
-const starNoEmpty = qmark + '+?';
-// remove the \ chars that we added if we end up doing a nonmagic compare
-// const deslash = (s: string) => s.replace(/\\(.)/g, '$1')
-class AST {
-    type;
-    #root;
-    #hasMagic;
-    #uflag = false;
-    #parts = [];
-    #parent;
-    #parentIndex;
-    #negs;
-    #filledNegs = false;
-    #options;
-    #toString;
-    // set to true if it's an extglob with no children
-    // (which really means one child of '')
-    #emptyExt = false;
-    constructor(type, parent, options = {}) {
-        this.type = type;
-        // extglobs are inherently magical
-        if (type)
-            this.#hasMagic = true;
-        this.#parent = parent;
-        this.#root = this.#parent ? this.#parent.#root : this;
-        this.#options = this.#root === this ? options : this.#root.#options;
-        this.#negs = this.#root === this ? [] : this.#root.#negs;
-        if (type === '!' && !this.#root.#filledNegs)
-            this.#negs.push(this);
-        this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
-    }
-    get hasMagic() {
-        /* c8 ignore start */
-        if (this.#hasMagic !== undefined)
-            return this.#hasMagic;
-        /* c8 ignore stop */
-        for (const p of this.#parts) {
-            if (typeof p === 'string')
-                continue;
-            if (p.type || p.hasMagic)
-                return (this.#hasMagic = true);
-        }
-        // note: will be undefined until we generate the regexp src and find out
-        return this.#hasMagic;
-    }
-    // reconstructs the pattern
-    toString() {
-        if (this.#toString !== undefined)
-            return this.#toString;
-        if (!this.type) {
-            return (this.#toString = this.#parts.map(p => String(p)).join(''));
-        }
-        else {
-            return (this.#toString =
-                this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')');
-        }
-    }
-    #fillNegs() {
-        /* c8 ignore start */
-        if (this !== this.#root)
-            throw new Error('should only call on root');
-        if (this.#filledNegs)
-            return this;
-        /* c8 ignore stop */
-        // call toString() once to fill this out
-        this.toString();
-        this.#filledNegs = true;
-        let n;
-        while ((n = this.#negs.pop())) {
-            if (n.type !== '!')
-                continue;
-            // walk up the tree, appending everthing that comes AFTER parentIndex
-            let p = n;
-            let pp = p.#parent;
-            while (pp) {
-                for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
-                    for (const part of n.#parts) {
-                        /* c8 ignore start */
-                        if (typeof part === 'string') {
-                            throw new Error('string part in extglob AST??');
-                        }
-                        /* c8 ignore stop */
-                        part.copyIn(pp.#parts[i]);
-                    }
-                }
-                p = pp;
-                pp = p.#parent;
-            }
-        }
-        return this;
-    }
-    push(...parts) {
-        for (const p of parts) {
-            if (p === '')
-                continue;
-            /* c8 ignore start */
-            if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {
-                throw new Error('invalid part: ' + p);
-            }
-            /* c8 ignore stop */
-            this.#parts.push(p);
-        }
-    }
-    toJSON() {
-        const ret = this.type === null
-            ? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON()))
-            : [this.type, ...this.#parts.map(p => p.toJSON())];
-        if (this.isStart() && !this.type)
-            ret.unshift([]);
-        if (this.isEnd() &&
-            (this === this.#root ||
-                (this.#root.#filledNegs && this.#parent?.type === '!'))) {
-            ret.push({});
-        }
-        return ret;
-    }
-    isStart() {
-        if (this.#root === this)
-            return true;
-        // if (this.type) return !!this.#parent?.isStart()
-        if (!this.#parent?.isStart())
-            return false;
-        if (this.#parentIndex === 0)
-            return true;
-        // if everything AHEAD of this is a negation, then it's still the "start"
-        const p = this.#parent;
-        for (let i = 0; i < this.#parentIndex; i++) {
-            const pp = p.#parts[i];
-            if (!(pp instanceof AST && pp.type === '!')) {
-                return false;
-            }
-        }
-        return true;
-    }
-    isEnd() {
-        if (this.#root === this)
-            return true;
-        if (this.#parent?.type === '!')
-            return true;
-        if (!this.#parent?.isEnd())
-            return false;
-        if (!this.type)
-            return this.#parent?.isEnd();
-        // if not root, it'll always have a parent
-        /* c8 ignore start */
-        const pl = this.#parent ? this.#parent.#parts.length : 0;
-        /* c8 ignore stop */
-        return this.#parentIndex === pl - 1;
-    }
-    copyIn(part) {
-        if (typeof part === 'string')
-            this.push(part);
-        else
-            this.push(part.clone(this));
-    }
-    clone(parent) {
-        const c = new AST(this.type, parent);
-        for (const p of this.#parts) {
-            c.copyIn(p);
-        }
-        return c;
-    }
-    static #parseAST(str, ast, pos, opt) {
-        let escaping = false;
-        let inBrace = false;
-        let braceStart = -1;
-        let braceNeg = false;
-        if (ast.type === null) {
-            // outside of a extglob, append until we find a start
-            let i = pos;
-            let acc = '';
-            while (i < str.length) {
-                const c = str.charAt(i++);
-                // still accumulate escapes at this point, but we do ignore
-                // starts that are escaped
-                if (escaping || c === '\\') {
-                    escaping = !escaping;
-                    acc += c;
-                    continue;
-                }
-                if (inBrace) {
-                    if (i === braceStart + 1) {
-                        if (c === '^' || c === '!') {
-                            braceNeg = true;
-                        }
-                    }
-                    else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {
-                        inBrace = false;
-                    }
-                    acc += c;
-                    continue;
-                }
-                else if (c === '[') {
-                    inBrace = true;
-                    braceStart = i;
-                    braceNeg = false;
-                    acc += c;
-                    continue;
-                }
-                if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {
-                    ast.push(acc);
-                    acc = '';
-                    const ext = new AST(c, ast);
-                    i = AST.#parseAST(str, ext, i, opt);
-                    ast.push(ext);
-                    continue;
-                }
-                acc += c;
-            }
-            ast.push(acc);
-            return i;
-        }
-        // some kind of extglob, pos is at the (
-        // find the next | or )
-        let i = pos + 1;
-        let part = new AST(null, ast);
-        const parts = [];
-        let acc = '';
-        while (i < str.length) {
-            const c = str.charAt(i++);
-            // still accumulate escapes at this point, but we do ignore
-            // starts that are escaped
-            if (escaping || c === '\\') {
-                escaping = !escaping;
-                acc += c;
-                continue;
-            }
-            if (inBrace) {
-                if (i === braceStart + 1) {
-                    if (c === '^' || c === '!') {
-                        braceNeg = true;
-                    }
-                }
-                else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {
-                    inBrace = false;
-                }
-                acc += c;
-                continue;
-            }
-            else if (c === '[') {
-                inBrace = true;
-                braceStart = i;
-                braceNeg = false;
-                acc += c;
-                continue;
-            }
-            if (isExtglobType(c) && str.charAt(i) === '(') {
-                part.push(acc);
-                acc = '';
-                const ext = new AST(c, part);
-                part.push(ext);
-                i = AST.#parseAST(str, ext, i, opt);
-                continue;
-            }
-            if (c === '|') {
-                part.push(acc);
-                acc = '';
-                parts.push(part);
-                part = new AST(null, ast);
-                continue;
-            }
-            if (c === ')') {
-                if (acc === '' && ast.#parts.length === 0) {
-                    ast.#emptyExt = true;
-                }
-                part.push(acc);
-                acc = '';
-                ast.push(...parts, part);
-                return i;
-            }
-            acc += c;
-        }
-        // unfinished extglob
-        // if we got here, it was a malformed extglob! not an extglob, but
-        // maybe something else in there.
-        ast.type = null;
-        ast.#hasMagic = undefined;
-        ast.#parts = [str.substring(pos - 1)];
-        return i;
-    }
-    static fromGlob(pattern, options = {}) {
-        const ast = new AST(null, undefined, options);
-        AST.#parseAST(pattern, ast, 0, options);
-        return ast;
-    }
-    // returns the regular expression if there's magic, or the unescaped
-    // string if not.
-    toMMPattern() {
-        // should only be called on root
-        /* c8 ignore start */
-        if (this !== this.#root)
-            return this.#root.toMMPattern();
-        /* c8 ignore stop */
-        const glob = this.toString();
-        const [re, body, hasMagic, uflag] = this.toRegExpSource();
-        // if we're in nocase mode, and not nocaseMagicOnly, then we do
-        // still need a regular expression if we have to case-insensitively
-        // match capital/lowercase characters.
-        const anyMagic = hasMagic ||
-            this.#hasMagic ||
-            (this.#options.nocase &&
-                !this.#options.nocaseMagicOnly &&
-                glob.toUpperCase() !== glob.toLowerCase());
-        if (!anyMagic) {
-            return body;
-        }
-        const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : '');
-        return Object.assign(new RegExp(`^${re}$`, flags), {
-            _src: re,
-            _glob: glob,
-        });
-    }
-    // returns the string match, the regexp source, whether there's magic
-    // in the regexp (so a regular expression is required) and whether or
-    // not the uflag is needed for the regular expression (for posix classes)
-    // TODO: instead of injecting the start/end at this point, just return
-    // the BODY of the regexp, along with the start/end portions suitable
-    // for binding the start/end in either a joined full-path makeRe context
-    // (where we bind to (^|/), or a standalone matchPart context (where
-    // we bind to ^, and not /).  Otherwise slashes get duped!
-    //
-    // In part-matching mode, the start is:
-    // - if not isStart: nothing
-    // - if traversal possible, but not allowed: ^(?!\.\.?$)
-    // - if dots allowed or not possible: ^
-    // - if dots possible and not allowed: ^(?!\.)
-    // end is:
-    // - if not isEnd(): nothing
-    // - else: $
-    //
-    // In full-path matching mode, we put the slash at the START of the
-    // pattern, so start is:
-    // - if first pattern: same as part-matching mode
-    // - if not isStart(): nothing
-    // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
-    // - if dots allowed or not possible: /
-    // - if dots possible and not allowed: /(?!\.)
-    // end is:
-    // - if last pattern, same as part-matching mode
-    // - else nothing
-    //
-    // Always put the (?:$|/) on negated tails, though, because that has to be
-    // there to bind the end of the negated pattern portion, and it's easier to
-    // just stick it in now rather than try to inject it later in the middle of
-    // the pattern.
-    //
-    // We can just always return the same end, and leave it up to the caller
-    // to know whether it's going to be used joined or in parts.
-    // And, if the start is adjusted slightly, can do the same there:
-    // - if not isStart: nothing
-    // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
-    // - if dots allowed or not possible: (?:/|^)
-    // - if dots possible and not allowed: (?:/|^)(?!\.)
-    //
-    // But it's better to have a simpler binding without a conditional, for
-    // performance, so probably better to return both start options.
-    //
-    // Then the caller just ignores the end if it's not the first pattern,
-    // and the start always gets applied.
-    //
-    // But that's always going to be $ if it's the ending pattern, or nothing,
-    // so the caller can just attach $ at the end of the pattern when building.
-    //
-    // So the todo is:
-    // - better detect what kind of start is needed
-    // - return both flavors of starting pattern
-    // - attach $ at the end of the pattern when creating the actual RegExp
-    //
-    // Ah, but wait, no, that all only applies to the root when the first pattern
-    // is not an extglob. If the first pattern IS an extglob, then we need all
-    // that dot prevention biz to live in the extglob portions, because eg
-    // +(*|.x*) can match .xy but not .yx.
-    //
-    // So, return the two flavors if it's #root and the first child is not an
-    // AST, otherwise leave it to the child AST to handle it, and there,
-    // use the (?:^|/) style of start binding.
-    //
-    // Even simplified further:
-    // - Since the start for a join is eg /(?!\.) and the start for a part
-    // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
-    // or start or whatever) and prepend ^ or / at the Regexp construction.
-    toRegExpSource(allowDot) {
-        const dot = allowDot ?? !!this.#options.dot;
-        if (this.#root === this)
-            this.#fillNegs();
-        if (!this.type) {
-            const noEmpty = this.isStart() && this.isEnd();
-            const src = this.#parts
-                .map(p => {
-                const [re, _, hasMagic, uflag] = typeof p === 'string'
-                    ? AST.#parseGlob(p, this.#hasMagic, noEmpty)
-                    : p.toRegExpSource(allowDot);
-                this.#hasMagic = this.#hasMagic || hasMagic;
-                this.#uflag = this.#uflag || uflag;
-                return re;
-            })
-                .join('');
-            let start = '';
-            if (this.isStart()) {
-                if (typeof this.#parts[0] === 'string') {
-                    // this is the string that will match the start of the pattern,
-                    // so we need to protect against dots and such.
-                    // '.' and '..' cannot match unless the pattern is that exactly,
-                    // even if it starts with . or dot:true is set.
-                    const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
-                    if (!dotTravAllowed) {
-                        const aps = addPatternStart;
-                        // check if we have a possibility of matching . or ..,
-                        // and prevent that.
-                        const needNoTrav = 
-                        // dots are allowed, and the pattern starts with [ or .
-                        (dot && aps.has(src.charAt(0))) ||
-                            // the pattern starts with \., and then [ or .
-                            (src.startsWith('\\.') && aps.has(src.charAt(2))) ||
-                            // the pattern starts with \.\., and then [ or .
-                            (src.startsWith('\\.\\.') && aps.has(src.charAt(4)));
-                        // no need to prevent dots if it can't match a dot, or if a
-                        // sub-pattern will be preventing it anyway.
-                        const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
-                        start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : '';
-                    }
-                }
-            }
-            // append the "end of path portion" pattern to negation tails
-            let end = '';
-            if (this.isEnd() &&
-                this.#root.#filledNegs &&
-                this.#parent?.type === '!') {
-                end = '(?:$|\\/)';
-            }
-            const final = start + src + end;
-            return [
-                final,
-                (0, unescape_js_1.unescape)(src),
-                (this.#hasMagic = !!this.#hasMagic),
-                this.#uflag,
-            ];
-        }
-        // We need to calculate the body *twice* if it's a repeat pattern
-        // at the start, once in nodot mode, then again in dot mode, so a
-        // pattern like *(?) can match 'x.y'
-        const repeated = this.type === '*' || this.type === '+';
-        // some kind of extglob
-        const start = this.type === '!' ? '(?:(?!(?:' : '(?:';
-        let body = this.#partsToRegExp(dot);
-        if (this.isStart() && this.isEnd() && !body && this.type !== '!') {
-            // invalid extglob, has to at least be *something* present, if it's
-            // the entire path portion.
-            const s = this.toString();
-            this.#parts = [s];
-            this.type = null;
-            this.#hasMagic = undefined;
-            return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
-        }
-        // XXX abstract out this map method
-        let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot
-            ? ''
-            : this.#partsToRegExp(true);
-        if (bodyDotAllowed === body) {
-            bodyDotAllowed = '';
-        }
-        if (bodyDotAllowed) {
-            body = `(?:${body})(?:${bodyDotAllowed})*?`;
-        }
-        // an empty !() is exactly equivalent to a starNoEmpty
-        let final = '';
-        if (this.type === '!' && this.#emptyExt) {
-            final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty;
-        }
-        else {
-            const close = this.type === '!'
-                ? // !() must match something,but !(x) can match ''
-                    '))' +
-                        (this.isStart() && !dot && !allowDot ? startNoDot : '') +
-                        star +
-                        ')'
-                : this.type === '@'
-                    ? ')'
-                    : this.type === '?'
-                        ? ')?'
-                        : this.type === '+' && bodyDotAllowed
-                            ? ')'
-                            : this.type === '*' && bodyDotAllowed
-                                ? `)?`
-                                : `)${this.type}`;
-            final = start + body + close;
-        }
-        return [
-            final,
-            (0, unescape_js_1.unescape)(body),
-            (this.#hasMagic = !!this.#hasMagic),
-            this.#uflag,
-        ];
-    }
-    #partsToRegExp(dot) {
-        return this.#parts
-            .map(p => {
-            // extglob ASTs should only contain parent ASTs
-            /* c8 ignore start */
-            if (typeof p === 'string') {
-                throw new Error('string type in extglob ast??');
-            }
-            /* c8 ignore stop */
-            // can ignore hasMagic, because extglobs are already always magic
-            const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
-            this.#uflag = this.#uflag || uflag;
-            return re;
-        })
-            .filter(p => !(this.isStart() && this.isEnd()) || !!p)
-            .join('|');
-    }
-    static #parseGlob(glob, hasMagic, noEmpty = false) {
-        let escaping = false;
-        let re = '';
-        let uflag = false;
-        for (let i = 0; i < glob.length; i++) {
-            const c = glob.charAt(i);
-            if (escaping) {
-                escaping = false;
-                re += (reSpecials.has(c) ? '\\' : '') + c;
-                continue;
-            }
-            if (c === '\\') {
-                if (i === glob.length - 1) {
-                    re += '\\\\';
-                }
-                else {
-                    escaping = true;
-                }
-                continue;
-            }
-            if (c === '[') {
-                const [src, needUflag, consumed, magic] = (0, brace_expressions_js_1.parseClass)(glob, i);
-                if (consumed) {
-                    re += src;
-                    uflag = uflag || needUflag;
-                    i += consumed - 1;
-                    hasMagic = hasMagic || magic;
-                    continue;
-                }
-            }
-            if (c === '*') {
-                if (noEmpty && glob === '*')
-                    re += starNoEmpty;
-                else
-                    re += star;
-                hasMagic = true;
-                continue;
-            }
-            if (c === '?') {
-                re += qmark;
-                hasMagic = true;
-                continue;
-            }
-            re += regExpEscape(c);
-        }
-        return [re, (0, unescape_js_1.unescape)(glob), !!hasMagic, uflag];
-    }
-}
-exports.AST = AST;
-//# sourceMappingURL=ast.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/brace-expressions.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/brace-expressions.js
deleted file mode 100644
index 0e13eefc4cfee..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/brace-expressions.js
+++ /dev/null
@@ -1,152 +0,0 @@
-"use strict";
-// translate the various posix character classes into unicode properties
-// this works across all unicode locales
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.parseClass = void 0;
-// { : [, /u flag required, negated]
-const posixClasses = {
-    '[:alnum:]': ['\\p{L}\\p{Nl}\\p{Nd}', true],
-    '[:alpha:]': ['\\p{L}\\p{Nl}', true],
-    '[:ascii:]': ['\\x' + '00-\\x' + '7f', false],
-    '[:blank:]': ['\\p{Zs}\\t', true],
-    '[:cntrl:]': ['\\p{Cc}', true],
-    '[:digit:]': ['\\p{Nd}', true],
-    '[:graph:]': ['\\p{Z}\\p{C}', true, true],
-    '[:lower:]': ['\\p{Ll}', true],
-    '[:print:]': ['\\p{C}', true],
-    '[:punct:]': ['\\p{P}', true],
-    '[:space:]': ['\\p{Z}\\t\\r\\n\\v\\f', true],
-    '[:upper:]': ['\\p{Lu}', true],
-    '[:word:]': ['\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}', true],
-    '[:xdigit:]': ['A-Fa-f0-9', false],
-};
-// only need to escape a few things inside of brace expressions
-// escapes: [ \ ] -
-const braceEscape = (s) => s.replace(/[[\]\\-]/g, '\\$&');
-// escape all regexp magic characters
-const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
-// everything has already been escaped, we just have to join
-const rangesToString = (ranges) => ranges.join('');
-// takes a glob string at a posix brace expression, and returns
-// an equivalent regular expression source, and boolean indicating
-// whether the /u flag needs to be applied, and the number of chars
-// consumed to parse the character class.
-// This also removes out of order ranges, and returns ($.) if the
-// entire class just no good.
-const parseClass = (glob, position) => {
-    const pos = position;
-    /* c8 ignore start */
-    if (glob.charAt(pos) !== '[') {
-        throw new Error('not in a brace expression');
-    }
-    /* c8 ignore stop */
-    const ranges = [];
-    const negs = [];
-    let i = pos + 1;
-    let sawStart = false;
-    let uflag = false;
-    let escaping = false;
-    let negate = false;
-    let endPos = pos;
-    let rangeStart = '';
-    WHILE: while (i < glob.length) {
-        const c = glob.charAt(i);
-        if ((c === '!' || c === '^') && i === pos + 1) {
-            negate = true;
-            i++;
-            continue;
-        }
-        if (c === ']' && sawStart && !escaping) {
-            endPos = i + 1;
-            break;
-        }
-        sawStart = true;
-        if (c === '\\') {
-            if (!escaping) {
-                escaping = true;
-                i++;
-                continue;
-            }
-            // escaped \ char, fall through and treat like normal char
-        }
-        if (c === '[' && !escaping) {
-            // either a posix class, a collation equivalent, or just a [
-            for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
-                if (glob.startsWith(cls, i)) {
-                    // invalid, [a-[] is fine, but not [a-[:alpha]]
-                    if (rangeStart) {
-                        return ['$.', false, glob.length - pos, true];
-                    }
-                    i += cls.length;
-                    if (neg)
-                        negs.push(unip);
-                    else
-                        ranges.push(unip);
-                    uflag = uflag || u;
-                    continue WHILE;
-                }
-            }
-        }
-        // now it's just a normal character, effectively
-        escaping = false;
-        if (rangeStart) {
-            // throw this range away if it's not valid, but others
-            // can still match.
-            if (c > rangeStart) {
-                ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c));
-            }
-            else if (c === rangeStart) {
-                ranges.push(braceEscape(c));
-            }
-            rangeStart = '';
-            i++;
-            continue;
-        }
-        // now might be the start of a range.
-        // can be either c-d or c-] or c] or c] at this point
-        if (glob.startsWith('-]', i + 1)) {
-            ranges.push(braceEscape(c + '-'));
-            i += 2;
-            continue;
-        }
-        if (glob.startsWith('-', i + 1)) {
-            rangeStart = c;
-            i += 2;
-            continue;
-        }
-        // not the start of a range, just a single character
-        ranges.push(braceEscape(c));
-        i++;
-    }
-    if (endPos < i) {
-        // didn't see the end of the class, not a valid class,
-        // but might still be valid as a literal match.
-        return ['', false, 0, false];
-    }
-    // if we got no ranges and no negates, then we have a range that
-    // cannot possibly match anything, and that poisons the whole glob
-    if (!ranges.length && !negs.length) {
-        return ['$.', false, glob.length - pos, true];
-    }
-    // if we got one positive range, and it's a single character, then that's
-    // not actually a magic pattern, it's just that one literal character.
-    // we should not treat that as "magic", we should just return the literal
-    // character. [_] is a perfectly valid way to escape glob magic chars.
-    if (negs.length === 0 &&
-        ranges.length === 1 &&
-        /^\\?.$/.test(ranges[0]) &&
-        !negate) {
-        const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
-        return [regexpEscape(r), false, endPos - pos, false];
-    }
-    const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']';
-    const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']';
-    const comb = ranges.length && negs.length
-        ? '(' + sranges + '|' + snegs + ')'
-        : ranges.length
-            ? sranges
-            : snegs;
-    return [comb, uflag, endPos - pos, true];
-};
-exports.parseClass = parseClass;
-//# sourceMappingURL=brace-expressions.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/escape.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/escape.js
deleted file mode 100644
index 02a4f8a8e0a58..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/escape.js
+++ /dev/null
@@ -1,22 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.escape = void 0;
-/**
- * Escape all magic characters in a glob pattern.
- *
- * If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}
- * option is used, then characters are escaped by wrapping in `[]`, because
- * a magic character wrapped in a character class can only be satisfied by
- * that exact character.  In this mode, `\` is _not_ escaped, because it is
- * not interpreted as a magic character, but instead as a path separator.
- */
-const escape = (s, { windowsPathsNoEscape = false, } = {}) => {
-    // don't need to escape +@! because we escape the parens
-    // that make those magic, and escaping ! as [!] isn't valid,
-    // because [!]] is a valid glob class meaning not ']'.
-    return windowsPathsNoEscape
-        ? s.replace(/[?*()[\]]/g, '[$&]')
-        : s.replace(/[?*()[\]\\]/g, '\\$&');
-};
-exports.escape = escape;
-//# sourceMappingURL=escape.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/index.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/index.js
deleted file mode 100644
index d70e681fef5d7..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/index.js
+++ /dev/null
@@ -1,1011 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
-    return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.unescape = exports.escape = exports.AST = exports.Minimatch = exports.match = exports.makeRe = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0;
-const brace_expansion_1 = __importDefault(require("brace-expansion"));
-const assert_valid_pattern_js_1 = require("./assert-valid-pattern.js");
-const ast_js_1 = require("./ast.js");
-const escape_js_1 = require("./escape.js");
-const unescape_js_1 = require("./unescape.js");
-const minimatch = (p, pattern, options = {}) => {
-    (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
-    // shortcut: comments match nothing.
-    if (!options.nocomment && pattern.charAt(0) === '#') {
-        return false;
-    }
-    return new Minimatch(pattern, options).match(p);
-};
-exports.minimatch = minimatch;
-// Optimized checking for the most common glob patterns.
-const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
-const starDotExtTest = (ext) => (f) => !f.startsWith('.') && f.endsWith(ext);
-const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
-const starDotExtTestNocase = (ext) => {
-    ext = ext.toLowerCase();
-    return (f) => !f.startsWith('.') && f.toLowerCase().endsWith(ext);
-};
-const starDotExtTestNocaseDot = (ext) => {
-    ext = ext.toLowerCase();
-    return (f) => f.toLowerCase().endsWith(ext);
-};
-const starDotStarRE = /^\*+\.\*+$/;
-const starDotStarTest = (f) => !f.startsWith('.') && f.includes('.');
-const starDotStarTestDot = (f) => f !== '.' && f !== '..' && f.includes('.');
-const dotStarRE = /^\.\*+$/;
-const dotStarTest = (f) => f !== '.' && f !== '..' && f.startsWith('.');
-const starRE = /^\*+$/;
-const starTest = (f) => f.length !== 0 && !f.startsWith('.');
-const starTestDot = (f) => f.length !== 0 && f !== '.' && f !== '..';
-const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
-const qmarksTestNocase = ([$0, ext = '']) => {
-    const noext = qmarksTestNoExt([$0]);
-    if (!ext)
-        return noext;
-    ext = ext.toLowerCase();
-    return (f) => noext(f) && f.toLowerCase().endsWith(ext);
-};
-const qmarksTestNocaseDot = ([$0, ext = '']) => {
-    const noext = qmarksTestNoExtDot([$0]);
-    if (!ext)
-        return noext;
-    ext = ext.toLowerCase();
-    return (f) => noext(f) && f.toLowerCase().endsWith(ext);
-};
-const qmarksTestDot = ([$0, ext = '']) => {
-    const noext = qmarksTestNoExtDot([$0]);
-    return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
-};
-const qmarksTest = ([$0, ext = '']) => {
-    const noext = qmarksTestNoExt([$0]);
-    return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
-};
-const qmarksTestNoExt = ([$0]) => {
-    const len = $0.length;
-    return (f) => f.length === len && !f.startsWith('.');
-};
-const qmarksTestNoExtDot = ([$0]) => {
-    const len = $0.length;
-    return (f) => f.length === len && f !== '.' && f !== '..';
-};
-/* c8 ignore start */
-const defaultPlatform = (typeof process === 'object' && process
-    ? (typeof process.env === 'object' &&
-        process.env &&
-        process.env.__MINIMATCH_TESTING_PLATFORM__) ||
-        process.platform
-    : 'posix');
-const path = {
-    win32: { sep: '\\' },
-    posix: { sep: '/' },
-};
-/* c8 ignore stop */
-exports.sep = defaultPlatform === 'win32' ? path.win32.sep : path.posix.sep;
-exports.minimatch.sep = exports.sep;
-exports.GLOBSTAR = Symbol('globstar **');
-exports.minimatch.GLOBSTAR = exports.GLOBSTAR;
-// any single thing other than /
-// don't need to escape / when using new RegExp()
-const qmark = '[^/]';
-// * => any number of characters
-const star = qmark + '*?';
-// ** when dots are allowed.  Anything goes, except .. and .
-// not (^ or / followed by one or two dots followed by $ or /),
-// followed by anything, any number of times.
-const twoStarDot = '(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?';
-// not a ^ or / followed by a dot,
-// followed by anything, any number of times.
-const twoStarNoDot = '(?:(?!(?:\\/|^)\\.).)*?';
-const filter = (pattern, options = {}) => (p) => (0, exports.minimatch)(p, pattern, options);
-exports.filter = filter;
-exports.minimatch.filter = exports.filter;
-const ext = (a, b = {}) => Object.assign({}, a, b);
-const defaults = (def) => {
-    if (!def || typeof def !== 'object' || !Object.keys(def).length) {
-        return exports.minimatch;
-    }
-    const orig = exports.minimatch;
-    const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
-    return Object.assign(m, {
-        Minimatch: class Minimatch extends orig.Minimatch {
-            constructor(pattern, options = {}) {
-                super(pattern, ext(def, options));
-            }
-            static defaults(options) {
-                return orig.defaults(ext(def, options)).Minimatch;
-            }
-        },
-        AST: class AST extends orig.AST {
-            /* c8 ignore start */
-            constructor(type, parent, options = {}) {
-                super(type, parent, ext(def, options));
-            }
-            /* c8 ignore stop */
-            static fromGlob(pattern, options = {}) {
-                return orig.AST.fromGlob(pattern, ext(def, options));
-            }
-        },
-        unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
-        escape: (s, options = {}) => orig.escape(s, ext(def, options)),
-        filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
-        defaults: (options) => orig.defaults(ext(def, options)),
-        makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
-        braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
-        match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
-        sep: orig.sep,
-        GLOBSTAR: exports.GLOBSTAR,
-    });
-};
-exports.defaults = defaults;
-exports.minimatch.defaults = exports.defaults;
-// Brace expansion:
-// a{b,c}d -> abd acd
-// a{b,}c -> abc ac
-// a{0..3}d -> a0d a1d a2d a3d
-// a{b,c{d,e}f}g -> abg acdfg acefg
-// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
-//
-// Invalid sets are not expanded.
-// a{2..}b -> a{2..}b
-// a{b}c -> a{b}c
-const braceExpand = (pattern, options = {}) => {
-    (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
-    // Thanks to Yeting Li  for
-    // improving this regexp to avoid a ReDOS vulnerability.
-    if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
-        // shortcut. no need to expand.
-        return [pattern];
-    }
-    return (0, brace_expansion_1.default)(pattern);
-};
-exports.braceExpand = braceExpand;
-exports.minimatch.braceExpand = exports.braceExpand;
-// parse a component of the expanded set.
-// At this point, no pattern may contain "/" in it
-// so we're going to return a 2d array, where each entry is the full
-// pattern, split on '/', and then turned into a regular expression.
-// A regexp is made at the end which joins each array with an
-// escaped /, and another full one which joins each regexp with |.
-//
-// Following the lead of Bash 4.1, note that "**" only has special meaning
-// when it is the *only* thing in a path portion.  Otherwise, any series
-// of * is equivalent to a single *.  Globstar behavior is enabled by
-// default, and can be disabled by setting options.noglobstar.
-const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
-exports.makeRe = makeRe;
-exports.minimatch.makeRe = exports.makeRe;
-const match = (list, pattern, options = {}) => {
-    const mm = new Minimatch(pattern, options);
-    list = list.filter(f => mm.match(f));
-    if (mm.options.nonull && !list.length) {
-        list.push(pattern);
-    }
-    return list;
-};
-exports.match = match;
-exports.minimatch.match = exports.match;
-// replace stuff like \* with *
-const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
-const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
-class Minimatch {
-    options;
-    set;
-    pattern;
-    windowsPathsNoEscape;
-    nonegate;
-    negate;
-    comment;
-    empty;
-    preserveMultipleSlashes;
-    partial;
-    globSet;
-    globParts;
-    nocase;
-    isWindows;
-    platform;
-    windowsNoMagicRoot;
-    regexp;
-    constructor(pattern, options = {}) {
-        (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
-        options = options || {};
-        this.options = options;
-        this.pattern = pattern;
-        this.platform = options.platform || defaultPlatform;
-        this.isWindows = this.platform === 'win32';
-        this.windowsPathsNoEscape =
-            !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
-        if (this.windowsPathsNoEscape) {
-            this.pattern = this.pattern.replace(/\\/g, '/');
-        }
-        this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
-        this.regexp = null;
-        this.negate = false;
-        this.nonegate = !!options.nonegate;
-        this.comment = false;
-        this.empty = false;
-        this.partial = !!options.partial;
-        this.nocase = !!this.options.nocase;
-        this.windowsNoMagicRoot =
-            options.windowsNoMagicRoot !== undefined
-                ? options.windowsNoMagicRoot
-                : !!(this.isWindows && this.nocase);
-        this.globSet = [];
-        this.globParts = [];
-        this.set = [];
-        // make the set of regexps etc.
-        this.make();
-    }
-    hasMagic() {
-        if (this.options.magicalBraces && this.set.length > 1) {
-            return true;
-        }
-        for (const pattern of this.set) {
-            for (const part of pattern) {
-                if (typeof part !== 'string')
-                    return true;
-            }
-        }
-        return false;
-    }
-    debug(..._) { }
-    make() {
-        const pattern = this.pattern;
-        const options = this.options;
-        // empty patterns and comments match nothing.
-        if (!options.nocomment && pattern.charAt(0) === '#') {
-            this.comment = true;
-            return;
-        }
-        if (!pattern) {
-            this.empty = true;
-            return;
-        }
-        // step 1: figure out negation, etc.
-        this.parseNegate();
-        // step 2: expand braces
-        this.globSet = [...new Set(this.braceExpand())];
-        if (options.debug) {
-            this.debug = (...args) => console.error(...args);
-        }
-        this.debug(this.pattern, this.globSet);
-        // step 3: now we have a set, so turn each one into a series of
-        // path-portion matching patterns.
-        // These will be regexps, except in the case of "**", which is
-        // set to the GLOBSTAR object for globstar behavior,
-        // and will not contain any / characters
-        //
-        // First, we preprocess to make the glob pattern sets a bit simpler
-        // and deduped.  There are some perf-killing patterns that can cause
-        // problems with a glob walk, but we can simplify them down a bit.
-        const rawGlobParts = this.globSet.map(s => this.slashSplit(s));
-        this.globParts = this.preprocess(rawGlobParts);
-        this.debug(this.pattern, this.globParts);
-        // glob --> regexps
-        let set = this.globParts.map((s, _, __) => {
-            if (this.isWindows && this.windowsNoMagicRoot) {
-                // check if it's a drive or unc path.
-                const isUNC = s[0] === '' &&
-                    s[1] === '' &&
-                    (s[2] === '?' || !globMagic.test(s[2])) &&
-                    !globMagic.test(s[3]);
-                const isDrive = /^[a-z]:/i.test(s[0]);
-                if (isUNC) {
-                    return [...s.slice(0, 4), ...s.slice(4).map(ss => this.parse(ss))];
-                }
-                else if (isDrive) {
-                    return [s[0], ...s.slice(1).map(ss => this.parse(ss))];
-                }
-            }
-            return s.map(ss => this.parse(ss));
-        });
-        this.debug(this.pattern, set);
-        // filter out everything that didn't compile properly.
-        this.set = set.filter(s => s.indexOf(false) === -1);
-        // do not treat the ? in UNC paths as magic
-        if (this.isWindows) {
-            for (let i = 0; i < this.set.length; i++) {
-                const p = this.set[i];
-                if (p[0] === '' &&
-                    p[1] === '' &&
-                    this.globParts[i][2] === '?' &&
-                    typeof p[3] === 'string' &&
-                    /^[a-z]:$/i.test(p[3])) {
-                    p[2] = '?';
-                }
-            }
-        }
-        this.debug(this.pattern, this.set);
-    }
-    // various transforms to equivalent pattern sets that are
-    // faster to process in a filesystem walk.  The goal is to
-    // eliminate what we can, and push all ** patterns as far
-    // to the right as possible, even if it increases the number
-    // of patterns that we have to process.
-    preprocess(globParts) {
-        // if we're not in globstar mode, then turn all ** into *
-        if (this.options.noglobstar) {
-            for (let i = 0; i < globParts.length; i++) {
-                for (let j = 0; j < globParts[i].length; j++) {
-                    if (globParts[i][j] === '**') {
-                        globParts[i][j] = '*';
-                    }
-                }
-            }
-        }
-        const { optimizationLevel = 1 } = this.options;
-        if (optimizationLevel >= 2) {
-            // aggressive optimization for the purpose of fs walking
-            globParts = this.firstPhasePreProcess(globParts);
-            globParts = this.secondPhasePreProcess(globParts);
-        }
-        else if (optimizationLevel >= 1) {
-            // just basic optimizations to remove some .. parts
-            globParts = this.levelOneOptimize(globParts);
-        }
-        else {
-            globParts = this.adjascentGlobstarOptimize(globParts);
-        }
-        return globParts;
-    }
-    // just get rid of adjascent ** portions
-    adjascentGlobstarOptimize(globParts) {
-        return globParts.map(parts => {
-            let gs = -1;
-            while (-1 !== (gs = parts.indexOf('**', gs + 1))) {
-                let i = gs;
-                while (parts[i + 1] === '**') {
-                    i++;
-                }
-                if (i !== gs) {
-                    parts.splice(gs, i - gs);
-                }
-            }
-            return parts;
-        });
-    }
-    // get rid of adjascent ** and resolve .. portions
-    levelOneOptimize(globParts) {
-        return globParts.map(parts => {
-            parts = parts.reduce((set, part) => {
-                const prev = set[set.length - 1];
-                if (part === '**' && prev === '**') {
-                    return set;
-                }
-                if (part === '..') {
-                    if (prev && prev !== '..' && prev !== '.' && prev !== '**') {
-                        set.pop();
-                        return set;
-                    }
-                }
-                set.push(part);
-                return set;
-            }, []);
-            return parts.length === 0 ? [''] : parts;
-        });
-    }
-    levelTwoFileOptimize(parts) {
-        if (!Array.isArray(parts)) {
-            parts = this.slashSplit(parts);
-        }
-        let didSomething = false;
-        do {
-            didSomething = false;
-            // 
// -> 
/
-            if (!this.preserveMultipleSlashes) {
-                for (let i = 1; i < parts.length - 1; i++) {
-                    const p = parts[i];
-                    // don't squeeze out UNC patterns
-                    if (i === 1 && p === '' && parts[0] === '')
-                        continue;
-                    if (p === '.' || p === '') {
-                        didSomething = true;
-                        parts.splice(i, 1);
-                        i--;
-                    }
-                }
-                if (parts[0] === '.' &&
-                    parts.length === 2 &&
-                    (parts[1] === '.' || parts[1] === '')) {
-                    didSomething = true;
-                    parts.pop();
-                }
-            }
-            // 
/

/../ ->

/
-            let dd = 0;
-            while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
-                const p = parts[dd - 1];
-                if (p && p !== '.' && p !== '..' && p !== '**') {
-                    didSomething = true;
-                    parts.splice(dd - 1, 2);
-                    dd -= 2;
-                }
-            }
-        } while (didSomething);
-        return parts.length === 0 ? [''] : parts;
-    }
-    // First phase: single-pattern processing
-    // 
 is 1 or more portions
-    //  is 1 or more portions
-    // 

is any portion other than ., .., '', or ** - // is . or '' - // - // **/.. is *brutal* for filesystem walking performance, because - // it effectively resets the recursive walk each time it occurs, - // and ** cannot be reduced out by a .. pattern part like a regexp - // or most strings (other than .., ., and '') can be. - // - //

/**/../

/

/ -> {

/../

/

/,

/**/

/

/} - //

// -> 
/
-    // 
/

/../ ->

/
-    // **/**/ -> **/
-    //
-    // **/*/ -> */**/ <== not valid because ** doesn't follow
-    // this WOULD be allowed if ** did follow symlinks, or * didn't
-    firstPhasePreProcess(globParts) {
-        let didSomething = false;
-        do {
-            didSomething = false;
-            // 
/**/../

/

/ -> {

/../

/

/,

/**/

/

/} - for (let parts of globParts) { - let gs = -1; - while (-1 !== (gs = parts.indexOf('**', gs + 1))) { - let gss = gs; - while (parts[gss + 1] === '**') { - //

/**/**/ -> 
/**/
-                        gss++;
-                    }
-                    // eg, if gs is 2 and gss is 4, that means we have 3 **
-                    // parts, and can remove 2 of them.
-                    if (gss > gs) {
-                        parts.splice(gs + 1, gss - gs);
-                    }
-                    let next = parts[gs + 1];
-                    const p = parts[gs + 2];
-                    const p2 = parts[gs + 3];
-                    if (next !== '..')
-                        continue;
-                    if (!p ||
-                        p === '.' ||
-                        p === '..' ||
-                        !p2 ||
-                        p2 === '.' ||
-                        p2 === '..') {
-                        continue;
-                    }
-                    didSomething = true;
-                    // edit parts in place, and push the new one
-                    parts.splice(gs, 1);
-                    const other = parts.slice(0);
-                    other[gs] = '**';
-                    globParts.push(other);
-                    gs--;
-                }
-                // 
// -> 
/
-                if (!this.preserveMultipleSlashes) {
-                    for (let i = 1; i < parts.length - 1; i++) {
-                        const p = parts[i];
-                        // don't squeeze out UNC patterns
-                        if (i === 1 && p === '' && parts[0] === '')
-                            continue;
-                        if (p === '.' || p === '') {
-                            didSomething = true;
-                            parts.splice(i, 1);
-                            i--;
-                        }
-                    }
-                    if (parts[0] === '.' &&
-                        parts.length === 2 &&
-                        (parts[1] === '.' || parts[1] === '')) {
-                        didSomething = true;
-                        parts.pop();
-                    }
-                }
-                // 
/

/../ ->

/
-                let dd = 0;
-                while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
-                    const p = parts[dd - 1];
-                    if (p && p !== '.' && p !== '..' && p !== '**') {
-                        didSomething = true;
-                        const needDot = dd === 1 && parts[dd + 1] === '**';
-                        const splin = needDot ? ['.'] : [];
-                        parts.splice(dd - 1, 2, ...splin);
-                        if (parts.length === 0)
-                            parts.push('');
-                        dd -= 2;
-                    }
-                }
-            }
-        } while (didSomething);
-        return globParts;
-    }
-    // second phase: multi-pattern dedupes
-    // {
/*/,
/

/} ->

/*/
-    // {
/,
/} -> 
/
-    // {
/**/,
/} -> 
/**/
-    //
-    // {
/**/,
/**/

/} ->

/**/
-    // ^-- not valid because ** doens't follow symlinks
-    secondPhasePreProcess(globParts) {
-        for (let i = 0; i < globParts.length - 1; i++) {
-            for (let j = i + 1; j < globParts.length; j++) {
-                const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
-                if (!matched)
-                    continue;
-                globParts[i] = matched;
-                globParts[j] = [];
-            }
-        }
-        return globParts.filter(gs => gs.length);
-    }
-    partsMatch(a, b, emptyGSMatch = false) {
-        let ai = 0;
-        let bi = 0;
-        let result = [];
-        let which = '';
-        while (ai < a.length && bi < b.length) {
-            if (a[ai] === b[bi]) {
-                result.push(which === 'b' ? b[bi] : a[ai]);
-                ai++;
-                bi++;
-            }
-            else if (emptyGSMatch && a[ai] === '**' && b[bi] === a[ai + 1]) {
-                result.push(a[ai]);
-                ai++;
-            }
-            else if (emptyGSMatch && b[bi] === '**' && a[ai] === b[bi + 1]) {
-                result.push(b[bi]);
-                bi++;
-            }
-            else if (a[ai] === '*' &&
-                b[bi] &&
-                (this.options.dot || !b[bi].startsWith('.')) &&
-                b[bi] !== '**') {
-                if (which === 'b')
-                    return false;
-                which = 'a';
-                result.push(a[ai]);
-                ai++;
-                bi++;
-            }
-            else if (b[bi] === '*' &&
-                a[ai] &&
-                (this.options.dot || !a[ai].startsWith('.')) &&
-                a[ai] !== '**') {
-                if (which === 'a')
-                    return false;
-                which = 'b';
-                result.push(b[bi]);
-                ai++;
-                bi++;
-            }
-            else {
-                return false;
-            }
-        }
-        // if we fall out of the loop, it means they two are identical
-        // as long as their lengths match
-        return a.length === b.length && result;
-    }
-    parseNegate() {
-        if (this.nonegate)
-            return;
-        const pattern = this.pattern;
-        let negate = false;
-        let negateOffset = 0;
-        for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {
-            negate = !negate;
-            negateOffset++;
-        }
-        if (negateOffset)
-            this.pattern = pattern.slice(negateOffset);
-        this.negate = negate;
-    }
-    // set partial to true to test if, for example,
-    // "/a/b" matches the start of "/*/b/*/d"
-    // Partial means, if you run out of file before you run
-    // out of pattern, then that's fine, as long as all
-    // the parts match.
-    matchOne(file, pattern, partial = false) {
-        const options = this.options;
-        // UNC paths like //?/X:/... can match X:/... and vice versa
-        // Drive letters in absolute drive or unc paths are always compared
-        // case-insensitively.
-        if (this.isWindows) {
-            const fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0]);
-            const fileUNC = !fileDrive &&
-                file[0] === '' &&
-                file[1] === '' &&
-                file[2] === '?' &&
-                /^[a-z]:$/i.test(file[3]);
-            const patternDrive = typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0]);
-            const patternUNC = !patternDrive &&
-                pattern[0] === '' &&
-                pattern[1] === '' &&
-                pattern[2] === '?' &&
-                typeof pattern[3] === 'string' &&
-                /^[a-z]:$/i.test(pattern[3]);
-            const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined;
-            const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined;
-            if (typeof fdi === 'number' && typeof pdi === 'number') {
-                const [fd, pd] = [file[fdi], pattern[pdi]];
-                if (fd.toLowerCase() === pd.toLowerCase()) {
-                    pattern[pdi] = fd;
-                    if (pdi > fdi) {
-                        pattern = pattern.slice(pdi);
-                    }
-                    else if (fdi > pdi) {
-                        file = file.slice(fdi);
-                    }
-                }
-            }
-        }
-        // resolve and reduce . and .. portions in the file as well.
-        // dont' need to do the second phase, because it's only one string[]
-        const { optimizationLevel = 1 } = this.options;
-        if (optimizationLevel >= 2) {
-            file = this.levelTwoFileOptimize(file);
-        }
-        this.debug('matchOne', this, { file, pattern });
-        this.debug('matchOne', file.length, pattern.length);
-        for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
-            this.debug('matchOne loop');
-            var p = pattern[pi];
-            var f = file[fi];
-            this.debug(pattern, p, f);
-            // should be impossible.
-            // some invalid regexp stuff in the set.
-            /* c8 ignore start */
-            if (p === false) {
-                return false;
-            }
-            /* c8 ignore stop */
-            if (p === exports.GLOBSTAR) {
-                this.debug('GLOBSTAR', [pattern, p, f]);
-                // "**"
-                // a/**/b/**/c would match the following:
-                // a/b/x/y/z/c
-                // a/x/y/z/b/c
-                // a/b/x/b/x/c
-                // a/b/c
-                // To do this, take the rest of the pattern after
-                // the **, and see if it would match the file remainder.
-                // If so, return success.
-                // If not, the ** "swallows" a segment, and try again.
-                // This is recursively awful.
-                //
-                // a/**/b/**/c matching a/b/x/y/z/c
-                // - a matches a
-                // - doublestar
-                //   - matchOne(b/x/y/z/c, b/**/c)
-                //     - b matches b
-                //     - doublestar
-                //       - matchOne(x/y/z/c, c) -> no
-                //       - matchOne(y/z/c, c) -> no
-                //       - matchOne(z/c, c) -> no
-                //       - matchOne(c, c) yes, hit
-                var fr = fi;
-                var pr = pi + 1;
-                if (pr === pl) {
-                    this.debug('** at the end');
-                    // a ** at the end will just swallow the rest.
-                    // We have found a match.
-                    // however, it will not swallow /.x, unless
-                    // options.dot is set.
-                    // . and .. are *never* matched by **, for explosively
-                    // exponential reasons.
-                    for (; fi < fl; fi++) {
-                        if (file[fi] === '.' ||
-                            file[fi] === '..' ||
-                            (!options.dot && file[fi].charAt(0) === '.'))
-                            return false;
-                    }
-                    return true;
-                }
-                // ok, let's see if we can swallow whatever we can.
-                while (fr < fl) {
-                    var swallowee = file[fr];
-                    this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
-                    // XXX remove this slice.  Just pass the start index.
-                    if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
-                        this.debug('globstar found match!', fr, fl, swallowee);
-                        // found a match.
-                        return true;
-                    }
-                    else {
-                        // can't swallow "." or ".." ever.
-                        // can only swallow ".foo" when explicitly asked.
-                        if (swallowee === '.' ||
-                            swallowee === '..' ||
-                            (!options.dot && swallowee.charAt(0) === '.')) {
-                            this.debug('dot detected!', file, fr, pattern, pr);
-                            break;
-                        }
-                        // ** swallows a segment, and continue.
-                        this.debug('globstar swallow a segment, and continue');
-                        fr++;
-                    }
-                }
-                // no match was found.
-                // However, in partial mode, we can't say this is necessarily over.
-                /* c8 ignore start */
-                if (partial) {
-                    // ran out of file
-                    this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
-                    if (fr === fl) {
-                        return true;
-                    }
-                }
-                /* c8 ignore stop */
-                return false;
-            }
-            // something other than **
-            // non-magic patterns just have to match exactly
-            // patterns with magic have been turned into regexps.
-            let hit;
-            if (typeof p === 'string') {
-                hit = f === p;
-                this.debug('string match', p, f, hit);
-            }
-            else {
-                hit = p.test(f);
-                this.debug('pattern match', p, f, hit);
-            }
-            if (!hit)
-                return false;
-        }
-        // Note: ending in / means that we'll get a final ""
-        // at the end of the pattern.  This can only match a
-        // corresponding "" at the end of the file.
-        // If the file ends in /, then it can only match a
-        // a pattern that ends in /, unless the pattern just
-        // doesn't have any more for it. But, a/b/ should *not*
-        // match "a/b/*", even though "" matches against the
-        // [^/]*? pattern, except in partial mode, where it might
-        // simply not be reached yet.
-        // However, a/b/ should still satisfy a/*
-        // now either we fell off the end of the pattern, or we're done.
-        if (fi === fl && pi === pl) {
-            // ran out of pattern and filename at the same time.
-            // an exact hit!
-            return true;
-        }
-        else if (fi === fl) {
-            // ran out of file, but still had pattern left.
-            // this is ok if we're doing the match as part of
-            // a glob fs traversal.
-            return partial;
-        }
-        else if (pi === pl) {
-            // ran out of pattern, still have file left.
-            // this is only acceptable if we're on the very last
-            // empty segment of a file with a trailing slash.
-            // a/* should match a/b/
-            return fi === fl - 1 && file[fi] === '';
-            /* c8 ignore start */
-        }
-        else {
-            // should be unreachable.
-            throw new Error('wtf?');
-        }
-        /* c8 ignore stop */
-    }
-    braceExpand() {
-        return (0, exports.braceExpand)(this.pattern, this.options);
-    }
-    parse(pattern) {
-        (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
-        const options = this.options;
-        // shortcuts
-        if (pattern === '**')
-            return exports.GLOBSTAR;
-        if (pattern === '')
-            return '';
-        // far and away, the most common glob pattern parts are
-        // *, *.*, and *.  Add a fast check method for those.
-        let m;
-        let fastTest = null;
-        if ((m = pattern.match(starRE))) {
-            fastTest = options.dot ? starTestDot : starTest;
-        }
-        else if ((m = pattern.match(starDotExtRE))) {
-            fastTest = (options.nocase
-                ? options.dot
-                    ? starDotExtTestNocaseDot
-                    : starDotExtTestNocase
-                : options.dot
-                    ? starDotExtTestDot
-                    : starDotExtTest)(m[1]);
-        }
-        else if ((m = pattern.match(qmarksRE))) {
-            fastTest = (options.nocase
-                ? options.dot
-                    ? qmarksTestNocaseDot
-                    : qmarksTestNocase
-                : options.dot
-                    ? qmarksTestDot
-                    : qmarksTest)(m);
-        }
-        else if ((m = pattern.match(starDotStarRE))) {
-            fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
-        }
-        else if ((m = pattern.match(dotStarRE))) {
-            fastTest = dotStarTest;
-        }
-        const re = ast_js_1.AST.fromGlob(pattern, this.options).toMMPattern();
-        return fastTest ? Object.assign(re, { test: fastTest }) : re;
-    }
-    makeRe() {
-        if (this.regexp || this.regexp === false)
-            return this.regexp;
-        // at this point, this.set is a 2d array of partial
-        // pattern strings, or "**".
-        //
-        // It's better to use .match().  This function shouldn't
-        // be used, really, but it's pretty convenient sometimes,
-        // when you just want to work with a regex.
-        const set = this.set;
-        if (!set.length) {
-            this.regexp = false;
-            return this.regexp;
-        }
-        const options = this.options;
-        const twoStar = options.noglobstar
-            ? star
-            : options.dot
-                ? twoStarDot
-                : twoStarNoDot;
-        const flags = new Set(options.nocase ? ['i'] : []);
-        // regexpify non-globstar patterns
-        // if ** is only item, then we just do one twoStar
-        // if ** is first, and there are more, prepend (\/|twoStar\/)? to next
-        // if ** is last, append (\/twoStar|) to previous
-        // if ** is in the middle, append (\/|\/twoStar\/) to previous
-        // then filter out GLOBSTAR symbols
-        let re = set
-            .map(pattern => {
-            const pp = pattern.map(p => {
-                if (p instanceof RegExp) {
-                    for (const f of p.flags.split(''))
-                        flags.add(f);
-                }
-                return typeof p === 'string'
-                    ? regExpEscape(p)
-                    : p === exports.GLOBSTAR
-                        ? exports.GLOBSTAR
-                        : p._src;
-            });
-            pp.forEach((p, i) => {
-                const next = pp[i + 1];
-                const prev = pp[i - 1];
-                if (p !== exports.GLOBSTAR || prev === exports.GLOBSTAR) {
-                    return;
-                }
-                if (prev === undefined) {
-                    if (next !== undefined && next !== exports.GLOBSTAR) {
-                        pp[i + 1] = '(?:\\/|' + twoStar + '\\/)?' + next;
-                    }
-                    else {
-                        pp[i] = twoStar;
-                    }
-                }
-                else if (next === undefined) {
-                    pp[i - 1] = prev + '(?:\\/|' + twoStar + ')?';
-                }
-                else if (next !== exports.GLOBSTAR) {
-                    pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
-                    pp[i + 1] = exports.GLOBSTAR;
-                }
-            });
-            return pp.filter(p => p !== exports.GLOBSTAR).join('/');
-        })
-            .join('|');
-        // need to wrap in parens if we had more than one thing with |,
-        // otherwise only the first will be anchored to ^ and the last to $
-        const [open, close] = set.length > 1 ? ['(?:', ')'] : ['', ''];
-        // must match entire pattern
-        // ending in a * or ** will make it less strict.
-        re = '^' + open + re + close + '$';
-        // can match anything, as long as it's not this.
-        if (this.negate)
-            re = '^(?!' + re + ').+$';
-        try {
-            this.regexp = new RegExp(re, [...flags].join(''));
-            /* c8 ignore start */
-        }
-        catch (ex) {
-            // should be impossible
-            this.regexp = false;
-        }
-        /* c8 ignore stop */
-        return this.regexp;
-    }
-    slashSplit(p) {
-        // if p starts with // on windows, we preserve that
-        // so that UNC paths aren't broken.  Otherwise, any number of
-        // / characters are coalesced into one, unless
-        // preserveMultipleSlashes is set to true.
-        if (this.preserveMultipleSlashes) {
-            return p.split('/');
-        }
-        else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
-            // add an extra '' for the one we lose
-            return ['', ...p.split(/\/+/)];
-        }
-        else {
-            return p.split(/\/+/);
-        }
-    }
-    match(f, partial = this.partial) {
-        this.debug('match', f, this.pattern);
-        // short-circuit in the case of busted things.
-        // comments, etc.
-        if (this.comment) {
-            return false;
-        }
-        if (this.empty) {
-            return f === '';
-        }
-        if (f === '/' && partial) {
-            return true;
-        }
-        const options = this.options;
-        // windows: need to use /, not \
-        if (this.isWindows) {
-            f = f.split('\\').join('/');
-        }
-        // treat the test path as a set of pathparts.
-        const ff = this.slashSplit(f);
-        this.debug(this.pattern, 'split', ff);
-        // just ONE of the pattern sets in this.set needs to match
-        // in order for it to be valid.  If negating, then just one
-        // match means that we have failed.
-        // Either way, return on the first hit.
-        const set = this.set;
-        this.debug(this.pattern, 'set', set);
-        // Find the basename of the path by looking for the last non-empty segment
-        let filename = ff[ff.length - 1];
-        if (!filename) {
-            for (let i = ff.length - 2; !filename && i >= 0; i--) {
-                filename = ff[i];
-            }
-        }
-        for (let i = 0; i < set.length; i++) {
-            const pattern = set[i];
-            let file = ff;
-            if (options.matchBase && pattern.length === 1) {
-                file = [filename];
-            }
-            const hit = this.matchOne(file, pattern, partial);
-            if (hit) {
-                if (options.flipNegate) {
-                    return true;
-                }
-                return !this.negate;
-            }
-        }
-        // didn't get any hits.  this is success if it's a negative
-        // pattern, failure otherwise.
-        if (options.flipNegate) {
-            return false;
-        }
-        return this.negate;
-    }
-    static defaults(def) {
-        return exports.minimatch.defaults(def).Minimatch;
-    }
-}
-exports.Minimatch = Minimatch;
-/* c8 ignore start */
-var ast_js_2 = require("./ast.js");
-Object.defineProperty(exports, "AST", { enumerable: true, get: function () { return ast_js_2.AST; } });
-var escape_js_2 = require("./escape.js");
-Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return escape_js_2.escape; } });
-var unescape_js_2 = require("./unescape.js");
-Object.defineProperty(exports, "unescape", { enumerable: true, get: function () { return unescape_js_2.unescape; } });
-/* c8 ignore stop */
-exports.minimatch.AST = ast_js_1.AST;
-exports.minimatch.Minimatch = Minimatch;
-exports.minimatch.escape = escape_js_1.escape;
-exports.minimatch.unescape = unescape_js_1.unescape;
-//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/package.json b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/package.json
deleted file mode 100644
index 5bbefffbabee3..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-  "type": "commonjs"
-}
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/unescape.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/unescape.js
deleted file mode 100644
index 47c36bcee5a02..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/cjs/unescape.js
+++ /dev/null
@@ -1,24 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.unescape = void 0;
-/**
- * Un-escape a string that has been escaped with {@link escape}.
- *
- * If the {@link windowsPathsNoEscape} option is used, then square-brace
- * escapes are removed, but not backslash escapes.  For example, it will turn
- * the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
- * becuase `\` is a path separator in `windowsPathsNoEscape` mode.
- *
- * When `windowsPathsNoEscape` is not set, then both brace escapes and
- * backslash escapes are removed.
- *
- * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
- * or unescaped.
- */
-const unescape = (s, { windowsPathsNoEscape = false, } = {}) => {
-    return windowsPathsNoEscape
-        ? s.replace(/\[([^\/\\])\]/g, '$1')
-        : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2').replace(/\\([^\/])/g, '$1');
-};
-exports.unescape = unescape;
-//# sourceMappingURL=unescape.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/assert-valid-pattern.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/assert-valid-pattern.js
deleted file mode 100644
index 7b534fc30200b..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/assert-valid-pattern.js
+++ /dev/null
@@ -1,10 +0,0 @@
-const MAX_PATTERN_LENGTH = 1024 * 64;
-export const assertValidPattern = (pattern) => {
-    if (typeof pattern !== 'string') {
-        throw new TypeError('invalid pattern');
-    }
-    if (pattern.length > MAX_PATTERN_LENGTH) {
-        throw new TypeError('pattern is too long');
-    }
-};
-//# sourceMappingURL=assert-valid-pattern.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/ast.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/ast.js
deleted file mode 100644
index 9f9835e06a7d5..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/ast.js
+++ /dev/null
@@ -1,585 +0,0 @@
-// parse a single path portion
-import { parseClass } from './brace-expressions.js';
-import { unescape } from './unescape.js';
-const types = new Set(['!', '?', '+', '*', '@']);
-const isExtglobType = (c) => types.has(c);
-// Patterns that get prepended to bind to the start of either the
-// entire string, or just a single path portion, to prevent dots
-// and/or traversal patterns, when needed.
-// Exts don't need the ^ or / bit, because the root binds that already.
-const startNoTraversal = '(?!(?:^|/)\\.\\.?(?:$|/))';
-const startNoDot = '(?!\\.)';
-// characters that indicate a start of pattern needs the "no dots" bit,
-// because a dot *might* be matched. ( is not in the list, because in
-// the case of a child extglob, it will handle the prevention itself.
-const addPatternStart = new Set(['[', '.']);
-// cases where traversal is A-OK, no dot prevention needed
-const justDots = new Set(['..', '.']);
-const reSpecials = new Set('().*{}+?[]^$\\!');
-const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
-// any single thing other than /
-const qmark = '[^/]';
-// * => any number of characters
-const star = qmark + '*?';
-// use + when we need to ensure that *something* matches, because the * is
-// the only thing in the path portion.
-const starNoEmpty = qmark + '+?';
-// remove the \ chars that we added if we end up doing a nonmagic compare
-// const deslash = (s: string) => s.replace(/\\(.)/g, '$1')
-export class AST {
-    type;
-    #root;
-    #hasMagic;
-    #uflag = false;
-    #parts = [];
-    #parent;
-    #parentIndex;
-    #negs;
-    #filledNegs = false;
-    #options;
-    #toString;
-    // set to true if it's an extglob with no children
-    // (which really means one child of '')
-    #emptyExt = false;
-    constructor(type, parent, options = {}) {
-        this.type = type;
-        // extglobs are inherently magical
-        if (type)
-            this.#hasMagic = true;
-        this.#parent = parent;
-        this.#root = this.#parent ? this.#parent.#root : this;
-        this.#options = this.#root === this ? options : this.#root.#options;
-        this.#negs = this.#root === this ? [] : this.#root.#negs;
-        if (type === '!' && !this.#root.#filledNegs)
-            this.#negs.push(this);
-        this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
-    }
-    get hasMagic() {
-        /* c8 ignore start */
-        if (this.#hasMagic !== undefined)
-            return this.#hasMagic;
-        /* c8 ignore stop */
-        for (const p of this.#parts) {
-            if (typeof p === 'string')
-                continue;
-            if (p.type || p.hasMagic)
-                return (this.#hasMagic = true);
-        }
-        // note: will be undefined until we generate the regexp src and find out
-        return this.#hasMagic;
-    }
-    // reconstructs the pattern
-    toString() {
-        if (this.#toString !== undefined)
-            return this.#toString;
-        if (!this.type) {
-            return (this.#toString = this.#parts.map(p => String(p)).join(''));
-        }
-        else {
-            return (this.#toString =
-                this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')');
-        }
-    }
-    #fillNegs() {
-        /* c8 ignore start */
-        if (this !== this.#root)
-            throw new Error('should only call on root');
-        if (this.#filledNegs)
-            return this;
-        /* c8 ignore stop */
-        // call toString() once to fill this out
-        this.toString();
-        this.#filledNegs = true;
-        let n;
-        while ((n = this.#negs.pop())) {
-            if (n.type !== '!')
-                continue;
-            // walk up the tree, appending everthing that comes AFTER parentIndex
-            let p = n;
-            let pp = p.#parent;
-            while (pp) {
-                for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
-                    for (const part of n.#parts) {
-                        /* c8 ignore start */
-                        if (typeof part === 'string') {
-                            throw new Error('string part in extglob AST??');
-                        }
-                        /* c8 ignore stop */
-                        part.copyIn(pp.#parts[i]);
-                    }
-                }
-                p = pp;
-                pp = p.#parent;
-            }
-        }
-        return this;
-    }
-    push(...parts) {
-        for (const p of parts) {
-            if (p === '')
-                continue;
-            /* c8 ignore start */
-            if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {
-                throw new Error('invalid part: ' + p);
-            }
-            /* c8 ignore stop */
-            this.#parts.push(p);
-        }
-    }
-    toJSON() {
-        const ret = this.type === null
-            ? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON()))
-            : [this.type, ...this.#parts.map(p => p.toJSON())];
-        if (this.isStart() && !this.type)
-            ret.unshift([]);
-        if (this.isEnd() &&
-            (this === this.#root ||
-                (this.#root.#filledNegs && this.#parent?.type === '!'))) {
-            ret.push({});
-        }
-        return ret;
-    }
-    isStart() {
-        if (this.#root === this)
-            return true;
-        // if (this.type) return !!this.#parent?.isStart()
-        if (!this.#parent?.isStart())
-            return false;
-        if (this.#parentIndex === 0)
-            return true;
-        // if everything AHEAD of this is a negation, then it's still the "start"
-        const p = this.#parent;
-        for (let i = 0; i < this.#parentIndex; i++) {
-            const pp = p.#parts[i];
-            if (!(pp instanceof AST && pp.type === '!')) {
-                return false;
-            }
-        }
-        return true;
-    }
-    isEnd() {
-        if (this.#root === this)
-            return true;
-        if (this.#parent?.type === '!')
-            return true;
-        if (!this.#parent?.isEnd())
-            return false;
-        if (!this.type)
-            return this.#parent?.isEnd();
-        // if not root, it'll always have a parent
-        /* c8 ignore start */
-        const pl = this.#parent ? this.#parent.#parts.length : 0;
-        /* c8 ignore stop */
-        return this.#parentIndex === pl - 1;
-    }
-    copyIn(part) {
-        if (typeof part === 'string')
-            this.push(part);
-        else
-            this.push(part.clone(this));
-    }
-    clone(parent) {
-        const c = new AST(this.type, parent);
-        for (const p of this.#parts) {
-            c.copyIn(p);
-        }
-        return c;
-    }
-    static #parseAST(str, ast, pos, opt) {
-        let escaping = false;
-        let inBrace = false;
-        let braceStart = -1;
-        let braceNeg = false;
-        if (ast.type === null) {
-            // outside of a extglob, append until we find a start
-            let i = pos;
-            let acc = '';
-            while (i < str.length) {
-                const c = str.charAt(i++);
-                // still accumulate escapes at this point, but we do ignore
-                // starts that are escaped
-                if (escaping || c === '\\') {
-                    escaping = !escaping;
-                    acc += c;
-                    continue;
-                }
-                if (inBrace) {
-                    if (i === braceStart + 1) {
-                        if (c === '^' || c === '!') {
-                            braceNeg = true;
-                        }
-                    }
-                    else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {
-                        inBrace = false;
-                    }
-                    acc += c;
-                    continue;
-                }
-                else if (c === '[') {
-                    inBrace = true;
-                    braceStart = i;
-                    braceNeg = false;
-                    acc += c;
-                    continue;
-                }
-                if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {
-                    ast.push(acc);
-                    acc = '';
-                    const ext = new AST(c, ast);
-                    i = AST.#parseAST(str, ext, i, opt);
-                    ast.push(ext);
-                    continue;
-                }
-                acc += c;
-            }
-            ast.push(acc);
-            return i;
-        }
-        // some kind of extglob, pos is at the (
-        // find the next | or )
-        let i = pos + 1;
-        let part = new AST(null, ast);
-        const parts = [];
-        let acc = '';
-        while (i < str.length) {
-            const c = str.charAt(i++);
-            // still accumulate escapes at this point, but we do ignore
-            // starts that are escaped
-            if (escaping || c === '\\') {
-                escaping = !escaping;
-                acc += c;
-                continue;
-            }
-            if (inBrace) {
-                if (i === braceStart + 1) {
-                    if (c === '^' || c === '!') {
-                        braceNeg = true;
-                    }
-                }
-                else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {
-                    inBrace = false;
-                }
-                acc += c;
-                continue;
-            }
-            else if (c === '[') {
-                inBrace = true;
-                braceStart = i;
-                braceNeg = false;
-                acc += c;
-                continue;
-            }
-            if (isExtglobType(c) && str.charAt(i) === '(') {
-                part.push(acc);
-                acc = '';
-                const ext = new AST(c, part);
-                part.push(ext);
-                i = AST.#parseAST(str, ext, i, opt);
-                continue;
-            }
-            if (c === '|') {
-                part.push(acc);
-                acc = '';
-                parts.push(part);
-                part = new AST(null, ast);
-                continue;
-            }
-            if (c === ')') {
-                if (acc === '' && ast.#parts.length === 0) {
-                    ast.#emptyExt = true;
-                }
-                part.push(acc);
-                acc = '';
-                ast.push(...parts, part);
-                return i;
-            }
-            acc += c;
-        }
-        // unfinished extglob
-        // if we got here, it was a malformed extglob! not an extglob, but
-        // maybe something else in there.
-        ast.type = null;
-        ast.#hasMagic = undefined;
-        ast.#parts = [str.substring(pos - 1)];
-        return i;
-    }
-    static fromGlob(pattern, options = {}) {
-        const ast = new AST(null, undefined, options);
-        AST.#parseAST(pattern, ast, 0, options);
-        return ast;
-    }
-    // returns the regular expression if there's magic, or the unescaped
-    // string if not.
-    toMMPattern() {
-        // should only be called on root
-        /* c8 ignore start */
-        if (this !== this.#root)
-            return this.#root.toMMPattern();
-        /* c8 ignore stop */
-        const glob = this.toString();
-        const [re, body, hasMagic, uflag] = this.toRegExpSource();
-        // if we're in nocase mode, and not nocaseMagicOnly, then we do
-        // still need a regular expression if we have to case-insensitively
-        // match capital/lowercase characters.
-        const anyMagic = hasMagic ||
-            this.#hasMagic ||
-            (this.#options.nocase &&
-                !this.#options.nocaseMagicOnly &&
-                glob.toUpperCase() !== glob.toLowerCase());
-        if (!anyMagic) {
-            return body;
-        }
-        const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : '');
-        return Object.assign(new RegExp(`^${re}$`, flags), {
-            _src: re,
-            _glob: glob,
-        });
-    }
-    // returns the string match, the regexp source, whether there's magic
-    // in the regexp (so a regular expression is required) and whether or
-    // not the uflag is needed for the regular expression (for posix classes)
-    // TODO: instead of injecting the start/end at this point, just return
-    // the BODY of the regexp, along with the start/end portions suitable
-    // for binding the start/end in either a joined full-path makeRe context
-    // (where we bind to (^|/), or a standalone matchPart context (where
-    // we bind to ^, and not /).  Otherwise slashes get duped!
-    //
-    // In part-matching mode, the start is:
-    // - if not isStart: nothing
-    // - if traversal possible, but not allowed: ^(?!\.\.?$)
-    // - if dots allowed or not possible: ^
-    // - if dots possible and not allowed: ^(?!\.)
-    // end is:
-    // - if not isEnd(): nothing
-    // - else: $
-    //
-    // In full-path matching mode, we put the slash at the START of the
-    // pattern, so start is:
-    // - if first pattern: same as part-matching mode
-    // - if not isStart(): nothing
-    // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
-    // - if dots allowed or not possible: /
-    // - if dots possible and not allowed: /(?!\.)
-    // end is:
-    // - if last pattern, same as part-matching mode
-    // - else nothing
-    //
-    // Always put the (?:$|/) on negated tails, though, because that has to be
-    // there to bind the end of the negated pattern portion, and it's easier to
-    // just stick it in now rather than try to inject it later in the middle of
-    // the pattern.
-    //
-    // We can just always return the same end, and leave it up to the caller
-    // to know whether it's going to be used joined or in parts.
-    // And, if the start is adjusted slightly, can do the same there:
-    // - if not isStart: nothing
-    // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
-    // - if dots allowed or not possible: (?:/|^)
-    // - if dots possible and not allowed: (?:/|^)(?!\.)
-    //
-    // But it's better to have a simpler binding without a conditional, for
-    // performance, so probably better to return both start options.
-    //
-    // Then the caller just ignores the end if it's not the first pattern,
-    // and the start always gets applied.
-    //
-    // But that's always going to be $ if it's the ending pattern, or nothing,
-    // so the caller can just attach $ at the end of the pattern when building.
-    //
-    // So the todo is:
-    // - better detect what kind of start is needed
-    // - return both flavors of starting pattern
-    // - attach $ at the end of the pattern when creating the actual RegExp
-    //
-    // Ah, but wait, no, that all only applies to the root when the first pattern
-    // is not an extglob. If the first pattern IS an extglob, then we need all
-    // that dot prevention biz to live in the extglob portions, because eg
-    // +(*|.x*) can match .xy but not .yx.
-    //
-    // So, return the two flavors if it's #root and the first child is not an
-    // AST, otherwise leave it to the child AST to handle it, and there,
-    // use the (?:^|/) style of start binding.
-    //
-    // Even simplified further:
-    // - Since the start for a join is eg /(?!\.) and the start for a part
-    // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
-    // or start or whatever) and prepend ^ or / at the Regexp construction.
-    toRegExpSource(allowDot) {
-        const dot = allowDot ?? !!this.#options.dot;
-        if (this.#root === this)
-            this.#fillNegs();
-        if (!this.type) {
-            const noEmpty = this.isStart() && this.isEnd();
-            const src = this.#parts
-                .map(p => {
-                const [re, _, hasMagic, uflag] = typeof p === 'string'
-                    ? AST.#parseGlob(p, this.#hasMagic, noEmpty)
-                    : p.toRegExpSource(allowDot);
-                this.#hasMagic = this.#hasMagic || hasMagic;
-                this.#uflag = this.#uflag || uflag;
-                return re;
-            })
-                .join('');
-            let start = '';
-            if (this.isStart()) {
-                if (typeof this.#parts[0] === 'string') {
-                    // this is the string that will match the start of the pattern,
-                    // so we need to protect against dots and such.
-                    // '.' and '..' cannot match unless the pattern is that exactly,
-                    // even if it starts with . or dot:true is set.
-                    const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
-                    if (!dotTravAllowed) {
-                        const aps = addPatternStart;
-                        // check if we have a possibility of matching . or ..,
-                        // and prevent that.
-                        const needNoTrav = 
-                        // dots are allowed, and the pattern starts with [ or .
-                        (dot && aps.has(src.charAt(0))) ||
-                            // the pattern starts with \., and then [ or .
-                            (src.startsWith('\\.') && aps.has(src.charAt(2))) ||
-                            // the pattern starts with \.\., and then [ or .
-                            (src.startsWith('\\.\\.') && aps.has(src.charAt(4)));
-                        // no need to prevent dots if it can't match a dot, or if a
-                        // sub-pattern will be preventing it anyway.
-                        const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
-                        start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : '';
-                    }
-                }
-            }
-            // append the "end of path portion" pattern to negation tails
-            let end = '';
-            if (this.isEnd() &&
-                this.#root.#filledNegs &&
-                this.#parent?.type === '!') {
-                end = '(?:$|\\/)';
-            }
-            const final = start + src + end;
-            return [
-                final,
-                unescape(src),
-                (this.#hasMagic = !!this.#hasMagic),
-                this.#uflag,
-            ];
-        }
-        // We need to calculate the body *twice* if it's a repeat pattern
-        // at the start, once in nodot mode, then again in dot mode, so a
-        // pattern like *(?) can match 'x.y'
-        const repeated = this.type === '*' || this.type === '+';
-        // some kind of extglob
-        const start = this.type === '!' ? '(?:(?!(?:' : '(?:';
-        let body = this.#partsToRegExp(dot);
-        if (this.isStart() && this.isEnd() && !body && this.type !== '!') {
-            // invalid extglob, has to at least be *something* present, if it's
-            // the entire path portion.
-            const s = this.toString();
-            this.#parts = [s];
-            this.type = null;
-            this.#hasMagic = undefined;
-            return [s, unescape(this.toString()), false, false];
-        }
-        // XXX abstract out this map method
-        let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot
-            ? ''
-            : this.#partsToRegExp(true);
-        if (bodyDotAllowed === body) {
-            bodyDotAllowed = '';
-        }
-        if (bodyDotAllowed) {
-            body = `(?:${body})(?:${bodyDotAllowed})*?`;
-        }
-        // an empty !() is exactly equivalent to a starNoEmpty
-        let final = '';
-        if (this.type === '!' && this.#emptyExt) {
-            final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty;
-        }
-        else {
-            const close = this.type === '!'
-                ? // !() must match something,but !(x) can match ''
-                    '))' +
-                        (this.isStart() && !dot && !allowDot ? startNoDot : '') +
-                        star +
-                        ')'
-                : this.type === '@'
-                    ? ')'
-                    : this.type === '?'
-                        ? ')?'
-                        : this.type === '+' && bodyDotAllowed
-                            ? ')'
-                            : this.type === '*' && bodyDotAllowed
-                                ? `)?`
-                                : `)${this.type}`;
-            final = start + body + close;
-        }
-        return [
-            final,
-            unescape(body),
-            (this.#hasMagic = !!this.#hasMagic),
-            this.#uflag,
-        ];
-    }
-    #partsToRegExp(dot) {
-        return this.#parts
-            .map(p => {
-            // extglob ASTs should only contain parent ASTs
-            /* c8 ignore start */
-            if (typeof p === 'string') {
-                throw new Error('string type in extglob ast??');
-            }
-            /* c8 ignore stop */
-            // can ignore hasMagic, because extglobs are already always magic
-            const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
-            this.#uflag = this.#uflag || uflag;
-            return re;
-        })
-            .filter(p => !(this.isStart() && this.isEnd()) || !!p)
-            .join('|');
-    }
-    static #parseGlob(glob, hasMagic, noEmpty = false) {
-        let escaping = false;
-        let re = '';
-        let uflag = false;
-        for (let i = 0; i < glob.length; i++) {
-            const c = glob.charAt(i);
-            if (escaping) {
-                escaping = false;
-                re += (reSpecials.has(c) ? '\\' : '') + c;
-                continue;
-            }
-            if (c === '\\') {
-                if (i === glob.length - 1) {
-                    re += '\\\\';
-                }
-                else {
-                    escaping = true;
-                }
-                continue;
-            }
-            if (c === '[') {
-                const [src, needUflag, consumed, magic] = parseClass(glob, i);
-                if (consumed) {
-                    re += src;
-                    uflag = uflag || needUflag;
-                    i += consumed - 1;
-                    hasMagic = hasMagic || magic;
-                    continue;
-                }
-            }
-            if (c === '*') {
-                if (noEmpty && glob === '*')
-                    re += starNoEmpty;
-                else
-                    re += star;
-                hasMagic = true;
-                continue;
-            }
-            if (c === '?') {
-                re += qmark;
-                hasMagic = true;
-                continue;
-            }
-            re += regExpEscape(c);
-        }
-        return [re, unescape(glob), !!hasMagic, uflag];
-    }
-}
-//# sourceMappingURL=ast.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/brace-expressions.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/brace-expressions.js
deleted file mode 100644
index c629d6ae816e2..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/brace-expressions.js
+++ /dev/null
@@ -1,148 +0,0 @@
-// translate the various posix character classes into unicode properties
-// this works across all unicode locales
-// { : [, /u flag required, negated]
-const posixClasses = {
-    '[:alnum:]': ['\\p{L}\\p{Nl}\\p{Nd}', true],
-    '[:alpha:]': ['\\p{L}\\p{Nl}', true],
-    '[:ascii:]': ['\\x' + '00-\\x' + '7f', false],
-    '[:blank:]': ['\\p{Zs}\\t', true],
-    '[:cntrl:]': ['\\p{Cc}', true],
-    '[:digit:]': ['\\p{Nd}', true],
-    '[:graph:]': ['\\p{Z}\\p{C}', true, true],
-    '[:lower:]': ['\\p{Ll}', true],
-    '[:print:]': ['\\p{C}', true],
-    '[:punct:]': ['\\p{P}', true],
-    '[:space:]': ['\\p{Z}\\t\\r\\n\\v\\f', true],
-    '[:upper:]': ['\\p{Lu}', true],
-    '[:word:]': ['\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}', true],
-    '[:xdigit:]': ['A-Fa-f0-9', false],
-};
-// only need to escape a few things inside of brace expressions
-// escapes: [ \ ] -
-const braceEscape = (s) => s.replace(/[[\]\\-]/g, '\\$&');
-// escape all regexp magic characters
-const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
-// everything has already been escaped, we just have to join
-const rangesToString = (ranges) => ranges.join('');
-// takes a glob string at a posix brace expression, and returns
-// an equivalent regular expression source, and boolean indicating
-// whether the /u flag needs to be applied, and the number of chars
-// consumed to parse the character class.
-// This also removes out of order ranges, and returns ($.) if the
-// entire class just no good.
-export const parseClass = (glob, position) => {
-    const pos = position;
-    /* c8 ignore start */
-    if (glob.charAt(pos) !== '[') {
-        throw new Error('not in a brace expression');
-    }
-    /* c8 ignore stop */
-    const ranges = [];
-    const negs = [];
-    let i = pos + 1;
-    let sawStart = false;
-    let uflag = false;
-    let escaping = false;
-    let negate = false;
-    let endPos = pos;
-    let rangeStart = '';
-    WHILE: while (i < glob.length) {
-        const c = glob.charAt(i);
-        if ((c === '!' || c === '^') && i === pos + 1) {
-            negate = true;
-            i++;
-            continue;
-        }
-        if (c === ']' && sawStart && !escaping) {
-            endPos = i + 1;
-            break;
-        }
-        sawStart = true;
-        if (c === '\\') {
-            if (!escaping) {
-                escaping = true;
-                i++;
-                continue;
-            }
-            // escaped \ char, fall through and treat like normal char
-        }
-        if (c === '[' && !escaping) {
-            // either a posix class, a collation equivalent, or just a [
-            for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
-                if (glob.startsWith(cls, i)) {
-                    // invalid, [a-[] is fine, but not [a-[:alpha]]
-                    if (rangeStart) {
-                        return ['$.', false, glob.length - pos, true];
-                    }
-                    i += cls.length;
-                    if (neg)
-                        negs.push(unip);
-                    else
-                        ranges.push(unip);
-                    uflag = uflag || u;
-                    continue WHILE;
-                }
-            }
-        }
-        // now it's just a normal character, effectively
-        escaping = false;
-        if (rangeStart) {
-            // throw this range away if it's not valid, but others
-            // can still match.
-            if (c > rangeStart) {
-                ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c));
-            }
-            else if (c === rangeStart) {
-                ranges.push(braceEscape(c));
-            }
-            rangeStart = '';
-            i++;
-            continue;
-        }
-        // now might be the start of a range.
-        // can be either c-d or c-] or c] or c] at this point
-        if (glob.startsWith('-]', i + 1)) {
-            ranges.push(braceEscape(c + '-'));
-            i += 2;
-            continue;
-        }
-        if (glob.startsWith('-', i + 1)) {
-            rangeStart = c;
-            i += 2;
-            continue;
-        }
-        // not the start of a range, just a single character
-        ranges.push(braceEscape(c));
-        i++;
-    }
-    if (endPos < i) {
-        // didn't see the end of the class, not a valid class,
-        // but might still be valid as a literal match.
-        return ['', false, 0, false];
-    }
-    // if we got no ranges and no negates, then we have a range that
-    // cannot possibly match anything, and that poisons the whole glob
-    if (!ranges.length && !negs.length) {
-        return ['$.', false, glob.length - pos, true];
-    }
-    // if we got one positive range, and it's a single character, then that's
-    // not actually a magic pattern, it's just that one literal character.
-    // we should not treat that as "magic", we should just return the literal
-    // character. [_] is a perfectly valid way to escape glob magic chars.
-    if (negs.length === 0 &&
-        ranges.length === 1 &&
-        /^\\?.$/.test(ranges[0]) &&
-        !negate) {
-        const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
-        return [regexpEscape(r), false, endPos - pos, false];
-    }
-    const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']';
-    const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']';
-    const comb = ranges.length && negs.length
-        ? '(' + sranges + '|' + snegs + ')'
-        : ranges.length
-            ? sranges
-            : snegs;
-    return [comb, uflag, endPos - pos, true];
-};
-//# sourceMappingURL=brace-expressions.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/escape.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/escape.js
deleted file mode 100644
index 16f7c8c7bdc64..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/escape.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Escape all magic characters in a glob pattern.
- *
- * If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}
- * option is used, then characters are escaped by wrapping in `[]`, because
- * a magic character wrapped in a character class can only be satisfied by
- * that exact character.  In this mode, `\` is _not_ escaped, because it is
- * not interpreted as a magic character, but instead as a path separator.
- */
-export const escape = (s, { windowsPathsNoEscape = false, } = {}) => {
-    // don't need to escape +@! because we escape the parens
-    // that make those magic, and escaping ! as [!] isn't valid,
-    // because [!]] is a valid glob class meaning not ']'.
-    return windowsPathsNoEscape
-        ? s.replace(/[?*()[\]]/g, '[$&]')
-        : s.replace(/[?*()[\]\\]/g, '\\$&');
-};
-//# sourceMappingURL=escape.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/index.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/index.js
deleted file mode 100644
index 831b6a67f63fb..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/index.js
+++ /dev/null
@@ -1,995 +0,0 @@
-import expand from 'brace-expansion';
-import { assertValidPattern } from './assert-valid-pattern.js';
-import { AST } from './ast.js';
-import { escape } from './escape.js';
-import { unescape } from './unescape.js';
-export const minimatch = (p, pattern, options = {}) => {
-    assertValidPattern(pattern);
-    // shortcut: comments match nothing.
-    if (!options.nocomment && pattern.charAt(0) === '#') {
-        return false;
-    }
-    return new Minimatch(pattern, options).match(p);
-};
-// Optimized checking for the most common glob patterns.
-const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
-const starDotExtTest = (ext) => (f) => !f.startsWith('.') && f.endsWith(ext);
-const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
-const starDotExtTestNocase = (ext) => {
-    ext = ext.toLowerCase();
-    return (f) => !f.startsWith('.') && f.toLowerCase().endsWith(ext);
-};
-const starDotExtTestNocaseDot = (ext) => {
-    ext = ext.toLowerCase();
-    return (f) => f.toLowerCase().endsWith(ext);
-};
-const starDotStarRE = /^\*+\.\*+$/;
-const starDotStarTest = (f) => !f.startsWith('.') && f.includes('.');
-const starDotStarTestDot = (f) => f !== '.' && f !== '..' && f.includes('.');
-const dotStarRE = /^\.\*+$/;
-const dotStarTest = (f) => f !== '.' && f !== '..' && f.startsWith('.');
-const starRE = /^\*+$/;
-const starTest = (f) => f.length !== 0 && !f.startsWith('.');
-const starTestDot = (f) => f.length !== 0 && f !== '.' && f !== '..';
-const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
-const qmarksTestNocase = ([$0, ext = '']) => {
-    const noext = qmarksTestNoExt([$0]);
-    if (!ext)
-        return noext;
-    ext = ext.toLowerCase();
-    return (f) => noext(f) && f.toLowerCase().endsWith(ext);
-};
-const qmarksTestNocaseDot = ([$0, ext = '']) => {
-    const noext = qmarksTestNoExtDot([$0]);
-    if (!ext)
-        return noext;
-    ext = ext.toLowerCase();
-    return (f) => noext(f) && f.toLowerCase().endsWith(ext);
-};
-const qmarksTestDot = ([$0, ext = '']) => {
-    const noext = qmarksTestNoExtDot([$0]);
-    return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
-};
-const qmarksTest = ([$0, ext = '']) => {
-    const noext = qmarksTestNoExt([$0]);
-    return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
-};
-const qmarksTestNoExt = ([$0]) => {
-    const len = $0.length;
-    return (f) => f.length === len && !f.startsWith('.');
-};
-const qmarksTestNoExtDot = ([$0]) => {
-    const len = $0.length;
-    return (f) => f.length === len && f !== '.' && f !== '..';
-};
-/* c8 ignore start */
-const defaultPlatform = (typeof process === 'object' && process
-    ? (typeof process.env === 'object' &&
-        process.env &&
-        process.env.__MINIMATCH_TESTING_PLATFORM__) ||
-        process.platform
-    : 'posix');
-const path = {
-    win32: { sep: '\\' },
-    posix: { sep: '/' },
-};
-/* c8 ignore stop */
-export const sep = defaultPlatform === 'win32' ? path.win32.sep : path.posix.sep;
-minimatch.sep = sep;
-export const GLOBSTAR = Symbol('globstar **');
-minimatch.GLOBSTAR = GLOBSTAR;
-// any single thing other than /
-// don't need to escape / when using new RegExp()
-const qmark = '[^/]';
-// * => any number of characters
-const star = qmark + '*?';
-// ** when dots are allowed.  Anything goes, except .. and .
-// not (^ or / followed by one or two dots followed by $ or /),
-// followed by anything, any number of times.
-const twoStarDot = '(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?';
-// not a ^ or / followed by a dot,
-// followed by anything, any number of times.
-const twoStarNoDot = '(?:(?!(?:\\/|^)\\.).)*?';
-export const filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
-minimatch.filter = filter;
-const ext = (a, b = {}) => Object.assign({}, a, b);
-export const defaults = (def) => {
-    if (!def || typeof def !== 'object' || !Object.keys(def).length) {
-        return minimatch;
-    }
-    const orig = minimatch;
-    const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
-    return Object.assign(m, {
-        Minimatch: class Minimatch extends orig.Minimatch {
-            constructor(pattern, options = {}) {
-                super(pattern, ext(def, options));
-            }
-            static defaults(options) {
-                return orig.defaults(ext(def, options)).Minimatch;
-            }
-        },
-        AST: class AST extends orig.AST {
-            /* c8 ignore start */
-            constructor(type, parent, options = {}) {
-                super(type, parent, ext(def, options));
-            }
-            /* c8 ignore stop */
-            static fromGlob(pattern, options = {}) {
-                return orig.AST.fromGlob(pattern, ext(def, options));
-            }
-        },
-        unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
-        escape: (s, options = {}) => orig.escape(s, ext(def, options)),
-        filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
-        defaults: (options) => orig.defaults(ext(def, options)),
-        makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
-        braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
-        match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
-        sep: orig.sep,
-        GLOBSTAR: GLOBSTAR,
-    });
-};
-minimatch.defaults = defaults;
-// Brace expansion:
-// a{b,c}d -> abd acd
-// a{b,}c -> abc ac
-// a{0..3}d -> a0d a1d a2d a3d
-// a{b,c{d,e}f}g -> abg acdfg acefg
-// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
-//
-// Invalid sets are not expanded.
-// a{2..}b -> a{2..}b
-// a{b}c -> a{b}c
-export const braceExpand = (pattern, options = {}) => {
-    assertValidPattern(pattern);
-    // Thanks to Yeting Li  for
-    // improving this regexp to avoid a ReDOS vulnerability.
-    if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
-        // shortcut. no need to expand.
-        return [pattern];
-    }
-    return expand(pattern);
-};
-minimatch.braceExpand = braceExpand;
-// parse a component of the expanded set.
-// At this point, no pattern may contain "/" in it
-// so we're going to return a 2d array, where each entry is the full
-// pattern, split on '/', and then turned into a regular expression.
-// A regexp is made at the end which joins each array with an
-// escaped /, and another full one which joins each regexp with |.
-//
-// Following the lead of Bash 4.1, note that "**" only has special meaning
-// when it is the *only* thing in a path portion.  Otherwise, any series
-// of * is equivalent to a single *.  Globstar behavior is enabled by
-// default, and can be disabled by setting options.noglobstar.
-export const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
-minimatch.makeRe = makeRe;
-export const match = (list, pattern, options = {}) => {
-    const mm = new Minimatch(pattern, options);
-    list = list.filter(f => mm.match(f));
-    if (mm.options.nonull && !list.length) {
-        list.push(pattern);
-    }
-    return list;
-};
-minimatch.match = match;
-// replace stuff like \* with *
-const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
-const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
-export class Minimatch {
-    options;
-    set;
-    pattern;
-    windowsPathsNoEscape;
-    nonegate;
-    negate;
-    comment;
-    empty;
-    preserveMultipleSlashes;
-    partial;
-    globSet;
-    globParts;
-    nocase;
-    isWindows;
-    platform;
-    windowsNoMagicRoot;
-    regexp;
-    constructor(pattern, options = {}) {
-        assertValidPattern(pattern);
-        options = options || {};
-        this.options = options;
-        this.pattern = pattern;
-        this.platform = options.platform || defaultPlatform;
-        this.isWindows = this.platform === 'win32';
-        this.windowsPathsNoEscape =
-            !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
-        if (this.windowsPathsNoEscape) {
-            this.pattern = this.pattern.replace(/\\/g, '/');
-        }
-        this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
-        this.regexp = null;
-        this.negate = false;
-        this.nonegate = !!options.nonegate;
-        this.comment = false;
-        this.empty = false;
-        this.partial = !!options.partial;
-        this.nocase = !!this.options.nocase;
-        this.windowsNoMagicRoot =
-            options.windowsNoMagicRoot !== undefined
-                ? options.windowsNoMagicRoot
-                : !!(this.isWindows && this.nocase);
-        this.globSet = [];
-        this.globParts = [];
-        this.set = [];
-        // make the set of regexps etc.
-        this.make();
-    }
-    hasMagic() {
-        if (this.options.magicalBraces && this.set.length > 1) {
-            return true;
-        }
-        for (const pattern of this.set) {
-            for (const part of pattern) {
-                if (typeof part !== 'string')
-                    return true;
-            }
-        }
-        return false;
-    }
-    debug(..._) { }
-    make() {
-        const pattern = this.pattern;
-        const options = this.options;
-        // empty patterns and comments match nothing.
-        if (!options.nocomment && pattern.charAt(0) === '#') {
-            this.comment = true;
-            return;
-        }
-        if (!pattern) {
-            this.empty = true;
-            return;
-        }
-        // step 1: figure out negation, etc.
-        this.parseNegate();
-        // step 2: expand braces
-        this.globSet = [...new Set(this.braceExpand())];
-        if (options.debug) {
-            this.debug = (...args) => console.error(...args);
-        }
-        this.debug(this.pattern, this.globSet);
-        // step 3: now we have a set, so turn each one into a series of
-        // path-portion matching patterns.
-        // These will be regexps, except in the case of "**", which is
-        // set to the GLOBSTAR object for globstar behavior,
-        // and will not contain any / characters
-        //
-        // First, we preprocess to make the glob pattern sets a bit simpler
-        // and deduped.  There are some perf-killing patterns that can cause
-        // problems with a glob walk, but we can simplify them down a bit.
-        const rawGlobParts = this.globSet.map(s => this.slashSplit(s));
-        this.globParts = this.preprocess(rawGlobParts);
-        this.debug(this.pattern, this.globParts);
-        // glob --> regexps
-        let set = this.globParts.map((s, _, __) => {
-            if (this.isWindows && this.windowsNoMagicRoot) {
-                // check if it's a drive or unc path.
-                const isUNC = s[0] === '' &&
-                    s[1] === '' &&
-                    (s[2] === '?' || !globMagic.test(s[2])) &&
-                    !globMagic.test(s[3]);
-                const isDrive = /^[a-z]:/i.test(s[0]);
-                if (isUNC) {
-                    return [...s.slice(0, 4), ...s.slice(4).map(ss => this.parse(ss))];
-                }
-                else if (isDrive) {
-                    return [s[0], ...s.slice(1).map(ss => this.parse(ss))];
-                }
-            }
-            return s.map(ss => this.parse(ss));
-        });
-        this.debug(this.pattern, set);
-        // filter out everything that didn't compile properly.
-        this.set = set.filter(s => s.indexOf(false) === -1);
-        // do not treat the ? in UNC paths as magic
-        if (this.isWindows) {
-            for (let i = 0; i < this.set.length; i++) {
-                const p = this.set[i];
-                if (p[0] === '' &&
-                    p[1] === '' &&
-                    this.globParts[i][2] === '?' &&
-                    typeof p[3] === 'string' &&
-                    /^[a-z]:$/i.test(p[3])) {
-                    p[2] = '?';
-                }
-            }
-        }
-        this.debug(this.pattern, this.set);
-    }
-    // various transforms to equivalent pattern sets that are
-    // faster to process in a filesystem walk.  The goal is to
-    // eliminate what we can, and push all ** patterns as far
-    // to the right as possible, even if it increases the number
-    // of patterns that we have to process.
-    preprocess(globParts) {
-        // if we're not in globstar mode, then turn all ** into *
-        if (this.options.noglobstar) {
-            for (let i = 0; i < globParts.length; i++) {
-                for (let j = 0; j < globParts[i].length; j++) {
-                    if (globParts[i][j] === '**') {
-                        globParts[i][j] = '*';
-                    }
-                }
-            }
-        }
-        const { optimizationLevel = 1 } = this.options;
-        if (optimizationLevel >= 2) {
-            // aggressive optimization for the purpose of fs walking
-            globParts = this.firstPhasePreProcess(globParts);
-            globParts = this.secondPhasePreProcess(globParts);
-        }
-        else if (optimizationLevel >= 1) {
-            // just basic optimizations to remove some .. parts
-            globParts = this.levelOneOptimize(globParts);
-        }
-        else {
-            globParts = this.adjascentGlobstarOptimize(globParts);
-        }
-        return globParts;
-    }
-    // just get rid of adjascent ** portions
-    adjascentGlobstarOptimize(globParts) {
-        return globParts.map(parts => {
-            let gs = -1;
-            while (-1 !== (gs = parts.indexOf('**', gs + 1))) {
-                let i = gs;
-                while (parts[i + 1] === '**') {
-                    i++;
-                }
-                if (i !== gs) {
-                    parts.splice(gs, i - gs);
-                }
-            }
-            return parts;
-        });
-    }
-    // get rid of adjascent ** and resolve .. portions
-    levelOneOptimize(globParts) {
-        return globParts.map(parts => {
-            parts = parts.reduce((set, part) => {
-                const prev = set[set.length - 1];
-                if (part === '**' && prev === '**') {
-                    return set;
-                }
-                if (part === '..') {
-                    if (prev && prev !== '..' && prev !== '.' && prev !== '**') {
-                        set.pop();
-                        return set;
-                    }
-                }
-                set.push(part);
-                return set;
-            }, []);
-            return parts.length === 0 ? [''] : parts;
-        });
-    }
-    levelTwoFileOptimize(parts) {
-        if (!Array.isArray(parts)) {
-            parts = this.slashSplit(parts);
-        }
-        let didSomething = false;
-        do {
-            didSomething = false;
-            // 
// -> 
/
-            if (!this.preserveMultipleSlashes) {
-                for (let i = 1; i < parts.length - 1; i++) {
-                    const p = parts[i];
-                    // don't squeeze out UNC patterns
-                    if (i === 1 && p === '' && parts[0] === '')
-                        continue;
-                    if (p === '.' || p === '') {
-                        didSomething = true;
-                        parts.splice(i, 1);
-                        i--;
-                    }
-                }
-                if (parts[0] === '.' &&
-                    parts.length === 2 &&
-                    (parts[1] === '.' || parts[1] === '')) {
-                    didSomething = true;
-                    parts.pop();
-                }
-            }
-            // 
/

/../ ->

/
-            let dd = 0;
-            while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
-                const p = parts[dd - 1];
-                if (p && p !== '.' && p !== '..' && p !== '**') {
-                    didSomething = true;
-                    parts.splice(dd - 1, 2);
-                    dd -= 2;
-                }
-            }
-        } while (didSomething);
-        return parts.length === 0 ? [''] : parts;
-    }
-    // First phase: single-pattern processing
-    // 
 is 1 or more portions
-    //  is 1 or more portions
-    // 

is any portion other than ., .., '', or ** - // is . or '' - // - // **/.. is *brutal* for filesystem walking performance, because - // it effectively resets the recursive walk each time it occurs, - // and ** cannot be reduced out by a .. pattern part like a regexp - // or most strings (other than .., ., and '') can be. - // - //

/**/../

/

/ -> {

/../

/

/,

/**/

/

/} - //

// -> 
/
-    // 
/

/../ ->

/
-    // **/**/ -> **/
-    //
-    // **/*/ -> */**/ <== not valid because ** doesn't follow
-    // this WOULD be allowed if ** did follow symlinks, or * didn't
-    firstPhasePreProcess(globParts) {
-        let didSomething = false;
-        do {
-            didSomething = false;
-            // 
/**/../

/

/ -> {

/../

/

/,

/**/

/

/} - for (let parts of globParts) { - let gs = -1; - while (-1 !== (gs = parts.indexOf('**', gs + 1))) { - let gss = gs; - while (parts[gss + 1] === '**') { - //

/**/**/ -> 
/**/
-                        gss++;
-                    }
-                    // eg, if gs is 2 and gss is 4, that means we have 3 **
-                    // parts, and can remove 2 of them.
-                    if (gss > gs) {
-                        parts.splice(gs + 1, gss - gs);
-                    }
-                    let next = parts[gs + 1];
-                    const p = parts[gs + 2];
-                    const p2 = parts[gs + 3];
-                    if (next !== '..')
-                        continue;
-                    if (!p ||
-                        p === '.' ||
-                        p === '..' ||
-                        !p2 ||
-                        p2 === '.' ||
-                        p2 === '..') {
-                        continue;
-                    }
-                    didSomething = true;
-                    // edit parts in place, and push the new one
-                    parts.splice(gs, 1);
-                    const other = parts.slice(0);
-                    other[gs] = '**';
-                    globParts.push(other);
-                    gs--;
-                }
-                // 
// -> 
/
-                if (!this.preserveMultipleSlashes) {
-                    for (let i = 1; i < parts.length - 1; i++) {
-                        const p = parts[i];
-                        // don't squeeze out UNC patterns
-                        if (i === 1 && p === '' && parts[0] === '')
-                            continue;
-                        if (p === '.' || p === '') {
-                            didSomething = true;
-                            parts.splice(i, 1);
-                            i--;
-                        }
-                    }
-                    if (parts[0] === '.' &&
-                        parts.length === 2 &&
-                        (parts[1] === '.' || parts[1] === '')) {
-                        didSomething = true;
-                        parts.pop();
-                    }
-                }
-                // 
/

/../ ->

/
-                let dd = 0;
-                while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
-                    const p = parts[dd - 1];
-                    if (p && p !== '.' && p !== '..' && p !== '**') {
-                        didSomething = true;
-                        const needDot = dd === 1 && parts[dd + 1] === '**';
-                        const splin = needDot ? ['.'] : [];
-                        parts.splice(dd - 1, 2, ...splin);
-                        if (parts.length === 0)
-                            parts.push('');
-                        dd -= 2;
-                    }
-                }
-            }
-        } while (didSomething);
-        return globParts;
-    }
-    // second phase: multi-pattern dedupes
-    // {
/*/,
/

/} ->

/*/
-    // {
/,
/} -> 
/
-    // {
/**/,
/} -> 
/**/
-    //
-    // {
/**/,
/**/

/} ->

/**/
-    // ^-- not valid because ** doens't follow symlinks
-    secondPhasePreProcess(globParts) {
-        for (let i = 0; i < globParts.length - 1; i++) {
-            for (let j = i + 1; j < globParts.length; j++) {
-                const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
-                if (!matched)
-                    continue;
-                globParts[i] = matched;
-                globParts[j] = [];
-            }
-        }
-        return globParts.filter(gs => gs.length);
-    }
-    partsMatch(a, b, emptyGSMatch = false) {
-        let ai = 0;
-        let bi = 0;
-        let result = [];
-        let which = '';
-        while (ai < a.length && bi < b.length) {
-            if (a[ai] === b[bi]) {
-                result.push(which === 'b' ? b[bi] : a[ai]);
-                ai++;
-                bi++;
-            }
-            else if (emptyGSMatch && a[ai] === '**' && b[bi] === a[ai + 1]) {
-                result.push(a[ai]);
-                ai++;
-            }
-            else if (emptyGSMatch && b[bi] === '**' && a[ai] === b[bi + 1]) {
-                result.push(b[bi]);
-                bi++;
-            }
-            else if (a[ai] === '*' &&
-                b[bi] &&
-                (this.options.dot || !b[bi].startsWith('.')) &&
-                b[bi] !== '**') {
-                if (which === 'b')
-                    return false;
-                which = 'a';
-                result.push(a[ai]);
-                ai++;
-                bi++;
-            }
-            else if (b[bi] === '*' &&
-                a[ai] &&
-                (this.options.dot || !a[ai].startsWith('.')) &&
-                a[ai] !== '**') {
-                if (which === 'a')
-                    return false;
-                which = 'b';
-                result.push(b[bi]);
-                ai++;
-                bi++;
-            }
-            else {
-                return false;
-            }
-        }
-        // if we fall out of the loop, it means they two are identical
-        // as long as their lengths match
-        return a.length === b.length && result;
-    }
-    parseNegate() {
-        if (this.nonegate)
-            return;
-        const pattern = this.pattern;
-        let negate = false;
-        let negateOffset = 0;
-        for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {
-            negate = !negate;
-            negateOffset++;
-        }
-        if (negateOffset)
-            this.pattern = pattern.slice(negateOffset);
-        this.negate = negate;
-    }
-    // set partial to true to test if, for example,
-    // "/a/b" matches the start of "/*/b/*/d"
-    // Partial means, if you run out of file before you run
-    // out of pattern, then that's fine, as long as all
-    // the parts match.
-    matchOne(file, pattern, partial = false) {
-        const options = this.options;
-        // UNC paths like //?/X:/... can match X:/... and vice versa
-        // Drive letters in absolute drive or unc paths are always compared
-        // case-insensitively.
-        if (this.isWindows) {
-            const fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0]);
-            const fileUNC = !fileDrive &&
-                file[0] === '' &&
-                file[1] === '' &&
-                file[2] === '?' &&
-                /^[a-z]:$/i.test(file[3]);
-            const patternDrive = typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0]);
-            const patternUNC = !patternDrive &&
-                pattern[0] === '' &&
-                pattern[1] === '' &&
-                pattern[2] === '?' &&
-                typeof pattern[3] === 'string' &&
-                /^[a-z]:$/i.test(pattern[3]);
-            const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined;
-            const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined;
-            if (typeof fdi === 'number' && typeof pdi === 'number') {
-                const [fd, pd] = [file[fdi], pattern[pdi]];
-                if (fd.toLowerCase() === pd.toLowerCase()) {
-                    pattern[pdi] = fd;
-                    if (pdi > fdi) {
-                        pattern = pattern.slice(pdi);
-                    }
-                    else if (fdi > pdi) {
-                        file = file.slice(fdi);
-                    }
-                }
-            }
-        }
-        // resolve and reduce . and .. portions in the file as well.
-        // dont' need to do the second phase, because it's only one string[]
-        const { optimizationLevel = 1 } = this.options;
-        if (optimizationLevel >= 2) {
-            file = this.levelTwoFileOptimize(file);
-        }
-        this.debug('matchOne', this, { file, pattern });
-        this.debug('matchOne', file.length, pattern.length);
-        for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
-            this.debug('matchOne loop');
-            var p = pattern[pi];
-            var f = file[fi];
-            this.debug(pattern, p, f);
-            // should be impossible.
-            // some invalid regexp stuff in the set.
-            /* c8 ignore start */
-            if (p === false) {
-                return false;
-            }
-            /* c8 ignore stop */
-            if (p === GLOBSTAR) {
-                this.debug('GLOBSTAR', [pattern, p, f]);
-                // "**"
-                // a/**/b/**/c would match the following:
-                // a/b/x/y/z/c
-                // a/x/y/z/b/c
-                // a/b/x/b/x/c
-                // a/b/c
-                // To do this, take the rest of the pattern after
-                // the **, and see if it would match the file remainder.
-                // If so, return success.
-                // If not, the ** "swallows" a segment, and try again.
-                // This is recursively awful.
-                //
-                // a/**/b/**/c matching a/b/x/y/z/c
-                // - a matches a
-                // - doublestar
-                //   - matchOne(b/x/y/z/c, b/**/c)
-                //     - b matches b
-                //     - doublestar
-                //       - matchOne(x/y/z/c, c) -> no
-                //       - matchOne(y/z/c, c) -> no
-                //       - matchOne(z/c, c) -> no
-                //       - matchOne(c, c) yes, hit
-                var fr = fi;
-                var pr = pi + 1;
-                if (pr === pl) {
-                    this.debug('** at the end');
-                    // a ** at the end will just swallow the rest.
-                    // We have found a match.
-                    // however, it will not swallow /.x, unless
-                    // options.dot is set.
-                    // . and .. are *never* matched by **, for explosively
-                    // exponential reasons.
-                    for (; fi < fl; fi++) {
-                        if (file[fi] === '.' ||
-                            file[fi] === '..' ||
-                            (!options.dot && file[fi].charAt(0) === '.'))
-                            return false;
-                    }
-                    return true;
-                }
-                // ok, let's see if we can swallow whatever we can.
-                while (fr < fl) {
-                    var swallowee = file[fr];
-                    this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
-                    // XXX remove this slice.  Just pass the start index.
-                    if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
-                        this.debug('globstar found match!', fr, fl, swallowee);
-                        // found a match.
-                        return true;
-                    }
-                    else {
-                        // can't swallow "." or ".." ever.
-                        // can only swallow ".foo" when explicitly asked.
-                        if (swallowee === '.' ||
-                            swallowee === '..' ||
-                            (!options.dot && swallowee.charAt(0) === '.')) {
-                            this.debug('dot detected!', file, fr, pattern, pr);
-                            break;
-                        }
-                        // ** swallows a segment, and continue.
-                        this.debug('globstar swallow a segment, and continue');
-                        fr++;
-                    }
-                }
-                // no match was found.
-                // However, in partial mode, we can't say this is necessarily over.
-                /* c8 ignore start */
-                if (partial) {
-                    // ran out of file
-                    this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
-                    if (fr === fl) {
-                        return true;
-                    }
-                }
-                /* c8 ignore stop */
-                return false;
-            }
-            // something other than **
-            // non-magic patterns just have to match exactly
-            // patterns with magic have been turned into regexps.
-            let hit;
-            if (typeof p === 'string') {
-                hit = f === p;
-                this.debug('string match', p, f, hit);
-            }
-            else {
-                hit = p.test(f);
-                this.debug('pattern match', p, f, hit);
-            }
-            if (!hit)
-                return false;
-        }
-        // Note: ending in / means that we'll get a final ""
-        // at the end of the pattern.  This can only match a
-        // corresponding "" at the end of the file.
-        // If the file ends in /, then it can only match a
-        // a pattern that ends in /, unless the pattern just
-        // doesn't have any more for it. But, a/b/ should *not*
-        // match "a/b/*", even though "" matches against the
-        // [^/]*? pattern, except in partial mode, where it might
-        // simply not be reached yet.
-        // However, a/b/ should still satisfy a/*
-        // now either we fell off the end of the pattern, or we're done.
-        if (fi === fl && pi === pl) {
-            // ran out of pattern and filename at the same time.
-            // an exact hit!
-            return true;
-        }
-        else if (fi === fl) {
-            // ran out of file, but still had pattern left.
-            // this is ok if we're doing the match as part of
-            // a glob fs traversal.
-            return partial;
-        }
-        else if (pi === pl) {
-            // ran out of pattern, still have file left.
-            // this is only acceptable if we're on the very last
-            // empty segment of a file with a trailing slash.
-            // a/* should match a/b/
-            return fi === fl - 1 && file[fi] === '';
-            /* c8 ignore start */
-        }
-        else {
-            // should be unreachable.
-            throw new Error('wtf?');
-        }
-        /* c8 ignore stop */
-    }
-    braceExpand() {
-        return braceExpand(this.pattern, this.options);
-    }
-    parse(pattern) {
-        assertValidPattern(pattern);
-        const options = this.options;
-        // shortcuts
-        if (pattern === '**')
-            return GLOBSTAR;
-        if (pattern === '')
-            return '';
-        // far and away, the most common glob pattern parts are
-        // *, *.*, and *.  Add a fast check method for those.
-        let m;
-        let fastTest = null;
-        if ((m = pattern.match(starRE))) {
-            fastTest = options.dot ? starTestDot : starTest;
-        }
-        else if ((m = pattern.match(starDotExtRE))) {
-            fastTest = (options.nocase
-                ? options.dot
-                    ? starDotExtTestNocaseDot
-                    : starDotExtTestNocase
-                : options.dot
-                    ? starDotExtTestDot
-                    : starDotExtTest)(m[1]);
-        }
-        else if ((m = pattern.match(qmarksRE))) {
-            fastTest = (options.nocase
-                ? options.dot
-                    ? qmarksTestNocaseDot
-                    : qmarksTestNocase
-                : options.dot
-                    ? qmarksTestDot
-                    : qmarksTest)(m);
-        }
-        else if ((m = pattern.match(starDotStarRE))) {
-            fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
-        }
-        else if ((m = pattern.match(dotStarRE))) {
-            fastTest = dotStarTest;
-        }
-        const re = AST.fromGlob(pattern, this.options).toMMPattern();
-        return fastTest ? Object.assign(re, { test: fastTest }) : re;
-    }
-    makeRe() {
-        if (this.regexp || this.regexp === false)
-            return this.regexp;
-        // at this point, this.set is a 2d array of partial
-        // pattern strings, or "**".
-        //
-        // It's better to use .match().  This function shouldn't
-        // be used, really, but it's pretty convenient sometimes,
-        // when you just want to work with a regex.
-        const set = this.set;
-        if (!set.length) {
-            this.regexp = false;
-            return this.regexp;
-        }
-        const options = this.options;
-        const twoStar = options.noglobstar
-            ? star
-            : options.dot
-                ? twoStarDot
-                : twoStarNoDot;
-        const flags = new Set(options.nocase ? ['i'] : []);
-        // regexpify non-globstar patterns
-        // if ** is only item, then we just do one twoStar
-        // if ** is first, and there are more, prepend (\/|twoStar\/)? to next
-        // if ** is last, append (\/twoStar|) to previous
-        // if ** is in the middle, append (\/|\/twoStar\/) to previous
-        // then filter out GLOBSTAR symbols
-        let re = set
-            .map(pattern => {
-            const pp = pattern.map(p => {
-                if (p instanceof RegExp) {
-                    for (const f of p.flags.split(''))
-                        flags.add(f);
-                }
-                return typeof p === 'string'
-                    ? regExpEscape(p)
-                    : p === GLOBSTAR
-                        ? GLOBSTAR
-                        : p._src;
-            });
-            pp.forEach((p, i) => {
-                const next = pp[i + 1];
-                const prev = pp[i - 1];
-                if (p !== GLOBSTAR || prev === GLOBSTAR) {
-                    return;
-                }
-                if (prev === undefined) {
-                    if (next !== undefined && next !== GLOBSTAR) {
-                        pp[i + 1] = '(?:\\/|' + twoStar + '\\/)?' + next;
-                    }
-                    else {
-                        pp[i] = twoStar;
-                    }
-                }
-                else if (next === undefined) {
-                    pp[i - 1] = prev + '(?:\\/|' + twoStar + ')?';
-                }
-                else if (next !== GLOBSTAR) {
-                    pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
-                    pp[i + 1] = GLOBSTAR;
-                }
-            });
-            return pp.filter(p => p !== GLOBSTAR).join('/');
-        })
-            .join('|');
-        // need to wrap in parens if we had more than one thing with |,
-        // otherwise only the first will be anchored to ^ and the last to $
-        const [open, close] = set.length > 1 ? ['(?:', ')'] : ['', ''];
-        // must match entire pattern
-        // ending in a * or ** will make it less strict.
-        re = '^' + open + re + close + '$';
-        // can match anything, as long as it's not this.
-        if (this.negate)
-            re = '^(?!' + re + ').+$';
-        try {
-            this.regexp = new RegExp(re, [...flags].join(''));
-            /* c8 ignore start */
-        }
-        catch (ex) {
-            // should be impossible
-            this.regexp = false;
-        }
-        /* c8 ignore stop */
-        return this.regexp;
-    }
-    slashSplit(p) {
-        // if p starts with // on windows, we preserve that
-        // so that UNC paths aren't broken.  Otherwise, any number of
-        // / characters are coalesced into one, unless
-        // preserveMultipleSlashes is set to true.
-        if (this.preserveMultipleSlashes) {
-            return p.split('/');
-        }
-        else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
-            // add an extra '' for the one we lose
-            return ['', ...p.split(/\/+/)];
-        }
-        else {
-            return p.split(/\/+/);
-        }
-    }
-    match(f, partial = this.partial) {
-        this.debug('match', f, this.pattern);
-        // short-circuit in the case of busted things.
-        // comments, etc.
-        if (this.comment) {
-            return false;
-        }
-        if (this.empty) {
-            return f === '';
-        }
-        if (f === '/' && partial) {
-            return true;
-        }
-        const options = this.options;
-        // windows: need to use /, not \
-        if (this.isWindows) {
-            f = f.split('\\').join('/');
-        }
-        // treat the test path as a set of pathparts.
-        const ff = this.slashSplit(f);
-        this.debug(this.pattern, 'split', ff);
-        // just ONE of the pattern sets in this.set needs to match
-        // in order for it to be valid.  If negating, then just one
-        // match means that we have failed.
-        // Either way, return on the first hit.
-        const set = this.set;
-        this.debug(this.pattern, 'set', set);
-        // Find the basename of the path by looking for the last non-empty segment
-        let filename = ff[ff.length - 1];
-        if (!filename) {
-            for (let i = ff.length - 2; !filename && i >= 0; i--) {
-                filename = ff[i];
-            }
-        }
-        for (let i = 0; i < set.length; i++) {
-            const pattern = set[i];
-            let file = ff;
-            if (options.matchBase && pattern.length === 1) {
-                file = [filename];
-            }
-            const hit = this.matchOne(file, pattern, partial);
-            if (hit) {
-                if (options.flipNegate) {
-                    return true;
-                }
-                return !this.negate;
-            }
-        }
-        // didn't get any hits.  this is success if it's a negative
-        // pattern, failure otherwise.
-        if (options.flipNegate) {
-            return false;
-        }
-        return this.negate;
-    }
-    static defaults(def) {
-        return minimatch.defaults(def).Minimatch;
-    }
-}
-/* c8 ignore start */
-export { AST } from './ast.js';
-export { escape } from './escape.js';
-export { unescape } from './unescape.js';
-/* c8 ignore stop */
-minimatch.AST = AST;
-minimatch.Minimatch = Minimatch;
-minimatch.escape = escape;
-minimatch.unescape = unescape;
-//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/package.json b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/package.json
deleted file mode 100644
index 3dbc1ca591c05..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-  "type": "module"
-}
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/unescape.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/unescape.js
deleted file mode 100644
index 0faf9a2b7306f..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/dist/mjs/unescape.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Un-escape a string that has been escaped with {@link escape}.
- *
- * If the {@link windowsPathsNoEscape} option is used, then square-brace
- * escapes are removed, but not backslash escapes.  For example, it will turn
- * the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
- * becuase `\` is a path separator in `windowsPathsNoEscape` mode.
- *
- * When `windowsPathsNoEscape` is not set, then both brace escapes and
- * backslash escapes are removed.
- *
- * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
- * or unescaped.
- */
-export const unescape = (s, { windowsPathsNoEscape = false, } = {}) => {
-    return windowsPathsNoEscape
-        ? s.replace(/\[([^\/\\])\]/g, '$1')
-        : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2').replace(/\\([^\/])/g, '$1');
-};
-//# sourceMappingURL=unescape.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/package.json b/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/package.json
deleted file mode 100644
index 061c3b9f34330..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch/package.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
-  "author": "Isaac Z. Schlueter  (http://blog.izs.me)",
-  "name": "minimatch",
-  "description": "a glob matcher in javascript",
-  "version": "9.0.3",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/minimatch.git"
-  },
-  "main": "./dist/cjs/index.js",
-  "module": "./dist/mjs/index.js",
-  "types": "./dist/cjs/index.d.ts",
-  "exports": {
-    ".": {
-      "import": {
-        "types": "./dist/mjs/index.d.ts",
-        "default": "./dist/mjs/index.js"
-      },
-      "require": {
-        "types": "./dist/cjs/index.d.ts",
-        "default": "./dist/cjs/index.js"
-      }
-    }
-  },
-  "files": [
-    "dist"
-  ],
-  "scripts": {
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "prepublishOnly": "git push origin --follow-tags",
-    "preprepare": "rm -rf dist",
-    "prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json",
-    "postprepare": "bash fixup.sh",
-    "pretest": "npm run prepare",
-    "presnap": "npm run prepare",
-    "test": "c8 tap",
-    "snap": "c8 tap",
-    "format": "prettier --write . --loglevel warn",
-    "benchmark": "node benchmark/index.js",
-    "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts"
-  },
-  "prettier": {
-    "semi": false,
-    "printWidth": 80,
-    "tabWidth": 2,
-    "useTabs": false,
-    "singleQuote": true,
-    "jsxSingleQuote": false,
-    "bracketSameLine": true,
-    "arrowParens": "avoid",
-    "endOfLine": "lf"
-  },
-  "engines": {
-    "node": ">=16 || 14 >=14.17"
-  },
-  "dependencies": {
-    "brace-expansion": "^2.0.1"
-  },
-  "devDependencies": {
-    "@types/brace-expansion": "^1.1.0",
-    "@types/node": "^18.15.11",
-    "@types/tap": "^15.0.8",
-    "c8": "^7.12.0",
-    "eslint-config-prettier": "^8.6.0",
-    "mkdirp": "1",
-    "prettier": "^2.8.2",
-    "tap": "^16.3.7",
-    "ts-node": "^10.9.1",
-    "typedoc": "^0.23.21",
-    "typescript": "^4.9.3"
-  },
-  "tap": {
-    "coverage": false,
-    "node-arg": [
-      "--no-warnings",
-      "--loader",
-      "ts-node/esm"
-    ],
-    "ts": false
-  },
-  "funding": {
-    "url": "https://github.com/sponsors/isaacs"
-  },
-  "license": "ISC"
-}
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/commonjs/index.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/commonjs/index.js
deleted file mode 100644
index b6cdae8eb514b..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/commonjs/index.js
+++ /dev/null
@@ -1,1028 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
-    return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.Minipass = exports.isWritable = exports.isReadable = exports.isStream = void 0;
-const proc = typeof process === 'object' && process
-    ? process
-    : {
-        stdout: null,
-        stderr: null,
-    };
-const events_1 = require("events");
-const stream_1 = __importDefault(require("stream"));
-const string_decoder_1 = require("string_decoder");
-/**
- * Return true if the argument is a Minipass stream, Node stream, or something
- * else that Minipass can interact with.
- */
-const isStream = (s) => !!s &&
-    typeof s === 'object' &&
-    (s instanceof Minipass ||
-        s instanceof stream_1.default ||
-        (0, exports.isReadable)(s) ||
-        (0, exports.isWritable)(s));
-exports.isStream = isStream;
-/**
- * Return true if the argument is a valid {@link Minipass.Readable}
- */
-const isReadable = (s) => !!s &&
-    typeof s === 'object' &&
-    s instanceof events_1.EventEmitter &&
-    typeof s.pipe === 'function' &&
-    // node core Writable streams have a pipe() method, but it throws
-    s.pipe !== stream_1.default.Writable.prototype.pipe;
-exports.isReadable = isReadable;
-/**
- * Return true if the argument is a valid {@link Minipass.Writable}
- */
-const isWritable = (s) => !!s &&
-    typeof s === 'object' &&
-    s instanceof events_1.EventEmitter &&
-    typeof s.write === 'function' &&
-    typeof s.end === 'function';
-exports.isWritable = isWritable;
-const EOF = Symbol('EOF');
-const MAYBE_EMIT_END = Symbol('maybeEmitEnd');
-const EMITTED_END = Symbol('emittedEnd');
-const EMITTING_END = Symbol('emittingEnd');
-const EMITTED_ERROR = Symbol('emittedError');
-const CLOSED = Symbol('closed');
-const READ = Symbol('read');
-const FLUSH = Symbol('flush');
-const FLUSHCHUNK = Symbol('flushChunk');
-const ENCODING = Symbol('encoding');
-const DECODER = Symbol('decoder');
-const FLOWING = Symbol('flowing');
-const PAUSED = Symbol('paused');
-const RESUME = Symbol('resume');
-const BUFFER = Symbol('buffer');
-const PIPES = Symbol('pipes');
-const BUFFERLENGTH = Symbol('bufferLength');
-const BUFFERPUSH = Symbol('bufferPush');
-const BUFFERSHIFT = Symbol('bufferShift');
-const OBJECTMODE = Symbol('objectMode');
-// internal event when stream is destroyed
-const DESTROYED = Symbol('destroyed');
-// internal event when stream has an error
-const ERROR = Symbol('error');
-const EMITDATA = Symbol('emitData');
-const EMITEND = Symbol('emitEnd');
-const EMITEND2 = Symbol('emitEnd2');
-const ASYNC = Symbol('async');
-const ABORT = Symbol('abort');
-const ABORTED = Symbol('aborted');
-const SIGNAL = Symbol('signal');
-const DATALISTENERS = Symbol('dataListeners');
-const DISCARDED = Symbol('discarded');
-const defer = (fn) => Promise.resolve().then(fn);
-const nodefer = (fn) => fn();
-const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish';
-const isArrayBufferLike = (b) => b instanceof ArrayBuffer ||
-    (!!b &&
-        typeof b === 'object' &&
-        b.constructor &&
-        b.constructor.name === 'ArrayBuffer' &&
-        b.byteLength >= 0);
-const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b);
-/**
- * Internal class representing a pipe to a destination stream.
- *
- * @internal
- */
-class Pipe {
-    src;
-    dest;
-    opts;
-    ondrain;
-    constructor(src, dest, opts) {
-        this.src = src;
-        this.dest = dest;
-        this.opts = opts;
-        this.ondrain = () => src[RESUME]();
-        this.dest.on('drain', this.ondrain);
-    }
-    unpipe() {
-        this.dest.removeListener('drain', this.ondrain);
-    }
-    // only here for the prototype
-    /* c8 ignore start */
-    proxyErrors(_er) { }
-    /* c8 ignore stop */
-    end() {
-        this.unpipe();
-        if (this.opts.end)
-            this.dest.end();
-    }
-}
-/**
- * Internal class representing a pipe to a destination stream where
- * errors are proxied.
- *
- * @internal
- */
-class PipeProxyErrors extends Pipe {
-    unpipe() {
-        this.src.removeListener('error', this.proxyErrors);
-        super.unpipe();
-    }
-    constructor(src, dest, opts) {
-        super(src, dest, opts);
-        this.proxyErrors = er => dest.emit('error', er);
-        src.on('error', this.proxyErrors);
-    }
-}
-const isObjectModeOptions = (o) => !!o.objectMode;
-const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer';
-/**
- * Main export, the Minipass class
- *
- * `RType` is the type of data emitted, defaults to Buffer
- *
- * `WType` is the type of data to be written, if RType is buffer or string,
- * then any {@link Minipass.ContiguousData} is allowed.
- *
- * `Events` is the set of event handler signatures that this object
- * will emit, see {@link Minipass.Events}
- */
-class Minipass extends events_1.EventEmitter {
-    [FLOWING] = false;
-    [PAUSED] = false;
-    [PIPES] = [];
-    [BUFFER] = [];
-    [OBJECTMODE];
-    [ENCODING];
-    [ASYNC];
-    [DECODER];
-    [EOF] = false;
-    [EMITTED_END] = false;
-    [EMITTING_END] = false;
-    [CLOSED] = false;
-    [EMITTED_ERROR] = null;
-    [BUFFERLENGTH] = 0;
-    [DESTROYED] = false;
-    [SIGNAL];
-    [ABORTED] = false;
-    [DATALISTENERS] = 0;
-    [DISCARDED] = false;
-    /**
-     * true if the stream can be written
-     */
-    writable = true;
-    /**
-     * true if the stream can be read
-     */
-    readable = true;
-    /**
-     * If `RType` is Buffer, then options do not need to be provided.
-     * Otherwise, an options object must be provided to specify either
-     * {@link Minipass.SharedOptions.objectMode} or
-     * {@link Minipass.SharedOptions.encoding}, as appropriate.
-     */
-    constructor(...args) {
-        const options = (args[0] ||
-            {});
-        super();
-        if (options.objectMode && typeof options.encoding === 'string') {
-            throw new TypeError('Encoding and objectMode may not be used together');
-        }
-        if (isObjectModeOptions(options)) {
-            this[OBJECTMODE] = true;
-            this[ENCODING] = null;
-        }
-        else if (isEncodingOptions(options)) {
-            this[ENCODING] = options.encoding;
-            this[OBJECTMODE] = false;
-        }
-        else {
-            this[OBJECTMODE] = false;
-            this[ENCODING] = null;
-        }
-        this[ASYNC] = !!options.async;
-        this[DECODER] = this[ENCODING]
-            ? new string_decoder_1.StringDecoder(this[ENCODING])
-            : null;
-        //@ts-ignore - private option for debugging and testing
-        if (options && options.debugExposeBuffer === true) {
-            Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] });
-        }
-        //@ts-ignore - private option for debugging and testing
-        if (options && options.debugExposePipes === true) {
-            Object.defineProperty(this, 'pipes', { get: () => this[PIPES] });
-        }
-        const { signal } = options;
-        if (signal) {
-            this[SIGNAL] = signal;
-            if (signal.aborted) {
-                this[ABORT]();
-            }
-            else {
-                signal.addEventListener('abort', () => this[ABORT]());
-            }
-        }
-    }
-    /**
-     * The amount of data stored in the buffer waiting to be read.
-     *
-     * For Buffer strings, this will be the total byte length.
-     * For string encoding streams, this will be the string character length,
-     * according to JavaScript's `string.length` logic.
-     * For objectMode streams, this is a count of the items waiting to be
-     * emitted.
-     */
-    get bufferLength() {
-        return this[BUFFERLENGTH];
-    }
-    /**
-     * The `BufferEncoding` currently in use, or `null`
-     */
-    get encoding() {
-        return this[ENCODING];
-    }
-    /**
-     * @deprecated - This is a read only property
-     */
-    set encoding(_enc) {
-        throw new Error('Encoding must be set at instantiation time');
-    }
-    /**
-     * @deprecated - Encoding may only be set at instantiation time
-     */
-    setEncoding(_enc) {
-        throw new Error('Encoding must be set at instantiation time');
-    }
-    /**
-     * True if this is an objectMode stream
-     */
-    get objectMode() {
-        return this[OBJECTMODE];
-    }
-    /**
-     * @deprecated - This is a read-only property
-     */
-    set objectMode(_om) {
-        throw new Error('objectMode must be set at instantiation time');
-    }
-    /**
-     * true if this is an async stream
-     */
-    get ['async']() {
-        return this[ASYNC];
-    }
-    /**
-     * Set to true to make this stream async.
-     *
-     * Once set, it cannot be unset, as this would potentially cause incorrect
-     * behavior.  Ie, a sync stream can be made async, but an async stream
-     * cannot be safely made sync.
-     */
-    set ['async'](a) {
-        this[ASYNC] = this[ASYNC] || !!a;
-    }
-    // drop everything and get out of the flow completely
-    [ABORT]() {
-        this[ABORTED] = true;
-        this.emit('abort', this[SIGNAL]?.reason);
-        this.destroy(this[SIGNAL]?.reason);
-    }
-    /**
-     * True if the stream has been aborted.
-     */
-    get aborted() {
-        return this[ABORTED];
-    }
-    /**
-     * No-op setter. Stream aborted status is set via the AbortSignal provided
-     * in the constructor options.
-     */
-    set aborted(_) { }
-    write(chunk, encoding, cb) {
-        if (this[ABORTED])
-            return false;
-        if (this[EOF])
-            throw new Error('write after end');
-        if (this[DESTROYED]) {
-            this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' }));
-            return true;
-        }
-        if (typeof encoding === 'function') {
-            cb = encoding;
-            encoding = 'utf8';
-        }
-        if (!encoding)
-            encoding = 'utf8';
-        const fn = this[ASYNC] ? defer : nodefer;
-        // convert array buffers and typed array views into buffers
-        // at some point in the future, we may want to do the opposite!
-        // leave strings and buffers as-is
-        // anything is only allowed if in object mode, so throw
-        if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
-            if (isArrayBufferView(chunk)) {
-                //@ts-ignore - sinful unsafe type changing
-                chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
-            }
-            else if (isArrayBufferLike(chunk)) {
-                //@ts-ignore - sinful unsafe type changing
-                chunk = Buffer.from(chunk);
-            }
-            else if (typeof chunk !== 'string') {
-                throw new Error('Non-contiguous data written to non-objectMode stream');
-            }
-        }
-        // handle object mode up front, since it's simpler
-        // this yields better performance, fewer checks later.
-        if (this[OBJECTMODE]) {
-            // maybe impossible?
-            /* c8 ignore start */
-            if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
-                this[FLUSH](true);
-            /* c8 ignore stop */
-            if (this[FLOWING])
-                this.emit('data', chunk);
-            else
-                this[BUFFERPUSH](chunk);
-            if (this[BUFFERLENGTH] !== 0)
-                this.emit('readable');
-            if (cb)
-                fn(cb);
-            return this[FLOWING];
-        }
-        // at this point the chunk is a buffer or string
-        // don't buffer it up or send it to the decoder
-        if (!chunk.length) {
-            if (this[BUFFERLENGTH] !== 0)
-                this.emit('readable');
-            if (cb)
-                fn(cb);
-            return this[FLOWING];
-        }
-        // fast-path writing strings of same encoding to a stream with
-        // an empty buffer, skipping the buffer/decoder dance
-        if (typeof chunk === 'string' &&
-            // unless it is a string already ready for us to use
-            !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) {
-            //@ts-ignore - sinful unsafe type change
-            chunk = Buffer.from(chunk, encoding);
-        }
-        if (Buffer.isBuffer(chunk) && this[ENCODING]) {
-            //@ts-ignore - sinful unsafe type change
-            chunk = this[DECODER].write(chunk);
-        }
-        // Note: flushing CAN potentially switch us into not-flowing mode
-        if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
-            this[FLUSH](true);
-        if (this[FLOWING])
-            this.emit('data', chunk);
-        else
-            this[BUFFERPUSH](chunk);
-        if (this[BUFFERLENGTH] !== 0)
-            this.emit('readable');
-        if (cb)
-            fn(cb);
-        return this[FLOWING];
-    }
-    /**
-     * Low-level explicit read method.
-     *
-     * In objectMode, the argument is ignored, and one item is returned if
-     * available.
-     *
-     * `n` is the number of bytes (or in the case of encoding streams,
-     * characters) to consume. If `n` is not provided, then the entire buffer
-     * is returned, or `null` is returned if no data is available.
-     *
-     * If `n` is greater that the amount of data in the internal buffer,
-     * then `null` is returned.
-     */
-    read(n) {
-        if (this[DESTROYED])
-            return null;
-        this[DISCARDED] = false;
-        if (this[BUFFERLENGTH] === 0 ||
-            n === 0 ||
-            (n && n > this[BUFFERLENGTH])) {
-            this[MAYBE_EMIT_END]();
-            return null;
-        }
-        if (this[OBJECTMODE])
-            n = null;
-        if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {
-            // not object mode, so if we have an encoding, then RType is string
-            // otherwise, must be Buffer
-            this[BUFFER] = [
-                (this[ENCODING]
-                    ? this[BUFFER].join('')
-                    : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])),
-            ];
-        }
-        const ret = this[READ](n || null, this[BUFFER][0]);
-        this[MAYBE_EMIT_END]();
-        return ret;
-    }
-    [READ](n, chunk) {
-        if (this[OBJECTMODE])
-            this[BUFFERSHIFT]();
-        else {
-            const c = chunk;
-            if (n === c.length || n === null)
-                this[BUFFERSHIFT]();
-            else if (typeof c === 'string') {
-                this[BUFFER][0] = c.slice(n);
-                chunk = c.slice(0, n);
-                this[BUFFERLENGTH] -= n;
-            }
-            else {
-                this[BUFFER][0] = c.subarray(n);
-                chunk = c.subarray(0, n);
-                this[BUFFERLENGTH] -= n;
-            }
-        }
-        this.emit('data', chunk);
-        if (!this[BUFFER].length && !this[EOF])
-            this.emit('drain');
-        return chunk;
-    }
-    end(chunk, encoding, cb) {
-        if (typeof chunk === 'function') {
-            cb = chunk;
-            chunk = undefined;
-        }
-        if (typeof encoding === 'function') {
-            cb = encoding;
-            encoding = 'utf8';
-        }
-        if (chunk !== undefined)
-            this.write(chunk, encoding);
-        if (cb)
-            this.once('end', cb);
-        this[EOF] = true;
-        this.writable = false;
-        // if we haven't written anything, then go ahead and emit,
-        // even if we're not reading.
-        // we'll re-emit if a new 'end' listener is added anyway.
-        // This makes MP more suitable to write-only use cases.
-        if (this[FLOWING] || !this[PAUSED])
-            this[MAYBE_EMIT_END]();
-        return this;
-    }
-    // don't let the internal resume be overwritten
-    [RESUME]() {
-        if (this[DESTROYED])
-            return;
-        if (!this[DATALISTENERS] && !this[PIPES].length) {
-            this[DISCARDED] = true;
-        }
-        this[PAUSED] = false;
-        this[FLOWING] = true;
-        this.emit('resume');
-        if (this[BUFFER].length)
-            this[FLUSH]();
-        else if (this[EOF])
-            this[MAYBE_EMIT_END]();
-        else
-            this.emit('drain');
-    }
-    /**
-     * Resume the stream if it is currently in a paused state
-     *
-     * If called when there are no pipe destinations or `data` event listeners,
-     * this will place the stream in a "discarded" state, where all data will
-     * be thrown away. The discarded state is removed if a pipe destination or
-     * data handler is added, if pause() is called, or if any synchronous or
-     * asynchronous iteration is started.
-     */
-    resume() {
-        return this[RESUME]();
-    }
-    /**
-     * Pause the stream
-     */
-    pause() {
-        this[FLOWING] = false;
-        this[PAUSED] = true;
-        this[DISCARDED] = false;
-    }
-    /**
-     * true if the stream has been forcibly destroyed
-     */
-    get destroyed() {
-        return this[DESTROYED];
-    }
-    /**
-     * true if the stream is currently in a flowing state, meaning that
-     * any writes will be immediately emitted.
-     */
-    get flowing() {
-        return this[FLOWING];
-    }
-    /**
-     * true if the stream is currently in a paused state
-     */
-    get paused() {
-        return this[PAUSED];
-    }
-    [BUFFERPUSH](chunk) {
-        if (this[OBJECTMODE])
-            this[BUFFERLENGTH] += 1;
-        else
-            this[BUFFERLENGTH] += chunk.length;
-        this[BUFFER].push(chunk);
-    }
-    [BUFFERSHIFT]() {
-        if (this[OBJECTMODE])
-            this[BUFFERLENGTH] -= 1;
-        else
-            this[BUFFERLENGTH] -= this[BUFFER][0].length;
-        return this[BUFFER].shift();
-    }
-    [FLUSH](noDrain = false) {
-        do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&
-            this[BUFFER].length);
-        if (!noDrain && !this[BUFFER].length && !this[EOF])
-            this.emit('drain');
-    }
-    [FLUSHCHUNK](chunk) {
-        this.emit('data', chunk);
-        return this[FLOWING];
-    }
-    /**
-     * Pipe all data emitted by this stream into the destination provided.
-     *
-     * Triggers the flow of data.
-     */
-    pipe(dest, opts) {
-        if (this[DESTROYED])
-            return dest;
-        this[DISCARDED] = false;
-        const ended = this[EMITTED_END];
-        opts = opts || {};
-        if (dest === proc.stdout || dest === proc.stderr)
-            opts.end = false;
-        else
-            opts.end = opts.end !== false;
-        opts.proxyErrors = !!opts.proxyErrors;
-        // piping an ended stream ends immediately
-        if (ended) {
-            if (opts.end)
-                dest.end();
-        }
-        else {
-            // "as" here just ignores the WType, which pipes don't care about,
-            // since they're only consuming from us, and writing to the dest
-            this[PIPES].push(!opts.proxyErrors
-                ? new Pipe(this, dest, opts)
-                : new PipeProxyErrors(this, dest, opts));
-            if (this[ASYNC])
-                defer(() => this[RESUME]());
-            else
-                this[RESUME]();
-        }
-        return dest;
-    }
-    /**
-     * Fully unhook a piped destination stream.
-     *
-     * If the destination stream was the only consumer of this stream (ie,
-     * there are no other piped destinations or `'data'` event listeners)
-     * then the flow of data will stop until there is another consumer or
-     * {@link Minipass#resume} is explicitly called.
-     */
-    unpipe(dest) {
-        const p = this[PIPES].find(p => p.dest === dest);
-        if (p) {
-            if (this[PIPES].length === 1) {
-                if (this[FLOWING] && this[DATALISTENERS] === 0) {
-                    this[FLOWING] = false;
-                }
-                this[PIPES] = [];
-            }
-            else
-                this[PIPES].splice(this[PIPES].indexOf(p), 1);
-            p.unpipe();
-        }
-    }
-    /**
-     * Alias for {@link Minipass#on}
-     */
-    addListener(ev, handler) {
-        return this.on(ev, handler);
-    }
-    /**
-     * Mostly identical to `EventEmitter.on`, with the following
-     * behavior differences to prevent data loss and unnecessary hangs:
-     *
-     * - Adding a 'data' event handler will trigger the flow of data
-     *
-     * - Adding a 'readable' event handler when there is data waiting to be read
-     *   will cause 'readable' to be emitted immediately.
-     *
-     * - Adding an 'endish' event handler ('end', 'finish', etc.) which has
-     *   already passed will cause the event to be emitted immediately and all
-     *   handlers removed.
-     *
-     * - Adding an 'error' event handler after an error has been emitted will
-     *   cause the event to be re-emitted immediately with the error previously
-     *   raised.
-     */
-    on(ev, handler) {
-        const ret = super.on(ev, handler);
-        if (ev === 'data') {
-            this[DISCARDED] = false;
-            this[DATALISTENERS]++;
-            if (!this[PIPES].length && !this[FLOWING]) {
-                this[RESUME]();
-            }
-        }
-        else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {
-            super.emit('readable');
-        }
-        else if (isEndish(ev) && this[EMITTED_END]) {
-            super.emit(ev);
-            this.removeAllListeners(ev);
-        }
-        else if (ev === 'error' && this[EMITTED_ERROR]) {
-            const h = handler;
-            if (this[ASYNC])
-                defer(() => h.call(this, this[EMITTED_ERROR]));
-            else
-                h.call(this, this[EMITTED_ERROR]);
-        }
-        return ret;
-    }
-    /**
-     * Alias for {@link Minipass#off}
-     */
-    removeListener(ev, handler) {
-        return this.off(ev, handler);
-    }
-    /**
-     * Mostly identical to `EventEmitter.off`
-     *
-     * If a 'data' event handler is removed, and it was the last consumer
-     * (ie, there are no pipe destinations or other 'data' event listeners),
-     * then the flow of data will stop until there is another consumer or
-     * {@link Minipass#resume} is explicitly called.
-     */
-    off(ev, handler) {
-        const ret = super.off(ev, handler);
-        // if we previously had listeners, and now we don't, and we don't
-        // have any pipes, then stop the flow, unless it's been explicitly
-        // put in a discarded flowing state via stream.resume().
-        if (ev === 'data') {
-            this[DATALISTENERS] = this.listeners('data').length;
-            if (this[DATALISTENERS] === 0 &&
-                !this[DISCARDED] &&
-                !this[PIPES].length) {
-                this[FLOWING] = false;
-            }
-        }
-        return ret;
-    }
-    /**
-     * Mostly identical to `EventEmitter.removeAllListeners`
-     *
-     * If all 'data' event handlers are removed, and they were the last consumer
-     * (ie, there are no pipe destinations), then the flow of data will stop
-     * until there is another consumer or {@link Minipass#resume} is explicitly
-     * called.
-     */
-    removeAllListeners(ev) {
-        const ret = super.removeAllListeners(ev);
-        if (ev === 'data' || ev === undefined) {
-            this[DATALISTENERS] = 0;
-            if (!this[DISCARDED] && !this[PIPES].length) {
-                this[FLOWING] = false;
-            }
-        }
-        return ret;
-    }
-    /**
-     * true if the 'end' event has been emitted
-     */
-    get emittedEnd() {
-        return this[EMITTED_END];
-    }
-    [MAYBE_EMIT_END]() {
-        if (!this[EMITTING_END] &&
-            !this[EMITTED_END] &&
-            !this[DESTROYED] &&
-            this[BUFFER].length === 0 &&
-            this[EOF]) {
-            this[EMITTING_END] = true;
-            this.emit('end');
-            this.emit('prefinish');
-            this.emit('finish');
-            if (this[CLOSED])
-                this.emit('close');
-            this[EMITTING_END] = false;
-        }
-    }
-    /**
-     * Mostly identical to `EventEmitter.emit`, with the following
-     * behavior differences to prevent data loss and unnecessary hangs:
-     *
-     * If the stream has been destroyed, and the event is something other
-     * than 'close' or 'error', then `false` is returned and no handlers
-     * are called.
-     *
-     * If the event is 'end', and has already been emitted, then the event
-     * is ignored. If the stream is in a paused or non-flowing state, then
-     * the event will be deferred until data flow resumes. If the stream is
-     * async, then handlers will be called on the next tick rather than
-     * immediately.
-     *
-     * If the event is 'close', and 'end' has not yet been emitted, then
-     * the event will be deferred until after 'end' is emitted.
-     *
-     * If the event is 'error', and an AbortSignal was provided for the stream,
-     * and there are no listeners, then the event is ignored, matching the
-     * behavior of node core streams in the presense of an AbortSignal.
-     *
-     * If the event is 'finish' or 'prefinish', then all listeners will be
-     * removed after emitting the event, to prevent double-firing.
-     */
-    emit(ev, ...args) {
-        const data = args[0];
-        // error and close are only events allowed after calling destroy()
-        if (ev !== 'error' &&
-            ev !== 'close' &&
-            ev !== DESTROYED &&
-            this[DESTROYED]) {
-            return false;
-        }
-        else if (ev === 'data') {
-            return !this[OBJECTMODE] && !data
-                ? false
-                : this[ASYNC]
-                    ? (defer(() => this[EMITDATA](data)), true)
-                    : this[EMITDATA](data);
-        }
-        else if (ev === 'end') {
-            return this[EMITEND]();
-        }
-        else if (ev === 'close') {
-            this[CLOSED] = true;
-            // don't emit close before 'end' and 'finish'
-            if (!this[EMITTED_END] && !this[DESTROYED])
-                return false;
-            const ret = super.emit('close');
-            this.removeAllListeners('close');
-            return ret;
-        }
-        else if (ev === 'error') {
-            this[EMITTED_ERROR] = data;
-            super.emit(ERROR, data);
-            const ret = !this[SIGNAL] || this.listeners('error').length
-                ? super.emit('error', data)
-                : false;
-            this[MAYBE_EMIT_END]();
-            return ret;
-        }
-        else if (ev === 'resume') {
-            const ret = super.emit('resume');
-            this[MAYBE_EMIT_END]();
-            return ret;
-        }
-        else if (ev === 'finish' || ev === 'prefinish') {
-            const ret = super.emit(ev);
-            this.removeAllListeners(ev);
-            return ret;
-        }
-        // Some other unknown event
-        const ret = super.emit(ev, ...args);
-        this[MAYBE_EMIT_END]();
-        return ret;
-    }
-    [EMITDATA](data) {
-        for (const p of this[PIPES]) {
-            if (p.dest.write(data) === false)
-                this.pause();
-        }
-        const ret = this[DISCARDED] ? false : super.emit('data', data);
-        this[MAYBE_EMIT_END]();
-        return ret;
-    }
-    [EMITEND]() {
-        if (this[EMITTED_END])
-            return false;
-        this[EMITTED_END] = true;
-        this.readable = false;
-        return this[ASYNC]
-            ? (defer(() => this[EMITEND2]()), true)
-            : this[EMITEND2]();
-    }
-    [EMITEND2]() {
-        if (this[DECODER]) {
-            const data = this[DECODER].end();
-            if (data) {
-                for (const p of this[PIPES]) {
-                    p.dest.write(data);
-                }
-                if (!this[DISCARDED])
-                    super.emit('data', data);
-            }
-        }
-        for (const p of this[PIPES]) {
-            p.end();
-        }
-        const ret = super.emit('end');
-        this.removeAllListeners('end');
-        return ret;
-    }
-    /**
-     * Return a Promise that resolves to an array of all emitted data once
-     * the stream ends.
-     */
-    async collect() {
-        const buf = Object.assign([], {
-            dataLength: 0,
-        });
-        if (!this[OBJECTMODE])
-            buf.dataLength = 0;
-        // set the promise first, in case an error is raised
-        // by triggering the flow here.
-        const p = this.promise();
-        this.on('data', c => {
-            buf.push(c);
-            if (!this[OBJECTMODE])
-                buf.dataLength += c.length;
-        });
-        await p;
-        return buf;
-    }
-    /**
-     * Return a Promise that resolves to the concatenation of all emitted data
-     * once the stream ends.
-     *
-     * Not allowed on objectMode streams.
-     */
-    async concat() {
-        if (this[OBJECTMODE]) {
-            throw new Error('cannot concat in objectMode');
-        }
-        const buf = await this.collect();
-        return (this[ENCODING]
-            ? buf.join('')
-            : Buffer.concat(buf, buf.dataLength));
-    }
-    /**
-     * Return a void Promise that resolves once the stream ends.
-     */
-    async promise() {
-        return new Promise((resolve, reject) => {
-            this.on(DESTROYED, () => reject(new Error('stream destroyed')));
-            this.on('error', er => reject(er));
-            this.on('end', () => resolve());
-        });
-    }
-    /**
-     * Asynchronous `for await of` iteration.
-     *
-     * This will continue emitting all chunks until the stream terminates.
-     */
-    [Symbol.asyncIterator]() {
-        // set this up front, in case the consumer doesn't call next()
-        // right away.
-        this[DISCARDED] = false;
-        let stopped = false;
-        const stop = async () => {
-            this.pause();
-            stopped = true;
-            return { value: undefined, done: true };
-        };
-        const next = () => {
-            if (stopped)
-                return stop();
-            const res = this.read();
-            if (res !== null)
-                return Promise.resolve({ done: false, value: res });
-            if (this[EOF])
-                return stop();
-            let resolve;
-            let reject;
-            const onerr = (er) => {
-                this.off('data', ondata);
-                this.off('end', onend);
-                this.off(DESTROYED, ondestroy);
-                stop();
-                reject(er);
-            };
-            const ondata = (value) => {
-                this.off('error', onerr);
-                this.off('end', onend);
-                this.off(DESTROYED, ondestroy);
-                this.pause();
-                resolve({ value, done: !!this[EOF] });
-            };
-            const onend = () => {
-                this.off('error', onerr);
-                this.off('data', ondata);
-                this.off(DESTROYED, ondestroy);
-                stop();
-                resolve({ done: true, value: undefined });
-            };
-            const ondestroy = () => onerr(new Error('stream destroyed'));
-            return new Promise((res, rej) => {
-                reject = rej;
-                resolve = res;
-                this.once(DESTROYED, ondestroy);
-                this.once('error', onerr);
-                this.once('end', onend);
-                this.once('data', ondata);
-            });
-        };
-        return {
-            next,
-            throw: stop,
-            return: stop,
-            [Symbol.asyncIterator]() {
-                return this;
-            },
-        };
-    }
-    /**
-     * Synchronous `for of` iteration.
-     *
-     * The iteration will terminate when the internal buffer runs out, even
-     * if the stream has not yet terminated.
-     */
-    [Symbol.iterator]() {
-        // set this up front, in case the consumer doesn't call next()
-        // right away.
-        this[DISCARDED] = false;
-        let stopped = false;
-        const stop = () => {
-            this.pause();
-            this.off(ERROR, stop);
-            this.off(DESTROYED, stop);
-            this.off('end', stop);
-            stopped = true;
-            return { done: true, value: undefined };
-        };
-        const next = () => {
-            if (stopped)
-                return stop();
-            const value = this.read();
-            return value === null ? stop() : { done: false, value };
-        };
-        this.once('end', stop);
-        this.once(ERROR, stop);
-        this.once(DESTROYED, stop);
-        return {
-            next,
-            throw: stop,
-            return: stop,
-            [Symbol.iterator]() {
-                return this;
-            },
-        };
-    }
-    /**
-     * Destroy a stream, preventing it from being used for any further purpose.
-     *
-     * If the stream has a `close()` method, then it will be called on
-     * destruction.
-     *
-     * After destruction, any attempt to write data, read data, or emit most
-     * events will be ignored.
-     *
-     * If an error argument is provided, then it will be emitted in an
-     * 'error' event.
-     */
-    destroy(er) {
-        if (this[DESTROYED]) {
-            if (er)
-                this.emit('error', er);
-            else
-                this.emit(DESTROYED);
-            return this;
-        }
-        this[DESTROYED] = true;
-        this[DISCARDED] = true;
-        // throw away all buffered data, it's never coming out
-        this[BUFFER].length = 0;
-        this[BUFFERLENGTH] = 0;
-        const wc = this;
-        if (typeof wc.close === 'function' && !this[CLOSED])
-            wc.close();
-        if (er)
-            this.emit('error', er);
-        // if no error to emit, still reject pending promises
-        else
-            this.emit(DESTROYED);
-        return this;
-    }
-    /**
-     * Alias for {@link isStream}
-     *
-     * Former export location, maintained for backwards compatibility.
-     *
-     * @deprecated
-     */
-    static get isStream() {
-        return exports.isStream;
-    }
-}
-exports.Minipass = Minipass;
-//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/commonjs/package.json b/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/commonjs/package.json
deleted file mode 100644
index 0292b9956f2e4..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/commonjs/package.json
+++ /dev/null
@@ -1 +0,0 @@
-{"type":"commonjs"}
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/esm/index.js b/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/esm/index.js
deleted file mode 100644
index b65fafbae43a4..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/esm/index.js
+++ /dev/null
@@ -1,1018 +0,0 @@
-const proc = typeof process === 'object' && process
-    ? process
-    : {
-        stdout: null,
-        stderr: null,
-    };
-import { EventEmitter } from 'events';
-import Stream from 'stream';
-import { StringDecoder } from 'string_decoder';
-/**
- * Return true if the argument is a Minipass stream, Node stream, or something
- * else that Minipass can interact with.
- */
-export const isStream = (s) => !!s &&
-    typeof s === 'object' &&
-    (s instanceof Minipass ||
-        s instanceof Stream ||
-        isReadable(s) ||
-        isWritable(s));
-/**
- * Return true if the argument is a valid {@link Minipass.Readable}
- */
-export const isReadable = (s) => !!s &&
-    typeof s === 'object' &&
-    s instanceof EventEmitter &&
-    typeof s.pipe === 'function' &&
-    // node core Writable streams have a pipe() method, but it throws
-    s.pipe !== Stream.Writable.prototype.pipe;
-/**
- * Return true if the argument is a valid {@link Minipass.Writable}
- */
-export const isWritable = (s) => !!s &&
-    typeof s === 'object' &&
-    s instanceof EventEmitter &&
-    typeof s.write === 'function' &&
-    typeof s.end === 'function';
-const EOF = Symbol('EOF');
-const MAYBE_EMIT_END = Symbol('maybeEmitEnd');
-const EMITTED_END = Symbol('emittedEnd');
-const EMITTING_END = Symbol('emittingEnd');
-const EMITTED_ERROR = Symbol('emittedError');
-const CLOSED = Symbol('closed');
-const READ = Symbol('read');
-const FLUSH = Symbol('flush');
-const FLUSHCHUNK = Symbol('flushChunk');
-const ENCODING = Symbol('encoding');
-const DECODER = Symbol('decoder');
-const FLOWING = Symbol('flowing');
-const PAUSED = Symbol('paused');
-const RESUME = Symbol('resume');
-const BUFFER = Symbol('buffer');
-const PIPES = Symbol('pipes');
-const BUFFERLENGTH = Symbol('bufferLength');
-const BUFFERPUSH = Symbol('bufferPush');
-const BUFFERSHIFT = Symbol('bufferShift');
-const OBJECTMODE = Symbol('objectMode');
-// internal event when stream is destroyed
-const DESTROYED = Symbol('destroyed');
-// internal event when stream has an error
-const ERROR = Symbol('error');
-const EMITDATA = Symbol('emitData');
-const EMITEND = Symbol('emitEnd');
-const EMITEND2 = Symbol('emitEnd2');
-const ASYNC = Symbol('async');
-const ABORT = Symbol('abort');
-const ABORTED = Symbol('aborted');
-const SIGNAL = Symbol('signal');
-const DATALISTENERS = Symbol('dataListeners');
-const DISCARDED = Symbol('discarded');
-const defer = (fn) => Promise.resolve().then(fn);
-const nodefer = (fn) => fn();
-const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish';
-const isArrayBufferLike = (b) => b instanceof ArrayBuffer ||
-    (!!b &&
-        typeof b === 'object' &&
-        b.constructor &&
-        b.constructor.name === 'ArrayBuffer' &&
-        b.byteLength >= 0);
-const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b);
-/**
- * Internal class representing a pipe to a destination stream.
- *
- * @internal
- */
-class Pipe {
-    src;
-    dest;
-    opts;
-    ondrain;
-    constructor(src, dest, opts) {
-        this.src = src;
-        this.dest = dest;
-        this.opts = opts;
-        this.ondrain = () => src[RESUME]();
-        this.dest.on('drain', this.ondrain);
-    }
-    unpipe() {
-        this.dest.removeListener('drain', this.ondrain);
-    }
-    // only here for the prototype
-    /* c8 ignore start */
-    proxyErrors(_er) { }
-    /* c8 ignore stop */
-    end() {
-        this.unpipe();
-        if (this.opts.end)
-            this.dest.end();
-    }
-}
-/**
- * Internal class representing a pipe to a destination stream where
- * errors are proxied.
- *
- * @internal
- */
-class PipeProxyErrors extends Pipe {
-    unpipe() {
-        this.src.removeListener('error', this.proxyErrors);
-        super.unpipe();
-    }
-    constructor(src, dest, opts) {
-        super(src, dest, opts);
-        this.proxyErrors = er => dest.emit('error', er);
-        src.on('error', this.proxyErrors);
-    }
-}
-const isObjectModeOptions = (o) => !!o.objectMode;
-const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer';
-/**
- * Main export, the Minipass class
- *
- * `RType` is the type of data emitted, defaults to Buffer
- *
- * `WType` is the type of data to be written, if RType is buffer or string,
- * then any {@link Minipass.ContiguousData} is allowed.
- *
- * `Events` is the set of event handler signatures that this object
- * will emit, see {@link Minipass.Events}
- */
-export class Minipass extends EventEmitter {
-    [FLOWING] = false;
-    [PAUSED] = false;
-    [PIPES] = [];
-    [BUFFER] = [];
-    [OBJECTMODE];
-    [ENCODING];
-    [ASYNC];
-    [DECODER];
-    [EOF] = false;
-    [EMITTED_END] = false;
-    [EMITTING_END] = false;
-    [CLOSED] = false;
-    [EMITTED_ERROR] = null;
-    [BUFFERLENGTH] = 0;
-    [DESTROYED] = false;
-    [SIGNAL];
-    [ABORTED] = false;
-    [DATALISTENERS] = 0;
-    [DISCARDED] = false;
-    /**
-     * true if the stream can be written
-     */
-    writable = true;
-    /**
-     * true if the stream can be read
-     */
-    readable = true;
-    /**
-     * If `RType` is Buffer, then options do not need to be provided.
-     * Otherwise, an options object must be provided to specify either
-     * {@link Minipass.SharedOptions.objectMode} or
-     * {@link Minipass.SharedOptions.encoding}, as appropriate.
-     */
-    constructor(...args) {
-        const options = (args[0] ||
-            {});
-        super();
-        if (options.objectMode && typeof options.encoding === 'string') {
-            throw new TypeError('Encoding and objectMode may not be used together');
-        }
-        if (isObjectModeOptions(options)) {
-            this[OBJECTMODE] = true;
-            this[ENCODING] = null;
-        }
-        else if (isEncodingOptions(options)) {
-            this[ENCODING] = options.encoding;
-            this[OBJECTMODE] = false;
-        }
-        else {
-            this[OBJECTMODE] = false;
-            this[ENCODING] = null;
-        }
-        this[ASYNC] = !!options.async;
-        this[DECODER] = this[ENCODING]
-            ? new StringDecoder(this[ENCODING])
-            : null;
-        //@ts-ignore - private option for debugging and testing
-        if (options && options.debugExposeBuffer === true) {
-            Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] });
-        }
-        //@ts-ignore - private option for debugging and testing
-        if (options && options.debugExposePipes === true) {
-            Object.defineProperty(this, 'pipes', { get: () => this[PIPES] });
-        }
-        const { signal } = options;
-        if (signal) {
-            this[SIGNAL] = signal;
-            if (signal.aborted) {
-                this[ABORT]();
-            }
-            else {
-                signal.addEventListener('abort', () => this[ABORT]());
-            }
-        }
-    }
-    /**
-     * The amount of data stored in the buffer waiting to be read.
-     *
-     * For Buffer strings, this will be the total byte length.
-     * For string encoding streams, this will be the string character length,
-     * according to JavaScript's `string.length` logic.
-     * For objectMode streams, this is a count of the items waiting to be
-     * emitted.
-     */
-    get bufferLength() {
-        return this[BUFFERLENGTH];
-    }
-    /**
-     * The `BufferEncoding` currently in use, or `null`
-     */
-    get encoding() {
-        return this[ENCODING];
-    }
-    /**
-     * @deprecated - This is a read only property
-     */
-    set encoding(_enc) {
-        throw new Error('Encoding must be set at instantiation time');
-    }
-    /**
-     * @deprecated - Encoding may only be set at instantiation time
-     */
-    setEncoding(_enc) {
-        throw new Error('Encoding must be set at instantiation time');
-    }
-    /**
-     * True if this is an objectMode stream
-     */
-    get objectMode() {
-        return this[OBJECTMODE];
-    }
-    /**
-     * @deprecated - This is a read-only property
-     */
-    set objectMode(_om) {
-        throw new Error('objectMode must be set at instantiation time');
-    }
-    /**
-     * true if this is an async stream
-     */
-    get ['async']() {
-        return this[ASYNC];
-    }
-    /**
-     * Set to true to make this stream async.
-     *
-     * Once set, it cannot be unset, as this would potentially cause incorrect
-     * behavior.  Ie, a sync stream can be made async, but an async stream
-     * cannot be safely made sync.
-     */
-    set ['async'](a) {
-        this[ASYNC] = this[ASYNC] || !!a;
-    }
-    // drop everything and get out of the flow completely
-    [ABORT]() {
-        this[ABORTED] = true;
-        this.emit('abort', this[SIGNAL]?.reason);
-        this.destroy(this[SIGNAL]?.reason);
-    }
-    /**
-     * True if the stream has been aborted.
-     */
-    get aborted() {
-        return this[ABORTED];
-    }
-    /**
-     * No-op setter. Stream aborted status is set via the AbortSignal provided
-     * in the constructor options.
-     */
-    set aborted(_) { }
-    write(chunk, encoding, cb) {
-        if (this[ABORTED])
-            return false;
-        if (this[EOF])
-            throw new Error('write after end');
-        if (this[DESTROYED]) {
-            this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' }));
-            return true;
-        }
-        if (typeof encoding === 'function') {
-            cb = encoding;
-            encoding = 'utf8';
-        }
-        if (!encoding)
-            encoding = 'utf8';
-        const fn = this[ASYNC] ? defer : nodefer;
-        // convert array buffers and typed array views into buffers
-        // at some point in the future, we may want to do the opposite!
-        // leave strings and buffers as-is
-        // anything is only allowed if in object mode, so throw
-        if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
-            if (isArrayBufferView(chunk)) {
-                //@ts-ignore - sinful unsafe type changing
-                chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
-            }
-            else if (isArrayBufferLike(chunk)) {
-                //@ts-ignore - sinful unsafe type changing
-                chunk = Buffer.from(chunk);
-            }
-            else if (typeof chunk !== 'string') {
-                throw new Error('Non-contiguous data written to non-objectMode stream');
-            }
-        }
-        // handle object mode up front, since it's simpler
-        // this yields better performance, fewer checks later.
-        if (this[OBJECTMODE]) {
-            // maybe impossible?
-            /* c8 ignore start */
-            if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
-                this[FLUSH](true);
-            /* c8 ignore stop */
-            if (this[FLOWING])
-                this.emit('data', chunk);
-            else
-                this[BUFFERPUSH](chunk);
-            if (this[BUFFERLENGTH] !== 0)
-                this.emit('readable');
-            if (cb)
-                fn(cb);
-            return this[FLOWING];
-        }
-        // at this point the chunk is a buffer or string
-        // don't buffer it up or send it to the decoder
-        if (!chunk.length) {
-            if (this[BUFFERLENGTH] !== 0)
-                this.emit('readable');
-            if (cb)
-                fn(cb);
-            return this[FLOWING];
-        }
-        // fast-path writing strings of same encoding to a stream with
-        // an empty buffer, skipping the buffer/decoder dance
-        if (typeof chunk === 'string' &&
-            // unless it is a string already ready for us to use
-            !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) {
-            //@ts-ignore - sinful unsafe type change
-            chunk = Buffer.from(chunk, encoding);
-        }
-        if (Buffer.isBuffer(chunk) && this[ENCODING]) {
-            //@ts-ignore - sinful unsafe type change
-            chunk = this[DECODER].write(chunk);
-        }
-        // Note: flushing CAN potentially switch us into not-flowing mode
-        if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
-            this[FLUSH](true);
-        if (this[FLOWING])
-            this.emit('data', chunk);
-        else
-            this[BUFFERPUSH](chunk);
-        if (this[BUFFERLENGTH] !== 0)
-            this.emit('readable');
-        if (cb)
-            fn(cb);
-        return this[FLOWING];
-    }
-    /**
-     * Low-level explicit read method.
-     *
-     * In objectMode, the argument is ignored, and one item is returned if
-     * available.
-     *
-     * `n` is the number of bytes (or in the case of encoding streams,
-     * characters) to consume. If `n` is not provided, then the entire buffer
-     * is returned, or `null` is returned if no data is available.
-     *
-     * If `n` is greater that the amount of data in the internal buffer,
-     * then `null` is returned.
-     */
-    read(n) {
-        if (this[DESTROYED])
-            return null;
-        this[DISCARDED] = false;
-        if (this[BUFFERLENGTH] === 0 ||
-            n === 0 ||
-            (n && n > this[BUFFERLENGTH])) {
-            this[MAYBE_EMIT_END]();
-            return null;
-        }
-        if (this[OBJECTMODE])
-            n = null;
-        if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {
-            // not object mode, so if we have an encoding, then RType is string
-            // otherwise, must be Buffer
-            this[BUFFER] = [
-                (this[ENCODING]
-                    ? this[BUFFER].join('')
-                    : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])),
-            ];
-        }
-        const ret = this[READ](n || null, this[BUFFER][0]);
-        this[MAYBE_EMIT_END]();
-        return ret;
-    }
-    [READ](n, chunk) {
-        if (this[OBJECTMODE])
-            this[BUFFERSHIFT]();
-        else {
-            const c = chunk;
-            if (n === c.length || n === null)
-                this[BUFFERSHIFT]();
-            else if (typeof c === 'string') {
-                this[BUFFER][0] = c.slice(n);
-                chunk = c.slice(0, n);
-                this[BUFFERLENGTH] -= n;
-            }
-            else {
-                this[BUFFER][0] = c.subarray(n);
-                chunk = c.subarray(0, n);
-                this[BUFFERLENGTH] -= n;
-            }
-        }
-        this.emit('data', chunk);
-        if (!this[BUFFER].length && !this[EOF])
-            this.emit('drain');
-        return chunk;
-    }
-    end(chunk, encoding, cb) {
-        if (typeof chunk === 'function') {
-            cb = chunk;
-            chunk = undefined;
-        }
-        if (typeof encoding === 'function') {
-            cb = encoding;
-            encoding = 'utf8';
-        }
-        if (chunk !== undefined)
-            this.write(chunk, encoding);
-        if (cb)
-            this.once('end', cb);
-        this[EOF] = true;
-        this.writable = false;
-        // if we haven't written anything, then go ahead and emit,
-        // even if we're not reading.
-        // we'll re-emit if a new 'end' listener is added anyway.
-        // This makes MP more suitable to write-only use cases.
-        if (this[FLOWING] || !this[PAUSED])
-            this[MAYBE_EMIT_END]();
-        return this;
-    }
-    // don't let the internal resume be overwritten
-    [RESUME]() {
-        if (this[DESTROYED])
-            return;
-        if (!this[DATALISTENERS] && !this[PIPES].length) {
-            this[DISCARDED] = true;
-        }
-        this[PAUSED] = false;
-        this[FLOWING] = true;
-        this.emit('resume');
-        if (this[BUFFER].length)
-            this[FLUSH]();
-        else if (this[EOF])
-            this[MAYBE_EMIT_END]();
-        else
-            this.emit('drain');
-    }
-    /**
-     * Resume the stream if it is currently in a paused state
-     *
-     * If called when there are no pipe destinations or `data` event listeners,
-     * this will place the stream in a "discarded" state, where all data will
-     * be thrown away. The discarded state is removed if a pipe destination or
-     * data handler is added, if pause() is called, or if any synchronous or
-     * asynchronous iteration is started.
-     */
-    resume() {
-        return this[RESUME]();
-    }
-    /**
-     * Pause the stream
-     */
-    pause() {
-        this[FLOWING] = false;
-        this[PAUSED] = true;
-        this[DISCARDED] = false;
-    }
-    /**
-     * true if the stream has been forcibly destroyed
-     */
-    get destroyed() {
-        return this[DESTROYED];
-    }
-    /**
-     * true if the stream is currently in a flowing state, meaning that
-     * any writes will be immediately emitted.
-     */
-    get flowing() {
-        return this[FLOWING];
-    }
-    /**
-     * true if the stream is currently in a paused state
-     */
-    get paused() {
-        return this[PAUSED];
-    }
-    [BUFFERPUSH](chunk) {
-        if (this[OBJECTMODE])
-            this[BUFFERLENGTH] += 1;
-        else
-            this[BUFFERLENGTH] += chunk.length;
-        this[BUFFER].push(chunk);
-    }
-    [BUFFERSHIFT]() {
-        if (this[OBJECTMODE])
-            this[BUFFERLENGTH] -= 1;
-        else
-            this[BUFFERLENGTH] -= this[BUFFER][0].length;
-        return this[BUFFER].shift();
-    }
-    [FLUSH](noDrain = false) {
-        do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&
-            this[BUFFER].length);
-        if (!noDrain && !this[BUFFER].length && !this[EOF])
-            this.emit('drain');
-    }
-    [FLUSHCHUNK](chunk) {
-        this.emit('data', chunk);
-        return this[FLOWING];
-    }
-    /**
-     * Pipe all data emitted by this stream into the destination provided.
-     *
-     * Triggers the flow of data.
-     */
-    pipe(dest, opts) {
-        if (this[DESTROYED])
-            return dest;
-        this[DISCARDED] = false;
-        const ended = this[EMITTED_END];
-        opts = opts || {};
-        if (dest === proc.stdout || dest === proc.stderr)
-            opts.end = false;
-        else
-            opts.end = opts.end !== false;
-        opts.proxyErrors = !!opts.proxyErrors;
-        // piping an ended stream ends immediately
-        if (ended) {
-            if (opts.end)
-                dest.end();
-        }
-        else {
-            // "as" here just ignores the WType, which pipes don't care about,
-            // since they're only consuming from us, and writing to the dest
-            this[PIPES].push(!opts.proxyErrors
-                ? new Pipe(this, dest, opts)
-                : new PipeProxyErrors(this, dest, opts));
-            if (this[ASYNC])
-                defer(() => this[RESUME]());
-            else
-                this[RESUME]();
-        }
-        return dest;
-    }
-    /**
-     * Fully unhook a piped destination stream.
-     *
-     * If the destination stream was the only consumer of this stream (ie,
-     * there are no other piped destinations or `'data'` event listeners)
-     * then the flow of data will stop until there is another consumer or
-     * {@link Minipass#resume} is explicitly called.
-     */
-    unpipe(dest) {
-        const p = this[PIPES].find(p => p.dest === dest);
-        if (p) {
-            if (this[PIPES].length === 1) {
-                if (this[FLOWING] && this[DATALISTENERS] === 0) {
-                    this[FLOWING] = false;
-                }
-                this[PIPES] = [];
-            }
-            else
-                this[PIPES].splice(this[PIPES].indexOf(p), 1);
-            p.unpipe();
-        }
-    }
-    /**
-     * Alias for {@link Minipass#on}
-     */
-    addListener(ev, handler) {
-        return this.on(ev, handler);
-    }
-    /**
-     * Mostly identical to `EventEmitter.on`, with the following
-     * behavior differences to prevent data loss and unnecessary hangs:
-     *
-     * - Adding a 'data' event handler will trigger the flow of data
-     *
-     * - Adding a 'readable' event handler when there is data waiting to be read
-     *   will cause 'readable' to be emitted immediately.
-     *
-     * - Adding an 'endish' event handler ('end', 'finish', etc.) which has
-     *   already passed will cause the event to be emitted immediately and all
-     *   handlers removed.
-     *
-     * - Adding an 'error' event handler after an error has been emitted will
-     *   cause the event to be re-emitted immediately with the error previously
-     *   raised.
-     */
-    on(ev, handler) {
-        const ret = super.on(ev, handler);
-        if (ev === 'data') {
-            this[DISCARDED] = false;
-            this[DATALISTENERS]++;
-            if (!this[PIPES].length && !this[FLOWING]) {
-                this[RESUME]();
-            }
-        }
-        else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {
-            super.emit('readable');
-        }
-        else if (isEndish(ev) && this[EMITTED_END]) {
-            super.emit(ev);
-            this.removeAllListeners(ev);
-        }
-        else if (ev === 'error' && this[EMITTED_ERROR]) {
-            const h = handler;
-            if (this[ASYNC])
-                defer(() => h.call(this, this[EMITTED_ERROR]));
-            else
-                h.call(this, this[EMITTED_ERROR]);
-        }
-        return ret;
-    }
-    /**
-     * Alias for {@link Minipass#off}
-     */
-    removeListener(ev, handler) {
-        return this.off(ev, handler);
-    }
-    /**
-     * Mostly identical to `EventEmitter.off`
-     *
-     * If a 'data' event handler is removed, and it was the last consumer
-     * (ie, there are no pipe destinations or other 'data' event listeners),
-     * then the flow of data will stop until there is another consumer or
-     * {@link Minipass#resume} is explicitly called.
-     */
-    off(ev, handler) {
-        const ret = super.off(ev, handler);
-        // if we previously had listeners, and now we don't, and we don't
-        // have any pipes, then stop the flow, unless it's been explicitly
-        // put in a discarded flowing state via stream.resume().
-        if (ev === 'data') {
-            this[DATALISTENERS] = this.listeners('data').length;
-            if (this[DATALISTENERS] === 0 &&
-                !this[DISCARDED] &&
-                !this[PIPES].length) {
-                this[FLOWING] = false;
-            }
-        }
-        return ret;
-    }
-    /**
-     * Mostly identical to `EventEmitter.removeAllListeners`
-     *
-     * If all 'data' event handlers are removed, and they were the last consumer
-     * (ie, there are no pipe destinations), then the flow of data will stop
-     * until there is another consumer or {@link Minipass#resume} is explicitly
-     * called.
-     */
-    removeAllListeners(ev) {
-        const ret = super.removeAllListeners(ev);
-        if (ev === 'data' || ev === undefined) {
-            this[DATALISTENERS] = 0;
-            if (!this[DISCARDED] && !this[PIPES].length) {
-                this[FLOWING] = false;
-            }
-        }
-        return ret;
-    }
-    /**
-     * true if the 'end' event has been emitted
-     */
-    get emittedEnd() {
-        return this[EMITTED_END];
-    }
-    [MAYBE_EMIT_END]() {
-        if (!this[EMITTING_END] &&
-            !this[EMITTED_END] &&
-            !this[DESTROYED] &&
-            this[BUFFER].length === 0 &&
-            this[EOF]) {
-            this[EMITTING_END] = true;
-            this.emit('end');
-            this.emit('prefinish');
-            this.emit('finish');
-            if (this[CLOSED])
-                this.emit('close');
-            this[EMITTING_END] = false;
-        }
-    }
-    /**
-     * Mostly identical to `EventEmitter.emit`, with the following
-     * behavior differences to prevent data loss and unnecessary hangs:
-     *
-     * If the stream has been destroyed, and the event is something other
-     * than 'close' or 'error', then `false` is returned and no handlers
-     * are called.
-     *
-     * If the event is 'end', and has already been emitted, then the event
-     * is ignored. If the stream is in a paused or non-flowing state, then
-     * the event will be deferred until data flow resumes. If the stream is
-     * async, then handlers will be called on the next tick rather than
-     * immediately.
-     *
-     * If the event is 'close', and 'end' has not yet been emitted, then
-     * the event will be deferred until after 'end' is emitted.
-     *
-     * If the event is 'error', and an AbortSignal was provided for the stream,
-     * and there are no listeners, then the event is ignored, matching the
-     * behavior of node core streams in the presense of an AbortSignal.
-     *
-     * If the event is 'finish' or 'prefinish', then all listeners will be
-     * removed after emitting the event, to prevent double-firing.
-     */
-    emit(ev, ...args) {
-        const data = args[0];
-        // error and close are only events allowed after calling destroy()
-        if (ev !== 'error' &&
-            ev !== 'close' &&
-            ev !== DESTROYED &&
-            this[DESTROYED]) {
-            return false;
-        }
-        else if (ev === 'data') {
-            return !this[OBJECTMODE] && !data
-                ? false
-                : this[ASYNC]
-                    ? (defer(() => this[EMITDATA](data)), true)
-                    : this[EMITDATA](data);
-        }
-        else if (ev === 'end') {
-            return this[EMITEND]();
-        }
-        else if (ev === 'close') {
-            this[CLOSED] = true;
-            // don't emit close before 'end' and 'finish'
-            if (!this[EMITTED_END] && !this[DESTROYED])
-                return false;
-            const ret = super.emit('close');
-            this.removeAllListeners('close');
-            return ret;
-        }
-        else if (ev === 'error') {
-            this[EMITTED_ERROR] = data;
-            super.emit(ERROR, data);
-            const ret = !this[SIGNAL] || this.listeners('error').length
-                ? super.emit('error', data)
-                : false;
-            this[MAYBE_EMIT_END]();
-            return ret;
-        }
-        else if (ev === 'resume') {
-            const ret = super.emit('resume');
-            this[MAYBE_EMIT_END]();
-            return ret;
-        }
-        else if (ev === 'finish' || ev === 'prefinish') {
-            const ret = super.emit(ev);
-            this.removeAllListeners(ev);
-            return ret;
-        }
-        // Some other unknown event
-        const ret = super.emit(ev, ...args);
-        this[MAYBE_EMIT_END]();
-        return ret;
-    }
-    [EMITDATA](data) {
-        for (const p of this[PIPES]) {
-            if (p.dest.write(data) === false)
-                this.pause();
-        }
-        const ret = this[DISCARDED] ? false : super.emit('data', data);
-        this[MAYBE_EMIT_END]();
-        return ret;
-    }
-    [EMITEND]() {
-        if (this[EMITTED_END])
-            return false;
-        this[EMITTED_END] = true;
-        this.readable = false;
-        return this[ASYNC]
-            ? (defer(() => this[EMITEND2]()), true)
-            : this[EMITEND2]();
-    }
-    [EMITEND2]() {
-        if (this[DECODER]) {
-            const data = this[DECODER].end();
-            if (data) {
-                for (const p of this[PIPES]) {
-                    p.dest.write(data);
-                }
-                if (!this[DISCARDED])
-                    super.emit('data', data);
-            }
-        }
-        for (const p of this[PIPES]) {
-            p.end();
-        }
-        const ret = super.emit('end');
-        this.removeAllListeners('end');
-        return ret;
-    }
-    /**
-     * Return a Promise that resolves to an array of all emitted data once
-     * the stream ends.
-     */
-    async collect() {
-        const buf = Object.assign([], {
-            dataLength: 0,
-        });
-        if (!this[OBJECTMODE])
-            buf.dataLength = 0;
-        // set the promise first, in case an error is raised
-        // by triggering the flow here.
-        const p = this.promise();
-        this.on('data', c => {
-            buf.push(c);
-            if (!this[OBJECTMODE])
-                buf.dataLength += c.length;
-        });
-        await p;
-        return buf;
-    }
-    /**
-     * Return a Promise that resolves to the concatenation of all emitted data
-     * once the stream ends.
-     *
-     * Not allowed on objectMode streams.
-     */
-    async concat() {
-        if (this[OBJECTMODE]) {
-            throw new Error('cannot concat in objectMode');
-        }
-        const buf = await this.collect();
-        return (this[ENCODING]
-            ? buf.join('')
-            : Buffer.concat(buf, buf.dataLength));
-    }
-    /**
-     * Return a void Promise that resolves once the stream ends.
-     */
-    async promise() {
-        return new Promise((resolve, reject) => {
-            this.on(DESTROYED, () => reject(new Error('stream destroyed')));
-            this.on('error', er => reject(er));
-            this.on('end', () => resolve());
-        });
-    }
-    /**
-     * Asynchronous `for await of` iteration.
-     *
-     * This will continue emitting all chunks until the stream terminates.
-     */
-    [Symbol.asyncIterator]() {
-        // set this up front, in case the consumer doesn't call next()
-        // right away.
-        this[DISCARDED] = false;
-        let stopped = false;
-        const stop = async () => {
-            this.pause();
-            stopped = true;
-            return { value: undefined, done: true };
-        };
-        const next = () => {
-            if (stopped)
-                return stop();
-            const res = this.read();
-            if (res !== null)
-                return Promise.resolve({ done: false, value: res });
-            if (this[EOF])
-                return stop();
-            let resolve;
-            let reject;
-            const onerr = (er) => {
-                this.off('data', ondata);
-                this.off('end', onend);
-                this.off(DESTROYED, ondestroy);
-                stop();
-                reject(er);
-            };
-            const ondata = (value) => {
-                this.off('error', onerr);
-                this.off('end', onend);
-                this.off(DESTROYED, ondestroy);
-                this.pause();
-                resolve({ value, done: !!this[EOF] });
-            };
-            const onend = () => {
-                this.off('error', onerr);
-                this.off('data', ondata);
-                this.off(DESTROYED, ondestroy);
-                stop();
-                resolve({ done: true, value: undefined });
-            };
-            const ondestroy = () => onerr(new Error('stream destroyed'));
-            return new Promise((res, rej) => {
-                reject = rej;
-                resolve = res;
-                this.once(DESTROYED, ondestroy);
-                this.once('error', onerr);
-                this.once('end', onend);
-                this.once('data', ondata);
-            });
-        };
-        return {
-            next,
-            throw: stop,
-            return: stop,
-            [Symbol.asyncIterator]() {
-                return this;
-            },
-        };
-    }
-    /**
-     * Synchronous `for of` iteration.
-     *
-     * The iteration will terminate when the internal buffer runs out, even
-     * if the stream has not yet terminated.
-     */
-    [Symbol.iterator]() {
-        // set this up front, in case the consumer doesn't call next()
-        // right away.
-        this[DISCARDED] = false;
-        let stopped = false;
-        const stop = () => {
-            this.pause();
-            this.off(ERROR, stop);
-            this.off(DESTROYED, stop);
-            this.off('end', stop);
-            stopped = true;
-            return { done: true, value: undefined };
-        };
-        const next = () => {
-            if (stopped)
-                return stop();
-            const value = this.read();
-            return value === null ? stop() : { done: false, value };
-        };
-        this.once('end', stop);
-        this.once(ERROR, stop);
-        this.once(DESTROYED, stop);
-        return {
-            next,
-            throw: stop,
-            return: stop,
-            [Symbol.iterator]() {
-                return this;
-            },
-        };
-    }
-    /**
-     * Destroy a stream, preventing it from being used for any further purpose.
-     *
-     * If the stream has a `close()` method, then it will be called on
-     * destruction.
-     *
-     * After destruction, any attempt to write data, read data, or emit most
-     * events will be ignored.
-     *
-     * If an error argument is provided, then it will be emitted in an
-     * 'error' event.
-     */
-    destroy(er) {
-        if (this[DESTROYED]) {
-            if (er)
-                this.emit('error', er);
-            else
-                this.emit(DESTROYED);
-            return this;
-        }
-        this[DESTROYED] = true;
-        this[DISCARDED] = true;
-        // throw away all buffered data, it's never coming out
-        this[BUFFER].length = 0;
-        this[BUFFERLENGTH] = 0;
-        const wc = this;
-        if (typeof wc.close === 'function' && !this[CLOSED])
-            wc.close();
-        if (er)
-            this.emit('error', er);
-        // if no error to emit, still reject pending promises
-        else
-            this.emit(DESTROYED);
-        return this;
-    }
-    /**
-     * Alias for {@link isStream}
-     *
-     * Former export location, maintained for backwards compatibility.
-     *
-     * @deprecated
-     */
-    static get isStream() {
-        return isStream;
-    }
-}
-//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/esm/package.json b/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/esm/package.json
deleted file mode 100644
index 7c34deb5837d8..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/dist/esm/package.json
+++ /dev/null
@@ -1 +0,0 @@
-{"type":"module"}
\ No newline at end of file
diff --git a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/package.json b/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/package.json
deleted file mode 100644
index 4398347289164..0000000000000
--- a/node_modules/node-gyp/node_modules/cacache/node_modules/minipass/package.json
+++ /dev/null
@@ -1,82 +0,0 @@
-{
-  "name": "minipass",
-  "version": "7.0.4",
-  "description": "minimal implementation of a PassThrough stream",
-  "main": "./dist/commonjs/index.js",
-  "types": "./dist/commonjs/index.d.ts",
-  "type": "module",
-  "tshy": {
-    "main": true,
-    "exports": {
-      "./package.json": "./package.json",
-      ".": "./src/index.ts"
-    }
-  },
-  "exports": {
-    "./package.json": "./package.json",
-    ".": {
-      "import": {
-        "types": "./dist/esm/index.d.ts",
-        "default": "./dist/esm/index.js"
-      },
-      "require": {
-        "types": "./dist/commonjs/index.d.ts",
-        "default": "./dist/commonjs/index.js"
-      }
-    }
-  },
-  "files": [
-    "dist"
-  ],
-  "scripts": {
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "prepublishOnly": "git push origin --follow-tags",
-    "prepare": "tshy",
-    "pretest": "npm run prepare",
-    "presnap": "npm run prepare",
-    "test": "tap",
-    "snap": "tap",
-    "format": "prettier --write . --loglevel warn",
-    "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
-  },
-  "prettier": {
-    "semi": false,
-    "printWidth": 75,
-    "tabWidth": 2,
-    "useTabs": false,
-    "singleQuote": true,
-    "jsxSingleQuote": false,
-    "bracketSameLine": true,
-    "arrowParens": "avoid",
-    "endOfLine": "lf"
-  },
-  "devDependencies": {
-    "@types/end-of-stream": "^1.4.2",
-    "@types/node": "^20.1.2",
-    "end-of-stream": "^1.4.0",
-    "node-abort-controller": "^3.1.1",
-    "prettier": "^2.6.2",
-    "sync-content": "^1.0.2",
-    "tap": "^18.3.0",
-    "through2": "^2.0.3",
-    "tshy": "^1.2.2",
-    "typedoc": "^0.25.1",
-    "typescript": "^5.2.2"
-  },
-  "repository": "https://github.com/isaacs/minipass",
-  "keywords": [
-    "passthrough",
-    "stream"
-  ],
-  "author": "Isaac Z. Schlueter  (http://blog.izs.me/)",
-  "license": "ISC",
-  "engines": {
-    "node": ">=16 || 14 >=14.17"
-  },
-  "tap": {
-    "include": [
-      "test/*.ts"
-    ]
-  }
-}
diff --git a/node_modules/node-gyp/node_modules/minipass/index.js b/node_modules/node-gyp/node_modules/minipass/index.js
deleted file mode 100644
index ed07c17acd97b..0000000000000
--- a/node_modules/node-gyp/node_modules/minipass/index.js
+++ /dev/null
@@ -1,702 +0,0 @@
-'use strict'
-const proc =
-  typeof process === 'object' && process
-    ? process
-    : {
-        stdout: null,
-        stderr: null,
-      }
-const EE = require('events')
-const Stream = require('stream')
-const stringdecoder = require('string_decoder')
-const SD = stringdecoder.StringDecoder
-
-const EOF = Symbol('EOF')
-const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
-const EMITTED_END = Symbol('emittedEnd')
-const EMITTING_END = Symbol('emittingEnd')
-const EMITTED_ERROR = Symbol('emittedError')
-const CLOSED = Symbol('closed')
-const READ = Symbol('read')
-const FLUSH = Symbol('flush')
-const FLUSHCHUNK = Symbol('flushChunk')
-const ENCODING = Symbol('encoding')
-const DECODER = Symbol('decoder')
-const FLOWING = Symbol('flowing')
-const PAUSED = Symbol('paused')
-const RESUME = Symbol('resume')
-const BUFFER = Symbol('buffer')
-const PIPES = Symbol('pipes')
-const BUFFERLENGTH = Symbol('bufferLength')
-const BUFFERPUSH = Symbol('bufferPush')
-const BUFFERSHIFT = Symbol('bufferShift')
-const OBJECTMODE = Symbol('objectMode')
-// internal event when stream is destroyed
-const DESTROYED = Symbol('destroyed')
-// internal event when stream has an error
-const ERROR = Symbol('error')
-const EMITDATA = Symbol('emitData')
-const EMITEND = Symbol('emitEnd')
-const EMITEND2 = Symbol('emitEnd2')
-const ASYNC = Symbol('async')
-const ABORT = Symbol('abort')
-const ABORTED = Symbol('aborted')
-const SIGNAL = Symbol('signal')
-
-const defer = fn => Promise.resolve().then(fn)
-
-// TODO remove when Node v8 support drops
-const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1'
-const ASYNCITERATOR =
-  (doIter && Symbol.asyncIterator) || Symbol('asyncIterator not implemented')
-const ITERATOR =
-  (doIter && Symbol.iterator) || Symbol('iterator not implemented')
-
-// events that mean 'the stream is over'
-// these are treated specially, and re-emitted
-// if they are listened for after emitting.
-const isEndish = ev => ev === 'end' || ev === 'finish' || ev === 'prefinish'
-
-const isArrayBuffer = b =>
-  b instanceof ArrayBuffer ||
-  (typeof b === 'object' &&
-    b.constructor &&
-    b.constructor.name === 'ArrayBuffer' &&
-    b.byteLength >= 0)
-
-const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b)
-
-class Pipe {
-  constructor(src, dest, opts) {
-    this.src = src
-    this.dest = dest
-    this.opts = opts
-    this.ondrain = () => src[RESUME]()
-    dest.on('drain', this.ondrain)
-  }
-  unpipe() {
-    this.dest.removeListener('drain', this.ondrain)
-  }
-  // istanbul ignore next - only here for the prototype
-  proxyErrors() {}
-  end() {
-    this.unpipe()
-    if (this.opts.end) this.dest.end()
-  }
-}
-
-class PipeProxyErrors extends Pipe {
-  unpipe() {
-    this.src.removeListener('error', this.proxyErrors)
-    super.unpipe()
-  }
-  constructor(src, dest, opts) {
-    super(src, dest, opts)
-    this.proxyErrors = er => dest.emit('error', er)
-    src.on('error', this.proxyErrors)
-  }
-}
-
-class Minipass extends Stream {
-  constructor(options) {
-    super()
-    this[FLOWING] = false
-    // whether we're explicitly paused
-    this[PAUSED] = false
-    this[PIPES] = []
-    this[BUFFER] = []
-    this[OBJECTMODE] = (options && options.objectMode) || false
-    if (this[OBJECTMODE]) this[ENCODING] = null
-    else this[ENCODING] = (options && options.encoding) || null
-    if (this[ENCODING] === 'buffer') this[ENCODING] = null
-    this[ASYNC] = (options && !!options.async) || false
-    this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
-    this[EOF] = false
-    this[EMITTED_END] = false
-    this[EMITTING_END] = false
-    this[CLOSED] = false
-    this[EMITTED_ERROR] = null
-    this.writable = true
-    this.readable = true
-    this[BUFFERLENGTH] = 0
-    this[DESTROYED] = false
-    if (options && options.debugExposeBuffer === true) {
-      Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })
-    }
-    if (options && options.debugExposePipes === true) {
-      Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })
-    }
-    this[SIGNAL] = options && options.signal
-    this[ABORTED] = false
-    if (this[SIGNAL]) {
-      this[SIGNAL].addEventListener('abort', () => this[ABORT]())
-      if (this[SIGNAL].aborted) {
-        this[ABORT]()
-      }
-    }
-  }
-
-  get bufferLength() {
-    return this[BUFFERLENGTH]
-  }
-
-  get encoding() {
-    return this[ENCODING]
-  }
-  set encoding(enc) {
-    if (this[OBJECTMODE]) throw new Error('cannot set encoding in objectMode')
-
-    if (
-      this[ENCODING] &&
-      enc !== this[ENCODING] &&
-      ((this[DECODER] && this[DECODER].lastNeed) || this[BUFFERLENGTH])
-    )
-      throw new Error('cannot change encoding')
-
-    if (this[ENCODING] !== enc) {
-      this[DECODER] = enc ? new SD(enc) : null
-      if (this[BUFFER].length)
-        this[BUFFER] = this[BUFFER].map(chunk => this[DECODER].write(chunk))
-    }
-
-    this[ENCODING] = enc
-  }
-
-  setEncoding(enc) {
-    this.encoding = enc
-  }
-
-  get objectMode() {
-    return this[OBJECTMODE]
-  }
-  set objectMode(om) {
-    this[OBJECTMODE] = this[OBJECTMODE] || !!om
-  }
-
-  get ['async']() {
-    return this[ASYNC]
-  }
-  set ['async'](a) {
-    this[ASYNC] = this[ASYNC] || !!a
-  }
-
-  // drop everything and get out of the flow completely
-  [ABORT]() {
-    this[ABORTED] = true
-    this.emit('abort', this[SIGNAL].reason)
-    this.destroy(this[SIGNAL].reason)
-  }
-
-  get aborted() {
-    return this[ABORTED]
-  }
-  set aborted(_) {}
-
-  write(chunk, encoding, cb) {
-    if (this[ABORTED]) return false
-    if (this[EOF]) throw new Error('write after end')
-
-    if (this[DESTROYED]) {
-      this.emit(
-        'error',
-        Object.assign(
-          new Error('Cannot call write after a stream was destroyed'),
-          { code: 'ERR_STREAM_DESTROYED' }
-        )
-      )
-      return true
-    }
-
-    if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8')
-
-    if (!encoding) encoding = 'utf8'
-
-    const fn = this[ASYNC] ? defer : f => f()
-
-    // convert array buffers and typed array views into buffers
-    // at some point in the future, we may want to do the opposite!
-    // leave strings and buffers as-is
-    // anything else switches us into object mode
-    if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
-      if (isArrayBufferView(chunk))
-        chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)
-      else if (isArrayBuffer(chunk)) chunk = Buffer.from(chunk)
-      else if (typeof chunk !== 'string')
-        // use the setter so we throw if we have encoding set
-        this.objectMode = true
-    }
-
-    // handle object mode up front, since it's simpler
-    // this yields better performance, fewer checks later.
-    if (this[OBJECTMODE]) {
-      /* istanbul ignore if - maybe impossible? */
-      if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true)
-
-      if (this.flowing) this.emit('data', chunk)
-      else this[BUFFERPUSH](chunk)
-
-      if (this[BUFFERLENGTH] !== 0) this.emit('readable')
-
-      if (cb) fn(cb)
-
-      return this.flowing
-    }
-
-    // at this point the chunk is a buffer or string
-    // don't buffer it up or send it to the decoder
-    if (!chunk.length) {
-      if (this[BUFFERLENGTH] !== 0) this.emit('readable')
-      if (cb) fn(cb)
-      return this.flowing
-    }
-
-    // fast-path writing strings of same encoding to a stream with
-    // an empty buffer, skipping the buffer/decoder dance
-    if (
-      typeof chunk === 'string' &&
-      // unless it is a string already ready for us to use
-      !(encoding === this[ENCODING] && !this[DECODER].lastNeed)
-    ) {
-      chunk = Buffer.from(chunk, encoding)
-    }
-
-    if (Buffer.isBuffer(chunk) && this[ENCODING])
-      chunk = this[DECODER].write(chunk)
-
-    // Note: flushing CAN potentially switch us into not-flowing mode
-    if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true)
-
-    if (this.flowing) this.emit('data', chunk)
-    else this[BUFFERPUSH](chunk)
-
-    if (this[BUFFERLENGTH] !== 0) this.emit('readable')
-
-    if (cb) fn(cb)
-
-    return this.flowing
-  }
-
-  read(n) {
-    if (this[DESTROYED]) return null
-
-    if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) {
-      this[MAYBE_EMIT_END]()
-      return null
-    }
-
-    if (this[OBJECTMODE]) n = null
-
-    if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {
-      if (this.encoding) this[BUFFER] = [this[BUFFER].join('')]
-      else this[BUFFER] = [Buffer.concat(this[BUFFER], this[BUFFERLENGTH])]
-    }
-
-    const ret = this[READ](n || null, this[BUFFER][0])
-    this[MAYBE_EMIT_END]()
-    return ret
-  }
-
-  [READ](n, chunk) {
-    if (n === chunk.length || n === null) this[BUFFERSHIFT]()
-    else {
-      this[BUFFER][0] = chunk.slice(n)
-      chunk = chunk.slice(0, n)
-      this[BUFFERLENGTH] -= n
-    }
-
-    this.emit('data', chunk)
-
-    if (!this[BUFFER].length && !this[EOF]) this.emit('drain')
-
-    return chunk
-  }
-
-  end(chunk, encoding, cb) {
-    if (typeof chunk === 'function') (cb = chunk), (chunk = null)
-    if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8')
-    if (chunk) this.write(chunk, encoding)
-    if (cb) this.once('end', cb)
-    this[EOF] = true
-    this.writable = false
-
-    // if we haven't written anything, then go ahead and emit,
-    // even if we're not reading.
-    // we'll re-emit if a new 'end' listener is added anyway.
-    // This makes MP more suitable to write-only use cases.
-    if (this.flowing || !this[PAUSED]) this[MAYBE_EMIT_END]()
-    return this
-  }
-
-  // don't let the internal resume be overwritten
-  [RESUME]() {
-    if (this[DESTROYED]) return
-
-    this[PAUSED] = false
-    this[FLOWING] = true
-    this.emit('resume')
-    if (this[BUFFER].length) this[FLUSH]()
-    else if (this[EOF]) this[MAYBE_EMIT_END]()
-    else this.emit('drain')
-  }
-
-  resume() {
-    return this[RESUME]()
-  }
-
-  pause() {
-    this[FLOWING] = false
-    this[PAUSED] = true
-  }
-
-  get destroyed() {
-    return this[DESTROYED]
-  }
-
-  get flowing() {
-    return this[FLOWING]
-  }
-
-  get paused() {
-    return this[PAUSED]
-  }
-
-  [BUFFERPUSH](chunk) {
-    if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1
-    else this[BUFFERLENGTH] += chunk.length
-    this[BUFFER].push(chunk)
-  }
-
-  [BUFFERSHIFT]() {
-    if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1
-    else this[BUFFERLENGTH] -= this[BUFFER][0].length
-    return this[BUFFER].shift()
-  }
-
-  [FLUSH](noDrain) {
-    do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length)
-
-    if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')
-  }
-
-  [FLUSHCHUNK](chunk) {
-    this.emit('data', chunk)
-    return this.flowing
-  }
-
-  pipe(dest, opts) {
-    if (this[DESTROYED]) return
-
-    const ended = this[EMITTED_END]
-    opts = opts || {}
-    if (dest === proc.stdout || dest === proc.stderr) opts.end = false
-    else opts.end = opts.end !== false
-    opts.proxyErrors = !!opts.proxyErrors
-
-    // piping an ended stream ends immediately
-    if (ended) {
-      if (opts.end) dest.end()
-    } else {
-      this[PIPES].push(
-        !opts.proxyErrors
-          ? new Pipe(this, dest, opts)
-          : new PipeProxyErrors(this, dest, opts)
-      )
-      if (this[ASYNC]) defer(() => this[RESUME]())
-      else this[RESUME]()
-    }
-
-    return dest
-  }
-
-  unpipe(dest) {
-    const p = this[PIPES].find(p => p.dest === dest)
-    if (p) {
-      this[PIPES].splice(this[PIPES].indexOf(p), 1)
-      p.unpipe()
-    }
-  }
-
-  addListener(ev, fn) {
-    return this.on(ev, fn)
-  }
-
-  on(ev, fn) {
-    const ret = super.on(ev, fn)
-    if (ev === 'data' && !this[PIPES].length && !this.flowing) this[RESUME]()
-    else if (ev === 'readable' && this[BUFFERLENGTH] !== 0)
-      super.emit('readable')
-    else if (isEndish(ev) && this[EMITTED_END]) {
-      super.emit(ev)
-      this.removeAllListeners(ev)
-    } else if (ev === 'error' && this[EMITTED_ERROR]) {
-      if (this[ASYNC]) defer(() => fn.call(this, this[EMITTED_ERROR]))
-      else fn.call(this, this[EMITTED_ERROR])
-    }
-    return ret
-  }
-
-  get emittedEnd() {
-    return this[EMITTED_END]
-  }
-
-  [MAYBE_EMIT_END]() {
-    if (
-      !this[EMITTING_END] &&
-      !this[EMITTED_END] &&
-      !this[DESTROYED] &&
-      this[BUFFER].length === 0 &&
-      this[EOF]
-    ) {
-      this[EMITTING_END] = true
-      this.emit('end')
-      this.emit('prefinish')
-      this.emit('finish')
-      if (this[CLOSED]) this.emit('close')
-      this[EMITTING_END] = false
-    }
-  }
-
-  emit(ev, data, ...extra) {
-    // error and close are only events allowed after calling destroy()
-    if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])
-      return
-    else if (ev === 'data') {
-      return !this[OBJECTMODE] && !data
-        ? false
-        : this[ASYNC]
-        ? defer(() => this[EMITDATA](data))
-        : this[EMITDATA](data)
-    } else if (ev === 'end') {
-      return this[EMITEND]()
-    } else if (ev === 'close') {
-      this[CLOSED] = true
-      // don't emit close before 'end' and 'finish'
-      if (!this[EMITTED_END] && !this[DESTROYED]) return
-      const ret = super.emit('close')
-      this.removeAllListeners('close')
-      return ret
-    } else if (ev === 'error') {
-      this[EMITTED_ERROR] = data
-      super.emit(ERROR, data)
-      const ret =
-        !this[SIGNAL] || this.listeners('error').length
-          ? super.emit('error', data)
-          : false
-      this[MAYBE_EMIT_END]()
-      return ret
-    } else if (ev === 'resume') {
-      const ret = super.emit('resume')
-      this[MAYBE_EMIT_END]()
-      return ret
-    } else if (ev === 'finish' || ev === 'prefinish') {
-      const ret = super.emit(ev)
-      this.removeAllListeners(ev)
-      return ret
-    }
-
-    // Some other unknown event
-    const ret = super.emit(ev, data, ...extra)
-    this[MAYBE_EMIT_END]()
-    return ret
-  }
-
-  [EMITDATA](data) {
-    for (const p of this[PIPES]) {
-      if (p.dest.write(data) === false) this.pause()
-    }
-    const ret = super.emit('data', data)
-    this[MAYBE_EMIT_END]()
-    return ret
-  }
-
-  [EMITEND]() {
-    if (this[EMITTED_END]) return
-
-    this[EMITTED_END] = true
-    this.readable = false
-    if (this[ASYNC]) defer(() => this[EMITEND2]())
-    else this[EMITEND2]()
-  }
-
-  [EMITEND2]() {
-    if (this[DECODER]) {
-      const data = this[DECODER].end()
-      if (data) {
-        for (const p of this[PIPES]) {
-          p.dest.write(data)
-        }
-        super.emit('data', data)
-      }
-    }
-
-    for (const p of this[PIPES]) {
-      p.end()
-    }
-    const ret = super.emit('end')
-    this.removeAllListeners('end')
-    return ret
-  }
-
-  // const all = await stream.collect()
-  collect() {
-    const buf = []
-    if (!this[OBJECTMODE]) buf.dataLength = 0
-    // set the promise first, in case an error is raised
-    // by triggering the flow here.
-    const p = this.promise()
-    this.on('data', c => {
-      buf.push(c)
-      if (!this[OBJECTMODE]) buf.dataLength += c.length
-    })
-    return p.then(() => buf)
-  }
-
-  // const data = await stream.concat()
-  concat() {
-    return this[OBJECTMODE]
-      ? Promise.reject(new Error('cannot concat in objectMode'))
-      : this.collect().then(buf =>
-          this[OBJECTMODE]
-            ? Promise.reject(new Error('cannot concat in objectMode'))
-            : this[ENCODING]
-            ? buf.join('')
-            : Buffer.concat(buf, buf.dataLength)
-        )
-  }
-
-  // stream.promise().then(() => done, er => emitted error)
-  promise() {
-    return new Promise((resolve, reject) => {
-      this.on(DESTROYED, () => reject(new Error('stream destroyed')))
-      this.on('error', er => reject(er))
-      this.on('end', () => resolve())
-    })
-  }
-
-  // for await (let chunk of stream)
-  [ASYNCITERATOR]() {
-    let stopped = false
-    const stop = () => {
-      this.pause()
-      stopped = true
-      return Promise.resolve({ done: true })
-    }
-    const next = () => {
-      if (stopped) return stop()
-      const res = this.read()
-      if (res !== null) return Promise.resolve({ done: false, value: res })
-
-      if (this[EOF]) return stop()
-
-      let resolve = null
-      let reject = null
-      const onerr = er => {
-        this.removeListener('data', ondata)
-        this.removeListener('end', onend)
-        this.removeListener(DESTROYED, ondestroy)
-        stop()
-        reject(er)
-      }
-      const ondata = value => {
-        this.removeListener('error', onerr)
-        this.removeListener('end', onend)
-        this.removeListener(DESTROYED, ondestroy)
-        this.pause()
-        resolve({ value: value, done: !!this[EOF] })
-      }
-      const onend = () => {
-        this.removeListener('error', onerr)
-        this.removeListener('data', ondata)
-        this.removeListener(DESTROYED, ondestroy)
-        stop()
-        resolve({ done: true })
-      }
-      const ondestroy = () => onerr(new Error('stream destroyed'))
-      return new Promise((res, rej) => {
-        reject = rej
-        resolve = res
-        this.once(DESTROYED, ondestroy)
-        this.once('error', onerr)
-        this.once('end', onend)
-        this.once('data', ondata)
-      })
-    }
-
-    return {
-      next,
-      throw: stop,
-      return: stop,
-      [ASYNCITERATOR]() {
-        return this
-      },
-    }
-  }
-
-  // for (let chunk of stream)
-  [ITERATOR]() {
-    let stopped = false
-    const stop = () => {
-      this.pause()
-      this.removeListener(ERROR, stop)
-      this.removeListener(DESTROYED, stop)
-      this.removeListener('end', stop)
-      stopped = true
-      return { done: true }
-    }
-
-    const next = () => {
-      if (stopped) return stop()
-      const value = this.read()
-      return value === null ? stop() : { value }
-    }
-    this.once('end', stop)
-    this.once(ERROR, stop)
-    this.once(DESTROYED, stop)
-
-    return {
-      next,
-      throw: stop,
-      return: stop,
-      [ITERATOR]() {
-        return this
-      },
-    }
-  }
-
-  destroy(er) {
-    if (this[DESTROYED]) {
-      if (er) this.emit('error', er)
-      else this.emit(DESTROYED)
-      return this
-    }
-
-    this[DESTROYED] = true
-
-    // throw away all buffered data, it's never coming out
-    this[BUFFER].length = 0
-    this[BUFFERLENGTH] = 0
-
-    if (typeof this.close === 'function' && !this[CLOSED]) this.close()
-
-    if (er) this.emit('error', er)
-    // if no error to emit, still reject pending promises
-    else this.emit(DESTROYED)
-
-    return this
-  }
-
-  static isStream(s) {
-    return (
-      !!s &&
-      (s instanceof Minipass ||
-        s instanceof Stream ||
-        (s instanceof EE &&
-          // readable
-          (typeof s.pipe === 'function' ||
-            // writable
-            (typeof s.write === 'function' && typeof s.end === 'function'))))
-    )
-  }
-}
-
-exports.Minipass = Minipass
diff --git a/node_modules/node-gyp/node_modules/minipass/index.mjs b/node_modules/node-gyp/node_modules/minipass/index.mjs
deleted file mode 100644
index 6ef6cd8cf0703..0000000000000
--- a/node_modules/node-gyp/node_modules/minipass/index.mjs
+++ /dev/null
@@ -1,702 +0,0 @@
-'use strict'
-const proc =
-  typeof process === 'object' && process
-    ? process
-    : {
-        stdout: null,
-        stderr: null,
-      }
-import EE from 'events'
-import Stream from 'stream'
-import stringdecoder from 'string_decoder'
-const SD = stringdecoder.StringDecoder
-
-const EOF = Symbol('EOF')
-const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
-const EMITTED_END = Symbol('emittedEnd')
-const EMITTING_END = Symbol('emittingEnd')
-const EMITTED_ERROR = Symbol('emittedError')
-const CLOSED = Symbol('closed')
-const READ = Symbol('read')
-const FLUSH = Symbol('flush')
-const FLUSHCHUNK = Symbol('flushChunk')
-const ENCODING = Symbol('encoding')
-const DECODER = Symbol('decoder')
-const FLOWING = Symbol('flowing')
-const PAUSED = Symbol('paused')
-const RESUME = Symbol('resume')
-const BUFFER = Symbol('buffer')
-const PIPES = Symbol('pipes')
-const BUFFERLENGTH = Symbol('bufferLength')
-const BUFFERPUSH = Symbol('bufferPush')
-const BUFFERSHIFT = Symbol('bufferShift')
-const OBJECTMODE = Symbol('objectMode')
-// internal event when stream is destroyed
-const DESTROYED = Symbol('destroyed')
-// internal event when stream has an error
-const ERROR = Symbol('error')
-const EMITDATA = Symbol('emitData')
-const EMITEND = Symbol('emitEnd')
-const EMITEND2 = Symbol('emitEnd2')
-const ASYNC = Symbol('async')
-const ABORT = Symbol('abort')
-const ABORTED = Symbol('aborted')
-const SIGNAL = Symbol('signal')
-
-const defer = fn => Promise.resolve().then(fn)
-
-// TODO remove when Node v8 support drops
-const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1'
-const ASYNCITERATOR =
-  (doIter && Symbol.asyncIterator) || Symbol('asyncIterator not implemented')
-const ITERATOR =
-  (doIter && Symbol.iterator) || Symbol('iterator not implemented')
-
-// events that mean 'the stream is over'
-// these are treated specially, and re-emitted
-// if they are listened for after emitting.
-const isEndish = ev => ev === 'end' || ev === 'finish' || ev === 'prefinish'
-
-const isArrayBuffer = b =>
-  b instanceof ArrayBuffer ||
-  (typeof b === 'object' &&
-    b.constructor &&
-    b.constructor.name === 'ArrayBuffer' &&
-    b.byteLength >= 0)
-
-const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b)
-
-class Pipe {
-  constructor(src, dest, opts) {
-    this.src = src
-    this.dest = dest
-    this.opts = opts
-    this.ondrain = () => src[RESUME]()
-    dest.on('drain', this.ondrain)
-  }
-  unpipe() {
-    this.dest.removeListener('drain', this.ondrain)
-  }
-  // istanbul ignore next - only here for the prototype
-  proxyErrors() {}
-  end() {
-    this.unpipe()
-    if (this.opts.end) this.dest.end()
-  }
-}
-
-class PipeProxyErrors extends Pipe {
-  unpipe() {
-    this.src.removeListener('error', this.proxyErrors)
-    super.unpipe()
-  }
-  constructor(src, dest, opts) {
-    super(src, dest, opts)
-    this.proxyErrors = er => dest.emit('error', er)
-    src.on('error', this.proxyErrors)
-  }
-}
-
-export class Minipass extends Stream {
-  constructor(options) {
-    super()
-    this[FLOWING] = false
-    // whether we're explicitly paused
-    this[PAUSED] = false
-    this[PIPES] = []
-    this[BUFFER] = []
-    this[OBJECTMODE] = (options && options.objectMode) || false
-    if (this[OBJECTMODE]) this[ENCODING] = null
-    else this[ENCODING] = (options && options.encoding) || null
-    if (this[ENCODING] === 'buffer') this[ENCODING] = null
-    this[ASYNC] = (options && !!options.async) || false
-    this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
-    this[EOF] = false
-    this[EMITTED_END] = false
-    this[EMITTING_END] = false
-    this[CLOSED] = false
-    this[EMITTED_ERROR] = null
-    this.writable = true
-    this.readable = true
-    this[BUFFERLENGTH] = 0
-    this[DESTROYED] = false
-    if (options && options.debugExposeBuffer === true) {
-      Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })
-    }
-    if (options && options.debugExposePipes === true) {
-      Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })
-    }
-    this[SIGNAL] = options && options.signal
-    this[ABORTED] = false
-    if (this[SIGNAL]) {
-      this[SIGNAL].addEventListener('abort', () => this[ABORT]())
-      if (this[SIGNAL].aborted) {
-        this[ABORT]()
-      }
-    }
-  }
-
-  get bufferLength() {
-    return this[BUFFERLENGTH]
-  }
-
-  get encoding() {
-    return this[ENCODING]
-  }
-  set encoding(enc) {
-    if (this[OBJECTMODE]) throw new Error('cannot set encoding in objectMode')
-
-    if (
-      this[ENCODING] &&
-      enc !== this[ENCODING] &&
-      ((this[DECODER] && this[DECODER].lastNeed) || this[BUFFERLENGTH])
-    )
-      throw new Error('cannot change encoding')
-
-    if (this[ENCODING] !== enc) {
-      this[DECODER] = enc ? new SD(enc) : null
-      if (this[BUFFER].length)
-        this[BUFFER] = this[BUFFER].map(chunk => this[DECODER].write(chunk))
-    }
-
-    this[ENCODING] = enc
-  }
-
-  setEncoding(enc) {
-    this.encoding = enc
-  }
-
-  get objectMode() {
-    return this[OBJECTMODE]
-  }
-  set objectMode(om) {
-    this[OBJECTMODE] = this[OBJECTMODE] || !!om
-  }
-
-  get ['async']() {
-    return this[ASYNC]
-  }
-  set ['async'](a) {
-    this[ASYNC] = this[ASYNC] || !!a
-  }
-
-  // drop everything and get out of the flow completely
-  [ABORT]() {
-    this[ABORTED] = true
-    this.emit('abort', this[SIGNAL].reason)
-    this.destroy(this[SIGNAL].reason)
-  }
-
-  get aborted() {
-    return this[ABORTED]
-  }
-  set aborted(_) {}
-
-  write(chunk, encoding, cb) {
-    if (this[ABORTED]) return false
-    if (this[EOF]) throw new Error('write after end')
-
-    if (this[DESTROYED]) {
-      this.emit(
-        'error',
-        Object.assign(
-          new Error('Cannot call write after a stream was destroyed'),
-          { code: 'ERR_STREAM_DESTROYED' }
-        )
-      )
-      return true
-    }
-
-    if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8')
-
-    if (!encoding) encoding = 'utf8'
-
-    const fn = this[ASYNC] ? defer : f => f()
-
-    // convert array buffers and typed array views into buffers
-    // at some point in the future, we may want to do the opposite!
-    // leave strings and buffers as-is
-    // anything else switches us into object mode
-    if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
-      if (isArrayBufferView(chunk))
-        chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)
-      else if (isArrayBuffer(chunk)) chunk = Buffer.from(chunk)
-      else if (typeof chunk !== 'string')
-        // use the setter so we throw if we have encoding set
-        this.objectMode = true
-    }
-
-    // handle object mode up front, since it's simpler
-    // this yields better performance, fewer checks later.
-    if (this[OBJECTMODE]) {
-      /* istanbul ignore if - maybe impossible? */
-      if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true)
-
-      if (this.flowing) this.emit('data', chunk)
-      else this[BUFFERPUSH](chunk)
-
-      if (this[BUFFERLENGTH] !== 0) this.emit('readable')
-
-      if (cb) fn(cb)
-
-      return this.flowing
-    }
-
-    // at this point the chunk is a buffer or string
-    // don't buffer it up or send it to the decoder
-    if (!chunk.length) {
-      if (this[BUFFERLENGTH] !== 0) this.emit('readable')
-      if (cb) fn(cb)
-      return this.flowing
-    }
-
-    // fast-path writing strings of same encoding to a stream with
-    // an empty buffer, skipping the buffer/decoder dance
-    if (
-      typeof chunk === 'string' &&
-      // unless it is a string already ready for us to use
-      !(encoding === this[ENCODING] && !this[DECODER].lastNeed)
-    ) {
-      chunk = Buffer.from(chunk, encoding)
-    }
-
-    if (Buffer.isBuffer(chunk) && this[ENCODING])
-      chunk = this[DECODER].write(chunk)
-
-    // Note: flushing CAN potentially switch us into not-flowing mode
-    if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true)
-
-    if (this.flowing) this.emit('data', chunk)
-    else this[BUFFERPUSH](chunk)
-
-    if (this[BUFFERLENGTH] !== 0) this.emit('readable')
-
-    if (cb) fn(cb)
-
-    return this.flowing
-  }
-
-  read(n) {
-    if (this[DESTROYED]) return null
-
-    if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) {
-      this[MAYBE_EMIT_END]()
-      return null
-    }
-
-    if (this[OBJECTMODE]) n = null
-
-    if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {
-      if (this.encoding) this[BUFFER] = [this[BUFFER].join('')]
-      else this[BUFFER] = [Buffer.concat(this[BUFFER], this[BUFFERLENGTH])]
-    }
-
-    const ret = this[READ](n || null, this[BUFFER][0])
-    this[MAYBE_EMIT_END]()
-    return ret
-  }
-
-  [READ](n, chunk) {
-    if (n === chunk.length || n === null) this[BUFFERSHIFT]()
-    else {
-      this[BUFFER][0] = chunk.slice(n)
-      chunk = chunk.slice(0, n)
-      this[BUFFERLENGTH] -= n
-    }
-
-    this.emit('data', chunk)
-
-    if (!this[BUFFER].length && !this[EOF]) this.emit('drain')
-
-    return chunk
-  }
-
-  end(chunk, encoding, cb) {
-    if (typeof chunk === 'function') (cb = chunk), (chunk = null)
-    if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8')
-    if (chunk) this.write(chunk, encoding)
-    if (cb) this.once('end', cb)
-    this[EOF] = true
-    this.writable = false
-
-    // if we haven't written anything, then go ahead and emit,
-    // even if we're not reading.
-    // we'll re-emit if a new 'end' listener is added anyway.
-    // This makes MP more suitable to write-only use cases.
-    if (this.flowing || !this[PAUSED]) this[MAYBE_EMIT_END]()
-    return this
-  }
-
-  // don't let the internal resume be overwritten
-  [RESUME]() {
-    if (this[DESTROYED]) return
-
-    this[PAUSED] = false
-    this[FLOWING] = true
-    this.emit('resume')
-    if (this[BUFFER].length) this[FLUSH]()
-    else if (this[EOF]) this[MAYBE_EMIT_END]()
-    else this.emit('drain')
-  }
-
-  resume() {
-    return this[RESUME]()
-  }
-
-  pause() {
-    this[FLOWING] = false
-    this[PAUSED] = true
-  }
-
-  get destroyed() {
-    return this[DESTROYED]
-  }
-
-  get flowing() {
-    return this[FLOWING]
-  }
-
-  get paused() {
-    return this[PAUSED]
-  }
-
-  [BUFFERPUSH](chunk) {
-    if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1
-    else this[BUFFERLENGTH] += chunk.length
-    this[BUFFER].push(chunk)
-  }
-
-  [BUFFERSHIFT]() {
-    if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1
-    else this[BUFFERLENGTH] -= this[BUFFER][0].length
-    return this[BUFFER].shift()
-  }
-
-  [FLUSH](noDrain) {
-    do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length)
-
-    if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')
-  }
-
-  [FLUSHCHUNK](chunk) {
-    this.emit('data', chunk)
-    return this.flowing
-  }
-
-  pipe(dest, opts) {
-    if (this[DESTROYED]) return
-
-    const ended = this[EMITTED_END]
-    opts = opts || {}
-    if (dest === proc.stdout || dest === proc.stderr) opts.end = false
-    else opts.end = opts.end !== false
-    opts.proxyErrors = !!opts.proxyErrors
-
-    // piping an ended stream ends immediately
-    if (ended) {
-      if (opts.end) dest.end()
-    } else {
-      this[PIPES].push(
-        !opts.proxyErrors
-          ? new Pipe(this, dest, opts)
-          : new PipeProxyErrors(this, dest, opts)
-      )
-      if (this[ASYNC]) defer(() => this[RESUME]())
-      else this[RESUME]()
-    }
-
-    return dest
-  }
-
-  unpipe(dest) {
-    const p = this[PIPES].find(p => p.dest === dest)
-    if (p) {
-      this[PIPES].splice(this[PIPES].indexOf(p), 1)
-      p.unpipe()
-    }
-  }
-
-  addListener(ev, fn) {
-    return this.on(ev, fn)
-  }
-
-  on(ev, fn) {
-    const ret = super.on(ev, fn)
-    if (ev === 'data' && !this[PIPES].length && !this.flowing) this[RESUME]()
-    else if (ev === 'readable' && this[BUFFERLENGTH] !== 0)
-      super.emit('readable')
-    else if (isEndish(ev) && this[EMITTED_END]) {
-      super.emit(ev)
-      this.removeAllListeners(ev)
-    } else if (ev === 'error' && this[EMITTED_ERROR]) {
-      if (this[ASYNC]) defer(() => fn.call(this, this[EMITTED_ERROR]))
-      else fn.call(this, this[EMITTED_ERROR])
-    }
-    return ret
-  }
-
-  get emittedEnd() {
-    return this[EMITTED_END]
-  }
-
-  [MAYBE_EMIT_END]() {
-    if (
-      !this[EMITTING_END] &&
-      !this[EMITTED_END] &&
-      !this[DESTROYED] &&
-      this[BUFFER].length === 0 &&
-      this[EOF]
-    ) {
-      this[EMITTING_END] = true
-      this.emit('end')
-      this.emit('prefinish')
-      this.emit('finish')
-      if (this[CLOSED]) this.emit('close')
-      this[EMITTING_END] = false
-    }
-  }
-
-  emit(ev, data, ...extra) {
-    // error and close are only events allowed after calling destroy()
-    if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])
-      return
-    else if (ev === 'data') {
-      return !this[OBJECTMODE] && !data
-        ? false
-        : this[ASYNC]
-        ? defer(() => this[EMITDATA](data))
-        : this[EMITDATA](data)
-    } else if (ev === 'end') {
-      return this[EMITEND]()
-    } else if (ev === 'close') {
-      this[CLOSED] = true
-      // don't emit close before 'end' and 'finish'
-      if (!this[EMITTED_END] && !this[DESTROYED]) return
-      const ret = super.emit('close')
-      this.removeAllListeners('close')
-      return ret
-    } else if (ev === 'error') {
-      this[EMITTED_ERROR] = data
-      super.emit(ERROR, data)
-      const ret =
-        !this[SIGNAL] || this.listeners('error').length
-          ? super.emit('error', data)
-          : false
-      this[MAYBE_EMIT_END]()
-      return ret
-    } else if (ev === 'resume') {
-      const ret = super.emit('resume')
-      this[MAYBE_EMIT_END]()
-      return ret
-    } else if (ev === 'finish' || ev === 'prefinish') {
-      const ret = super.emit(ev)
-      this.removeAllListeners(ev)
-      return ret
-    }
-
-    // Some other unknown event
-    const ret = super.emit(ev, data, ...extra)
-    this[MAYBE_EMIT_END]()
-    return ret
-  }
-
-  [EMITDATA](data) {
-    for (const p of this[PIPES]) {
-      if (p.dest.write(data) === false) this.pause()
-    }
-    const ret = super.emit('data', data)
-    this[MAYBE_EMIT_END]()
-    return ret
-  }
-
-  [EMITEND]() {
-    if (this[EMITTED_END]) return
-
-    this[EMITTED_END] = true
-    this.readable = false
-    if (this[ASYNC]) defer(() => this[EMITEND2]())
-    else this[EMITEND2]()
-  }
-
-  [EMITEND2]() {
-    if (this[DECODER]) {
-      const data = this[DECODER].end()
-      if (data) {
-        for (const p of this[PIPES]) {
-          p.dest.write(data)
-        }
-        super.emit('data', data)
-      }
-    }
-
-    for (const p of this[PIPES]) {
-      p.end()
-    }
-    const ret = super.emit('end')
-    this.removeAllListeners('end')
-    return ret
-  }
-
-  // const all = await stream.collect()
-  collect() {
-    const buf = []
-    if (!this[OBJECTMODE]) buf.dataLength = 0
-    // set the promise first, in case an error is raised
-    // by triggering the flow here.
-    const p = this.promise()
-    this.on('data', c => {
-      buf.push(c)
-      if (!this[OBJECTMODE]) buf.dataLength += c.length
-    })
-    return p.then(() => buf)
-  }
-
-  // const data = await stream.concat()
-  concat() {
-    return this[OBJECTMODE]
-      ? Promise.reject(new Error('cannot concat in objectMode'))
-      : this.collect().then(buf =>
-          this[OBJECTMODE]
-            ? Promise.reject(new Error('cannot concat in objectMode'))
-            : this[ENCODING]
-            ? buf.join('')
-            : Buffer.concat(buf, buf.dataLength)
-        )
-  }
-
-  // stream.promise().then(() => done, er => emitted error)
-  promise() {
-    return new Promise((resolve, reject) => {
-      this.on(DESTROYED, () => reject(new Error('stream destroyed')))
-      this.on('error', er => reject(er))
-      this.on('end', () => resolve())
-    })
-  }
-
-  // for await (let chunk of stream)
-  [ASYNCITERATOR]() {
-    let stopped = false
-    const stop = () => {
-      this.pause()
-      stopped = true
-      return Promise.resolve({ done: true })
-    }
-    const next = () => {
-      if (stopped) return stop()
-      const res = this.read()
-      if (res !== null) return Promise.resolve({ done: false, value: res })
-
-      if (this[EOF]) return stop()
-
-      let resolve = null
-      let reject = null
-      const onerr = er => {
-        this.removeListener('data', ondata)
-        this.removeListener('end', onend)
-        this.removeListener(DESTROYED, ondestroy)
-        stop()
-        reject(er)
-      }
-      const ondata = value => {
-        this.removeListener('error', onerr)
-        this.removeListener('end', onend)
-        this.removeListener(DESTROYED, ondestroy)
-        this.pause()
-        resolve({ value: value, done: !!this[EOF] })
-      }
-      const onend = () => {
-        this.removeListener('error', onerr)
-        this.removeListener('data', ondata)
-        this.removeListener(DESTROYED, ondestroy)
-        stop()
-        resolve({ done: true })
-      }
-      const ondestroy = () => onerr(new Error('stream destroyed'))
-      return new Promise((res, rej) => {
-        reject = rej
-        resolve = res
-        this.once(DESTROYED, ondestroy)
-        this.once('error', onerr)
-        this.once('end', onend)
-        this.once('data', ondata)
-      })
-    }
-
-    return {
-      next,
-      throw: stop,
-      return: stop,
-      [ASYNCITERATOR]() {
-        return this
-      },
-    }
-  }
-
-  // for (let chunk of stream)
-  [ITERATOR]() {
-    let stopped = false
-    const stop = () => {
-      this.pause()
-      this.removeListener(ERROR, stop)
-      this.removeListener(DESTROYED, stop)
-      this.removeListener('end', stop)
-      stopped = true
-      return { done: true }
-    }
-
-    const next = () => {
-      if (stopped) return stop()
-      const value = this.read()
-      return value === null ? stop() : { value }
-    }
-    this.once('end', stop)
-    this.once(ERROR, stop)
-    this.once(DESTROYED, stop)
-
-    return {
-      next,
-      throw: stop,
-      return: stop,
-      [ITERATOR]() {
-        return this
-      },
-    }
-  }
-
-  destroy(er) {
-    if (this[DESTROYED]) {
-      if (er) this.emit('error', er)
-      else this.emit(DESTROYED)
-      return this
-    }
-
-    this[DESTROYED] = true
-
-    // throw away all buffered data, it's never coming out
-    this[BUFFER].length = 0
-    this[BUFFERLENGTH] = 0
-
-    if (typeof this.close === 'function' && !this[CLOSED]) this.close()
-
-    if (er) this.emit('error', er)
-    // if no error to emit, still reject pending promises
-    else this.emit(DESTROYED)
-
-    return this
-  }
-
-  static isStream(s) {
-    return (
-      !!s &&
-      (s instanceof Minipass ||
-        s instanceof Stream ||
-        (s instanceof EE &&
-          // readable
-          (typeof s.pipe === 'function' ||
-            // writable
-            (typeof s.write === 'function' && typeof s.end === 'function'))))
-    )
-  }
-}
-
-
diff --git a/node_modules/node-gyp/package.json b/node_modules/node-gyp/package.json
index 7e9fb648ab082..62139ca33b121 100644
--- a/node_modules/node-gyp/package.json
+++ b/node_modules/node-gyp/package.json
@@ -11,7 +11,7 @@
     "bindings",
     "gyp"
   ],
-  "version": "9.4.0",
+  "version": "10.0.0",
   "installVersion": 11,
   "author": "Nathan Rajlich  (http://tootallnate.net)",
   "repository": {
@@ -24,28 +24,28 @@
   "dependencies": {
     "env-paths": "^2.2.0",
     "exponential-backoff": "^3.1.1",
-    "glob": "^7.1.4",
+    "glob": "^10.3.10",
     "graceful-fs": "^4.2.6",
-    "make-fetch-happen": "^11.0.3",
-    "nopt": "^6.0.0",
-    "npmlog": "^6.0.0",
-    "rimraf": "^3.0.2",
+    "make-fetch-happen": "^13.0.0",
+    "nopt": "^7.0.0",
+    "proc-log": "^3.0.0",
     "semver": "^7.3.5",
     "tar": "^6.1.2",
-    "which": "^2.0.2"
+    "which": "^4.0.0"
   },
   "engines": {
-    "node": "^12.13 || ^14.13 || >=16"
+    "node": "^16.14.0 || >=18.0.0"
   },
   "devDependencies": {
     "bindings": "^1.5.0",
+    "cross-env": "^7.0.3",
     "mocha": "^10.2.0",
     "nan": "^2.14.2",
     "require-inject": "^1.4.4",
-    "standard": "^14.3.4"
+    "standard": "^17.0.0"
   },
   "scripts": {
-    "lint": "standard */*.js test/**/*.js",
-    "test": "npm run lint && mocha --reporter=test/reporter.js test/test-download.js test/test-*"
+    "lint": "standard \"*/*.js\" \"test/**/*.js\" \".github/**/*.js\"",
+    "test": "cross-env NODE_GYP_NULL_LOGGER=true mocha --timeout 15000 test/test-download.js test/test-*"
   }
 }
diff --git a/package-lock.json b/package-lock.json
index 0168785808227..2ab9394cd58d4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -131,7 +131,7 @@
         "minipass": "^7.0.4",
         "minipass-pipeline": "^1.2.4",
         "ms": "^2.1.2",
-        "node-gyp": "^9.4.0",
+        "node-gyp": "^10.0.0",
         "nopt": "^7.2.0",
         "normalize-package-data": "^6.0.0",
         "npm-audit-report": "^5.0.0",
@@ -1295,6 +1295,12 @@
         "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
       }
     },
+    "node_modules/@gar/promisify": {
+      "version": "1.1.3",
+      "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz",
+      "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==",
+      "inBundle": true
+    },
     "node_modules/@google-automations/git-file-utils": {
       "version": "1.2.6",
       "resolved": "https://registry.npmjs.org/@google-automations/git-file-utils/-/git-file-utils-1.2.6.tgz",
@@ -2661,6 +2667,20 @@
       "resolved": "mock-registry",
       "link": true
     },
+    "node_modules/@npmcli/move-file": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-2.0.1.tgz",
+      "integrity": "sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ==",
+      "deprecated": "This functionality has been moved to @npmcli/fs",
+      "inBundle": true,
+      "dependencies": {
+        "mkdirp": "^1.0.4",
+        "rimraf": "^3.0.2"
+      },
+      "engines": {
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+      }
+    },
     "node_modules/@npmcli/name-from-folder": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/@npmcli/name-from-folder/-/name-from-folder-2.0.0.tgz",
@@ -2736,3680 +2756,3617 @@
         "node": "^16.14.0 || >=18.0.0"
       }
     },
-    "node_modules/@npmcli/smoke-tests": {
-      "resolved": "smoke-tests",
-      "link": true
-    },
-    "node_modules/@npmcli/template-oss": {
-      "version": "4.19.0",
-      "resolved": "https://registry.npmjs.org/@npmcli/template-oss/-/template-oss-4.19.0.tgz",
-      "integrity": "sha512-5WHCup9pCF3q8HYQ2Nja5+M/JKUUCObLc/iv+I5u/pVmfD/lHhMifdWAE8bopZeyOFb65rRW/1qI6E+g0U4QiA==",
-      "dev": true,
-      "hasInstallScript": true,
+    "node_modules/@npmcli/run-script/node_modules/@npmcli/fs": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz",
+      "integrity": "sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==",
+      "inBundle": true,
       "dependencies": {
-        "@actions/core": "^1.9.1",
-        "@commitlint/cli": "^17.1.1",
-        "@commitlint/config-conventional": "^17.1.0",
-        "@isaacs/string-locale-compare": "^1.1.0",
-        "@npmcli/arborist": "^6.0.0",
-        "@npmcli/git": "^4.0.0",
-        "@npmcli/map-workspaces": "^3.0.0",
-        "@npmcli/package-json": "^4.0.0",
-        "@octokit/rest": "^19.0.4",
-        "diff": "^5.0.0",
-        "glob": "^10.1.0",
-        "handlebars": "^4.7.7",
-        "hosted-git-info": "^6.0.0",
-        "ini": "^4.0.0",
-        "json-parse-even-better-errors": "^3.0.0",
-        "just-deep-map-values": "^1.1.1",
-        "just-diff": "^6.0.0",
-        "lodash": "^4.17.21",
-        "minimatch": "^9.0.2",
-        "npm-package-arg": "^10.0.0",
-        "proc-log": "^3.0.0",
-        "release-please": "npm:@npmcli/release-please@^14.2.6",
-        "semver": "^7.3.5",
-        "yaml": "^2.1.1"
-      },
-      "bin": {
-        "template-oss-apply": "bin/apply.js",
-        "template-oss-check": "bin/check.js",
-        "template-oss-release-manager": "bin/release-manager.js",
-        "template-oss-release-please": "bin/release-please.js"
+        "@gar/promisify": "^1.1.3",
+        "semver": "^7.3.5"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/@npmcli/arborist": {
-      "version": "6.3.0",
-      "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-6.3.0.tgz",
-      "integrity": "sha512-XrS14qBDhK95RdGhjTSx8AgeZPNah949qp3b0v3GUFOugtPc9Z85rpWid57mONS8gHbuGIHjFzuA+5hSM7BuBA==",
-      "dev": true,
-      "dependencies": {
-        "@isaacs/string-locale-compare": "^1.1.0",
-        "@npmcli/fs": "^3.1.0",
-        "@npmcli/installed-package-contents": "^2.0.2",
-        "@npmcli/map-workspaces": "^3.0.2",
-        "@npmcli/metavuln-calculator": "^5.0.0",
-        "@npmcli/name-from-folder": "^2.0.0",
-        "@npmcli/node-gyp": "^3.0.0",
-        "@npmcli/package-json": "^4.0.0",
-        "@npmcli/query": "^3.0.0",
-        "@npmcli/run-script": "^6.0.0",
-        "bin-links": "^4.0.1",
-        "cacache": "^17.0.4",
-        "common-ancestor-path": "^1.0.1",
-        "hosted-git-info": "^6.1.1",
-        "json-parse-even-better-errors": "^3.0.0",
-        "json-stringify-nice": "^1.1.4",
-        "minimatch": "^9.0.0",
-        "nopt": "^7.0.0",
-        "npm-install-checks": "^6.0.0",
-        "npm-package-arg": "^10.1.0",
-        "npm-pick-manifest": "^8.0.1",
-        "npm-registry-fetch": "^14.0.3",
-        "npmlog": "^7.0.1",
-        "pacote": "^15.0.8",
-        "parse-conflict-json": "^3.0.0",
-        "proc-log": "^3.0.0",
-        "promise-all-reject-late": "^1.0.0",
-        "promise-call-limit": "^1.0.2",
-        "read-package-json-fast": "^3.0.2",
-        "semver": "^7.3.7",
-        "ssri": "^10.0.1",
-        "treeverse": "^3.0.0",
-        "walk-up-path": "^3.0.1"
-      },
-      "bin": {
-        "arborist": "bin/index.js"
-      },
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
-      }
+    "node_modules/@npmcli/run-script/node_modules/abbrev": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
+      "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
+      "inBundle": true
     },
-    "node_modules/@npmcli/template-oss/node_modules/@npmcli/git": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-4.1.0.tgz",
-      "integrity": "sha512-9hwoB3gStVfa0N31ymBmrX+GuDGdVA/QWShZVqE0HK2Af+7QGGrCTbZia/SW0ImUTjTne7SP91qxDmtXvDHRPQ==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/are-we-there-yet": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz",
+      "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==",
+      "inBundle": true,
       "dependencies": {
-        "@npmcli/promise-spawn": "^6.0.0",
-        "lru-cache": "^7.4.4",
-        "npm-pick-manifest": "^8.0.0",
-        "proc-log": "^3.0.0",
-        "promise-inflight": "^1.0.1",
-        "promise-retry": "^2.0.1",
-        "semver": "^7.3.5",
-        "which": "^3.0.0"
+        "delegates": "^1.0.0",
+        "readable-stream": "^3.6.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/@npmcli/metavuln-calculator": {
-      "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-5.0.1.tgz",
-      "integrity": "sha512-qb8Q9wIIlEPj3WeA1Lba91R4ZboPL0uspzV0F9uwP+9AYMVB2zOoa7Pbk12g6D2NHAinSbHh6QYmGuRyHZ874Q==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/brace-expansion": {
+      "version": "1.1.11",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+      "inBundle": true,
       "dependencies": {
-        "cacache": "^17.0.0",
-        "json-parse-even-better-errors": "^3.0.0",
-        "pacote": "^15.0.0",
-        "semver": "^7.3.5"
-      },
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "balanced-match": "^1.0.0",
+        "concat-map": "0.0.1"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/@npmcli/package-json": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-4.0.1.tgz",
-      "integrity": "sha512-lRCEGdHZomFsURroh522YvA/2cVb9oPIJrjHanCJZkiasz1BzcnLr3tBJhlV7S86MBJBuAQ33is2D60YitZL2Q==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/cacache": {
+      "version": "16.1.3",
+      "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.3.tgz",
+      "integrity": "sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==",
+      "inBundle": true,
       "dependencies": {
-        "@npmcli/git": "^4.1.0",
-        "glob": "^10.2.2",
-        "hosted-git-info": "^6.1.1",
-        "json-parse-even-better-errors": "^3.0.0",
-        "normalize-package-data": "^5.0.0",
-        "proc-log": "^3.0.0",
-        "semver": "^7.5.3"
+        "@npmcli/fs": "^2.1.0",
+        "@npmcli/move-file": "^2.0.0",
+        "chownr": "^2.0.0",
+        "fs-minipass": "^2.1.0",
+        "glob": "^8.0.1",
+        "infer-owner": "^1.0.4",
+        "lru-cache": "^7.7.1",
+        "minipass": "^3.1.6",
+        "minipass-collect": "^1.0.2",
+        "minipass-flush": "^1.0.5",
+        "minipass-pipeline": "^1.2.4",
+        "mkdirp": "^1.0.4",
+        "p-map": "^4.0.0",
+        "promise-inflight": "^1.0.1",
+        "rimraf": "^3.0.2",
+        "ssri": "^9.0.0",
+        "tar": "^6.1.11",
+        "unique-filename": "^2.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/@npmcli/promise-spawn": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-6.0.2.tgz",
-      "integrity": "sha512-gGq0NJkIGSwdbUt4yhdF8ZrmkGKVz9vAdVzpOfnom+V8PLSmSOVhZwbNvZZS1EYcJN5hzzKBxmmVVAInM6HQLg==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+      "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+      "inBundle": true,
       "dependencies": {
-        "which": "^3.0.0"
-      },
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "balanced-match": "^1.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/@npmcli/run-script": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-6.0.2.tgz",
-      "integrity": "sha512-NCcr1uQo1k5U+SYlnIrbAh3cxy+OQT1VtqiAbxdymSlptbzBb62AjH2xXgjNCoP073hoa1CfCAcwoZ8k96C4nA==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob": {
+      "version": "8.1.0",
+      "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
+      "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
+      "inBundle": true,
       "dependencies": {
-        "@npmcli/node-gyp": "^3.0.0",
-        "@npmcli/promise-spawn": "^6.0.0",
-        "node-gyp": "^9.0.0",
-        "read-package-json-fast": "^3.0.0",
-        "which": "^3.0.0"
+        "fs.realpath": "^1.0.0",
+        "inflight": "^1.0.4",
+        "inherits": "2",
+        "minimatch": "^5.0.1",
+        "once": "^1.3.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">=12"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/@sigstore/bundle": {
-      "version": "1.1.0",
-      "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-1.1.0.tgz",
-      "integrity": "sha512-PFutXEy0SmQxYI4texPw3dd2KewuNqv7OuK1ZFtY2fM754yhvG2KdgwIhRnoEE2uHdtdGNQ8s0lb94dW9sELog==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch": {
+      "version": "5.1.6",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
+      "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
+      "inBundle": true,
       "dependencies": {
-        "@sigstore/protobuf-specs": "^0.2.0"
+        "brace-expansion": "^2.0.1"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">=10"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/@sigstore/sign": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/@sigstore/sign/-/sign-1.0.0.tgz",
-      "integrity": "sha512-INxFVNQteLtcfGmcoldzV6Je0sbbfh9I16DM4yJPw3j5+TFP8X6uIiA18mvpEa9yyeycAKgPmOA3X9hVdVTPUA==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/fs-minipass": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
+      "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
+      "inBundle": true,
       "dependencies": {
-        "@sigstore/bundle": "^1.1.0",
-        "@sigstore/protobuf-specs": "^0.2.0",
-        "make-fetch-happen": "^11.0.1"
+        "minipass": "^3.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">= 8"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/@sigstore/tuf": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/@sigstore/tuf/-/tuf-1.0.3.tgz",
-      "integrity": "sha512-2bRovzs0nJZFlCN3rXirE4gwxCn97JNjMmwpecqlbgV9WcxX7WRuIrgzx/X7Ib7MYRbyUTpBYE0s2x6AmZXnlg==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/gauge": {
+      "version": "4.0.4",
+      "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz",
+      "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==",
+      "inBundle": true,
       "dependencies": {
-        "@sigstore/protobuf-specs": "^0.2.0",
-        "tuf-js": "^1.1.7"
+        "aproba": "^1.0.3 || ^2.0.0",
+        "color-support": "^1.1.3",
+        "console-control-strings": "^1.1.0",
+        "has-unicode": "^2.0.1",
+        "signal-exit": "^3.0.7",
+        "string-width": "^4.2.3",
+        "strip-ansi": "^6.0.1",
+        "wide-align": "^1.1.5"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/@tufjs/canonical-json": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz",
-      "integrity": "sha512-QTnf++uxunWvG2z3UFNzAoQPHxnSXOwtaI3iJ+AohhV+5vONuArPjJE7aPXPVXfXJsqrVbZBu9b81AJoSd09IQ==",
-      "dev": true,
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
-      }
-    },
-    "node_modules/@npmcli/template-oss/node_modules/@tufjs/models": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/@tufjs/models/-/models-1.0.4.tgz",
-      "integrity": "sha512-qaGV9ltJP0EO25YfFUPhxRVK0evXFIAGicsVXuRim4Ed9cjPxYhNnNJ49SFmbeLgtxpslIkX317IgpfcHPVj/A==",
-      "dev": true,
-      "dependencies": {
-        "@tufjs/canonical-json": "1.0.0",
-        "minimatch": "^9.0.0"
-      },
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
-      }
-    },
-    "node_modules/@npmcli/template-oss/node_modules/cacache": {
-      "version": "17.1.4",
-      "resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.4.tgz",
-      "integrity": "sha512-/aJwG2l3ZMJ1xNAnqbMpA40of9dj/pIH3QfiuQSqjfPJF747VR0J/bHn+/KdNnHKc6XQcWt/AfRSBft82W1d2A==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/glob": {
+      "version": "7.2.3",
+      "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+      "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
+      "inBundle": true,
       "dependencies": {
-        "@npmcli/fs": "^3.1.0",
-        "fs-minipass": "^3.0.0",
-        "glob": "^10.2.2",
-        "lru-cache": "^7.7.1",
-        "minipass": "^7.0.3",
-        "minipass-collect": "^1.0.2",
-        "minipass-flush": "^1.0.5",
-        "minipass-pipeline": "^1.2.4",
-        "p-map": "^4.0.0",
-        "ssri": "^10.0.0",
-        "tar": "^6.1.11",
-        "unique-filename": "^3.0.0"
+        "fs.realpath": "^1.0.0",
+        "inflight": "^1.0.4",
+        "inherits": "2",
+        "minimatch": "^3.1.1",
+        "once": "^1.3.0",
+        "path-is-absolute": "^1.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
-      }
-    },
-    "node_modules/@npmcli/template-oss/node_modules/hosted-git-info": {
-      "version": "6.1.1",
-      "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-6.1.1.tgz",
-      "integrity": "sha512-r0EI+HBMcXadMrugk0GCQ+6BQV39PiWAZVfq7oIckeGiN7sjRGyQxPdft3nQekFTCQbYxLBH+/axZMeH8UX6+w==",
-      "dev": true,
-      "dependencies": {
-        "lru-cache": "^7.5.1"
+        "node": "*"
       },
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/lru-cache": {
+    "node_modules/@npmcli/run-script/node_modules/lru-cache": {
       "version": "7.18.3",
       "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
       "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
-      "dev": true,
+      "inBundle": true,
       "engines": {
         "node": ">=12"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/make-fetch-happen": {
-      "version": "11.1.1",
-      "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz",
-      "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/make-fetch-happen": {
+      "version": "10.2.1",
+      "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz",
+      "integrity": "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==",
+      "inBundle": true,
       "dependencies": {
         "agentkeepalive": "^4.2.1",
-        "cacache": "^17.0.0",
-        "http-cache-semantics": "^4.1.1",
+        "cacache": "^16.1.0",
+        "http-cache-semantics": "^4.1.0",
         "http-proxy-agent": "^5.0.0",
         "https-proxy-agent": "^5.0.0",
         "is-lambda": "^1.0.1",
         "lru-cache": "^7.7.1",
-        "minipass": "^5.0.0",
-        "minipass-fetch": "^3.0.0",
+        "minipass": "^3.1.6",
+        "minipass-collect": "^1.0.2",
+        "minipass-fetch": "^2.0.3",
         "minipass-flush": "^1.0.5",
         "minipass-pipeline": "^1.2.4",
         "negotiator": "^0.6.3",
         "promise-retry": "^2.0.1",
         "socks-proxy-agent": "^7.0.0",
-        "ssri": "^10.0.0"
+        "ssri": "^9.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/make-fetch-happen/node_modules/minipass": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
-      "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/minimatch": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+      "inBundle": true,
+      "dependencies": {
+        "brace-expansion": "^1.1.7"
+      },
+      "engines": {
+        "node": "*"
+      }
+    },
+    "node_modules/@npmcli/run-script/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+      "inBundle": true,
+      "dependencies": {
+        "yallist": "^4.0.0"
+      },
       "engines": {
         "node": ">=8"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/normalize-package-data": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-5.0.0.tgz",
-      "integrity": "sha512-h9iPVIfrVZ9wVYQnxFgtw1ugSvGEMOlyPWWtm8BMJhnwyEL/FLbYbTY3V3PpjI/BUK67n9PEWDu6eHzu1fB15Q==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/minipass-fetch": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.2.tgz",
+      "integrity": "sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==",
+      "inBundle": true,
       "dependencies": {
-        "hosted-git-info": "^6.0.0",
-        "is-core-module": "^2.8.1",
-        "semver": "^7.3.5",
-        "validate-npm-package-license": "^3.0.4"
+        "minipass": "^3.1.6",
+        "minipass-sized": "^1.0.3",
+        "minizlib": "^2.1.2"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+      },
+      "optionalDependencies": {
+        "encoding": "^0.1.13"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/npm-package-arg": {
-      "version": "10.1.0",
-      "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-10.1.0.tgz",
-      "integrity": "sha512-uFyyCEmgBfZTtrKk/5xDfHp6+MdrqGotX/VoOyEEl3mBwiEE5FlBaePanazJSVMPT7vKepcjYBY2ztg9A3yPIA==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/node-gyp": {
+      "version": "9.4.1",
+      "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.1.tgz",
+      "integrity": "sha512-OQkWKbjQKbGkMf/xqI1jjy3oCTgMKJac58G2+bjZb3fza6gW2YrCSdMQYaoTb70crvE//Gngr4f0AgVHmqHvBQ==",
+      "inBundle": true,
       "dependencies": {
-        "hosted-git-info": "^6.0.0",
-        "proc-log": "^3.0.0",
+        "env-paths": "^2.2.0",
+        "exponential-backoff": "^3.1.1",
+        "glob": "^7.1.4",
+        "graceful-fs": "^4.2.6",
+        "make-fetch-happen": "^10.0.3",
+        "nopt": "^6.0.0",
+        "npmlog": "^6.0.0",
+        "rimraf": "^3.0.2",
         "semver": "^7.3.5",
-        "validate-npm-package-name": "^5.0.0"
+        "tar": "^6.1.2",
+        "which": "^2.0.2"
+      },
+      "bin": {
+        "node-gyp": "bin/node-gyp.js"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13 || ^14.13 || >=16"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/npm-packlist": {
-      "version": "7.0.4",
-      "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-7.0.4.tgz",
-      "integrity": "sha512-d6RGEuRrNS5/N84iglPivjaJPxhDbZmlbTwTDX2IbcRHG5bZCdtysYMhwiPvcF4GisXHGn7xsxv+GQ7T/02M5Q==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+      "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+      "inBundle": true,
       "dependencies": {
-        "ignore-walk": "^6.0.0"
+        "isexe": "^2.0.0"
+      },
+      "bin": {
+        "node-which": "bin/node-which"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">= 8"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/npm-pick-manifest": {
-      "version": "8.0.2",
-      "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-8.0.2.tgz",
-      "integrity": "sha512-1dKY+86/AIiq1tkKVD3l0WI+Gd3vkknVGAggsFeBkTvbhMQ1OND/LKkYv4JtXPKUJ8bOTCyLiqEg2P6QNdK+Gg==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/nopt": {
+      "version": "6.0.0",
+      "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz",
+      "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==",
+      "inBundle": true,
       "dependencies": {
-        "npm-install-checks": "^6.0.0",
-        "npm-normalize-package-bin": "^3.0.0",
-        "npm-package-arg": "^10.0.0",
-        "semver": "^7.3.5"
+        "abbrev": "^1.0.0"
+      },
+      "bin": {
+        "nopt": "bin/nopt.js"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/npm-registry-fetch": {
-      "version": "14.0.5",
-      "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-14.0.5.tgz",
-      "integrity": "sha512-kIDMIo4aBm6xg7jOttupWZamsZRkAqMqwqqbVXnUqstY5+tapvv6bkH/qMR76jdgV+YljEUCyWx3hRYMrJiAgA==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/npmlog": {
+      "version": "6.0.2",
+      "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz",
+      "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==",
+      "inBundle": true,
       "dependencies": {
-        "make-fetch-happen": "^11.0.0",
-        "minipass": "^5.0.0",
-        "minipass-fetch": "^3.0.0",
-        "minipass-json-stream": "^1.0.1",
-        "minizlib": "^2.1.2",
-        "npm-package-arg": "^10.0.0",
-        "proc-log": "^3.0.0"
+        "are-we-there-yet": "^3.0.0",
+        "console-control-strings": "^1.1.0",
+        "gauge": "^4.0.3",
+        "set-blocking": "^2.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/npm-registry-fetch/node_modules/minipass": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
-      "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/readable-stream": {
+      "version": "3.6.2",
+      "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+      "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
+      "inBundle": true,
+      "dependencies": {
+        "inherits": "^2.0.3",
+        "string_decoder": "^1.1.1",
+        "util-deprecate": "^1.0.1"
+      },
       "engines": {
-        "node": ">=8"
+        "node": ">= 6"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/pacote": {
-      "version": "15.2.0",
-      "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.2.0.tgz",
-      "integrity": "sha512-rJVZeIwHTUta23sIZgEIM62WYwbmGbThdbnkt81ravBplQv+HjyroqnLRNH2+sLJHcGZmLRmhPwACqhfTcOmnA==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/signal-exit": {
+      "version": "3.0.7",
+      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
+      "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+      "inBundle": true
+    },
+    "node_modules/@npmcli/run-script/node_modules/ssri": {
+      "version": "9.0.1",
+      "resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz",
+      "integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==",
+      "inBundle": true,
       "dependencies": {
-        "@npmcli/git": "^4.0.0",
-        "@npmcli/installed-package-contents": "^2.0.1",
-        "@npmcli/promise-spawn": "^6.0.1",
-        "@npmcli/run-script": "^6.0.0",
-        "cacache": "^17.0.0",
-        "fs-minipass": "^3.0.0",
-        "minipass": "^5.0.0",
-        "npm-package-arg": "^10.0.0",
-        "npm-packlist": "^7.0.0",
-        "npm-pick-manifest": "^8.0.0",
-        "npm-registry-fetch": "^14.0.0",
-        "proc-log": "^3.0.0",
-        "promise-retry": "^2.0.1",
-        "read-package-json": "^6.0.0",
-        "read-package-json-fast": "^3.0.0",
-        "sigstore": "^1.3.0",
-        "ssri": "^10.0.0",
-        "tar": "^6.1.11"
-      },
-      "bin": {
-        "pacote": "lib/bin.js"
+        "minipass": "^3.1.1"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/pacote/node_modules/minipass": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
-      "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
-      "dev": true,
+    "node_modules/@npmcli/run-script/node_modules/unique-filename": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz",
+      "integrity": "sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==",
+      "inBundle": true,
+      "dependencies": {
+        "unique-slug": "^3.0.0"
+      },
       "engines": {
-        "node": ">=8"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/read-package-json": {
-      "version": "6.0.4",
-      "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-6.0.4.tgz",
-      "integrity": "sha512-AEtWXYfopBj2z5N5PbkAOeNHRPUg5q+Nen7QLxV8M2zJq1ym6/lCz3fYNTCXe19puu2d06jfHhrP7v/S2PtMMw==",
+    "node_modules/@npmcli/run-script/node_modules/unique-slug": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-3.0.0.tgz",
+      "integrity": "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w==",
+      "inBundle": true,
+      "dependencies": {
+        "imurmurhash": "^0.1.4"
+      },
+      "engines": {
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+      }
+    },
+    "node_modules/@npmcli/smoke-tests": {
+      "resolved": "smoke-tests",
+      "link": true
+    },
+    "node_modules/@npmcli/template-oss": {
+      "version": "4.19.0",
+      "resolved": "https://registry.npmjs.org/@npmcli/template-oss/-/template-oss-4.19.0.tgz",
+      "integrity": "sha512-5WHCup9pCF3q8HYQ2Nja5+M/JKUUCObLc/iv+I5u/pVmfD/lHhMifdWAE8bopZeyOFb65rRW/1qI6E+g0U4QiA==",
       "dev": true,
+      "hasInstallScript": true,
       "dependencies": {
-        "glob": "^10.2.2",
+        "@actions/core": "^1.9.1",
+        "@commitlint/cli": "^17.1.1",
+        "@commitlint/config-conventional": "^17.1.0",
+        "@isaacs/string-locale-compare": "^1.1.0",
+        "@npmcli/arborist": "^6.0.0",
+        "@npmcli/git": "^4.0.0",
+        "@npmcli/map-workspaces": "^3.0.0",
+        "@npmcli/package-json": "^4.0.0",
+        "@octokit/rest": "^19.0.4",
+        "diff": "^5.0.0",
+        "glob": "^10.1.0",
+        "handlebars": "^4.7.7",
+        "hosted-git-info": "^6.0.0",
+        "ini": "^4.0.0",
         "json-parse-even-better-errors": "^3.0.0",
-        "normalize-package-data": "^5.0.0",
-        "npm-normalize-package-bin": "^3.0.0"
+        "just-deep-map-values": "^1.1.1",
+        "just-diff": "^6.0.0",
+        "lodash": "^4.17.21",
+        "minimatch": "^9.0.2",
+        "npm-package-arg": "^10.0.0",
+        "proc-log": "^3.0.0",
+        "release-please": "npm:@npmcli/release-please@^14.2.6",
+        "semver": "^7.3.5",
+        "yaml": "^2.1.1"
+      },
+      "bin": {
+        "template-oss-apply": "bin/apply.js",
+        "template-oss-check": "bin/check.js",
+        "template-oss-release-manager": "bin/release-manager.js",
+        "template-oss-release-please": "bin/release-please.js"
       },
       "engines": {
         "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/sigstore": {
-      "version": "1.9.0",
-      "resolved": "https://registry.npmjs.org/sigstore/-/sigstore-1.9.0.tgz",
-      "integrity": "sha512-0Zjz0oe37d08VeOtBIuB6cRriqXse2e8w+7yIy2XSXjshRKxbc2KkhXjL229jXSxEm7UbcjS76wcJDGQddVI9A==",
+    "node_modules/@npmcli/template-oss/node_modules/@npmcli/arborist": {
+      "version": "6.3.0",
+      "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-6.3.0.tgz",
+      "integrity": "sha512-XrS14qBDhK95RdGhjTSx8AgeZPNah949qp3b0v3GUFOugtPc9Z85rpWid57mONS8gHbuGIHjFzuA+5hSM7BuBA==",
       "dev": true,
       "dependencies": {
-        "@sigstore/bundle": "^1.1.0",
-        "@sigstore/protobuf-specs": "^0.2.0",
-        "@sigstore/sign": "^1.0.0",
-        "@sigstore/tuf": "^1.0.3",
-        "make-fetch-happen": "^11.0.1"
+        "@isaacs/string-locale-compare": "^1.1.0",
+        "@npmcli/fs": "^3.1.0",
+        "@npmcli/installed-package-contents": "^2.0.2",
+        "@npmcli/map-workspaces": "^3.0.2",
+        "@npmcli/metavuln-calculator": "^5.0.0",
+        "@npmcli/name-from-folder": "^2.0.0",
+        "@npmcli/node-gyp": "^3.0.0",
+        "@npmcli/package-json": "^4.0.0",
+        "@npmcli/query": "^3.0.0",
+        "@npmcli/run-script": "^6.0.0",
+        "bin-links": "^4.0.1",
+        "cacache": "^17.0.4",
+        "common-ancestor-path": "^1.0.1",
+        "hosted-git-info": "^6.1.1",
+        "json-parse-even-better-errors": "^3.0.0",
+        "json-stringify-nice": "^1.1.4",
+        "minimatch": "^9.0.0",
+        "nopt": "^7.0.0",
+        "npm-install-checks": "^6.0.0",
+        "npm-package-arg": "^10.1.0",
+        "npm-pick-manifest": "^8.0.1",
+        "npm-registry-fetch": "^14.0.3",
+        "npmlog": "^7.0.1",
+        "pacote": "^15.0.8",
+        "parse-conflict-json": "^3.0.0",
+        "proc-log": "^3.0.0",
+        "promise-all-reject-late": "^1.0.0",
+        "promise-call-limit": "^1.0.2",
+        "read-package-json-fast": "^3.0.2",
+        "semver": "^7.3.7",
+        "ssri": "^10.0.1",
+        "treeverse": "^3.0.0",
+        "walk-up-path": "^3.0.1"
       },
       "bin": {
-        "sigstore": "bin/sigstore.js"
+        "arborist": "bin/index.js"
       },
       "engines": {
         "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/tuf-js": {
-      "version": "1.1.7",
-      "resolved": "https://registry.npmjs.org/tuf-js/-/tuf-js-1.1.7.tgz",
-      "integrity": "sha512-i3P9Kgw3ytjELUfpuKVDNBJvk4u5bXL6gskv572mcevPbSKCV3zt3djhmlEQ65yERjIbOSncy7U4cQJaB1CBCg==",
+    "node_modules/@npmcli/template-oss/node_modules/@npmcli/git": {
+      "version": "4.1.0",
+      "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-4.1.0.tgz",
+      "integrity": "sha512-9hwoB3gStVfa0N31ymBmrX+GuDGdVA/QWShZVqE0HK2Af+7QGGrCTbZia/SW0ImUTjTne7SP91qxDmtXvDHRPQ==",
       "dev": true,
       "dependencies": {
-        "@tufjs/models": "1.0.4",
-        "debug": "^4.3.4",
-        "make-fetch-happen": "^11.1.1"
+        "@npmcli/promise-spawn": "^6.0.0",
+        "lru-cache": "^7.4.4",
+        "npm-pick-manifest": "^8.0.0",
+        "proc-log": "^3.0.0",
+        "promise-inflight": "^1.0.1",
+        "promise-retry": "^2.0.1",
+        "semver": "^7.3.5",
+        "which": "^3.0.0"
       },
       "engines": {
         "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@npmcli/template-oss/node_modules/which": {
-      "version": "3.0.1",
-      "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz",
-      "integrity": "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==",
+    "node_modules/@npmcli/template-oss/node_modules/@npmcli/metavuln-calculator": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-5.0.1.tgz",
+      "integrity": "sha512-qb8Q9wIIlEPj3WeA1Lba91R4ZboPL0uspzV0F9uwP+9AYMVB2zOoa7Pbk12g6D2NHAinSbHh6QYmGuRyHZ874Q==",
       "dev": true,
       "dependencies": {
-        "isexe": "^2.0.0"
-      },
-      "bin": {
-        "node-which": "bin/which.js"
+        "cacache": "^17.0.0",
+        "json-parse-even-better-errors": "^3.0.0",
+        "pacote": "^15.0.0",
+        "semver": "^7.3.5"
       },
       "engines": {
         "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@octokit/auth-token": {
-      "version": "3.0.3",
-      "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-3.0.3.tgz",
-      "integrity": "sha512-/aFM2M4HVDBT/jjDBa84sJniv1t9Gm/rLkalaz9htOm+L+8JMj1k9w0CkUdcxNyNxZPlTxKPVko+m1VlM58ZVA==",
+    "node_modules/@npmcli/template-oss/node_modules/@npmcli/package-json": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-4.0.1.tgz",
+      "integrity": "sha512-lRCEGdHZomFsURroh522YvA/2cVb9oPIJrjHanCJZkiasz1BzcnLr3tBJhlV7S86MBJBuAQ33is2D60YitZL2Q==",
       "dev": true,
       "dependencies": {
-        "@octokit/types": "^9.0.0"
+        "@npmcli/git": "^4.1.0",
+        "glob": "^10.2.2",
+        "hosted-git-info": "^6.1.1",
+        "json-parse-even-better-errors": "^3.0.0",
+        "normalize-package-data": "^5.0.0",
+        "proc-log": "^3.0.0",
+        "semver": "^7.5.3"
       },
       "engines": {
-        "node": ">= 14"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@octokit/core": {
-      "version": "4.2.0",
-      "resolved": "https://registry.npmjs.org/@octokit/core/-/core-4.2.0.tgz",
-      "integrity": "sha512-AgvDRUg3COpR82P7PBdGZF/NNqGmtMq2NiPqeSsDIeCfYFOZ9gddqWNQHnFdEUf+YwOj4aZYmJnlPp7OXmDIDg==",
+    "node_modules/@npmcli/template-oss/node_modules/@npmcli/promise-spawn": {
+      "version": "6.0.2",
+      "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-6.0.2.tgz",
+      "integrity": "sha512-gGq0NJkIGSwdbUt4yhdF8ZrmkGKVz9vAdVzpOfnom+V8PLSmSOVhZwbNvZZS1EYcJN5hzzKBxmmVVAInM6HQLg==",
       "dev": true,
       "dependencies": {
-        "@octokit/auth-token": "^3.0.0",
-        "@octokit/graphql": "^5.0.0",
-        "@octokit/request": "^6.0.0",
-        "@octokit/request-error": "^3.0.0",
-        "@octokit/types": "^9.0.0",
-        "before-after-hook": "^2.2.0",
-        "universal-user-agent": "^6.0.0"
+        "which": "^3.0.0"
       },
       "engines": {
-        "node": ">= 14"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@octokit/endpoint": {
-      "version": "7.0.5",
-      "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-7.0.5.tgz",
-      "integrity": "sha512-LG4o4HMY1Xoaec87IqQ41TQ+glvIeTKqfjkCEmt5AIwDZJwQeVZFIEYXrYY6yLwK+pAScb9Gj4q+Nz2qSw1roA==",
+    "node_modules/@npmcli/template-oss/node_modules/@npmcli/run-script": {
+      "version": "6.0.2",
+      "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-6.0.2.tgz",
+      "integrity": "sha512-NCcr1uQo1k5U+SYlnIrbAh3cxy+OQT1VtqiAbxdymSlptbzBb62AjH2xXgjNCoP073hoa1CfCAcwoZ8k96C4nA==",
       "dev": true,
       "dependencies": {
-        "@octokit/types": "^9.0.0",
-        "is-plain-object": "^5.0.0",
-        "universal-user-agent": "^6.0.0"
+        "@npmcli/node-gyp": "^3.0.0",
+        "@npmcli/promise-spawn": "^6.0.0",
+        "node-gyp": "^9.0.0",
+        "read-package-json-fast": "^3.0.0",
+        "which": "^3.0.0"
       },
       "engines": {
-        "node": ">= 14"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@octokit/graphql": {
-      "version": "5.0.5",
-      "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.5.tgz",
-      "integrity": "sha512-Qwfvh3xdqKtIznjX9lz2D458r7dJPP8l6r4GQkIdWQouZwHQK0mVT88uwiU2bdTU2OtT1uOlKpRciUWldpG0yQ==",
+    "node_modules/@npmcli/template-oss/node_modules/@sigstore/bundle": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-1.1.0.tgz",
+      "integrity": "sha512-PFutXEy0SmQxYI4texPw3dd2KewuNqv7OuK1ZFtY2fM754yhvG2KdgwIhRnoEE2uHdtdGNQ8s0lb94dW9sELog==",
       "dev": true,
       "dependencies": {
-        "@octokit/request": "^6.0.0",
-        "@octokit/types": "^9.0.0",
-        "universal-user-agent": "^6.0.0"
+        "@sigstore/protobuf-specs": "^0.2.0"
       },
       "engines": {
-        "node": ">= 14"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@octokit/openapi-types": {
-      "version": "17.1.0",
-      "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-17.1.0.tgz",
-      "integrity": "sha512-rnI26BAITDZTo5vqFOmA7oX4xRd18rO+gcK4MiTpJmsRMxAw0JmevNjPsjpry1bb9SVNo56P/0kbiyXXa4QluA==",
-      "dev": true
-    },
-    "node_modules/@octokit/plugin-paginate-rest": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-6.0.0.tgz",
-      "integrity": "sha512-Sq5VU1PfT6/JyuXPyt04KZNVsFOSBaYOAq2QRZUwzVlI10KFvcbUo8lR258AAQL1Et60b0WuVik+zOWKLuDZxw==",
+    "node_modules/@npmcli/template-oss/node_modules/@sigstore/sign": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/@sigstore/sign/-/sign-1.0.0.tgz",
+      "integrity": "sha512-INxFVNQteLtcfGmcoldzV6Je0sbbfh9I16DM4yJPw3j5+TFP8X6uIiA18mvpEa9yyeycAKgPmOA3X9hVdVTPUA==",
       "dev": true,
       "dependencies": {
-        "@octokit/types": "^9.0.0"
+        "@sigstore/bundle": "^1.1.0",
+        "@sigstore/protobuf-specs": "^0.2.0",
+        "make-fetch-happen": "^11.0.1"
       },
       "engines": {
-        "node": ">= 14"
-      },
-      "peerDependencies": {
-        "@octokit/core": ">=4"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@octokit/plugin-request-log": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz",
-      "integrity": "sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==",
+    "node_modules/@npmcli/template-oss/node_modules/@sigstore/tuf": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/@sigstore/tuf/-/tuf-1.0.3.tgz",
+      "integrity": "sha512-2bRovzs0nJZFlCN3rXirE4gwxCn97JNjMmwpecqlbgV9WcxX7WRuIrgzx/X7Ib7MYRbyUTpBYE0s2x6AmZXnlg==",
       "dev": true,
-      "peerDependencies": {
-        "@octokit/core": ">=3"
+      "dependencies": {
+        "@sigstore/protobuf-specs": "^0.2.0",
+        "tuf-js": "^1.1.7"
+      },
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@octokit/plugin-rest-endpoint-methods": {
-      "version": "7.0.1",
-      "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-7.0.1.tgz",
-      "integrity": "sha512-pnCaLwZBudK5xCdrR823xHGNgqOzRnJ/mpC/76YPpNP7DybdsJtP7mdOwh+wYZxK5jqeQuhu59ogMI4NRlBUvA==",
+    "node_modules/@npmcli/template-oss/node_modules/@tufjs/canonical-json": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz",
+      "integrity": "sha512-QTnf++uxunWvG2z3UFNzAoQPHxnSXOwtaI3iJ+AohhV+5vONuArPjJE7aPXPVXfXJsqrVbZBu9b81AJoSd09IQ==",
       "dev": true,
-      "dependencies": {
-        "@octokit/types": "^9.0.0",
-        "deprecation": "^2.3.1"
-      },
       "engines": {
-        "node": ">= 14"
-      },
-      "peerDependencies": {
-        "@octokit/core": ">=3"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@octokit/request": {
-      "version": "6.2.3",
-      "resolved": "https://registry.npmjs.org/@octokit/request/-/request-6.2.3.tgz",
-      "integrity": "sha512-TNAodj5yNzrrZ/VxP+H5HiYaZep0H3GU0O7PaF+fhDrt8FPrnkei9Aal/txsN/1P7V3CPiThG0tIvpPDYUsyAA==",
+    "node_modules/@npmcli/template-oss/node_modules/@tufjs/models": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/@tufjs/models/-/models-1.0.4.tgz",
+      "integrity": "sha512-qaGV9ltJP0EO25YfFUPhxRVK0evXFIAGicsVXuRim4Ed9cjPxYhNnNJ49SFmbeLgtxpslIkX317IgpfcHPVj/A==",
       "dev": true,
       "dependencies": {
-        "@octokit/endpoint": "^7.0.0",
-        "@octokit/request-error": "^3.0.0",
-        "@octokit/types": "^9.0.0",
-        "is-plain-object": "^5.0.0",
-        "node-fetch": "^2.6.7",
-        "universal-user-agent": "^6.0.0"
+        "@tufjs/canonical-json": "1.0.0",
+        "minimatch": "^9.0.0"
       },
       "engines": {
-        "node": ">= 14"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@octokit/request-error": {
-      "version": "3.0.3",
-      "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-3.0.3.tgz",
-      "integrity": "sha512-crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ==",
+    "node_modules/@npmcli/template-oss/node_modules/abbrev": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
+      "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
+      "dev": true
+    },
+    "node_modules/@npmcli/template-oss/node_modules/are-we-there-yet": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz",
+      "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==",
       "dev": true,
       "dependencies": {
-        "@octokit/types": "^9.0.0",
-        "deprecation": "^2.0.0",
-        "once": "^1.4.0"
+        "delegates": "^1.0.0",
+        "readable-stream": "^3.6.0"
       },
       "engines": {
-        "node": ">= 14"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@octokit/rest": {
-      "version": "19.0.7",
-      "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-19.0.7.tgz",
-      "integrity": "sha512-HRtSfjrWmWVNp2uAkEpQnuGMJsu/+dBr47dRc5QVgsCbnIc1+GFEaoKBWkYG+zjrsHpSqcAElMio+n10c0b5JA==",
+    "node_modules/@npmcli/template-oss/node_modules/brace-expansion": {
+      "version": "1.1.11",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
       "dev": true,
       "dependencies": {
-        "@octokit/core": "^4.1.0",
-        "@octokit/plugin-paginate-rest": "^6.0.0",
-        "@octokit/plugin-request-log": "^1.0.4",
-        "@octokit/plugin-rest-endpoint-methods": "^7.0.0"
-      },
-      "engines": {
-        "node": ">= 14"
+        "balanced-match": "^1.0.0",
+        "concat-map": "0.0.1"
       }
     },
-    "node_modules/@octokit/types": {
-      "version": "9.2.0",
-      "resolved": "https://registry.npmjs.org/@octokit/types/-/types-9.2.0.tgz",
-      "integrity": "sha512-xySzJG4noWrIBFyMu4lg4tu9vAgNg9S0aoLRONhAEz6ueyi1evBzb40HitIosaYS4XOexphG305IVcLrIX/30g==",
+    "node_modules/@npmcli/template-oss/node_modules/cacache": {
+      "version": "17.1.4",
+      "resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.4.tgz",
+      "integrity": "sha512-/aJwG2l3ZMJ1xNAnqbMpA40of9dj/pIH3QfiuQSqjfPJF747VR0J/bHn+/KdNnHKc6XQcWt/AfRSBft82W1d2A==",
       "dev": true,
       "dependencies": {
-        "@octokit/openapi-types": "^17.1.0"
-      }
-    },
-    "node_modules/@pkgjs/parseargs": {
-      "version": "0.11.0",
-      "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
-      "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
-      "inBundle": true,
-      "optional": true,
+        "@npmcli/fs": "^3.1.0",
+        "fs-minipass": "^3.0.0",
+        "glob": "^10.2.2",
+        "lru-cache": "^7.7.1",
+        "minipass": "^7.0.3",
+        "minipass-collect": "^1.0.2",
+        "minipass-flush": "^1.0.5",
+        "minipass-pipeline": "^1.2.4",
+        "p-map": "^4.0.0",
+        "ssri": "^10.0.0",
+        "tar": "^6.1.11",
+        "unique-filename": "^3.0.0"
+      },
       "engines": {
-        "node": ">=14"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@sigstore/bundle": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-2.1.0.tgz",
-      "integrity": "sha512-89uOo6yh/oxaU8AeOUnVrTdVMcGk9Q1hJa7Hkvalc6G3Z3CupWk4Xe9djSgJm9fMkH69s0P0cVHUoKSOemLdng==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/gauge": {
+      "version": "4.0.4",
+      "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz",
+      "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==",
+      "dev": true,
       "dependencies": {
-        "@sigstore/protobuf-specs": "^0.2.1"
+        "aproba": "^1.0.3 || ^2.0.0",
+        "color-support": "^1.1.3",
+        "console-control-strings": "^1.1.0",
+        "has-unicode": "^2.0.1",
+        "signal-exit": "^3.0.7",
+        "string-width": "^4.2.3",
+        "strip-ansi": "^6.0.1",
+        "wide-align": "^1.1.5"
       },
       "engines": {
-        "node": "^16.14.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@sigstore/protobuf-specs": {
-      "version": "0.2.1",
-      "resolved": "https://registry.npmjs.org/@sigstore/protobuf-specs/-/protobuf-specs-0.2.1.tgz",
-      "integrity": "sha512-XTWVxnWJu+c1oCshMLwnKvz8ZQJJDVOlciMfgpJBQbThVjKTCG8dwyhgLngBD2KN0ap9F/gOV8rFDEx8uh7R2A==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/hosted-git-info": {
+      "version": "6.1.1",
+      "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-6.1.1.tgz",
+      "integrity": "sha512-r0EI+HBMcXadMrugk0GCQ+6BQV39PiWAZVfq7oIckeGiN7sjRGyQxPdft3nQekFTCQbYxLBH+/axZMeH8UX6+w==",
+      "dev": true,
+      "dependencies": {
+        "lru-cache": "^7.5.1"
+      },
       "engines": {
         "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@sigstore/sign": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/@sigstore/sign/-/sign-2.1.0.tgz",
-      "integrity": "sha512-4VRpfJxs+8eLqzLVrZngVNExVA/zAhVbi4UT4zmtLi4xRd7vz5qie834OgkrGsLlLB1B2nz/3wUxT1XAUBe8gw==",
-      "inBundle": true,
-      "dependencies": {
-        "@sigstore/bundle": "^2.1.0",
-        "@sigstore/protobuf-specs": "^0.2.1",
-        "make-fetch-happen": "^13.0.0"
-      },
+    "node_modules/@npmcli/template-oss/node_modules/lru-cache": {
+      "version": "7.18.3",
+      "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+      "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
+      "dev": true,
       "engines": {
-        "node": "^16.14.0 || >=18.0.0"
+        "node": ">=12"
       }
     },
-    "node_modules/@sigstore/tuf": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/@sigstore/tuf/-/tuf-2.1.0.tgz",
-      "integrity": "sha512-BUoVCx+7Wj+8moEGvUU2MyBI+f93lmg1CLmoG6KrhQMeDyAG8HAZNk+YRCNuvwvSDCfPhwsj37Bg63/Q+bnGsw==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/make-fetch-happen": {
+      "version": "11.1.1",
+      "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz",
+      "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==",
+      "dev": true,
       "dependencies": {
-        "@sigstore/protobuf-specs": "^0.2.1",
-        "tuf-js": "^2.1.0"
+        "agentkeepalive": "^4.2.1",
+        "cacache": "^17.0.0",
+        "http-cache-semantics": "^4.1.1",
+        "http-proxy-agent": "^5.0.0",
+        "https-proxy-agent": "^5.0.0",
+        "is-lambda": "^1.0.1",
+        "lru-cache": "^7.7.1",
+        "minipass": "^5.0.0",
+        "minipass-fetch": "^3.0.0",
+        "minipass-flush": "^1.0.5",
+        "minipass-pipeline": "^1.2.4",
+        "negotiator": "^0.6.3",
+        "promise-retry": "^2.0.1",
+        "socks-proxy-agent": "^7.0.0",
+        "ssri": "^10.0.0"
       },
       "engines": {
-        "node": "^16.14.0 || >=18.0.0"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/@tootallnate/once": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
-      "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/make-fetch-happen/node_modules/minipass": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
+      "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
+      "dev": true,
       "engines": {
-        "node": ">= 10"
+        "node": ">=8"
       }
     },
-    "node_modules/@tsconfig/node10": {
-      "version": "1.0.9",
-      "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
-      "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
-      "dev": true
-    },
-    "node_modules/@tsconfig/node12": {
-      "version": "1.0.11",
-      "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
-      "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
-      "dev": true
-    },
-    "node_modules/@tsconfig/node14": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
-      "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
-      "dev": true
-    },
-    "node_modules/@tsconfig/node16": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
-      "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
-      "dev": true
-    },
-    "node_modules/@tufjs/canonical-json": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz",
-      "integrity": "sha512-yVtV8zsdo8qFHe+/3kw81dSLyF7D576A5cCFCi4X7B39tWT7SekaEFUnvnWJHz+9qO7qJTah1JbrDjWKqFtdWA==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp": {
+      "version": "9.4.1",
+      "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.1.tgz",
+      "integrity": "sha512-OQkWKbjQKbGkMf/xqI1jjy3oCTgMKJac58G2+bjZb3fza6gW2YrCSdMQYaoTb70crvE//Gngr4f0AgVHmqHvBQ==",
+      "dev": true,
+      "dependencies": {
+        "env-paths": "^2.2.0",
+        "exponential-backoff": "^3.1.1",
+        "glob": "^7.1.4",
+        "graceful-fs": "^4.2.6",
+        "make-fetch-happen": "^10.0.3",
+        "nopt": "^6.0.0",
+        "npmlog": "^6.0.0",
+        "rimraf": "^3.0.2",
+        "semver": "^7.3.5",
+        "tar": "^6.1.2",
+        "which": "^2.0.2"
+      },
+      "bin": {
+        "node-gyp": "bin/node-gyp.js"
+      },
       "engines": {
-        "node": "^16.14.0 || >=18.0.0"
+        "node": "^12.13 || ^14.13 || >=16"
       }
     },
-    "node_modules/@tufjs/models": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/@tufjs/models/-/models-2.0.0.tgz",
-      "integrity": "sha512-c8nj8BaOExmZKO2DXhDfegyhSGcG9E/mPN3U13L+/PsoWm1uaGiHHjxqSHQiasDBQwDA3aHuw9+9spYAP1qvvg==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/@npmcli/fs": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz",
+      "integrity": "sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==",
+      "dev": true,
       "dependencies": {
-        "@tufjs/canonical-json": "2.0.0",
-        "minimatch": "^9.0.3"
+        "@gar/promisify": "^1.1.3",
+        "semver": "^7.3.5"
       },
       "engines": {
-        "node": "^16.14.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@tufjs/repo-mock": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/@tufjs/repo-mock/-/repo-mock-2.0.0.tgz",
-      "integrity": "sha512-z0OtgGBn05dhpcvLaOMQPG1V16zOAL8+2A/L6EGIUE8pOP6PMX6vlJGSsN9JQ9glakXupCN4fdX8JF9XrNYUrw==",
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/cacache": {
+      "version": "16.1.3",
+      "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.3.tgz",
+      "integrity": "sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==",
       "dev": true,
       "dependencies": {
-        "@tufjs/models": "2.0.0",
-        "nock": "^13.3.3"
+        "@npmcli/fs": "^2.1.0",
+        "@npmcli/move-file": "^2.0.0",
+        "chownr": "^2.0.0",
+        "fs-minipass": "^2.1.0",
+        "glob": "^8.0.1",
+        "infer-owner": "^1.0.4",
+        "lru-cache": "^7.7.1",
+        "minipass": "^3.1.6",
+        "minipass-collect": "^1.0.2",
+        "minipass-flush": "^1.0.5",
+        "minipass-pipeline": "^1.2.4",
+        "mkdirp": "^1.0.4",
+        "p-map": "^4.0.0",
+        "promise-inflight": "^1.0.1",
+        "rimraf": "^3.0.2",
+        "ssri": "^9.0.0",
+        "tar": "^6.1.11",
+        "unique-filename": "^2.0.0"
       },
       "engines": {
-        "node": "^16.14.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/@types/debug": {
-      "version": "4.1.7",
-      "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz",
-      "integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==",
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+      "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
       "dev": true,
       "dependencies": {
-        "@types/ms": "*"
+        "balanced-match": "^1.0.0"
       }
     },
-    "node_modules/@types/hast": {
-      "version": "2.3.4",
-      "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.4.tgz",
-      "integrity": "sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==",
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/cacache/node_modules/glob": {
+      "version": "8.1.0",
+      "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
+      "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
       "dev": true,
       "dependencies": {
-        "@types/unist": "*"
+        "fs.realpath": "^1.0.0",
+        "inflight": "^1.0.4",
+        "inherits": "2",
+        "minimatch": "^5.0.1",
+        "once": "^1.3.0"
+      },
+      "engines": {
+        "node": ">=12"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
       }
     },
-    "node_modules/@types/json5": {
-      "version": "0.0.29",
-      "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
-      "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch": {
+      "version": "5.1.6",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
+      "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
       "dev": true,
-      "peer": true
+      "dependencies": {
+        "brace-expansion": "^2.0.1"
+      },
+      "engines": {
+        "node": ">=10"
+      }
     },
-    "node_modules/@types/mdast": {
-      "version": "3.0.11",
-      "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.11.tgz",
-      "integrity": "sha512-Y/uImid8aAwrEA24/1tcRZwpxX3pIFTSilcNDKSPn+Y2iDywSEachzRuvgAYYLR3wpGXAsMbv5lvKLDZLeYPAw==",
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/fs-minipass": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
+      "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
       "dev": true,
       "dependencies": {
-        "@types/unist": "*"
+        "minipass": "^3.0.0"
+      },
+      "engines": {
+        "node": ">= 8"
       }
     },
-    "node_modules/@types/minimist": {
-      "version": "1.2.2",
-      "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz",
-      "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==",
-      "dev": true
-    },
-    "node_modules/@types/ms": {
-      "version": "0.7.31",
-      "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz",
-      "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==",
-      "dev": true
-    },
-    "node_modules/@types/node": {
-      "version": "18.16.3",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz",
-      "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==",
-      "dev": true
-    },
-    "node_modules/@types/normalize-package-data": {
-      "version": "2.4.1",
-      "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz",
-      "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==",
-      "dev": true
-    },
-    "node_modules/@types/npm-package-arg": {
-      "version": "6.1.1",
-      "resolved": "https://registry.npmjs.org/@types/npm-package-arg/-/npm-package-arg-6.1.1.tgz",
-      "integrity": "sha512-452/1Kp9IdM/oR10AyqAgZOxUt7eLbm+EMJ194L6oarMYdZNiFIFAOJ7IIr0OrZXTySgfHjJezh2oiyk2kc3ag==",
-      "dev": true
-    },
-    "node_modules/@types/parse5": {
-      "version": "6.0.3",
-      "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz",
-      "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==",
-      "dev": true
-    },
-    "node_modules/@types/unist": {
-      "version": "2.0.6",
-      "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz",
-      "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==",
-      "dev": true
-    },
-    "node_modules/@types/yargs": {
-      "version": "16.0.5",
-      "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.5.tgz",
-      "integrity": "sha512-AxO/ADJOBFJScHbWhq2xAhlWP24rY4aCEG/NFaMvbT3X2MgRsLjhjQwsn0Zi5zn0LG9jUhCCZMeX9Dkuw6k+vQ==",
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/glob": {
+      "version": "7.2.3",
+      "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+      "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
       "dev": true,
       "dependencies": {
-        "@types/yargs-parser": "*"
+        "fs.realpath": "^1.0.0",
+        "inflight": "^1.0.4",
+        "inherits": "2",
+        "minimatch": "^3.1.1",
+        "once": "^1.3.0",
+        "path-is-absolute": "^1.0.0"
+      },
+      "engines": {
+        "node": "*"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
       }
     },
-    "node_modules/@types/yargs-parser": {
-      "version": "21.0.0",
-      "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz",
-      "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==",
-      "dev": true
-    },
-    "node_modules/@xmldom/xmldom": {
-      "version": "0.8.7",
-      "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.7.tgz",
-      "integrity": "sha512-sI1Ly2cODlWStkINzqGrZ8K6n+MTSbAeQnAipGyL+KZCXuHaRlj2gyyy8B/9MvsFFqN7XHryQnB2QwhzvJXovg==",
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/make-fetch-happen": {
+      "version": "10.2.1",
+      "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz",
+      "integrity": "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==",
       "dev": true,
+      "dependencies": {
+        "agentkeepalive": "^4.2.1",
+        "cacache": "^16.1.0",
+        "http-cache-semantics": "^4.1.0",
+        "http-proxy-agent": "^5.0.0",
+        "https-proxy-agent": "^5.0.0",
+        "is-lambda": "^1.0.1",
+        "lru-cache": "^7.7.1",
+        "minipass": "^3.1.6",
+        "minipass-collect": "^1.0.2",
+        "minipass-fetch": "^2.0.3",
+        "minipass-flush": "^1.0.5",
+        "minipass-pipeline": "^1.2.4",
+        "negotiator": "^0.6.3",
+        "promise-retry": "^2.0.1",
+        "socks-proxy-agent": "^7.0.0",
+        "ssri": "^9.0.0"
+      },
       "engines": {
-        "node": ">=10.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/abab": {
-      "version": "2.0.6",
-      "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
-      "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==",
-      "dev": true
-    },
-    "node_modules/abbrev": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-2.0.0.tgz",
-      "integrity": "sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/minimatch": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+      "dev": true,
+      "dependencies": {
+        "brace-expansion": "^1.1.7"
+      },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "*"
       }
     },
-    "node_modules/abort-controller": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
-      "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+      "dev": true,
       "dependencies": {
-        "event-target-shim": "^5.0.0"
+        "yallist": "^4.0.0"
       },
       "engines": {
-        "node": ">=6.5"
+        "node": ">=8"
       }
     },
-    "node_modules/acorn": {
-      "version": "8.8.2",
-      "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
-      "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/minipass-fetch": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.2.tgz",
+      "integrity": "sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==",
       "dev": true,
-      "bin": {
-        "acorn": "bin/acorn"
+      "dependencies": {
+        "minipass": "^3.1.6",
+        "minipass-sized": "^1.0.3",
+        "minizlib": "^2.1.2"
       },
       "engines": {
-        "node": ">=0.4.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+      },
+      "optionalDependencies": {
+        "encoding": "^0.1.13"
       }
     },
-    "node_modules/acorn-globals": {
-      "version": "7.0.1",
-      "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz",
-      "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==",
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/nopt": {
+      "version": "6.0.0",
+      "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz",
+      "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==",
       "dev": true,
       "dependencies": {
-        "acorn": "^8.1.0",
-        "acorn-walk": "^8.0.2"
+        "abbrev": "^1.0.0"
+      },
+      "bin": {
+        "nopt": "bin/nopt.js"
+      },
+      "engines": {
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/acorn-jsx": {
-      "version": "5.3.2",
-      "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
-      "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/npmlog": {
+      "version": "6.0.2",
+      "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz",
+      "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==",
       "dev": true,
-      "peer": true,
-      "peerDependencies": {
-        "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
+      "dependencies": {
+        "are-we-there-yet": "^3.0.0",
+        "console-control-strings": "^1.1.0",
+        "gauge": "^4.0.3",
+        "set-blocking": "^2.0.0"
+      },
+      "engines": {
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/acorn-walk": {
-      "version": "8.2.0",
-      "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
-      "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/ssri": {
+      "version": "9.0.1",
+      "resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz",
+      "integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==",
       "dev": true,
+      "dependencies": {
+        "minipass": "^3.1.1"
+      },
       "engines": {
-        "node": ">=0.4.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/agent-base": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
-      "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/unique-filename": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz",
+      "integrity": "sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==",
+      "dev": true,
       "dependencies": {
-        "debug": "4"
+        "unique-slug": "^3.0.0"
       },
       "engines": {
-        "node": ">= 6.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/agentkeepalive": {
-      "version": "4.5.0",
-      "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz",
-      "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/node-gyp/node_modules/which": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+      "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+      "dev": true,
       "dependencies": {
-        "humanize-ms": "^1.2.1"
+        "isexe": "^2.0.0"
+      },
+      "bin": {
+        "node-which": "bin/node-which"
       },
       "engines": {
-        "node": ">= 8.0.0"
+        "node": ">= 8"
       }
     },
-    "node_modules/aggregate-error": {
-      "version": "3.1.0",
-      "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz",
-      "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/normalize-package-data": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-5.0.0.tgz",
+      "integrity": "sha512-h9iPVIfrVZ9wVYQnxFgtw1ugSvGEMOlyPWWtm8BMJhnwyEL/FLbYbTY3V3PpjI/BUK67n9PEWDu6eHzu1fB15Q==",
+      "dev": true,
       "dependencies": {
-        "clean-stack": "^2.0.0",
-        "indent-string": "^4.0.0"
+        "hosted-git-info": "^6.0.0",
+        "is-core-module": "^2.8.1",
+        "semver": "^7.3.5",
+        "validate-npm-package-license": "^3.0.4"
       },
       "engines": {
-        "node": ">=8"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/ajv": {
-      "version": "8.12.0",
-      "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz",
-      "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==",
+    "node_modules/@npmcli/template-oss/node_modules/npm-package-arg": {
+      "version": "10.1.0",
+      "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-10.1.0.tgz",
+      "integrity": "sha512-uFyyCEmgBfZTtrKk/5xDfHp6+MdrqGotX/VoOyEEl3mBwiEE5FlBaePanazJSVMPT7vKepcjYBY2ztg9A3yPIA==",
       "dev": true,
       "dependencies": {
-        "fast-deep-equal": "^3.1.1",
-        "json-schema-traverse": "^1.0.0",
-        "require-from-string": "^2.0.2",
-        "uri-js": "^4.2.2"
+        "hosted-git-info": "^6.0.0",
+        "proc-log": "^3.0.0",
+        "semver": "^7.3.5",
+        "validate-npm-package-name": "^5.0.0"
       },
-      "funding": {
-        "type": "github",
-        "url": "https://github.com/sponsors/epoberezkin"
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/ajv-formats": {
-      "version": "2.1.1",
-      "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz",
-      "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",
+    "node_modules/@npmcli/template-oss/node_modules/npm-packlist": {
+      "version": "7.0.4",
+      "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-7.0.4.tgz",
+      "integrity": "sha512-d6RGEuRrNS5/N84iglPivjaJPxhDbZmlbTwTDX2IbcRHG5bZCdtysYMhwiPvcF4GisXHGn7xsxv+GQ7T/02M5Q==",
       "dev": true,
       "dependencies": {
-        "ajv": "^8.0.0"
-      },
-      "peerDependencies": {
-        "ajv": "^8.0.0"
+        "ignore-walk": "^6.0.0"
       },
-      "peerDependenciesMeta": {
-        "ajv": {
-          "optional": true
-        }
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/ajv-formats-draft2019": {
-      "version": "1.6.1",
-      "resolved": "https://registry.npmjs.org/ajv-formats-draft2019/-/ajv-formats-draft2019-1.6.1.tgz",
-      "integrity": "sha512-JQPvavpkWDvIsBp2Z33UkYCtXCSpW4HD3tAZ+oL4iEFOk9obQZffx0yANwECt6vzr6ET+7HN5czRyqXbnq/u0Q==",
+    "node_modules/@npmcli/template-oss/node_modules/npm-pick-manifest": {
+      "version": "8.0.2",
+      "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-8.0.2.tgz",
+      "integrity": "sha512-1dKY+86/AIiq1tkKVD3l0WI+Gd3vkknVGAggsFeBkTvbhMQ1OND/LKkYv4JtXPKUJ8bOTCyLiqEg2P6QNdK+Gg==",
       "dev": true,
       "dependencies": {
-        "punycode": "^2.1.1",
-        "schemes": "^1.4.0",
-        "smtp-address-parser": "^1.0.3",
-        "uri-js": "^4.4.1"
+        "npm-install-checks": "^6.0.0",
+        "npm-normalize-package-bin": "^3.0.0",
+        "npm-package-arg": "^10.0.0",
+        "semver": "^7.3.5"
       },
-      "peerDependencies": {
-        "ajv": "*"
-      }
-    },
-    "node_modules/ansi-regex": {
-      "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
-      "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
-      "inBundle": true,
       "engines": {
-        "node": ">=8"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/ansi-styles": {
-      "version": "4.3.0",
-      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
-      "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/npm-registry-fetch": {
+      "version": "14.0.5",
+      "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-14.0.5.tgz",
+      "integrity": "sha512-kIDMIo4aBm6xg7jOttupWZamsZRkAqMqwqqbVXnUqstY5+tapvv6bkH/qMR76jdgV+YljEUCyWx3hRYMrJiAgA==",
+      "dev": true,
       "dependencies": {
-        "color-convert": "^2.0.1"
+        "make-fetch-happen": "^11.0.0",
+        "minipass": "^5.0.0",
+        "minipass-fetch": "^3.0.0",
+        "minipass-json-stream": "^1.0.1",
+        "minizlib": "^2.1.2",
+        "npm-package-arg": "^10.0.0",
+        "proc-log": "^3.0.0"
       },
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+      }
+    },
+    "node_modules/@npmcli/template-oss/node_modules/npm-registry-fetch/node_modules/minipass": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
+      "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
+      "dev": true,
       "engines": {
         "node": ">=8"
-      },
-      "funding": {
-        "url": "https://github.com/chalk/ansi-styles?sponsor=1"
       }
     },
-    "node_modules/anymatch": {
-      "version": "3.1.3",
-      "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
-      "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
+    "node_modules/@npmcli/template-oss/node_modules/pacote": {
+      "version": "15.2.0",
+      "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.2.0.tgz",
+      "integrity": "sha512-rJVZeIwHTUta23sIZgEIM62WYwbmGbThdbnkt81ravBplQv+HjyroqnLRNH2+sLJHcGZmLRmhPwACqhfTcOmnA==",
       "dev": true,
       "dependencies": {
-        "normalize-path": "^3.0.0",
-        "picomatch": "^2.0.4"
+        "@npmcli/git": "^4.0.0",
+        "@npmcli/installed-package-contents": "^2.0.1",
+        "@npmcli/promise-spawn": "^6.0.1",
+        "@npmcli/run-script": "^6.0.0",
+        "cacache": "^17.0.0",
+        "fs-minipass": "^3.0.0",
+        "minipass": "^5.0.0",
+        "npm-package-arg": "^10.0.0",
+        "npm-packlist": "^7.0.0",
+        "npm-pick-manifest": "^8.0.0",
+        "npm-registry-fetch": "^14.0.0",
+        "proc-log": "^3.0.0",
+        "promise-retry": "^2.0.1",
+        "read-package-json": "^6.0.0",
+        "read-package-json-fast": "^3.0.0",
+        "sigstore": "^1.3.0",
+        "ssri": "^10.0.0",
+        "tar": "^6.1.11"
+      },
+      "bin": {
+        "pacote": "lib/bin.js"
       },
       "engines": {
-        "node": ">= 8"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/append-transform": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz",
-      "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==",
+    "node_modules/@npmcli/template-oss/node_modules/pacote/node_modules/minipass": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
+      "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
       "dev": true,
-      "dependencies": {
-        "default-require-extensions": "^3.0.0"
-      },
       "engines": {
         "node": ">=8"
       }
     },
-    "node_modules/aproba": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz",
-      "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==",
-      "inBundle": true
-    },
-    "node_modules/archy": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz",
-      "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==",
-      "inBundle": true
-    },
-    "node_modules/are-we-there-yet": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-4.0.1.tgz",
-      "integrity": "sha512-2zuA+jpOYBRgoBCfa+fB87Rk0oGJjDX6pxGzqH6f33NzUhG25Xur6R0u0Z9VVAq8Z5JvQpQI6j6rtonuivC8QA==",
-      "inBundle": true,
+    "node_modules/@npmcli/template-oss/node_modules/read-package-json": {
+      "version": "6.0.4",
+      "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-6.0.4.tgz",
+      "integrity": "sha512-AEtWXYfopBj2z5N5PbkAOeNHRPUg5q+Nen7QLxV8M2zJq1ym6/lCz3fYNTCXe19puu2d06jfHhrP7v/S2PtMMw==",
+      "dev": true,
       "dependencies": {
-        "delegates": "^1.0.0",
-        "readable-stream": "^4.1.0"
+        "glob": "^10.2.2",
+        "json-parse-even-better-errors": "^3.0.0",
+        "normalize-package-data": "^5.0.0",
+        "npm-normalize-package-bin": "^3.0.0"
       },
       "engines": {
         "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/arg": {
-      "version": "4.1.3",
-      "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
-      "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
-      "dev": true
-    },
-    "node_modules/argparse": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
-      "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
-      "dev": true
-    },
-    "node_modules/args": {
-      "version": "5.0.3",
-      "resolved": "https://registry.npmjs.org/args/-/args-5.0.3.tgz",
-      "integrity": "sha512-h6k/zfFgusnv3i5TU08KQkVKuCPBtL/PWQbWkHUxvJrZ2nAyeaUupneemcrgn1xmqxPQsPIzwkUhOpoqPDRZuA==",
+    "node_modules/@npmcli/template-oss/node_modules/readable-stream": {
+      "version": "3.6.2",
+      "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+      "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
       "dev": true,
       "dependencies": {
-        "camelcase": "5.0.0",
-        "chalk": "2.4.2",
-        "leven": "2.1.0",
-        "mri": "1.1.4"
+        "inherits": "^2.0.3",
+        "string_decoder": "^1.1.1",
+        "util-deprecate": "^1.0.1"
       },
       "engines": {
-        "node": ">= 6.0.0"
+        "node": ">= 6"
       }
     },
-    "node_modules/args/node_modules/ansi-styles": {
-      "version": "3.2.1",
-      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
-      "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+    "node_modules/@npmcli/template-oss/node_modules/signal-exit": {
+      "version": "3.0.7",
+      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
+      "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+      "dev": true
+    },
+    "node_modules/@npmcli/template-oss/node_modules/sigstore": {
+      "version": "1.9.0",
+      "resolved": "https://registry.npmjs.org/sigstore/-/sigstore-1.9.0.tgz",
+      "integrity": "sha512-0Zjz0oe37d08VeOtBIuB6cRriqXse2e8w+7yIy2XSXjshRKxbc2KkhXjL229jXSxEm7UbcjS76wcJDGQddVI9A==",
       "dev": true,
       "dependencies": {
-        "color-convert": "^1.9.0"
+        "@sigstore/bundle": "^1.1.0",
+        "@sigstore/protobuf-specs": "^0.2.0",
+        "@sigstore/sign": "^1.0.0",
+        "@sigstore/tuf": "^1.0.3",
+        "make-fetch-happen": "^11.0.1"
+      },
+      "bin": {
+        "sigstore": "bin/sigstore.js"
       },
       "engines": {
-        "node": ">=4"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/args/node_modules/camelcase": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz",
-      "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==",
+    "node_modules/@npmcli/template-oss/node_modules/tuf-js": {
+      "version": "1.1.7",
+      "resolved": "https://registry.npmjs.org/tuf-js/-/tuf-js-1.1.7.tgz",
+      "integrity": "sha512-i3P9Kgw3ytjELUfpuKVDNBJvk4u5bXL6gskv572mcevPbSKCV3zt3djhmlEQ65yERjIbOSncy7U4cQJaB1CBCg==",
       "dev": true,
+      "dependencies": {
+        "@tufjs/models": "1.0.4",
+        "debug": "^4.3.4",
+        "make-fetch-happen": "^11.1.1"
+      },
       "engines": {
-        "node": ">=6"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/args/node_modules/chalk": {
-      "version": "2.4.2",
-      "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
-      "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+    "node_modules/@npmcli/template-oss/node_modules/unique-slug": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-3.0.0.tgz",
+      "integrity": "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w==",
       "dev": true,
       "dependencies": {
-        "ansi-styles": "^3.2.1",
-        "escape-string-regexp": "^1.0.5",
-        "supports-color": "^5.3.0"
+        "imurmurhash": "^0.1.4"
       },
       "engines": {
-        "node": ">=4"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/args/node_modules/color-convert": {
-      "version": "1.9.3",
-      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
-      "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+    "node_modules/@npmcli/template-oss/node_modules/which": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz",
+      "integrity": "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==",
       "dev": true,
       "dependencies": {
-        "color-name": "1.1.3"
-      }
-    },
-    "node_modules/args/node_modules/color-name": {
-      "version": "1.1.3",
-      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
-      "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
-      "dev": true
-    },
-    "node_modules/args/node_modules/escape-string-regexp": {
-      "version": "1.0.5",
-      "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
-      "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
-      "dev": true,
+        "isexe": "^2.0.0"
+      },
+      "bin": {
+        "node-which": "bin/which.js"
+      },
       "engines": {
-        "node": ">=0.8.0"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/args/node_modules/has-flag": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
-      "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
+    "node_modules/@octokit/auth-token": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-3.0.3.tgz",
+      "integrity": "sha512-/aFM2M4HVDBT/jjDBa84sJniv1t9Gm/rLkalaz9htOm+L+8JMj1k9w0CkUdcxNyNxZPlTxKPVko+m1VlM58ZVA==",
       "dev": true,
+      "dependencies": {
+        "@octokit/types": "^9.0.0"
+      },
       "engines": {
-        "node": ">=4"
+        "node": ">= 14"
       }
     },
-    "node_modules/args/node_modules/mri": {
-      "version": "1.1.4",
-      "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.4.tgz",
-      "integrity": "sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w==",
+    "node_modules/@octokit/core": {
+      "version": "4.2.0",
+      "resolved": "https://registry.npmjs.org/@octokit/core/-/core-4.2.0.tgz",
+      "integrity": "sha512-AgvDRUg3COpR82P7PBdGZF/NNqGmtMq2NiPqeSsDIeCfYFOZ9gddqWNQHnFdEUf+YwOj4aZYmJnlPp7OXmDIDg==",
       "dev": true,
+      "dependencies": {
+        "@octokit/auth-token": "^3.0.0",
+        "@octokit/graphql": "^5.0.0",
+        "@octokit/request": "^6.0.0",
+        "@octokit/request-error": "^3.0.0",
+        "@octokit/types": "^9.0.0",
+        "before-after-hook": "^2.2.0",
+        "universal-user-agent": "^6.0.0"
+      },
       "engines": {
-        "node": ">=4"
+        "node": ">= 14"
       }
     },
-    "node_modules/args/node_modules/supports-color": {
-      "version": "5.5.0",
-      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
-      "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+    "node_modules/@octokit/endpoint": {
+      "version": "7.0.5",
+      "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-7.0.5.tgz",
+      "integrity": "sha512-LG4o4HMY1Xoaec87IqQ41TQ+glvIeTKqfjkCEmt5AIwDZJwQeVZFIEYXrYY6yLwK+pAScb9Gj4q+Nz2qSw1roA==",
       "dev": true,
       "dependencies": {
-        "has-flag": "^3.0.0"
+        "@octokit/types": "^9.0.0",
+        "is-plain-object": "^5.0.0",
+        "universal-user-agent": "^6.0.0"
       },
       "engines": {
-        "node": ">=4"
+        "node": ">= 14"
       }
     },
-    "node_modules/array-buffer-byte-length": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz",
-      "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==",
+    "node_modules/@octokit/graphql": {
+      "version": "5.0.5",
+      "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.5.tgz",
+      "integrity": "sha512-Qwfvh3xdqKtIznjX9lz2D458r7dJPP8l6r4GQkIdWQouZwHQK0mVT88uwiU2bdTU2OtT1uOlKpRciUWldpG0yQ==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "call-bind": "^1.0.2",
-        "is-array-buffer": "^3.0.1"
+        "@octokit/request": "^6.0.0",
+        "@octokit/types": "^9.0.0",
+        "universal-user-agent": "^6.0.0"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
-      }
-    },
-    "node_modules/array-find-index": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
-      "integrity": "sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==",
-      "dev": true,
       "engines": {
-        "node": ">=0.10.0"
+        "node": ">= 14"
       }
     },
-    "node_modules/array-ify": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz",
-      "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==",
+    "node_modules/@octokit/openapi-types": {
+      "version": "17.1.0",
+      "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-17.1.0.tgz",
+      "integrity": "sha512-rnI26BAITDZTo5vqFOmA7oX4xRd18rO+gcK4MiTpJmsRMxAw0JmevNjPsjpry1bb9SVNo56P/0kbiyXXa4QluA==",
       "dev": true
     },
-    "node_modules/array-includes": {
-      "version": "3.1.6",
-      "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz",
-      "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==",
+    "node_modules/@octokit/plugin-paginate-rest": {
+      "version": "6.0.0",
+      "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-6.0.0.tgz",
+      "integrity": "sha512-Sq5VU1PfT6/JyuXPyt04KZNVsFOSBaYOAq2QRZUwzVlI10KFvcbUo8lR258AAQL1Et60b0WuVik+zOWKLuDZxw==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "call-bind": "^1.0.2",
-        "define-properties": "^1.1.4",
-        "es-abstract": "^1.20.4",
-        "get-intrinsic": "^1.1.3",
-        "is-string": "^1.0.7"
+        "@octokit/types": "^9.0.0"
       },
       "engines": {
-        "node": ">= 0.4"
+        "node": ">= 14"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+      "peerDependencies": {
+        "@octokit/core": ">=4"
       }
     },
-    "node_modules/array.prototype.flat": {
-      "version": "1.3.1",
-      "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz",
-      "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==",
+    "node_modules/@octokit/plugin-request-log": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz",
+      "integrity": "sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==",
+      "dev": true,
+      "peerDependencies": {
+        "@octokit/core": ">=3"
+      }
+    },
+    "node_modules/@octokit/plugin-rest-endpoint-methods": {
+      "version": "7.0.1",
+      "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-7.0.1.tgz",
+      "integrity": "sha512-pnCaLwZBudK5xCdrR823xHGNgqOzRnJ/mpC/76YPpNP7DybdsJtP7mdOwh+wYZxK5jqeQuhu59ogMI4NRlBUvA==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "call-bind": "^1.0.2",
-        "define-properties": "^1.1.4",
-        "es-abstract": "^1.20.4",
-        "es-shim-unscopables": "^1.0.0"
+        "@octokit/types": "^9.0.0",
+        "deprecation": "^2.3.1"
       },
       "engines": {
-        "node": ">= 0.4"
+        "node": ">= 14"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+      "peerDependencies": {
+        "@octokit/core": ">=3"
       }
     },
-    "node_modules/array.prototype.flatmap": {
-      "version": "1.3.1",
-      "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.1.tgz",
-      "integrity": "sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==",
+    "node_modules/@octokit/request": {
+      "version": "6.2.3",
+      "resolved": "https://registry.npmjs.org/@octokit/request/-/request-6.2.3.tgz",
+      "integrity": "sha512-TNAodj5yNzrrZ/VxP+H5HiYaZep0H3GU0O7PaF+fhDrt8FPrnkei9Aal/txsN/1P7V3CPiThG0tIvpPDYUsyAA==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "call-bind": "^1.0.2",
-        "define-properties": "^1.1.4",
-        "es-abstract": "^1.20.4",
-        "es-shim-unscopables": "^1.0.0"
+        "@octokit/endpoint": "^7.0.0",
+        "@octokit/request-error": "^3.0.0",
+        "@octokit/types": "^9.0.0",
+        "is-plain-object": "^5.0.0",
+        "node-fetch": "^2.6.7",
+        "universal-user-agent": "^6.0.0"
       },
       "engines": {
-        "node": ">= 0.4"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "node": ">= 14"
       }
     },
-    "node_modules/arrify": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
-      "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==",
+    "node_modules/@octokit/request-error": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-3.0.3.tgz",
+      "integrity": "sha512-crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ==",
       "dev": true,
+      "dependencies": {
+        "@octokit/types": "^9.0.0",
+        "deprecation": "^2.0.0",
+        "once": "^1.4.0"
+      },
       "engines": {
-        "node": ">=0.10.0"
+        "node": ">= 14"
       }
     },
-    "node_modules/async-hook-domain": {
-      "version": "2.0.4",
-      "resolved": "https://registry.npmjs.org/async-hook-domain/-/async-hook-domain-2.0.4.tgz",
-      "integrity": "sha512-14LjCmlK1PK8eDtTezR6WX8TMaYNIzBIsd2D1sGoGjgx0BuNMMoSdk7i/drlbtamy0AWv9yv2tkB+ASdmeqFIw==",
+    "node_modules/@octokit/rest": {
+      "version": "19.0.7",
+      "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-19.0.7.tgz",
+      "integrity": "sha512-HRtSfjrWmWVNp2uAkEpQnuGMJsu/+dBr47dRc5QVgsCbnIc1+GFEaoKBWkYG+zjrsHpSqcAElMio+n10c0b5JA==",
       "dev": true,
+      "dependencies": {
+        "@octokit/core": "^4.1.0",
+        "@octokit/plugin-paginate-rest": "^6.0.0",
+        "@octokit/plugin-request-log": "^1.0.4",
+        "@octokit/plugin-rest-endpoint-methods": "^7.0.0"
+      },
       "engines": {
-        "node": ">=10"
+        "node": ">= 14"
       }
     },
-    "node_modules/async-retry": {
-      "version": "1.3.3",
-      "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz",
-      "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==",
+    "node_modules/@octokit/types": {
+      "version": "9.2.0",
+      "resolved": "https://registry.npmjs.org/@octokit/types/-/types-9.2.0.tgz",
+      "integrity": "sha512-xySzJG4noWrIBFyMu4lg4tu9vAgNg9S0aoLRONhAEz6ueyi1evBzb40HitIosaYS4XOexphG305IVcLrIX/30g==",
       "dev": true,
       "dependencies": {
-        "retry": "0.13.1"
+        "@octokit/openapi-types": "^17.1.0"
       }
     },
-    "node_modules/async-retry/node_modules/retry": {
-      "version": "0.13.1",
-      "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
-      "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
-      "dev": true,
-      "engines": {
-        "node": ">= 4"
-      }
-    },
-    "node_modules/asynckit": {
-      "version": "0.4.0",
-      "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
-      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
-      "dev": true
-    },
-    "node_modules/available-typed-arrays": {
-      "version": "1.0.5",
-      "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz",
-      "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==",
-      "dev": true,
-      "peer": true,
+    "node_modules/@pkgjs/parseargs": {
+      "version": "0.11.0",
+      "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
+      "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
+      "inBundle": true,
+      "optional": true,
       "engines": {
-        "node": ">= 0.4"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "node": ">=14"
       }
     },
-    "node_modules/b4a": {
-      "version": "1.6.4",
-      "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz",
-      "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==",
-      "dev": true
-    },
-    "node_modules/bail": {
-      "version": "2.0.2",
-      "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz",
-      "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==",
-      "dev": true,
-      "funding": {
-        "type": "github",
-        "url": "https://github.com/sponsors/wooorm"
+    "node_modules/@sigstore/bundle": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-2.1.0.tgz",
+      "integrity": "sha512-89uOo6yh/oxaU8AeOUnVrTdVMcGk9Q1hJa7Hkvalc6G3Z3CupWk4Xe9djSgJm9fMkH69s0P0cVHUoKSOemLdng==",
+      "inBundle": true,
+      "dependencies": {
+        "@sigstore/protobuf-specs": "^0.2.1"
+      },
+      "engines": {
+        "node": "^16.14.0 || >=18.0.0"
       }
     },
-    "node_modules/balanced-match": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
-      "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
-      "inBundle": true
-    },
-    "node_modules/base64-js": {
-      "version": "1.5.1",
-      "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
-      "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
-      "funding": [
-        {
-          "type": "github",
-          "url": "https://github.com/sponsors/feross"
-        },
-        {
-          "type": "patreon",
-          "url": "https://www.patreon.com/feross"
-        },
-        {
-          "type": "consulting",
-          "url": "https://feross.org/support"
-        }
-      ],
-      "inBundle": true
-    },
-    "node_modules/basic-auth-parser": {
-      "version": "0.0.2-1",
-      "resolved": "https://registry.npmjs.org/basic-auth-parser/-/basic-auth-parser-0.0.2-1.tgz",
-      "integrity": "sha512-GFj8iVxo9onSU6BnnQvVwqvxh60UcSHJEDnIk3z4B6iOjsKSmqe+ibW0Rsz7YO7IE1HG3D3tqCNIidP46SZVdQ==",
-      "dev": true
-    },
-    "node_modules/before-after-hook": {
-      "version": "2.2.3",
-      "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
-      "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==",
-      "dev": true
-    },
-    "node_modules/benchmark": {
-      "version": "2.1.4",
-      "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz",
-      "integrity": "sha512-l9MlfN4M1K/H2fbhfMy3B7vJd6AGKJVQn2h6Sg/Yx+KckoUA7ewS5Vv6TjSq18ooE1kS9hhAlQRH3AkXIh/aOQ==",
-      "dev": true,
-      "dependencies": {
-        "lodash": "^4.17.4",
-        "platform": "^1.3.3"
+    "node_modules/@sigstore/protobuf-specs": {
+      "version": "0.2.1",
+      "resolved": "https://registry.npmjs.org/@sigstore/protobuf-specs/-/protobuf-specs-0.2.1.tgz",
+      "integrity": "sha512-XTWVxnWJu+c1oCshMLwnKvz8ZQJJDVOlciMfgpJBQbThVjKTCG8dwyhgLngBD2KN0ap9F/gOV8rFDEx8uh7R2A==",
+      "inBundle": true,
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/bin-links": {
-      "version": "4.0.3",
-      "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-4.0.3.tgz",
-      "integrity": "sha512-obsRaULtJurnfox/MDwgq6Yo9kzbv1CPTk/1/s7Z/61Lezc8IKkFCOXNeVLXz0456WRzBQmSsDWlai2tIhBsfA==",
+    "node_modules/@sigstore/sign": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/@sigstore/sign/-/sign-2.1.0.tgz",
+      "integrity": "sha512-4VRpfJxs+8eLqzLVrZngVNExVA/zAhVbi4UT4zmtLi4xRd7vz5qie834OgkrGsLlLB1B2nz/3wUxT1XAUBe8gw==",
+      "inBundle": true,
       "dependencies": {
-        "cmd-shim": "^6.0.0",
-        "npm-normalize-package-bin": "^3.0.0",
-        "read-cmd-shim": "^4.0.0",
-        "write-file-atomic": "^5.0.0"
+        "@sigstore/bundle": "^2.1.0",
+        "@sigstore/protobuf-specs": "^0.2.1",
+        "make-fetch-happen": "^13.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^16.14.0 || >=18.0.0"
       }
     },
-    "node_modules/binary-extensions": {
-      "version": "2.2.0",
-      "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
-      "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+    "node_modules/@sigstore/tuf": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/@sigstore/tuf/-/tuf-2.1.0.tgz",
+      "integrity": "sha512-BUoVCx+7Wj+8moEGvUU2MyBI+f93lmg1CLmoG6KrhQMeDyAG8HAZNk+YRCNuvwvSDCfPhwsj37Bg63/Q+bnGsw==",
+      "inBundle": true,
+      "dependencies": {
+        "@sigstore/protobuf-specs": "^0.2.1",
+        "tuf-js": "^2.1.0"
+      },
       "engines": {
-        "node": ">=8"
+        "node": "^16.14.0 || >=18.0.0"
       }
     },
-    "node_modules/bind-obj-methods": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/bind-obj-methods/-/bind-obj-methods-3.0.0.tgz",
-      "integrity": "sha512-nLEaaz3/sEzNSyPWRsN9HNsqwk1AUyECtGj+XwGdIi3xABnEqecvXtIJ0wehQXuuER5uZ/5fTs2usONgYjG+iw==",
-      "dev": true,
+    "node_modules/@tootallnate/once": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
+      "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==",
+      "inBundle": true,
       "engines": {
-        "node": ">=10"
+        "node": ">= 10"
       }
     },
-    "node_modules/boolbase": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
-      "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",
+    "node_modules/@tsconfig/node10": {
+      "version": "1.0.9",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
+      "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
       "dev": true
     },
-    "node_modules/brace-expansion": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
-      "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+    "node_modules/@tsconfig/node12": {
+      "version": "1.0.11",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
+      "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
+      "dev": true
+    },
+    "node_modules/@tsconfig/node14": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
+      "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
+      "dev": true
+    },
+    "node_modules/@tsconfig/node16": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
+      "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
+      "dev": true
+    },
+    "node_modules/@tufjs/canonical-json": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz",
+      "integrity": "sha512-yVtV8zsdo8qFHe+/3kw81dSLyF7D576A5cCFCi4X7B39tWT7SekaEFUnvnWJHz+9qO7qJTah1JbrDjWKqFtdWA==",
       "inBundle": true,
-      "dependencies": {
-        "balanced-match": "^1.0.0"
+      "engines": {
+        "node": "^16.14.0 || >=18.0.0"
       }
     },
-    "node_modules/braces": {
-      "version": "3.0.2",
-      "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
-      "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
-      "dev": true,
+    "node_modules/@tufjs/models": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/@tufjs/models/-/models-2.0.0.tgz",
+      "integrity": "sha512-c8nj8BaOExmZKO2DXhDfegyhSGcG9E/mPN3U13L+/PsoWm1uaGiHHjxqSHQiasDBQwDA3aHuw9+9spYAP1qvvg==",
+      "inBundle": true,
       "dependencies": {
-        "fill-range": "^7.0.1"
+        "@tufjs/canonical-json": "2.0.0",
+        "minimatch": "^9.0.3"
       },
       "engines": {
-        "node": ">=8"
+        "node": "^16.14.0 || >=18.0.0"
       }
     },
-    "node_modules/browserslist": {
-      "version": "4.21.5",
-      "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz",
-      "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==",
+    "node_modules/@tufjs/repo-mock": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/@tufjs/repo-mock/-/repo-mock-2.0.0.tgz",
+      "integrity": "sha512-z0OtgGBn05dhpcvLaOMQPG1V16zOAL8+2A/L6EGIUE8pOP6PMX6vlJGSsN9JQ9glakXupCN4fdX8JF9XrNYUrw==",
       "dev": true,
-      "funding": [
-        {
-          "type": "opencollective",
-          "url": "https://opencollective.com/browserslist"
-        },
-        {
-          "type": "tidelift",
-          "url": "https://tidelift.com/funding/github/npm/browserslist"
-        }
-      ],
       "dependencies": {
-        "caniuse-lite": "^1.0.30001449",
-        "electron-to-chromium": "^1.4.284",
-        "node-releases": "^2.0.8",
-        "update-browserslist-db": "^1.0.10"
-      },
-      "bin": {
-        "browserslist": "cli.js"
+        "@tufjs/models": "2.0.0",
+        "nock": "^13.3.3"
       },
       "engines": {
-        "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
+        "node": "^16.14.0 || >=18.0.0"
       }
     },
-    "node_modules/buffer": {
-      "version": "6.0.3",
-      "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
-      "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
-      "funding": [
-        {
-          "type": "github",
-          "url": "https://github.com/sponsors/feross"
-        },
-        {
-          "type": "patreon",
-          "url": "https://www.patreon.com/feross"
-        },
-        {
-          "type": "consulting",
-          "url": "https://feross.org/support"
-        }
-      ],
-      "inBundle": true,
+    "node_modules/@types/debug": {
+      "version": "4.1.7",
+      "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz",
+      "integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==",
+      "dev": true,
       "dependencies": {
-        "base64-js": "^1.3.1",
-        "ieee754": "^1.2.1"
+        "@types/ms": "*"
       }
     },
-    "node_modules/buffer-from": {
-      "version": "1.1.2",
-      "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
-      "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
-      "dev": true
-    },
-    "node_modules/builtins": {
-      "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz",
-      "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==",
-      "inBundle": true,
+    "node_modules/@types/hast": {
+      "version": "2.3.4",
+      "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.4.tgz",
+      "integrity": "sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==",
+      "dev": true,
       "dependencies": {
-        "semver": "^7.0.0"
+        "@types/unist": "*"
       }
     },
-    "node_modules/cacache": {
-      "version": "18.0.0",
-      "resolved": "https://registry.npmjs.org/cacache/-/cacache-18.0.0.tgz",
-      "integrity": "sha512-I7mVOPl3PUCeRub1U8YoGz2Lqv9WOBpobZ8RyWFXmReuILz+3OAyTa5oH3QPdtKZD7N0Yk00aLfzn0qvp8dZ1w==",
-      "inBundle": true,
-      "dependencies": {
-        "@npmcli/fs": "^3.1.0",
-        "fs-minipass": "^3.0.0",
-        "glob": "^10.2.2",
-        "lru-cache": "^10.0.1",
-        "minipass": "^7.0.3",
-        "minipass-collect": "^1.0.2",
-        "minipass-flush": "^1.0.5",
-        "minipass-pipeline": "^1.2.4",
-        "p-map": "^4.0.0",
-        "ssri": "^10.0.0",
-        "tar": "^6.1.11",
-        "unique-filename": "^3.0.0"
-      },
-      "engines": {
-        "node": "^16.14.0 || >=18.0.0"
-      }
+    "node_modules/@types/json5": {
+      "version": "0.0.29",
+      "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
+      "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
+      "dev": true,
+      "peer": true
     },
-    "node_modules/caching-transform": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz",
-      "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==",
+    "node_modules/@types/mdast": {
+      "version": "3.0.11",
+      "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.11.tgz",
+      "integrity": "sha512-Y/uImid8aAwrEA24/1tcRZwpxX3pIFTSilcNDKSPn+Y2iDywSEachzRuvgAYYLR3wpGXAsMbv5lvKLDZLeYPAw==",
       "dev": true,
       "dependencies": {
-        "hasha": "^5.0.0",
-        "make-dir": "^3.0.0",
-        "package-hash": "^4.0.0",
-        "write-file-atomic": "^3.0.0"
-      },
-      "engines": {
-        "node": ">=8"
+        "@types/unist": "*"
       }
     },
-    "node_modules/caching-transform/node_modules/signal-exit": {
-      "version": "3.0.7",
-      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
-      "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+    "node_modules/@types/minimist": {
+      "version": "1.2.2",
+      "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz",
+      "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==",
       "dev": true
     },
-    "node_modules/caching-transform/node_modules/write-file-atomic": {
-      "version": "3.0.3",
-      "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz",
-      "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==",
-      "dev": true,
-      "dependencies": {
-        "imurmurhash": "^0.1.4",
-        "is-typedarray": "^1.0.0",
-        "signal-exit": "^3.0.2",
-        "typedarray-to-buffer": "^3.1.5"
-      }
+    "node_modules/@types/ms": {
+      "version": "0.7.31",
+      "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz",
+      "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==",
+      "dev": true
     },
-    "node_modules/call-bind": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
-      "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
+    "node_modules/@types/node": {
+      "version": "18.16.3",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz",
+      "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==",
+      "dev": true
+    },
+    "node_modules/@types/normalize-package-data": {
+      "version": "2.4.1",
+      "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz",
+      "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==",
+      "dev": true
+    },
+    "node_modules/@types/npm-package-arg": {
+      "version": "6.1.1",
+      "resolved": "https://registry.npmjs.org/@types/npm-package-arg/-/npm-package-arg-6.1.1.tgz",
+      "integrity": "sha512-452/1Kp9IdM/oR10AyqAgZOxUt7eLbm+EMJ194L6oarMYdZNiFIFAOJ7IIr0OrZXTySgfHjJezh2oiyk2kc3ag==",
+      "dev": true
+    },
+    "node_modules/@types/parse5": {
+      "version": "6.0.3",
+      "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz",
+      "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==",
+      "dev": true
+    },
+    "node_modules/@types/unist": {
+      "version": "2.0.6",
+      "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz",
+      "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==",
+      "dev": true
+    },
+    "node_modules/@types/yargs": {
+      "version": "16.0.5",
+      "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.5.tgz",
+      "integrity": "sha512-AxO/ADJOBFJScHbWhq2xAhlWP24rY4aCEG/NFaMvbT3X2MgRsLjhjQwsn0Zi5zn0LG9jUhCCZMeX9Dkuw6k+vQ==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "function-bind": "^1.1.1",
-        "get-intrinsic": "^1.0.2"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "@types/yargs-parser": "*"
       }
     },
-    "node_modules/caller": {
-      "version": "1.1.0",
-      "resolved": "https://registry.npmjs.org/caller/-/caller-1.1.0.tgz",
-      "integrity": "sha512-n+21IZC3j06YpCWaxmUy5AnVqhmCIM2bQtqQyy00HJlmStRt6kwDX5F9Z97pqwAB+G/tgSz6q/kUBbNyQzIubw==",
+    "node_modules/@types/yargs-parser": {
+      "version": "21.0.0",
+      "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz",
+      "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==",
       "dev": true
     },
-    "node_modules/callsites": {
-      "version": "3.1.0",
-      "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
-      "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
+    "node_modules/@xmldom/xmldom": {
+      "version": "0.8.7",
+      "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.7.tgz",
+      "integrity": "sha512-sI1Ly2cODlWStkINzqGrZ8K6n+MTSbAeQnAipGyL+KZCXuHaRlj2gyyy8B/9MvsFFqN7XHryQnB2QwhzvJXovg==",
       "dev": true,
       "engines": {
-        "node": ">=6"
+        "node": ">=10.0.0"
       }
     },
-    "node_modules/camelcase": {
-      "version": "5.3.1",
-      "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
-      "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
-      "dev": true,
+    "node_modules/abab": {
+      "version": "2.0.6",
+      "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
+      "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==",
+      "dev": true
+    },
+    "node_modules/abbrev": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-2.0.0.tgz",
+      "integrity": "sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==",
+      "inBundle": true,
       "engines": {
-        "node": ">=6"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/camelcase-keys": {
-      "version": "6.2.2",
-      "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz",
-      "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==",
-      "dev": true,
+    "node_modules/abort-controller": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
+      "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
+      "inBundle": true,
       "dependencies": {
-        "camelcase": "^5.3.1",
-        "map-obj": "^4.0.0",
-        "quick-lru": "^4.0.1"
+        "event-target-shim": "^5.0.0"
       },
       "engines": {
-        "node": ">=8"
+        "node": ">=6.5"
+      }
+    },
+    "node_modules/acorn": {
+      "version": "8.8.2",
+      "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
+      "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
+      "dev": true,
+      "bin": {
+        "acorn": "bin/acorn"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/sindresorhus"
+      "engines": {
+        "node": ">=0.4.0"
       }
     },
-    "node_modules/caniuse-lite": {
-      "version": "1.0.30001482",
-      "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001482.tgz",
-      "integrity": "sha512-F1ZInsg53cegyjroxLNW9DmrEQ1SuGRTO1QlpA0o2/6OpQ0gFeDRoq1yFmnr8Sakn9qwwt9DmbxHB6w167OSuQ==",
+    "node_modules/acorn-globals": {
+      "version": "7.0.1",
+      "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz",
+      "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==",
       "dev": true,
-      "funding": [
-        {
-          "type": "opencollective",
-          "url": "https://opencollective.com/browserslist"
-        },
-        {
-          "type": "tidelift",
-          "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
-        },
-        {
-          "type": "github",
-          "url": "https://github.com/sponsors/ai"
-        }
-      ]
+      "dependencies": {
+        "acorn": "^8.1.0",
+        "acorn-walk": "^8.0.2"
+      }
     },
-    "node_modules/ccount": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz",
-      "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==",
+    "node_modules/acorn-jsx": {
+      "version": "5.3.2",
+      "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+      "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
       "dev": true,
-      "funding": {
-        "type": "github",
-        "url": "https://github.com/sponsors/wooorm"
+      "peer": true,
+      "peerDependencies": {
+        "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
       }
     },
-    "node_modules/chalk": {
-      "version": "5.3.0",
-      "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz",
-      "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==",
-      "inBundle": true,
+    "node_modules/acorn-walk": {
+      "version": "8.2.0",
+      "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
+      "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
+      "dev": true,
       "engines": {
-        "node": "^12.17.0 || ^14.13 || >=16.0.0"
-      },
-      "funding": {
-        "url": "https://github.com/chalk/chalk?sponsor=1"
+        "node": ">=0.4.0"
       }
     },
-    "node_modules/character-entities": {
-      "version": "2.0.2",
-      "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz",
-      "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==",
-      "dev": true,
-      "funding": {
-        "type": "github",
-        "url": "https://github.com/sponsors/wooorm"
+    "node_modules/agent-base": {
+      "version": "6.0.2",
+      "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
+      "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
+      "inBundle": true,
+      "dependencies": {
+        "debug": "4"
+      },
+      "engines": {
+        "node": ">= 6.0.0"
       }
     },
-    "node_modules/character-entities-html4": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz",
-      "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==",
-      "dev": true,
-      "funding": {
-        "type": "github",
-        "url": "https://github.com/sponsors/wooorm"
+    "node_modules/agentkeepalive": {
+      "version": "4.5.0",
+      "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz",
+      "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==",
+      "inBundle": true,
+      "dependencies": {
+        "humanize-ms": "^1.2.1"
+      },
+      "engines": {
+        "node": ">= 8.0.0"
       }
     },
-    "node_modules/character-entities-legacy": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz",
-      "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==",
+    "node_modules/aggregate-error": {
+      "version": "3.1.0",
+      "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz",
+      "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==",
+      "inBundle": true,
+      "dependencies": {
+        "clean-stack": "^2.0.0",
+        "indent-string": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/ajv": {
+      "version": "8.12.0",
+      "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz",
+      "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==",
       "dev": true,
+      "dependencies": {
+        "fast-deep-equal": "^3.1.1",
+        "json-schema-traverse": "^1.0.0",
+        "require-from-string": "^2.0.2",
+        "uri-js": "^4.2.2"
+      },
       "funding": {
         "type": "github",
-        "url": "https://github.com/sponsors/wooorm"
+        "url": "https://github.com/sponsors/epoberezkin"
       }
     },
-    "node_modules/chokidar": {
-      "version": "3.5.3",
-      "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
-      "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
+    "node_modules/ajv-formats": {
+      "version": "2.1.1",
+      "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz",
+      "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",
       "dev": true,
-      "funding": [
-        {
-          "type": "individual",
-          "url": "https://paulmillr.com/funding/"
-        }
-      ],
       "dependencies": {
-        "anymatch": "~3.1.2",
-        "braces": "~3.0.2",
-        "glob-parent": "~5.1.2",
-        "is-binary-path": "~2.1.0",
-        "is-glob": "~4.0.1",
-        "normalize-path": "~3.0.0",
-        "readdirp": "~3.6.0"
+        "ajv": "^8.0.0"
       },
-      "engines": {
-        "node": ">= 8.10.0"
+      "peerDependencies": {
+        "ajv": "^8.0.0"
       },
-      "optionalDependencies": {
-        "fsevents": "~2.3.2"
+      "peerDependenciesMeta": {
+        "ajv": {
+          "optional": true
+        }
       }
     },
-    "node_modules/chokidar/node_modules/glob-parent": {
-      "version": "5.1.2",
-      "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
-      "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+    "node_modules/ajv-formats-draft2019": {
+      "version": "1.6.1",
+      "resolved": "https://registry.npmjs.org/ajv-formats-draft2019/-/ajv-formats-draft2019-1.6.1.tgz",
+      "integrity": "sha512-JQPvavpkWDvIsBp2Z33UkYCtXCSpW4HD3tAZ+oL4iEFOk9obQZffx0yANwECt6vzr6ET+7HN5czRyqXbnq/u0Q==",
       "dev": true,
       "dependencies": {
-        "is-glob": "^4.0.1"
+        "punycode": "^2.1.1",
+        "schemes": "^1.4.0",
+        "smtp-address-parser": "^1.0.3",
+        "uri-js": "^4.4.1"
       },
-      "engines": {
-        "node": ">= 6"
-      }
-    },
-    "node_modules/chownr": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
-      "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
-      "inBundle": true,
-      "engines": {
-        "node": ">=10"
+      "peerDependencies": {
+        "ajv": "*"
       }
     },
-    "node_modules/ci-info": {
-      "version": "3.9.0",
-      "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
-      "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
-      "funding": [
-        {
-          "type": "github",
-          "url": "https://github.com/sponsors/sibiraj-s"
-        }
-      ],
+    "node_modules/ansi-regex": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+      "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
       "inBundle": true,
       "engines": {
         "node": ">=8"
       }
     },
-    "node_modules/cidr-regex": {
-      "version": "3.1.1",
-      "resolved": "https://registry.npmjs.org/cidr-regex/-/cidr-regex-3.1.1.tgz",
-      "integrity": "sha512-RBqYd32aDwbCMFJRL6wHOlDNYJsPNTt8vC82ErHF5vKt8QQzxm1FrkW8s/R5pVrXMf17sba09Uoy91PKiddAsw==",
+    "node_modules/ansi-styles": {
+      "version": "4.3.0",
+      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+      "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
       "inBundle": true,
       "dependencies": {
-        "ip-regex": "^4.1.0"
+        "color-convert": "^2.0.1"
       },
       "engines": {
-        "node": ">=10"
+        "node": ">=8"
+      },
+      "funding": {
+        "url": "https://github.com/chalk/ansi-styles?sponsor=1"
       }
     },
-    "node_modules/clean-stack": {
-      "version": "2.2.0",
-      "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
-      "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==",
-      "inBundle": true,
+    "node_modules/anymatch": {
+      "version": "3.1.3",
+      "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
+      "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
+      "dev": true,
+      "dependencies": {
+        "normalize-path": "^3.0.0",
+        "picomatch": "^2.0.4"
+      },
       "engines": {
-        "node": ">=6"
+        "node": ">= 8"
       }
     },
-    "node_modules/cli-columns": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/cli-columns/-/cli-columns-4.0.0.tgz",
-      "integrity": "sha512-XW2Vg+w+L9on9wtwKpyzluIPCWXjaBahI7mTcYjx+BVIYD9c3yqcv/yKC7CmdCZat4rq2yiE1UMSJC5ivKfMtQ==",
-      "inBundle": true,
+    "node_modules/append-transform": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz",
+      "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==",
+      "dev": true,
       "dependencies": {
-        "string-width": "^4.2.3",
-        "strip-ansi": "^6.0.1"
+        "default-require-extensions": "^3.0.0"
       },
       "engines": {
-        "node": ">= 10"
+        "node": ">=8"
       }
     },
-    "node_modules/cli-table3": {
-      "version": "0.6.3",
-      "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz",
-      "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==",
+    "node_modules/aproba": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz",
+      "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==",
+      "inBundle": true
+    },
+    "node_modules/archy": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz",
+      "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==",
+      "inBundle": true
+    },
+    "node_modules/are-we-there-yet": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-4.0.1.tgz",
+      "integrity": "sha512-2zuA+jpOYBRgoBCfa+fB87Rk0oGJjDX6pxGzqH6f33NzUhG25Xur6R0u0Z9VVAq8Z5JvQpQI6j6rtonuivC8QA==",
       "inBundle": true,
       "dependencies": {
-        "string-width": "^4.2.0"
+        "delegates": "^1.0.0",
+        "readable-stream": "^4.1.0"
       },
       "engines": {
-        "node": "10.* || >= 12.*"
-      },
-      "optionalDependencies": {
-        "@colors/colors": "1.5.0"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/cliui": {
-      "version": "8.0.1",
-      "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
-      "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
+    "node_modules/arg": {
+      "version": "4.1.3",
+      "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
+      "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
+      "dev": true
+    },
+    "node_modules/argparse": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+      "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+      "dev": true
+    },
+    "node_modules/args": {
+      "version": "5.0.3",
+      "resolved": "https://registry.npmjs.org/args/-/args-5.0.3.tgz",
+      "integrity": "sha512-h6k/zfFgusnv3i5TU08KQkVKuCPBtL/PWQbWkHUxvJrZ2nAyeaUupneemcrgn1xmqxPQsPIzwkUhOpoqPDRZuA==",
       "dev": true,
       "dependencies": {
-        "string-width": "^4.2.0",
-        "strip-ansi": "^6.0.1",
-        "wrap-ansi": "^7.0.0"
+        "camelcase": "5.0.0",
+        "chalk": "2.4.2",
+        "leven": "2.1.0",
+        "mri": "1.1.4"
       },
       "engines": {
-        "node": ">=12"
+        "node": ">= 6.0.0"
       }
     },
-    "node_modules/cliui/node_modules/wrap-ansi": {
-      "version": "7.0.0",
-      "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
-      "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+    "node_modules/args/node_modules/ansi-styles": {
+      "version": "3.2.1",
+      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+      "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
       "dev": true,
       "dependencies": {
-        "ansi-styles": "^4.0.0",
-        "string-width": "^4.1.0",
-        "strip-ansi": "^6.0.0"
+        "color-convert": "^1.9.0"
       },
       "engines": {
-        "node": ">=10"
-      },
-      "funding": {
-        "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+        "node": ">=4"
       }
     },
-    "node_modules/clone": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
-      "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==",
-      "inBundle": true,
+    "node_modules/args/node_modules/camelcase": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz",
+      "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==",
+      "dev": true,
       "engines": {
-        "node": ">=0.8"
+        "node": ">=6"
       }
     },
-    "node_modules/cmd-shim": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-6.0.2.tgz",
-      "integrity": "sha512-+FFYbB0YLaAkhkcrjkyNLYDiOsFSfRjwjY19LXk/psmMx1z00xlCv7hhQoTGXXIKi+YXHL/iiFo8NqMVQX9nOw==",
+    "node_modules/args/node_modules/chalk": {
+      "version": "2.4.2",
+      "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+      "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+      "dev": true,
+      "dependencies": {
+        "ansi-styles": "^3.2.1",
+        "escape-string-regexp": "^1.0.5",
+        "supports-color": "^5.3.0"
+      },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">=4"
       }
     },
-    "node_modules/code-point-at": {
-      "version": "1.1.0",
-      "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
-      "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==",
+    "node_modules/args/node_modules/color-convert": {
+      "version": "1.9.3",
+      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+      "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
       "dev": true,
-      "engines": {
-        "node": ">=0.10.0"
+      "dependencies": {
+        "color-name": "1.1.3"
       }
     },
-    "node_modules/code-suggester": {
-      "version": "4.3.2",
-      "resolved": "https://registry.npmjs.org/code-suggester/-/code-suggester-4.3.2.tgz",
-      "integrity": "sha512-n02zMwcyHtPLQQbQDpBhxjiN3t0i6ifFlffmRP3o+VEfp3RpUZs8NmZUBcl+5KRfPws/hDeYKaVndVQly8IVFA==",
+    "node_modules/args/node_modules/color-name": {
+      "version": "1.1.3",
+      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+      "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
+      "dev": true
+    },
+    "node_modules/args/node_modules/escape-string-regexp": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+      "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
       "dev": true,
-      "dependencies": {
-        "@octokit/rest": "^19.0.5",
-        "@types/yargs": "^16.0.0",
-        "async-retry": "^1.3.1",
-        "diff": "^5.0.0",
-        "glob": "^7.1.6",
-        "parse-diff": "^0.11.0",
-        "yargs": "^16.0.0"
-      },
-      "bin": {
-        "code-suggester": "build/src/bin/code-suggester.js"
-      },
       "engines": {
-        "node": ">=14.0.0"
+        "node": ">=0.8.0"
       }
     },
-    "node_modules/code-suggester/node_modules/brace-expansion": {
-      "version": "1.1.11",
-      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
-      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+    "node_modules/args/node_modules/has-flag": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+      "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
       "dev": true,
-      "dependencies": {
-        "balanced-match": "^1.0.0",
-        "concat-map": "0.0.1"
+      "engines": {
+        "node": ">=4"
       }
     },
-    "node_modules/code-suggester/node_modules/cliui": {
-      "version": "7.0.4",
-      "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
-      "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
+    "node_modules/args/node_modules/mri": {
+      "version": "1.1.4",
+      "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.4.tgz",
+      "integrity": "sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w==",
       "dev": true,
-      "dependencies": {
-        "string-width": "^4.2.0",
-        "strip-ansi": "^6.0.0",
-        "wrap-ansi": "^7.0.0"
+      "engines": {
+        "node": ">=4"
       }
     },
-    "node_modules/code-suggester/node_modules/glob": {
-      "version": "7.2.3",
-      "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
-      "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
+    "node_modules/args/node_modules/supports-color": {
+      "version": "5.5.0",
+      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+      "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
       "dev": true,
       "dependencies": {
-        "fs.realpath": "^1.0.0",
-        "inflight": "^1.0.4",
-        "inherits": "2",
-        "minimatch": "^3.1.1",
-        "once": "^1.3.0",
-        "path-is-absolute": "^1.0.0"
+        "has-flag": "^3.0.0"
       },
       "engines": {
-        "node": "*"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
+        "node": ">=4"
       }
     },
-    "node_modules/code-suggester/node_modules/minimatch": {
-      "version": "3.1.2",
-      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
-      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+    "node_modules/array-buffer-byte-length": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz",
+      "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "brace-expansion": "^1.1.7"
+        "call-bind": "^1.0.2",
+        "is-array-buffer": "^3.0.1"
       },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/array-find-index": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
+      "integrity": "sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==",
+      "dev": true,
       "engines": {
-        "node": "*"
+        "node": ">=0.10.0"
       }
     },
-    "node_modules/code-suggester/node_modules/wrap-ansi": {
-      "version": "7.0.0",
-      "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
-      "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+    "node_modules/array-ify": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz",
+      "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==",
+      "dev": true
+    },
+    "node_modules/array-includes": {
+      "version": "3.1.6",
+      "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz",
+      "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "ansi-styles": "^4.0.0",
-        "string-width": "^4.1.0",
-        "strip-ansi": "^6.0.0"
+        "call-bind": "^1.0.2",
+        "define-properties": "^1.1.4",
+        "es-abstract": "^1.20.4",
+        "get-intrinsic": "^1.1.3",
+        "is-string": "^1.0.7"
       },
       "engines": {
-        "node": ">=10"
+        "node": ">= 0.4"
       },
       "funding": {
-        "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/code-suggester/node_modules/yargs": {
-      "version": "16.2.0",
-      "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
-      "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
+    "node_modules/array.prototype.flat": {
+      "version": "1.3.1",
+      "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz",
+      "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "cliui": "^7.0.2",
-        "escalade": "^3.1.1",
-        "get-caller-file": "^2.0.5",
-        "require-directory": "^2.1.1",
-        "string-width": "^4.2.0",
-        "y18n": "^5.0.5",
-        "yargs-parser": "^20.2.2"
+        "call-bind": "^1.0.2",
+        "define-properties": "^1.1.4",
+        "es-abstract": "^1.20.4",
+        "es-shim-unscopables": "^1.0.0"
       },
       "engines": {
-        "node": ">=10"
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/color-convert": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
-      "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
-      "inBundle": true,
+    "node_modules/array.prototype.flatmap": {
+      "version": "1.3.1",
+      "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.1.tgz",
+      "integrity": "sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==",
+      "dev": true,
+      "peer": true,
       "dependencies": {
-        "color-name": "~1.1.4"
+        "call-bind": "^1.0.2",
+        "define-properties": "^1.1.4",
+        "es-abstract": "^1.20.4",
+        "es-shim-unscopables": "^1.0.0"
       },
       "engines": {
-        "node": ">=7.0.0"
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/color-name": {
-      "version": "1.1.4",
-      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
-      "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
-      "inBundle": true
-    },
-    "node_modules/color-support": {
-      "version": "1.1.3",
-      "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
-      "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
-      "inBundle": true,
-      "bin": {
-        "color-support": "bin.js"
+    "node_modules/arrify": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
+      "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.10.0"
       }
     },
-    "node_modules/columnify": {
-      "version": "1.6.0",
-      "resolved": "https://registry.npmjs.org/columnify/-/columnify-1.6.0.tgz",
-      "integrity": "sha512-lomjuFZKfM6MSAnV9aCZC9sc0qGbmZdfygNv+nCpqVkSKdCxCklLtd16O0EILGkImHw9ZpHkAnHaB+8Zxq5W6Q==",
-      "inBundle": true,
-      "dependencies": {
-        "strip-ansi": "^6.0.1",
-        "wcwidth": "^1.0.0"
-      },
+    "node_modules/async-hook-domain": {
+      "version": "2.0.4",
+      "resolved": "https://registry.npmjs.org/async-hook-domain/-/async-hook-domain-2.0.4.tgz",
+      "integrity": "sha512-14LjCmlK1PK8eDtTezR6WX8TMaYNIzBIsd2D1sGoGjgx0BuNMMoSdk7i/drlbtamy0AWv9yv2tkB+ASdmeqFIw==",
+      "dev": true,
       "engines": {
-        "node": ">=8.0.0"
+        "node": ">=10"
       }
     },
-    "node_modules/combined-stream": {
-      "version": "1.0.8",
-      "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
-      "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+    "node_modules/async-retry": {
+      "version": "1.3.3",
+      "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz",
+      "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==",
       "dev": true,
       "dependencies": {
-        "delayed-stream": "~1.0.0"
-      },
-      "engines": {
-        "node": ">= 0.8"
+        "retry": "0.13.1"
       }
     },
-    "node_modules/comma-separated-tokens": {
-      "version": "2.0.3",
-      "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",
-      "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==",
+    "node_modules/async-retry/node_modules/retry": {
+      "version": "0.13.1",
+      "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
+      "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
       "dev": true,
-      "funding": {
-        "type": "github",
-        "url": "https://github.com/sponsors/wooorm"
+      "engines": {
+        "node": ">= 4"
       }
     },
-    "node_modules/commander": {
-      "version": "2.20.3",
-      "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
-      "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+    "node_modules/asynckit": {
+      "version": "0.4.0",
+      "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
       "dev": true
     },
-    "node_modules/common-ancestor-path": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz",
-      "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w=="
+    "node_modules/available-typed-arrays": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz",
+      "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==",
+      "dev": true,
+      "peer": true,
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
     },
-    "node_modules/commondir": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
-      "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==",
+    "node_modules/b4a": {
+      "version": "1.6.4",
+      "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz",
+      "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==",
       "dev": true
     },
-    "node_modules/compare-func": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz",
-      "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==",
+    "node_modules/bail": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz",
+      "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==",
       "dev": true,
-      "dependencies": {
-        "array-ify": "^1.0.0",
-        "dot-prop": "^5.1.0"
+      "funding": {
+        "type": "github",
+        "url": "https://github.com/sponsors/wooorm"
       }
     },
-    "node_modules/concat-map": {
-      "version": "0.0.1",
-      "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
-      "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+    "node_modules/balanced-match": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+      "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
       "inBundle": true
     },
-    "node_modules/console-control-strings": {
-      "version": "1.1.0",
-      "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
-      "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
+    "node_modules/base64-js": {
+      "version": "1.5.1",
+      "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+      "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/feross"
+        },
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/feross"
+        },
+        {
+          "type": "consulting",
+          "url": "https://feross.org/support"
+        }
+      ],
       "inBundle": true
     },
-    "node_modules/conventional-changelog-angular": {
-      "version": "5.0.13",
-      "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz",
-      "integrity": "sha512-i/gipMxs7s8L/QeuavPF2hLnJgH6pEZAttySB6aiQLWcX3puWDL3ACVmvBhJGxnAy52Qc15ua26BufY6KpmrVA==",
+    "node_modules/basic-auth-parser": {
+      "version": "0.0.2-1",
+      "resolved": "https://registry.npmjs.org/basic-auth-parser/-/basic-auth-parser-0.0.2-1.tgz",
+      "integrity": "sha512-GFj8iVxo9onSU6BnnQvVwqvxh60UcSHJEDnIk3z4B6iOjsKSmqe+ibW0Rsz7YO7IE1HG3D3tqCNIidP46SZVdQ==",
+      "dev": true
+    },
+    "node_modules/before-after-hook": {
+      "version": "2.2.3",
+      "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
+      "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==",
+      "dev": true
+    },
+    "node_modules/benchmark": {
+      "version": "2.1.4",
+      "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz",
+      "integrity": "sha512-l9MlfN4M1K/H2fbhfMy3B7vJd6AGKJVQn2h6Sg/Yx+KckoUA7ewS5Vv6TjSq18ooE1kS9hhAlQRH3AkXIh/aOQ==",
       "dev": true,
       "dependencies": {
-        "compare-func": "^2.0.0",
-        "q": "^1.5.1"
-      },
-      "engines": {
-        "node": ">=10"
+        "lodash": "^4.17.4",
+        "platform": "^1.3.3"
       }
     },
-    "node_modules/conventional-changelog-conventionalcommits": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-5.0.0.tgz",
-      "integrity": "sha512-lCDbA+ZqVFQGUj7h9QBKoIpLhl8iihkO0nCTyRNzuXtcd7ubODpYB04IFy31JloiJgG0Uovu8ot8oxRzn7Nwtw==",
-      "dev": true,
+    "node_modules/bin-links": {
+      "version": "4.0.3",
+      "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-4.0.3.tgz",
+      "integrity": "sha512-obsRaULtJurnfox/MDwgq6Yo9kzbv1CPTk/1/s7Z/61Lezc8IKkFCOXNeVLXz0456WRzBQmSsDWlai2tIhBsfA==",
       "dependencies": {
-        "compare-func": "^2.0.0",
-        "lodash": "^4.17.15",
-        "q": "^1.5.1"
+        "cmd-shim": "^6.0.0",
+        "npm-normalize-package-bin": "^3.0.0",
+        "read-cmd-shim": "^4.0.0",
+        "write-file-atomic": "^5.0.0"
       },
       "engines": {
-        "node": ">=10"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/conventional-changelog-writer": {
-      "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-5.0.1.tgz",
-      "integrity": "sha512-5WsuKUfxW7suLblAbFnxAcrvf6r+0b7GvNaWUwUIk0bXMnENP/PEieGKVUQrjPqwPT4o3EPAASBXiY6iHooLOQ==",
+    "node_modules/binary-extensions": {
+      "version": "2.2.0",
+      "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
+      "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/bind-obj-methods": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/bind-obj-methods/-/bind-obj-methods-3.0.0.tgz",
+      "integrity": "sha512-nLEaaz3/sEzNSyPWRsN9HNsqwk1AUyECtGj+XwGdIi3xABnEqecvXtIJ0wehQXuuER5uZ/5fTs2usONgYjG+iw==",
       "dev": true,
-      "dependencies": {
-        "conventional-commits-filter": "^2.0.7",
-        "dateformat": "^3.0.0",
-        "handlebars": "^4.7.7",
-        "json-stringify-safe": "^5.0.1",
-        "lodash": "^4.17.15",
-        "meow": "^8.0.0",
-        "semver": "^6.0.0",
-        "split": "^1.0.0",
-        "through2": "^4.0.0"
-      },
-      "bin": {
-        "conventional-changelog-writer": "cli.js"
-      },
       "engines": {
         "node": ">=10"
       }
     },
-    "node_modules/conventional-changelog-writer/node_modules/semver": {
-      "version": "6.3.1",
-      "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
-      "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
-      "dev": true,
-      "bin": {
-        "semver": "bin/semver.js"
+    "node_modules/boolbase": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
+      "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",
+      "dev": true
+    },
+    "node_modules/brace-expansion": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+      "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+      "inBundle": true,
+      "dependencies": {
+        "balanced-match": "^1.0.0"
       }
     },
-    "node_modules/conventional-commits-filter": {
-      "version": "2.0.7",
-      "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-2.0.7.tgz",
-      "integrity": "sha512-ASS9SamOP4TbCClsRHxIHXRfcGCnIoQqkvAzCSbZzTFLfcTqJVugB0agRgsEELsqaeWgsXv513eS116wnlSSPA==",
+    "node_modules/braces": {
+      "version": "3.0.2",
+      "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+      "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
       "dev": true,
       "dependencies": {
-        "lodash.ismatch": "^4.4.0",
-        "modify-values": "^1.0.0"
+        "fill-range": "^7.0.1"
       },
       "engines": {
-        "node": ">=10"
+        "node": ">=8"
       }
     },
-    "node_modules/conventional-commits-parser": {
-      "version": "3.2.4",
-      "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.2.4.tgz",
-      "integrity": "sha512-nK7sAtfi+QXbxHCYfhpZsfRtaitZLIA6889kFIouLvz6repszQDgxBu7wf2WbU+Dco7sAnNCJYERCwt54WPC2Q==",
+    "node_modules/browserslist": {
+      "version": "4.21.5",
+      "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz",
+      "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==",
       "dev": true,
+      "funding": [
+        {
+          "type": "opencollective",
+          "url": "https://opencollective.com/browserslist"
+        },
+        {
+          "type": "tidelift",
+          "url": "https://tidelift.com/funding/github/npm/browserslist"
+        }
+      ],
       "dependencies": {
-        "is-text-path": "^1.0.1",
-        "JSONStream": "^1.0.4",
-        "lodash": "^4.17.15",
-        "meow": "^8.0.0",
-        "split2": "^3.0.0",
-        "through2": "^4.0.0"
+        "caniuse-lite": "^1.0.30001449",
+        "electron-to-chromium": "^1.4.284",
+        "node-releases": "^2.0.8",
+        "update-browserslist-db": "^1.0.10"
       },
       "bin": {
-        "conventional-commits-parser": "cli.js"
+        "browserslist": "cli.js"
       },
       "engines": {
-        "node": ">=10"
+        "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
       }
     },
-    "node_modules/convert-source-map": {
-      "version": "1.9.0",
-      "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz",
-      "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==",
-      "dev": true
+    "node_modules/buffer": {
+      "version": "6.0.3",
+      "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
+      "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/feross"
+        },
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/feross"
+        },
+        {
+          "type": "consulting",
+          "url": "https://feross.org/support"
+        }
+      ],
+      "inBundle": true,
+      "dependencies": {
+        "base64-js": "^1.3.1",
+        "ieee754": "^1.2.1"
+      }
     },
-    "node_modules/core-util-is": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
-      "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
+    "node_modules/buffer-from": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
+      "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
       "dev": true
     },
-    "node_modules/correct-license-metadata": {
-      "version": "1.4.0",
-      "resolved": "https://registry.npmjs.org/correct-license-metadata/-/correct-license-metadata-1.4.0.tgz",
-      "integrity": "sha512-nvbNpK/aYCbztZWGi9adIPqR+ZcQmZTWNT7eMYLvkaVGroN1nTHiVuuNPl7pK6ZNx1mvDztlRBJtfUdrVwKJ5A==",
-      "dev": true,
+    "node_modules/builtins": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz",
+      "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==",
+      "inBundle": true,
       "dependencies": {
-        "spdx-expression-validate": "^2.0.0"
+        "semver": "^7.0.0"
       }
     },
-    "node_modules/cosmiconfig": {
-      "version": "8.1.3",
-      "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.1.3.tgz",
-      "integrity": "sha512-/UkO2JKI18b5jVMJUp0lvKFMpa/Gye+ZgZjKD+DGEN9y7NRcf/nK1A0sp67ONmKtnDCNMS44E6jrk0Yc3bDuUw==",
-      "dev": true,
+    "node_modules/cacache": {
+      "version": "18.0.0",
+      "resolved": "https://registry.npmjs.org/cacache/-/cacache-18.0.0.tgz",
+      "integrity": "sha512-I7mVOPl3PUCeRub1U8YoGz2Lqv9WOBpobZ8RyWFXmReuILz+3OAyTa5oH3QPdtKZD7N0Yk00aLfzn0qvp8dZ1w==",
+      "inBundle": true,
       "dependencies": {
-        "import-fresh": "^3.2.1",
-        "js-yaml": "^4.1.0",
-        "parse-json": "^5.0.0",
-        "path-type": "^4.0.0"
+        "@npmcli/fs": "^3.1.0",
+        "fs-minipass": "^3.0.0",
+        "glob": "^10.2.2",
+        "lru-cache": "^10.0.1",
+        "minipass": "^7.0.3",
+        "minipass-collect": "^1.0.2",
+        "minipass-flush": "^1.0.5",
+        "minipass-pipeline": "^1.2.4",
+        "p-map": "^4.0.0",
+        "ssri": "^10.0.0",
+        "tar": "^6.1.11",
+        "unique-filename": "^3.0.0"
       },
       "engines": {
-        "node": ">=14"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/d-fischer"
+        "node": "^16.14.0 || >=18.0.0"
       }
     },
-    "node_modules/cosmiconfig-typescript-loader": {
-      "version": "4.3.0",
-      "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-4.3.0.tgz",
-      "integrity": "sha512-NTxV1MFfZDLPiBMjxbHRwSh5LaLcPMwNdCutmnHJCKoVnlvldPWlllonKwrsRJ5pYZBIBGRWWU2tfvzxgeSW5Q==",
+    "node_modules/caching-transform": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz",
+      "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==",
       "dev": true,
-      "engines": {
-        "node": ">=12",
-        "npm": ">=6"
-      },
-      "peerDependencies": {
-        "@types/node": "*",
-        "cosmiconfig": ">=7",
-        "ts-node": ">=10",
-        "typescript": ">=3"
-      }
-    },
-    "node_modules/create-require": {
-      "version": "1.1.1",
-      "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
-      "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
-      "dev": true
-    },
-    "node_modules/cross-spawn": {
-      "version": "7.0.3",
-      "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
-      "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
-      "inBundle": true,
       "dependencies": {
-        "path-key": "^3.1.0",
-        "shebang-command": "^2.0.0",
-        "which": "^2.0.1"
+        "hasha": "^5.0.0",
+        "make-dir": "^3.0.0",
+        "package-hash": "^4.0.0",
+        "write-file-atomic": "^3.0.0"
       },
       "engines": {
-        "node": ">= 8"
+        "node": ">=8"
       }
     },
-    "node_modules/cross-spawn/node_modules/which": {
-      "version": "2.0.2",
-      "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
-      "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
-      "inBundle": true,
-      "dependencies": {
-        "isexe": "^2.0.0"
-      },
-      "bin": {
-        "node-which": "bin/node-which"
-      },
-      "engines": {
-        "node": ">= 8"
-      }
+    "node_modules/caching-transform/node_modules/signal-exit": {
+      "version": "3.0.7",
+      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
+      "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+      "dev": true
     },
-    "node_modules/css-select": {
-      "version": "4.3.0",
-      "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz",
-      "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==",
+    "node_modules/caching-transform/node_modules/write-file-atomic": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz",
+      "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==",
       "dev": true,
       "dependencies": {
-        "boolbase": "^1.0.0",
-        "css-what": "^6.0.1",
-        "domhandler": "^4.3.1",
-        "domutils": "^2.8.0",
-        "nth-check": "^2.0.1"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/fb55"
+        "imurmurhash": "^0.1.4",
+        "is-typedarray": "^1.0.0",
+        "signal-exit": "^3.0.2",
+        "typedarray-to-buffer": "^3.1.5"
       }
     },
-    "node_modules/css-what": {
-      "version": "6.1.0",
-      "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz",
-      "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==",
+    "node_modules/call-bind": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
+      "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
       "dev": true,
-      "engines": {
-        "node": ">= 6"
+      "peer": true,
+      "dependencies": {
+        "function-bind": "^1.1.1",
+        "get-intrinsic": "^1.0.2"
       },
       "funding": {
-        "url": "https://github.com/sponsors/fb55"
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/cssesc": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
-      "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
-      "bin": {
-        "cssesc": "bin/cssesc"
-      },
-      "engines": {
-        "node": ">=4"
-      }
+    "node_modules/caller": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/caller/-/caller-1.1.0.tgz",
+      "integrity": "sha512-n+21IZC3j06YpCWaxmUy5AnVqhmCIM2bQtqQyy00HJlmStRt6kwDX5F9Z97pqwAB+G/tgSz6q/kUBbNyQzIubw==",
+      "dev": true
     },
-    "node_modules/cssstyle": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz",
-      "integrity": "sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==",
+    "node_modules/callsites": {
+      "version": "3.1.0",
+      "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+      "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
       "dev": true,
-      "dependencies": {
-        "rrweb-cssom": "^0.6.0"
-      },
       "engines": {
-        "node": ">=14"
+        "node": ">=6"
       }
     },
-    "node_modules/dargs": {
-      "version": "7.0.0",
-      "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz",
-      "integrity": "sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==",
+    "node_modules/camelcase": {
+      "version": "5.3.1",
+      "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
+      "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
       "dev": true,
       "engines": {
-        "node": ">=8"
+        "node": ">=6"
       }
     },
-    "node_modules/data-urls": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz",
-      "integrity": "sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==",
+    "node_modules/camelcase-keys": {
+      "version": "6.2.2",
+      "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz",
+      "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==",
       "dev": true,
       "dependencies": {
-        "abab": "^2.0.6",
-        "whatwg-mimetype": "^3.0.0",
-        "whatwg-url": "^12.0.0"
+        "camelcase": "^5.3.1",
+        "map-obj": "^4.0.0",
+        "quick-lru": "^4.0.1"
       },
       "engines": {
-        "node": ">=14"
-      }
-    },
-    "node_modules/data-urls/node_modules/tr46": {
-      "version": "4.1.1",
-      "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
-      "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
-      "dev": true,
-      "dependencies": {
-        "punycode": "^2.3.0"
+        "node": ">=8"
       },
-      "engines": {
-        "node": ">=14"
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/data-urls/node_modules/webidl-conversions": {
-      "version": "7.0.0",
-      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
-      "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
+    "node_modules/caniuse-lite": {
+      "version": "1.0.30001482",
+      "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001482.tgz",
+      "integrity": "sha512-F1ZInsg53cegyjroxLNW9DmrEQ1SuGRTO1QlpA0o2/6OpQ0gFeDRoq1yFmnr8Sakn9qwwt9DmbxHB6w167OSuQ==",
       "dev": true,
-      "engines": {
-        "node": ">=12"
-      }
+      "funding": [
+        {
+          "type": "opencollective",
+          "url": "https://opencollective.com/browserslist"
+        },
+        {
+          "type": "tidelift",
+          "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
+        },
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/ai"
+        }
+      ]
     },
-    "node_modules/data-urls/node_modules/whatwg-url": {
-      "version": "12.0.1",
-      "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz",
-      "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==",
+    "node_modules/ccount": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz",
+      "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==",
       "dev": true,
-      "dependencies": {
-        "tr46": "^4.1.1",
-        "webidl-conversions": "^7.0.0"
-      },
-      "engines": {
-        "node": ">=14"
+      "funding": {
+        "type": "github",
+        "url": "https://github.com/sponsors/wooorm"
       }
     },
-    "node_modules/dateformat": {
-      "version": "3.0.3",
-      "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz",
-      "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==",
-      "dev": true,
-      "engines": {
-        "node": "*"
-      }
-    },
-    "node_modules/debug": {
-      "version": "4.3.4",
-      "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
-      "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
+    "node_modules/chalk": {
+      "version": "5.3.0",
+      "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz",
+      "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==",
       "inBundle": true,
-      "dependencies": {
-        "ms": "2.1.2"
-      },
       "engines": {
-        "node": ">=6.0"
+        "node": "^12.17.0 || ^14.13 || >=16.0.0"
       },
-      "peerDependenciesMeta": {
-        "supports-color": {
-          "optional": true
-        }
-      }
-    },
-    "node_modules/debug/node_modules/ms": {
-      "version": "2.1.2",
-      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
-      "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
-      "inBundle": true
-    },
-    "node_modules/decamelize": {
-      "version": "1.2.0",
-      "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
-      "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
-      "dev": true,
-      "engines": {
-        "node": ">=0.10.0"
+      "funding": {
+        "url": "https://github.com/chalk/chalk?sponsor=1"
       }
     },
-    "node_modules/decamelize-keys": {
-      "version": "1.1.1",
-      "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz",
-      "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==",
+    "node_modules/character-entities": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz",
+      "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==",
       "dev": true,
-      "dependencies": {
-        "decamelize": "^1.1.0",
-        "map-obj": "^1.0.0"
-      },
-      "engines": {
-        "node": ">=0.10.0"
-      },
       "funding": {
-        "url": "https://github.com/sponsors/sindresorhus"
+        "type": "github",
+        "url": "https://github.com/sponsors/wooorm"
       }
     },
-    "node_modules/decamelize-keys/node_modules/map-obj": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
-      "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==",
+    "node_modules/character-entities-html4": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz",
+      "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==",
       "dev": true,
-      "engines": {
-        "node": ">=0.10.0"
+      "funding": {
+        "type": "github",
+        "url": "https://github.com/sponsors/wooorm"
       }
     },
-    "node_modules/decimal.js": {
-      "version": "10.4.3",
-      "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz",
-      "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==",
-      "dev": true
-    },
-    "node_modules/decode-named-character-reference": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz",
-      "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==",
+    "node_modules/character-entities-legacy": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz",
+      "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==",
       "dev": true,
-      "dependencies": {
-        "character-entities": "^2.0.0"
-      },
       "funding": {
         "type": "github",
         "url": "https://github.com/sponsors/wooorm"
       }
     },
-    "node_modules/deep-is": {
-      "version": "0.1.4",
-      "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
-      "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
-      "dev": true
-    },
-    "node_modules/default-require-extensions": {
-      "version": "3.0.1",
-      "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.1.tgz",
-      "integrity": "sha512-eXTJmRbm2TIt9MgWTsOH1wEuhew6XGZcMeGKCtLedIg/NCsg1iBePXkceTdK4Fii7pzmN9tGsZhKzZ4h7O/fxw==",
+    "node_modules/chokidar": {
+      "version": "3.5.3",
+      "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
+      "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
       "dev": true,
+      "funding": [
+        {
+          "type": "individual",
+          "url": "https://paulmillr.com/funding/"
+        }
+      ],
       "dependencies": {
-        "strip-bom": "^4.0.0"
+        "anymatch": "~3.1.2",
+        "braces": "~3.0.2",
+        "glob-parent": "~5.1.2",
+        "is-binary-path": "~2.1.0",
+        "is-glob": "~4.0.1",
+        "normalize-path": "~3.0.0",
+        "readdirp": "~3.6.0"
       },
       "engines": {
-        "node": ">=8"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/sindresorhus"
-      }
-    },
-    "node_modules/defaults": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz",
-      "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==",
-      "inBundle": true,
-      "dependencies": {
-        "clone": "^1.0.2"
+        "node": ">= 8.10.0"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/sindresorhus"
+      "optionalDependencies": {
+        "fsevents": "~2.3.2"
       }
     },
-    "node_modules/define-properties": {
-      "version": "1.2.0",
-      "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz",
-      "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==",
+    "node_modules/chokidar/node_modules/glob-parent": {
+      "version": "5.1.2",
+      "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+      "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "has-property-descriptors": "^1.0.0",
-        "object-keys": "^1.1.1"
-      },
-      "engines": {
-        "node": ">= 0.4"
+        "is-glob": "^4.0.1"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
-      }
-    },
-    "node_modules/delayed-stream": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
-      "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
-      "dev": true,
       "engines": {
-        "node": ">=0.4.0"
+        "node": ">= 6"
       }
     },
-    "node_modules/delegates": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
-      "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
-      "inBundle": true
-    },
-    "node_modules/deprecation": {
-      "version": "2.3.1",
-      "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
-      "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==",
-      "dev": true
-    },
-    "node_modules/dequal": {
-      "version": "2.0.3",
-      "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
-      "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
-      "dev": true,
+    "node_modules/chownr": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
+      "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
+      "inBundle": true,
       "engines": {
-        "node": ">=6"
+        "node": ">=10"
       }
     },
-    "node_modules/detect-indent": {
-      "version": "6.1.0",
-      "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz",
-      "integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==",
-      "dev": true,
+    "node_modules/ci-info": {
+      "version": "3.9.0",
+      "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
+      "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/sibiraj-s"
+        }
+      ],
+      "inBundle": true,
       "engines": {
         "node": ">=8"
       }
     },
-    "node_modules/diff": {
-      "version": "5.1.0",
-      "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz",
-      "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==",
+    "node_modules/cidr-regex": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmjs.org/cidr-regex/-/cidr-regex-3.1.1.tgz",
+      "integrity": "sha512-RBqYd32aDwbCMFJRL6wHOlDNYJsPNTt8vC82ErHF5vKt8QQzxm1FrkW8s/R5pVrXMf17sba09Uoy91PKiddAsw==",
+      "inBundle": true,
+      "dependencies": {
+        "ip-regex": "^4.1.0"
+      },
       "engines": {
-        "node": ">=0.3.1"
+        "node": ">=10"
       }
     },
-    "node_modules/discontinuous-range": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz",
-      "integrity": "sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==",
-      "dev": true
-    },
-    "node_modules/docopt": {
-      "version": "0.6.2",
-      "resolved": "https://registry.npmjs.org/docopt/-/docopt-0.6.2.tgz",
-      "integrity": "sha512-NqTbaYeE4gA/wU1hdKFdU+AFahpDOpgGLzHP42k6H6DKExJd0A55KEVWYhL9FEmHmgeLvEU2vuKXDuU+4yToOw==",
-      "dev": true,
+    "node_modules/clean-stack": {
+      "version": "2.2.0",
+      "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
+      "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==",
+      "inBundle": true,
       "engines": {
-        "node": ">=0.10.0"
+        "node": ">=6"
       }
     },
-    "node_modules/doctrine": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
-      "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
-      "dev": true,
-      "peer": true,
+    "node_modules/cli-columns": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/cli-columns/-/cli-columns-4.0.0.tgz",
+      "integrity": "sha512-XW2Vg+w+L9on9wtwKpyzluIPCWXjaBahI7mTcYjx+BVIYD9c3yqcv/yKC7CmdCZat4rq2yiE1UMSJC5ivKfMtQ==",
+      "inBundle": true,
       "dependencies": {
-        "esutils": "^2.0.2"
+        "string-width": "^4.2.3",
+        "strip-ansi": "^6.0.1"
       },
       "engines": {
-        "node": ">=6.0.0"
+        "node": ">= 10"
       }
     },
-    "node_modules/dom-serializer": {
-      "version": "1.4.1",
-      "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz",
-      "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==",
-      "dev": true,
-      "dependencies": {
-        "domelementtype": "^2.0.1",
-        "domhandler": "^4.2.0",
-        "entities": "^2.0.0"
+    "node_modules/cli-table3": {
+      "version": "0.6.3",
+      "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz",
+      "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==",
+      "inBundle": true,
+      "dependencies": {
+        "string-width": "^4.2.0"
       },
-      "funding": {
-        "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
+      "engines": {
+        "node": "10.* || >= 12.*"
+      },
+      "optionalDependencies": {
+        "@colors/colors": "1.5.0"
       }
     },
-    "node_modules/domelementtype": {
-      "version": "2.3.0",
-      "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
-      "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",
-      "dev": true,
-      "funding": [
-        {
-          "type": "github",
-          "url": "https://github.com/sponsors/fb55"
-        }
-      ]
-    },
-    "node_modules/domexception": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz",
-      "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==",
+    "node_modules/cliui": {
+      "version": "8.0.1",
+      "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
+      "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
       "dev": true,
       "dependencies": {
-        "webidl-conversions": "^7.0.0"
+        "string-width": "^4.2.0",
+        "strip-ansi": "^6.0.1",
+        "wrap-ansi": "^7.0.0"
       },
       "engines": {
         "node": ">=12"
       }
     },
-    "node_modules/domexception/node_modules/webidl-conversions": {
+    "node_modules/cliui/node_modules/wrap-ansi": {
       "version": "7.0.0",
-      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
-      "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
-      "dev": true,
-      "engines": {
-        "node": ">=12"
-      }
-    },
-    "node_modules/domhandler": {
-      "version": "4.3.1",
-      "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz",
-      "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==",
+      "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+      "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
       "dev": true,
       "dependencies": {
-        "domelementtype": "^2.2.0"
+        "ansi-styles": "^4.0.0",
+        "string-width": "^4.1.0",
+        "strip-ansi": "^6.0.0"
       },
       "engines": {
-        "node": ">= 4"
-      },
-      "funding": {
-        "url": "https://github.com/fb55/domhandler?sponsor=1"
-      }
-    },
-    "node_modules/domutils": {
-      "version": "2.8.0",
-      "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz",
-      "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==",
-      "dev": true,
-      "dependencies": {
-        "dom-serializer": "^1.0.1",
-        "domelementtype": "^2.2.0",
-        "domhandler": "^4.2.0"
+        "node": ">=10"
       },
       "funding": {
-        "url": "https://github.com/fb55/domutils?sponsor=1"
+        "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
       }
     },
-    "node_modules/dot-prop": {
-      "version": "5.3.0",
-      "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz",
-      "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==",
-      "dev": true,
-      "dependencies": {
-        "is-obj": "^2.0.0"
-      },
+    "node_modules/clone": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
+      "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==",
+      "inBundle": true,
       "engines": {
-        "node": ">=8"
+        "node": ">=0.8"
       }
     },
-    "node_modules/duplexer": {
-      "version": "0.1.2",
-      "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
-      "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==",
-      "dev": true
-    },
-    "node_modules/eastasianwidth": {
-      "version": "0.2.0",
-      "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
-      "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
-      "inBundle": true
-    },
-    "node_modules/electron-to-chromium": {
-      "version": "1.4.380",
-      "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.380.tgz",
-      "integrity": "sha512-XKGdI4pWM78eLH2cbXJHiBnWUwFSzZM7XujsB6stDiGu9AeSqziedP6amNLpJzE3i0rLTcfAwdCTs5ecP5yeSg==",
-      "dev": true
-    },
-    "node_modules/emoji-regex": {
-      "version": "8.0.0",
-      "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
-      "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
-      "inBundle": true
-    },
-    "node_modules/encoding": {
-      "version": "0.1.13",
-      "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
-      "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
-      "inBundle": true,
-      "optional": true,
-      "dependencies": {
-        "iconv-lite": "^0.6.2"
+    "node_modules/cmd-shim": {
+      "version": "6.0.2",
+      "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-6.0.2.tgz",
+      "integrity": "sha512-+FFYbB0YLaAkhkcrjkyNLYDiOsFSfRjwjY19LXk/psmMx1z00xlCv7hhQoTGXXIKi+YXHL/iiFo8NqMVQX9nOw==",
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/entities": {
-      "version": "2.2.0",
-      "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
-      "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==",
+    "node_modules/code-point-at": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
+      "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==",
       "dev": true,
-      "funding": {
-        "url": "https://github.com/fb55/entities?sponsor=1"
+      "engines": {
+        "node": ">=0.10.0"
       }
     },
-    "node_modules/env-paths": {
-      "version": "2.2.1",
-      "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
-      "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==",
-      "inBundle": true,
+    "node_modules/code-suggester": {
+      "version": "4.3.2",
+      "resolved": "https://registry.npmjs.org/code-suggester/-/code-suggester-4.3.2.tgz",
+      "integrity": "sha512-n02zMwcyHtPLQQbQDpBhxjiN3t0i6ifFlffmRP3o+VEfp3RpUZs8NmZUBcl+5KRfPws/hDeYKaVndVQly8IVFA==",
+      "dev": true,
+      "dependencies": {
+        "@octokit/rest": "^19.0.5",
+        "@types/yargs": "^16.0.0",
+        "async-retry": "^1.3.1",
+        "diff": "^5.0.0",
+        "glob": "^7.1.6",
+        "parse-diff": "^0.11.0",
+        "yargs": "^16.0.0"
+      },
+      "bin": {
+        "code-suggester": "build/src/bin/code-suggester.js"
+      },
       "engines": {
-        "node": ">=6"
+        "node": ">=14.0.0"
       }
     },
-    "node_modules/err-code": {
-      "version": "2.0.3",
-      "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz",
-      "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==",
-      "inBundle": true
+    "node_modules/code-suggester/node_modules/brace-expansion": {
+      "version": "1.1.11",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+      "dev": true,
+      "dependencies": {
+        "balanced-match": "^1.0.0",
+        "concat-map": "0.0.1"
+      }
     },
-    "node_modules/error-ex": {
-      "version": "1.3.2",
-      "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
-      "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+    "node_modules/code-suggester/node_modules/cliui": {
+      "version": "7.0.4",
+      "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
+      "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
       "dev": true,
       "dependencies": {
-        "is-arrayish": "^0.2.1"
+        "string-width": "^4.2.0",
+        "strip-ansi": "^6.0.0",
+        "wrap-ansi": "^7.0.0"
       }
     },
-    "node_modules/es-abstract": {
-      "version": "1.21.2",
-      "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.2.tgz",
-      "integrity": "sha512-y/B5POM2iBnIxCiernH1G7rC9qQoM77lLIMQLuob0zhp8C56Po81+2Nj0WFKnd0pNReDTnkYryc+zhOzpEIROg==",
+    "node_modules/code-suggester/node_modules/glob": {
+      "version": "7.2.3",
+      "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+      "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "array-buffer-byte-length": "^1.0.0",
-        "available-typed-arrays": "^1.0.5",
-        "call-bind": "^1.0.2",
-        "es-set-tostringtag": "^2.0.1",
-        "es-to-primitive": "^1.2.1",
-        "function.prototype.name": "^1.1.5",
-        "get-intrinsic": "^1.2.0",
-        "get-symbol-description": "^1.0.0",
-        "globalthis": "^1.0.3",
-        "gopd": "^1.0.1",
-        "has": "^1.0.3",
-        "has-property-descriptors": "^1.0.0",
-        "has-proto": "^1.0.1",
-        "has-symbols": "^1.0.3",
-        "internal-slot": "^1.0.5",
-        "is-array-buffer": "^3.0.2",
-        "is-callable": "^1.2.7",
-        "is-negative-zero": "^2.0.2",
-        "is-regex": "^1.1.4",
-        "is-shared-array-buffer": "^1.0.2",
-        "is-string": "^1.0.7",
-        "is-typed-array": "^1.1.10",
-        "is-weakref": "^1.0.2",
-        "object-inspect": "^1.12.3",
-        "object-keys": "^1.1.1",
-        "object.assign": "^4.1.4",
-        "regexp.prototype.flags": "^1.4.3",
-        "safe-regex-test": "^1.0.0",
-        "string.prototype.trim": "^1.2.7",
-        "string.prototype.trimend": "^1.0.6",
-        "string.prototype.trimstart": "^1.0.6",
-        "typed-array-length": "^1.0.4",
-        "unbox-primitive": "^1.0.2",
-        "which-typed-array": "^1.1.9"
+        "fs.realpath": "^1.0.0",
+        "inflight": "^1.0.4",
+        "inherits": "2",
+        "minimatch": "^3.1.1",
+        "once": "^1.3.0",
+        "path-is-absolute": "^1.0.0"
       },
       "engines": {
-        "node": ">= 0.4"
+        "node": "*"
       },
       "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "url": "https://github.com/sponsors/isaacs"
       }
     },
-    "node_modules/es-set-tostringtag": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz",
-      "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==",
+    "node_modules/code-suggester/node_modules/minimatch": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "get-intrinsic": "^1.1.3",
-        "has": "^1.0.3",
-        "has-tostringtag": "^1.0.0"
+        "brace-expansion": "^1.1.7"
       },
       "engines": {
-        "node": ">= 0.4"
-      }
-    },
-    "node_modules/es-shim-unscopables": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz",
-      "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==",
-      "dev": true,
-      "peer": true,
-      "dependencies": {
-        "has": "^1.0.3"
+        "node": "*"
       }
     },
-    "node_modules/es-to-primitive": {
-      "version": "1.2.1",
-      "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
-      "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==",
+    "node_modules/code-suggester/node_modules/wrap-ansi": {
+      "version": "7.0.0",
+      "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+      "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "is-callable": "^1.1.4",
-        "is-date-object": "^1.0.1",
-        "is-symbol": "^1.0.2"
+        "ansi-styles": "^4.0.0",
+        "string-width": "^4.1.0",
+        "strip-ansi": "^6.0.0"
       },
       "engines": {
-        "node": ">= 0.4"
+        "node": ">=10"
       },
       "funding": {
-        "url": "https://github.com/sponsors/ljharb"
-      }
-    },
-    "node_modules/es6-error": {
-      "version": "4.1.1",
-      "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
-      "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
-      "dev": true
-    },
-    "node_modules/escalade": {
-      "version": "3.1.1",
-      "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
-      "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
-      "dev": true,
-      "engines": {
-        "node": ">=6"
+        "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
       }
     },
-    "node_modules/escape-string-regexp": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
-      "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+    "node_modules/code-suggester/node_modules/yargs": {
+      "version": "16.2.0",
+      "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
+      "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
       "dev": true,
-      "peer": true,
+      "dependencies": {
+        "cliui": "^7.0.2",
+        "escalade": "^3.1.1",
+        "get-caller-file": "^2.0.5",
+        "require-directory": "^2.1.1",
+        "string-width": "^4.2.0",
+        "y18n": "^5.0.5",
+        "yargs-parser": "^20.2.2"
+      },
       "engines": {
         "node": ">=10"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/escodegen": {
-      "version": "1.14.3",
-      "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz",
-      "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==",
-      "dev": true,
+    "node_modules/color-convert": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+      "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+      "inBundle": true,
       "dependencies": {
-        "esprima": "^4.0.1",
-        "estraverse": "^4.2.0",
-        "esutils": "^2.0.2",
-        "optionator": "^0.8.1"
+        "color-name": "~1.1.4"
       },
+      "engines": {
+        "node": ">=7.0.0"
+      }
+    },
+    "node_modules/color-name": {
+      "version": "1.1.4",
+      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+      "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+      "inBundle": true
+    },
+    "node_modules/color-support": {
+      "version": "1.1.3",
+      "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
+      "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
+      "inBundle": true,
       "bin": {
-        "escodegen": "bin/escodegen.js",
-        "esgenerate": "bin/esgenerate.js"
+        "color-support": "bin.js"
+      }
+    },
+    "node_modules/columnify": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmjs.org/columnify/-/columnify-1.6.0.tgz",
+      "integrity": "sha512-lomjuFZKfM6MSAnV9aCZC9sc0qGbmZdfygNv+nCpqVkSKdCxCklLtd16O0EILGkImHw9ZpHkAnHaB+8Zxq5W6Q==",
+      "inBundle": true,
+      "dependencies": {
+        "strip-ansi": "^6.0.1",
+        "wcwidth": "^1.0.0"
       },
       "engines": {
-        "node": ">=4.0"
-      },
-      "optionalDependencies": {
-        "source-map": "~0.6.1"
+        "node": ">=8.0.0"
       }
     },
-    "node_modules/escodegen/node_modules/esprima": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
-      "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+    "node_modules/combined-stream": {
+      "version": "1.0.8",
+      "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+      "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
       "dev": true,
-      "bin": {
-        "esparse": "bin/esparse.js",
-        "esvalidate": "bin/esvalidate.js"
+      "dependencies": {
+        "delayed-stream": "~1.0.0"
       },
       "engines": {
-        "node": ">=4"
+        "node": ">= 0.8"
       }
     },
-    "node_modules/escodegen/node_modules/estraverse": {
-      "version": "4.3.0",
-      "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
-      "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
+    "node_modules/comma-separated-tokens": {
+      "version": "2.0.3",
+      "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",
+      "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==",
       "dev": true,
-      "engines": {
-        "node": ">=4.0"
+      "funding": {
+        "type": "github",
+        "url": "https://github.com/sponsors/wooorm"
       }
     },
-    "node_modules/escodegen/node_modules/levn": {
-      "version": "0.3.0",
-      "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
-      "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==",
+    "node_modules/commander": {
+      "version": "2.20.3",
+      "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+      "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+      "dev": true
+    },
+    "node_modules/common-ancestor-path": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz",
+      "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w=="
+    },
+    "node_modules/commondir": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
+      "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==",
+      "dev": true
+    },
+    "node_modules/compare-func": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz",
+      "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==",
       "dev": true,
       "dependencies": {
-        "prelude-ls": "~1.1.2",
-        "type-check": "~0.3.2"
-      },
-      "engines": {
-        "node": ">= 0.8.0"
+        "array-ify": "^1.0.0",
+        "dot-prop": "^5.1.0"
       }
     },
-    "node_modules/escodegen/node_modules/optionator": {
-      "version": "0.8.3",
-      "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
-      "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
+    "node_modules/concat-map": {
+      "version": "0.0.1",
+      "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+      "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+      "inBundle": true
+    },
+    "node_modules/console-control-strings": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
+      "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
+      "inBundle": true
+    },
+    "node_modules/conventional-changelog-angular": {
+      "version": "5.0.13",
+      "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz",
+      "integrity": "sha512-i/gipMxs7s8L/QeuavPF2hLnJgH6pEZAttySB6aiQLWcX3puWDL3ACVmvBhJGxnAy52Qc15ua26BufY6KpmrVA==",
       "dev": true,
       "dependencies": {
-        "deep-is": "~0.1.3",
-        "fast-levenshtein": "~2.0.6",
-        "levn": "~0.3.0",
-        "prelude-ls": "~1.1.2",
-        "type-check": "~0.3.2",
-        "word-wrap": "~1.2.3"
+        "compare-func": "^2.0.0",
+        "q": "^1.5.1"
       },
       "engines": {
-        "node": ">= 0.8.0"
+        "node": ">=10"
       }
     },
-    "node_modules/escodegen/node_modules/prelude-ls": {
-      "version": "1.1.2",
-      "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
-      "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==",
+    "node_modules/conventional-changelog-conventionalcommits": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-5.0.0.tgz",
+      "integrity": "sha512-lCDbA+ZqVFQGUj7h9QBKoIpLhl8iihkO0nCTyRNzuXtcd7ubODpYB04IFy31JloiJgG0Uovu8ot8oxRzn7Nwtw==",
       "dev": true,
+      "dependencies": {
+        "compare-func": "^2.0.0",
+        "lodash": "^4.17.15",
+        "q": "^1.5.1"
+      },
       "engines": {
-        "node": ">= 0.8.0"
+        "node": ">=10"
       }
     },
-    "node_modules/escodegen/node_modules/type-check": {
-      "version": "0.3.2",
-      "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
-      "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==",
+    "node_modules/conventional-changelog-writer": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-5.0.1.tgz",
+      "integrity": "sha512-5WsuKUfxW7suLblAbFnxAcrvf6r+0b7GvNaWUwUIk0bXMnENP/PEieGKVUQrjPqwPT4o3EPAASBXiY6iHooLOQ==",
       "dev": true,
       "dependencies": {
-        "prelude-ls": "~1.1.2"
+        "conventional-commits-filter": "^2.0.7",
+        "dateformat": "^3.0.0",
+        "handlebars": "^4.7.7",
+        "json-stringify-safe": "^5.0.1",
+        "lodash": "^4.17.15",
+        "meow": "^8.0.0",
+        "semver": "^6.0.0",
+        "split": "^1.0.0",
+        "through2": "^4.0.0"
+      },
+      "bin": {
+        "conventional-changelog-writer": "cli.js"
       },
       "engines": {
-        "node": ">= 0.8.0"
+        "node": ">=10"
       }
     },
-    "node_modules/eslint": {
-      "version": "8.39.0",
-      "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.39.0.tgz",
-      "integrity": "sha512-mwiok6cy7KTW7rBpo05k6+p4YVZByLNjAZ/ACB9DRCu4YDRwjXI01tWHp6KAUWelsBetTxKK/2sHB0vdS8Z2Og==",
+    "node_modules/conventional-changelog-writer/node_modules/semver": {
+      "version": "6.3.1",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+      "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
       "dev": true,
-      "peer": true,
-      "dependencies": {
-        "@eslint-community/eslint-utils": "^4.2.0",
-        "@eslint-community/regexpp": "^4.4.0",
-        "@eslint/eslintrc": "^2.0.2",
-        "@eslint/js": "8.39.0",
-        "@humanwhocodes/config-array": "^0.11.8",
-        "@humanwhocodes/module-importer": "^1.0.1",
-        "@nodelib/fs.walk": "^1.2.8",
-        "ajv": "^6.10.0",
-        "chalk": "^4.0.0",
-        "cross-spawn": "^7.0.2",
-        "debug": "^4.3.2",
-        "doctrine": "^3.0.0",
-        "escape-string-regexp": "^4.0.0",
-        "eslint-scope": "^7.2.0",
-        "eslint-visitor-keys": "^3.4.0",
-        "espree": "^9.5.1",
-        "esquery": "^1.4.2",
-        "esutils": "^2.0.2",
-        "fast-deep-equal": "^3.1.3",
-        "file-entry-cache": "^6.0.1",
-        "find-up": "^5.0.0",
-        "glob-parent": "^6.0.2",
-        "globals": "^13.19.0",
-        "grapheme-splitter": "^1.0.4",
-        "ignore": "^5.2.0",
-        "import-fresh": "^3.0.0",
-        "imurmurhash": "^0.1.4",
-        "is-glob": "^4.0.0",
-        "is-path-inside": "^3.0.3",
-        "js-sdsl": "^4.1.4",
-        "js-yaml": "^4.1.0",
-        "json-stable-stringify-without-jsonify": "^1.0.1",
-        "levn": "^0.4.1",
-        "lodash.merge": "^4.6.2",
-        "minimatch": "^3.1.2",
-        "natural-compare": "^1.4.0",
-        "optionator": "^0.9.1",
-        "strip-ansi": "^6.0.1",
-        "strip-json-comments": "^3.1.0",
-        "text-table": "^0.2.0"
-      },
       "bin": {
-        "eslint": "bin/eslint.js"
-      },
-      "engines": {
-        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
-      },
-      "funding": {
-        "url": "https://opencollective.com/eslint"
-      }
-    },
-    "node_modules/eslint-import-resolver-node": {
-      "version": "0.3.7",
-      "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz",
-      "integrity": "sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==",
-      "dev": true,
-      "peer": true,
-      "dependencies": {
-        "debug": "^3.2.7",
-        "is-core-module": "^2.11.0",
-        "resolve": "^1.22.1"
+        "semver": "bin/semver.js"
       }
     },
-    "node_modules/eslint-import-resolver-node/node_modules/debug": {
-      "version": "3.2.7",
-      "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
-      "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+    "node_modules/conventional-commits-filter": {
+      "version": "2.0.7",
+      "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-2.0.7.tgz",
+      "integrity": "sha512-ASS9SamOP4TbCClsRHxIHXRfcGCnIoQqkvAzCSbZzTFLfcTqJVugB0agRgsEELsqaeWgsXv513eS116wnlSSPA==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "ms": "^2.1.1"
+        "lodash.ismatch": "^4.4.0",
+        "modify-values": "^1.0.0"
+      },
+      "engines": {
+        "node": ">=10"
       }
     },
-    "node_modules/eslint-module-utils": {
-      "version": "2.8.0",
-      "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz",
-      "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==",
+    "node_modules/conventional-commits-parser": {
+      "version": "3.2.4",
+      "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.2.4.tgz",
+      "integrity": "sha512-nK7sAtfi+QXbxHCYfhpZsfRtaitZLIA6889kFIouLvz6repszQDgxBu7wf2WbU+Dco7sAnNCJYERCwt54WPC2Q==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "debug": "^3.2.7"
+        "is-text-path": "^1.0.1",
+        "JSONStream": "^1.0.4",
+        "lodash": "^4.17.15",
+        "meow": "^8.0.0",
+        "split2": "^3.0.0",
+        "through2": "^4.0.0"
       },
-      "engines": {
-        "node": ">=4"
+      "bin": {
+        "conventional-commits-parser": "cli.js"
       },
-      "peerDependenciesMeta": {
-        "eslint": {
-          "optional": true
-        }
+      "engines": {
+        "node": ">=10"
       }
     },
-    "node_modules/eslint-module-utils/node_modules/debug": {
-      "version": "3.2.7",
-      "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
-      "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+    "node_modules/convert-source-map": {
+      "version": "1.9.0",
+      "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz",
+      "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==",
+      "dev": true
+    },
+    "node_modules/core-util-is": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
+      "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
+      "dev": true
+    },
+    "node_modules/correct-license-metadata": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/correct-license-metadata/-/correct-license-metadata-1.4.0.tgz",
+      "integrity": "sha512-nvbNpK/aYCbztZWGi9adIPqR+ZcQmZTWNT7eMYLvkaVGroN1nTHiVuuNPl7pK6ZNx1mvDztlRBJtfUdrVwKJ5A==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "ms": "^2.1.1"
+        "spdx-expression-validate": "^2.0.0"
       }
     },
-    "node_modules/eslint-plugin-es": {
-      "version": "3.0.1",
-      "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz",
-      "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==",
+    "node_modules/cosmiconfig": {
+      "version": "8.1.3",
+      "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.1.3.tgz",
+      "integrity": "sha512-/UkO2JKI18b5jVMJUp0lvKFMpa/Gye+ZgZjKD+DGEN9y7NRcf/nK1A0sp67ONmKtnDCNMS44E6jrk0Yc3bDuUw==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "eslint-utils": "^2.0.0",
-        "regexpp": "^3.0.0"
+        "import-fresh": "^3.2.1",
+        "js-yaml": "^4.1.0",
+        "parse-json": "^5.0.0",
+        "path-type": "^4.0.0"
       },
       "engines": {
-        "node": ">=8.10.0"
+        "node": ">=14"
       },
       "funding": {
-        "url": "https://github.com/sponsors/mysticatea"
-      },
-      "peerDependencies": {
-        "eslint": ">=4.19.1"
+        "url": "https://github.com/sponsors/d-fischer"
       }
     },
-    "node_modules/eslint-plugin-import": {
-      "version": "2.27.5",
-      "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz",
-      "integrity": "sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==",
+    "node_modules/cosmiconfig-typescript-loader": {
+      "version": "4.3.0",
+      "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-4.3.0.tgz",
+      "integrity": "sha512-NTxV1MFfZDLPiBMjxbHRwSh5LaLcPMwNdCutmnHJCKoVnlvldPWlllonKwrsRJ5pYZBIBGRWWU2tfvzxgeSW5Q==",
       "dev": true,
-      "peer": true,
-      "dependencies": {
-        "array-includes": "^3.1.6",
-        "array.prototype.flat": "^1.3.1",
-        "array.prototype.flatmap": "^1.3.1",
-        "debug": "^3.2.7",
-        "doctrine": "^2.1.0",
-        "eslint-import-resolver-node": "^0.3.7",
-        "eslint-module-utils": "^2.7.4",
-        "has": "^1.0.3",
-        "is-core-module": "^2.11.0",
-        "is-glob": "^4.0.3",
-        "minimatch": "^3.1.2",
-        "object.values": "^1.1.6",
-        "resolve": "^1.22.1",
-        "semver": "^6.3.0",
-        "tsconfig-paths": "^3.14.1"
-      },
       "engines": {
-        "node": ">=4"
+        "node": ">=12",
+        "npm": ">=6"
       },
       "peerDependencies": {
-        "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8"
+        "@types/node": "*",
+        "cosmiconfig": ">=7",
+        "ts-node": ">=10",
+        "typescript": ">=3"
       }
     },
-    "node_modules/eslint-plugin-import/node_modules/brace-expansion": {
-      "version": "1.1.11",
-      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
-      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
-      "dev": true,
-      "peer": true,
-      "dependencies": {
-        "balanced-match": "^1.0.0",
-        "concat-map": "0.0.1"
-      }
+    "node_modules/create-require": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
+      "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
+      "dev": true
     },
-    "node_modules/eslint-plugin-import/node_modules/debug": {
-      "version": "3.2.7",
-      "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
-      "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
-      "dev": true,
-      "peer": true,
+    "node_modules/cross-spawn": {
+      "version": "7.0.3",
+      "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
+      "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
+      "inBundle": true,
       "dependencies": {
-        "ms": "^2.1.1"
+        "path-key": "^3.1.0",
+        "shebang-command": "^2.0.0",
+        "which": "^2.0.1"
+      },
+      "engines": {
+        "node": ">= 8"
       }
     },
-    "node_modules/eslint-plugin-import/node_modules/doctrine": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
-      "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
-      "dev": true,
-      "peer": true,
+    "node_modules/cross-spawn/node_modules/which": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+      "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+      "inBundle": true,
       "dependencies": {
-        "esutils": "^2.0.2"
+        "isexe": "^2.0.0"
+      },
+      "bin": {
+        "node-which": "bin/node-which"
       },
       "engines": {
-        "node": ">=0.10.0"
+        "node": ">= 8"
       }
     },
-    "node_modules/eslint-plugin-import/node_modules/minimatch": {
-      "version": "3.1.2",
-      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
-      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+    "node_modules/css-select": {
+      "version": "4.3.0",
+      "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz",
+      "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "brace-expansion": "^1.1.7"
+        "boolbase": "^1.0.0",
+        "css-what": "^6.0.1",
+        "domhandler": "^4.3.1",
+        "domutils": "^2.8.0",
+        "nth-check": "^2.0.1"
       },
-      "engines": {
-        "node": "*"
+      "funding": {
+        "url": "https://github.com/sponsors/fb55"
       }
     },
-    "node_modules/eslint-plugin-import/node_modules/semver": {
-      "version": "6.3.1",
-      "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
-      "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
-      "dev": true,
-      "peer": true,
+    "node_modules/css-what": {
+      "version": "6.1.0",
+      "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz",
+      "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==",
+      "dev": true,
+      "engines": {
+        "node": ">= 6"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/fb55"
+      }
+    },
+    "node_modules/cssesc": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
+      "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
       "bin": {
-        "semver": "bin/semver.js"
+        "cssesc": "bin/cssesc"
+      },
+      "engines": {
+        "node": ">=4"
       }
     },
-    "node_modules/eslint-plugin-node": {
-      "version": "11.1.0",
-      "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz",
-      "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==",
+    "node_modules/cssstyle": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz",
+      "integrity": "sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "eslint-plugin-es": "^3.0.0",
-        "eslint-utils": "^2.0.0",
-        "ignore": "^5.1.1",
-        "minimatch": "^3.0.4",
-        "resolve": "^1.10.1",
-        "semver": "^6.1.0"
+        "rrweb-cssom": "^0.6.0"
       },
       "engines": {
-        "node": ">=8.10.0"
-      },
-      "peerDependencies": {
-        "eslint": ">=5.16.0"
+        "node": ">=14"
       }
     },
-    "node_modules/eslint-plugin-node/node_modules/brace-expansion": {
-      "version": "1.1.11",
-      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
-      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+    "node_modules/dargs": {
+      "version": "7.0.0",
+      "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz",
+      "integrity": "sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==",
       "dev": true,
-      "peer": true,
-      "dependencies": {
-        "balanced-match": "^1.0.0",
-        "concat-map": "0.0.1"
+      "engines": {
+        "node": ">=8"
       }
     },
-    "node_modules/eslint-plugin-node/node_modules/minimatch": {
-      "version": "3.1.2",
-      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
-      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+    "node_modules/data-urls": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz",
+      "integrity": "sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "brace-expansion": "^1.1.7"
+        "abab": "^2.0.6",
+        "whatwg-mimetype": "^3.0.0",
+        "whatwg-url": "^12.0.0"
       },
       "engines": {
-        "node": "*"
+        "node": ">=14"
       }
     },
-    "node_modules/eslint-plugin-node/node_modules/semver": {
-      "version": "6.3.1",
-      "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
-      "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
+    "node_modules/data-urls/node_modules/tr46": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
+      "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
       "dev": true,
-      "peer": true,
-      "bin": {
-        "semver": "bin/semver.js"
+      "dependencies": {
+        "punycode": "^2.3.0"
+      },
+      "engines": {
+        "node": ">=14"
       }
     },
-    "node_modules/eslint-plugin-promise": {
-      "version": "6.1.1",
-      "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz",
-      "integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==",
+    "node_modules/data-urls/node_modules/webidl-conversions": {
+      "version": "7.0.0",
+      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
+      "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
       "dev": true,
-      "peer": true,
       "engines": {
-        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
-      },
-      "peerDependencies": {
-        "eslint": "^7.0.0 || ^8.0.0"
+        "node": ">=12"
       }
     },
-    "node_modules/eslint-scope": {
-      "version": "7.2.0",
-      "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz",
-      "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==",
+    "node_modules/data-urls/node_modules/whatwg-url": {
+      "version": "12.0.1",
+      "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz",
+      "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "esrecurse": "^4.3.0",
-        "estraverse": "^5.2.0"
+        "tr46": "^4.1.1",
+        "webidl-conversions": "^7.0.0"
       },
       "engines": {
-        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
-      },
-      "funding": {
-        "url": "https://opencollective.com/eslint"
+        "node": ">=14"
       }
     },
-    "node_modules/eslint-utils": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
-      "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
+    "node_modules/dateformat": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz",
+      "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==",
       "dev": true,
-      "peer": true,
+      "engines": {
+        "node": "*"
+      }
+    },
+    "node_modules/debug": {
+      "version": "4.3.4",
+      "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+      "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
+      "inBundle": true,
       "dependencies": {
-        "eslint-visitor-keys": "^1.1.0"
+        "ms": "2.1.2"
       },
       "engines": {
-        "node": ">=6"
+        "node": ">=6.0"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/mysticatea"
+      "peerDependenciesMeta": {
+        "supports-color": {
+          "optional": true
+        }
       }
     },
-    "node_modules/eslint-utils/node_modules/eslint-visitor-keys": {
-      "version": "1.3.0",
-      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
-      "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
+    "node_modules/debug/node_modules/ms": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+      "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+      "inBundle": true
+    },
+    "node_modules/decamelize": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+      "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
       "dev": true,
-      "peer": true,
       "engines": {
-        "node": ">=4"
+        "node": ">=0.10.0"
       }
     },
-    "node_modules/eslint-visitor-keys": {
-      "version": "3.4.0",
-      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz",
-      "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==",
+    "node_modules/decamelize-keys": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz",
+      "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==",
       "dev": true,
-      "peer": true,
+      "dependencies": {
+        "decamelize": "^1.1.0",
+        "map-obj": "^1.0.0"
+      },
       "engines": {
-        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+        "node": ">=0.10.0"
       },
       "funding": {
-        "url": "https://opencollective.com/eslint"
+        "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/eslint/node_modules/ajv": {
-      "version": "6.12.6",
-      "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
-      "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+    "node_modules/decamelize-keys/node_modules/map-obj": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
+      "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/decimal.js": {
+      "version": "10.4.3",
+      "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz",
+      "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==",
+      "dev": true
+    },
+    "node_modules/decode-named-character-reference": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz",
+      "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "fast-deep-equal": "^3.1.1",
-        "fast-json-stable-stringify": "^2.0.0",
-        "json-schema-traverse": "^0.4.1",
-        "uri-js": "^4.2.2"
+        "character-entities": "^2.0.0"
       },
       "funding": {
         "type": "github",
-        "url": "https://github.com/sponsors/epoberezkin"
+        "url": "https://github.com/sponsors/wooorm"
       }
     },
-    "node_modules/eslint/node_modules/brace-expansion": {
-      "version": "1.1.11",
-      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
-      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
-      "dev": true,
-      "peer": true,
-      "dependencies": {
-        "balanced-match": "^1.0.0",
-        "concat-map": "0.0.1"
-      }
+    "node_modules/deep-is": {
+      "version": "0.1.4",
+      "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+      "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+      "dev": true
     },
-    "node_modules/eslint/node_modules/chalk": {
-      "version": "4.1.2",
-      "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
-      "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+    "node_modules/default-require-extensions": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.1.tgz",
+      "integrity": "sha512-eXTJmRbm2TIt9MgWTsOH1wEuhew6XGZcMeGKCtLedIg/NCsg1iBePXkceTdK4Fii7pzmN9tGsZhKzZ4h7O/fxw==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "ansi-styles": "^4.1.0",
-        "supports-color": "^7.1.0"
+        "strip-bom": "^4.0.0"
       },
       "engines": {
-        "node": ">=10"
+        "node": ">=8"
       },
       "funding": {
-        "url": "https://github.com/chalk/chalk?sponsor=1"
+        "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/eslint/node_modules/json-schema-traverse": {
-      "version": "0.4.1",
-      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
-      "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
-      "dev": true,
-      "peer": true
-    },
-    "node_modules/eslint/node_modules/minimatch": {
-      "version": "3.1.2",
-      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
-      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
-      "dev": true,
-      "peer": true,
-      "dependencies": {
-        "brace-expansion": "^1.1.7"
-      },
-      "engines": {
-        "node": "*"
-      }
-    },
-    "node_modules/eslint/node_modules/supports-color": {
-      "version": "7.2.0",
-      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
-      "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
-      "dev": true,
-      "peer": true,
+    "node_modules/defaults": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz",
+      "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==",
+      "inBundle": true,
       "dependencies": {
-        "has-flag": "^4.0.0"
+        "clone": "^1.0.2"
       },
-      "engines": {
-        "node": ">=8"
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/espree": {
-      "version": "9.5.1",
-      "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz",
-      "integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==",
+    "node_modules/define-properties": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz",
+      "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "acorn": "^8.8.0",
-        "acorn-jsx": "^5.3.2",
-        "eslint-visitor-keys": "^3.4.0"
+        "has-property-descriptors": "^1.0.0",
+        "object-keys": "^1.1.1"
       },
       "engines": {
-        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+        "node": ">= 0.4"
       },
       "funding": {
-        "url": "https://opencollective.com/eslint"
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/esprima": {
-      "version": "1.2.2",
-      "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.2.tgz",
-      "integrity": "sha512-+JpPZam9w5DuJ3Q67SqsMGtiHKENSMRVoxvArfJZK01/BfLEObtZ6orJa/MtoGNR/rfMgp5837T41PAmTwAv/A==",
+    "node_modules/delayed-stream": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+      "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
       "dev": true,
-      "bin": {
-        "esparse": "bin/esparse.js",
-        "esvalidate": "bin/esvalidate.js"
-      },
       "engines": {
         "node": ">=0.4.0"
       }
     },
-    "node_modules/esquery": {
-      "version": "1.5.0",
-      "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
-      "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==",
+    "node_modules/delegates": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
+      "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
+      "inBundle": true
+    },
+    "node_modules/deprecation": {
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
+      "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==",
+      "dev": true
+    },
+    "node_modules/dequal": {
+      "version": "2.0.3",
+      "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
+      "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
       "dev": true,
-      "peer": true,
-      "dependencies": {
-        "estraverse": "^5.1.0"
-      },
       "engines": {
-        "node": ">=0.10"
+        "node": ">=6"
       }
     },
-    "node_modules/esrecurse": {
-      "version": "4.3.0",
-      "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
-      "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+    "node_modules/detect-indent": {
+      "version": "6.1.0",
+      "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz",
+      "integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==",
       "dev": true,
-      "peer": true,
-      "dependencies": {
-        "estraverse": "^5.2.0"
-      },
       "engines": {
-        "node": ">=4.0"
+        "node": ">=8"
       }
     },
-    "node_modules/estraverse": {
-      "version": "5.3.0",
-      "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
-      "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
-      "dev": true,
+    "node_modules/diff": {
+      "version": "5.1.0",
+      "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz",
+      "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==",
       "engines": {
-        "node": ">=4.0"
+        "node": ">=0.3.1"
       }
     },
-    "node_modules/esutils": {
-      "version": "2.0.3",
-      "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
-      "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+    "node_modules/discontinuous-range": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz",
+      "integrity": "sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==",
+      "dev": true
+    },
+    "node_modules/docopt": {
+      "version": "0.6.2",
+      "resolved": "https://registry.npmjs.org/docopt/-/docopt-0.6.2.tgz",
+      "integrity": "sha512-NqTbaYeE4gA/wU1hdKFdU+AFahpDOpgGLzHP42k6H6DKExJd0A55KEVWYhL9FEmHmgeLvEU2vuKXDuU+4yToOw==",
       "dev": true,
       "engines": {
         "node": ">=0.10.0"
       }
     },
-    "node_modules/event-target-shim": {
-      "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
-      "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
-      "inBundle": true,
+    "node_modules/doctrine": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
+      "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "esutils": "^2.0.2"
+      },
       "engines": {
-        "node": ">=6"
+        "node": ">=6.0.0"
       }
     },
-    "node_modules/eventemitter3": {
-      "version": "4.0.7",
-      "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
-      "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
-      "dev": true
+    "node_modules/dom-serializer": {
+      "version": "1.4.1",
+      "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz",
+      "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==",
+      "dev": true,
+      "dependencies": {
+        "domelementtype": "^2.0.1",
+        "domhandler": "^4.2.0",
+        "entities": "^2.0.0"
+      },
+      "funding": {
+        "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
+      }
     },
-    "node_modules/events": {
-      "version": "3.3.0",
-      "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
-      "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
-      "inBundle": true,
+    "node_modules/domelementtype": {
+      "version": "2.3.0",
+      "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
+      "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",
+      "dev": true,
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/fb55"
+        }
+      ]
+    },
+    "node_modules/domexception": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz",
+      "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==",
+      "dev": true,
+      "dependencies": {
+        "webidl-conversions": "^7.0.0"
+      },
       "engines": {
-        "node": ">=0.8.x"
+        "node": ">=12"
       }
     },
-    "node_modules/events-to-array": {
-      "version": "1.1.2",
-      "resolved": "https://registry.npmjs.org/events-to-array/-/events-to-array-1.1.2.tgz",
-      "integrity": "sha512-inRWzRY7nG+aXZxBzEqYKB3HPgwflZRopAjDCHv0whhRx+MTUr1ei0ICZUypdyE0HRm4L2d5VEcIqLD6yl+BFA==",
-      "dev": true
+    "node_modules/domexception/node_modules/webidl-conversions": {
+      "version": "7.0.0",
+      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
+      "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
+      "dev": true,
+      "engines": {
+        "node": ">=12"
+      }
     },
-    "node_modules/execa": {
-      "version": "5.1.1",
-      "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
-      "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+    "node_modules/domhandler": {
+      "version": "4.3.1",
+      "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz",
+      "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==",
       "dev": true,
       "dependencies": {
-        "cross-spawn": "^7.0.3",
-        "get-stream": "^6.0.0",
-        "human-signals": "^2.1.0",
-        "is-stream": "^2.0.0",
-        "merge-stream": "^2.0.0",
-        "npm-run-path": "^4.0.1",
-        "onetime": "^5.1.2",
-        "signal-exit": "^3.0.3",
-        "strip-final-newline": "^2.0.0"
+        "domelementtype": "^2.2.0"
       },
       "engines": {
-        "node": ">=10"
+        "node": ">= 4"
       },
       "funding": {
-        "url": "https://github.com/sindresorhus/execa?sponsor=1"
+        "url": "https://github.com/fb55/domhandler?sponsor=1"
       }
     },
-    "node_modules/execa/node_modules/signal-exit": {
-      "version": "3.0.7",
-      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
-      "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
-      "dev": true
+    "node_modules/domutils": {
+      "version": "2.8.0",
+      "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz",
+      "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==",
+      "dev": true,
+      "dependencies": {
+        "dom-serializer": "^1.0.1",
+        "domelementtype": "^2.2.0",
+        "domhandler": "^4.2.0"
+      },
+      "funding": {
+        "url": "https://github.com/fb55/domutils?sponsor=1"
+      }
     },
-    "node_modules/exponential-backoff": {
-      "version": "3.1.1",
-      "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz",
-      "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==",
-      "inBundle": true
+    "node_modules/dot-prop": {
+      "version": "5.3.0",
+      "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz",
+      "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==",
+      "dev": true,
+      "dependencies": {
+        "is-obj": "^2.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
     },
-    "node_modules/extend": {
-      "version": "3.0.2",
-      "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
-      "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+    "node_modules/duplexer": {
+      "version": "0.1.2",
+      "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
+      "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==",
       "dev": true
     },
-    "node_modules/fast-deep-equal": {
-      "version": "3.1.3",
-      "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
-      "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
-      "dev": true
+    "node_modules/eastasianwidth": {
+      "version": "0.2.0",
+      "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
+      "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
+      "inBundle": true
     },
-    "node_modules/fast-fifo": {
-      "version": "1.3.0",
-      "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.0.tgz",
-      "integrity": "sha512-IgfweLvEpwyA4WgiQe9Nx6VV2QkML2NkvZnk1oKnIzXgXdWxuhF7zw4DvLTPZJn6PIUneiAXPF24QmoEqHTjyw==",
+    "node_modules/electron-to-chromium": {
+      "version": "1.4.380",
+      "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.380.tgz",
+      "integrity": "sha512-XKGdI4pWM78eLH2cbXJHiBnWUwFSzZM7XujsB6stDiGu9AeSqziedP6amNLpJzE3i0rLTcfAwdCTs5ecP5yeSg==",
       "dev": true
     },
-    "node_modules/fast-json-stable-stringify": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
-      "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
-      "dev": true,
-      "peer": true
+    "node_modules/emoji-regex": {
+      "version": "8.0.0",
+      "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+      "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+      "inBundle": true
     },
-    "node_modules/fast-levenshtein": {
-      "version": "2.0.6",
-      "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
-      "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
-      "dev": true
+    "node_modules/encoding": {
+      "version": "0.1.13",
+      "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
+      "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
+      "inBundle": true,
+      "optional": true,
+      "dependencies": {
+        "iconv-lite": "^0.6.2"
+      }
     },
-    "node_modules/fastest-levenshtein": {
-      "version": "1.0.16",
-      "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz",
-      "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==",
+    "node_modules/entities": {
+      "version": "2.2.0",
+      "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
+      "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==",
+      "dev": true,
+      "funding": {
+        "url": "https://github.com/fb55/entities?sponsor=1"
+      }
+    },
+    "node_modules/env-paths": {
+      "version": "2.2.1",
+      "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
+      "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==",
       "inBundle": true,
       "engines": {
-        "node": ">= 4.9.1"
+        "node": ">=6"
       }
     },
-    "node_modules/fastq": {
-      "version": "1.15.0",
-      "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz",
-      "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==",
+    "node_modules/err-code": {
+      "version": "2.0.3",
+      "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz",
+      "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==",
+      "inBundle": true
+    },
+    "node_modules/error-ex": {
+      "version": "1.3.2",
+      "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
+      "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "reusify": "^1.0.4"
+        "is-arrayish": "^0.2.1"
       }
     },
-    "node_modules/figures": {
-      "version": "3.2.0",
-      "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
-      "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
+    "node_modules/es-abstract": {
+      "version": "1.21.2",
+      "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.2.tgz",
+      "integrity": "sha512-y/B5POM2iBnIxCiernH1G7rC9qQoM77lLIMQLuob0zhp8C56Po81+2Nj0WFKnd0pNReDTnkYryc+zhOzpEIROg==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "escape-string-regexp": "^1.0.5"
+        "array-buffer-byte-length": "^1.0.0",
+        "available-typed-arrays": "^1.0.5",
+        "call-bind": "^1.0.2",
+        "es-set-tostringtag": "^2.0.1",
+        "es-to-primitive": "^1.2.1",
+        "function.prototype.name": "^1.1.5",
+        "get-intrinsic": "^1.2.0",
+        "get-symbol-description": "^1.0.0",
+        "globalthis": "^1.0.3",
+        "gopd": "^1.0.1",
+        "has": "^1.0.3",
+        "has-property-descriptors": "^1.0.0",
+        "has-proto": "^1.0.1",
+        "has-symbols": "^1.0.3",
+        "internal-slot": "^1.0.5",
+        "is-array-buffer": "^3.0.2",
+        "is-callable": "^1.2.7",
+        "is-negative-zero": "^2.0.2",
+        "is-regex": "^1.1.4",
+        "is-shared-array-buffer": "^1.0.2",
+        "is-string": "^1.0.7",
+        "is-typed-array": "^1.1.10",
+        "is-weakref": "^1.0.2",
+        "object-inspect": "^1.12.3",
+        "object-keys": "^1.1.1",
+        "object.assign": "^4.1.4",
+        "regexp.prototype.flags": "^1.4.3",
+        "safe-regex-test": "^1.0.0",
+        "string.prototype.trim": "^1.2.7",
+        "string.prototype.trimend": "^1.0.6",
+        "string.prototype.trimstart": "^1.0.6",
+        "typed-array-length": "^1.0.4",
+        "unbox-primitive": "^1.0.2",
+        "which-typed-array": "^1.1.9"
       },
       "engines": {
-        "node": ">=8"
+        "node": ">= 0.4"
       },
       "funding": {
-        "url": "https://github.com/sponsors/sindresorhus"
-      }
-    },
-    "node_modules/figures/node_modules/escape-string-regexp": {
-      "version": "1.0.5",
-      "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
-      "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
-      "dev": true,
-      "engines": {
-        "node": ">=0.8.0"
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/file-entry-cache": {
-      "version": "6.0.1",
-      "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
-      "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==",
+    "node_modules/es-set-tostringtag": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz",
+      "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "flat-cache": "^3.0.4"
+        "get-intrinsic": "^1.1.3",
+        "has": "^1.0.3",
+        "has-tostringtag": "^1.0.0"
       },
       "engines": {
-        "node": "^10.12.0 || >=12.0.0"
+        "node": ">= 0.4"
       }
     },
-    "node_modules/fill-range": {
-      "version": "7.0.1",
-      "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
-      "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+    "node_modules/es-shim-unscopables": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz",
+      "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "to-regex-range": "^5.0.1"
-      },
-      "engines": {
-        "node": ">=8"
+        "has": "^1.0.3"
       }
     },
-    "node_modules/find-cache-dir": {
-      "version": "3.3.2",
-      "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz",
-      "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==",
+    "node_modules/es-to-primitive": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
+      "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "commondir": "^1.0.1",
-        "make-dir": "^3.0.2",
-        "pkg-dir": "^4.1.0"
+        "is-callable": "^1.1.4",
+        "is-date-object": "^1.0.1",
+        "is-symbol": "^1.0.2"
       },
       "engines": {
-        "node": ">=8"
+        "node": ">= 0.4"
       },
       "funding": {
-        "url": "https://github.com/avajs/find-cache-dir?sponsor=1"
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/find-up": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
-      "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+    "node_modules/es6-error": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
+      "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
+      "dev": true
+    },
+    "node_modules/escalade": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
+      "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
       "dev": true,
-      "dependencies": {
-        "locate-path": "^6.0.0",
-        "path-exists": "^4.0.0"
-      },
+      "engines": {
+        "node": ">=6"
+      }
+    },
+    "node_modules/escape-string-regexp": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+      "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+      "dev": true,
+      "peer": true,
       "engines": {
         "node": ">=10"
       },
@@ -6417,1109 +6374,861 @@
         "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/findit": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/findit/-/findit-2.0.0.tgz",
-      "integrity": "sha512-ENZS237/Hr8bjczn5eKuBohLgaD0JyUd0arxretR1f9RO46vZHA1b2y0VorgGV3WaOT3c+78P8h7v4JGJ1i/rg==",
-      "dev": true
-    },
-    "node_modules/flat-cache": {
-      "version": "3.0.4",
-      "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
-      "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==",
+    "node_modules/escodegen": {
+      "version": "1.14.3",
+      "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz",
+      "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "flatted": "^3.1.0",
-        "rimraf": "^3.0.2"
+        "esprima": "^4.0.1",
+        "estraverse": "^4.2.0",
+        "esutils": "^2.0.2",
+        "optionator": "^0.8.1"
+      },
+      "bin": {
+        "escodegen": "bin/escodegen.js",
+        "esgenerate": "bin/esgenerate.js"
       },
       "engines": {
-        "node": "^10.12.0 || >=12.0.0"
+        "node": ">=4.0"
+      },
+      "optionalDependencies": {
+        "source-map": "~0.6.1"
       }
     },
-    "node_modules/flatted": {
-      "version": "3.2.7",
-      "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
-      "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==",
-      "dev": true,
-      "peer": true
-    },
-    "node_modules/for-each": {
-      "version": "0.3.3",
-      "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
-      "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==",
+    "node_modules/escodegen/node_modules/esprima": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+      "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
       "dev": true,
-      "peer": true,
-      "dependencies": {
-        "is-callable": "^1.1.3"
-      }
-    },
-    "node_modules/foreground-child": {
-      "version": "3.1.1",
-      "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz",
-      "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==",
-      "inBundle": true,
-      "dependencies": {
-        "cross-spawn": "^7.0.0",
-        "signal-exit": "^4.0.1"
+      "bin": {
+        "esparse": "bin/esparse.js",
+        "esvalidate": "bin/esvalidate.js"
       },
       "engines": {
-        "node": ">=14"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
+        "node": ">=4"
       }
     },
-    "node_modules/form-data": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
-      "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+    "node_modules/escodegen/node_modules/estraverse": {
+      "version": "4.3.0",
+      "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
+      "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
       "dev": true,
-      "dependencies": {
-        "asynckit": "^0.4.0",
-        "combined-stream": "^1.0.8",
-        "mime-types": "^2.1.12"
-      },
       "engines": {
-        "node": ">= 6"
+        "node": ">=4.0"
       }
     },
-    "node_modules/fromentries": {
-      "version": "1.3.2",
-      "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz",
-      "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==",
-      "dev": true,
-      "funding": [
-        {
-          "type": "github",
-          "url": "https://github.com/sponsors/feross"
-        },
-        {
-          "type": "patreon",
-          "url": "https://www.patreon.com/feross"
-        },
-        {
-          "type": "consulting",
-          "url": "https://feross.org/support"
-        }
-      ]
-    },
-    "node_modules/front-matter": {
-      "version": "4.0.2",
-      "resolved": "https://registry.npmjs.org/front-matter/-/front-matter-4.0.2.tgz",
-      "integrity": "sha512-I8ZuJ/qG92NWX8i5x1Y8qyj3vizhXS31OxjKDu3LKP+7/qBgfIKValiZIEwoVoJKUHlhWtYrktkxV1XsX+pPlg==",
+    "node_modules/escodegen/node_modules/levn": {
+      "version": "0.3.0",
+      "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
+      "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==",
       "dev": true,
       "dependencies": {
-        "js-yaml": "^3.13.1"
+        "prelude-ls": "~1.1.2",
+        "type-check": "~0.3.2"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
       }
     },
-    "node_modules/front-matter/node_modules/argparse": {
-      "version": "1.0.10",
-      "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
-      "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+    "node_modules/escodegen/node_modules/optionator": {
+      "version": "0.8.3",
+      "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
+      "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
       "dev": true,
       "dependencies": {
-        "sprintf-js": "~1.0.2"
+        "deep-is": "~0.1.3",
+        "fast-levenshtein": "~2.0.6",
+        "levn": "~0.3.0",
+        "prelude-ls": "~1.1.2",
+        "type-check": "~0.3.2",
+        "word-wrap": "~1.2.3"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
       }
     },
-    "node_modules/front-matter/node_modules/esprima": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
-      "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+    "node_modules/escodegen/node_modules/prelude-ls": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
+      "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==",
       "dev": true,
-      "bin": {
-        "esparse": "bin/esparse.js",
-        "esvalidate": "bin/esvalidate.js"
-      },
       "engines": {
-        "node": ">=4"
+        "node": ">= 0.8.0"
       }
     },
-    "node_modules/front-matter/node_modules/js-yaml": {
-      "version": "3.14.1",
-      "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
-      "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
+    "node_modules/escodegen/node_modules/type-check": {
+      "version": "0.3.2",
+      "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
+      "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==",
       "dev": true,
       "dependencies": {
-        "argparse": "^1.0.7",
-        "esprima": "^4.0.0"
+        "prelude-ls": "~1.1.2"
       },
-      "bin": {
-        "js-yaml": "bin/js-yaml.js"
+      "engines": {
+        "node": ">= 0.8.0"
       }
     },
-    "node_modules/fs-exists-cached": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/fs-exists-cached/-/fs-exists-cached-1.0.0.tgz",
-      "integrity": "sha512-kSxoARUDn4F2RPXX48UXnaFKwVU7Ivd/6qpzZL29MCDmr9sTvybv4gFCp+qaI4fM9m0z9fgz/yJvi56GAz+BZg==",
-      "dev": true
-    },
-    "node_modules/fs-extra": {
-      "version": "11.1.1",
-      "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz",
-      "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==",
+    "node_modules/eslint": {
+      "version": "8.39.0",
+      "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.39.0.tgz",
+      "integrity": "sha512-mwiok6cy7KTW7rBpo05k6+p4YVZByLNjAZ/ACB9DRCu4YDRwjXI01tWHp6KAUWelsBetTxKK/2sHB0vdS8Z2Og==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "graceful-fs": "^4.2.0",
-        "jsonfile": "^6.0.1",
-        "universalify": "^2.0.0"
+        "@eslint-community/eslint-utils": "^4.2.0",
+        "@eslint-community/regexpp": "^4.4.0",
+        "@eslint/eslintrc": "^2.0.2",
+        "@eslint/js": "8.39.0",
+        "@humanwhocodes/config-array": "^0.11.8",
+        "@humanwhocodes/module-importer": "^1.0.1",
+        "@nodelib/fs.walk": "^1.2.8",
+        "ajv": "^6.10.0",
+        "chalk": "^4.0.0",
+        "cross-spawn": "^7.0.2",
+        "debug": "^4.3.2",
+        "doctrine": "^3.0.0",
+        "escape-string-regexp": "^4.0.0",
+        "eslint-scope": "^7.2.0",
+        "eslint-visitor-keys": "^3.4.0",
+        "espree": "^9.5.1",
+        "esquery": "^1.4.2",
+        "esutils": "^2.0.2",
+        "fast-deep-equal": "^3.1.3",
+        "file-entry-cache": "^6.0.1",
+        "find-up": "^5.0.0",
+        "glob-parent": "^6.0.2",
+        "globals": "^13.19.0",
+        "grapheme-splitter": "^1.0.4",
+        "ignore": "^5.2.0",
+        "import-fresh": "^3.0.0",
+        "imurmurhash": "^0.1.4",
+        "is-glob": "^4.0.0",
+        "is-path-inside": "^3.0.3",
+        "js-sdsl": "^4.1.4",
+        "js-yaml": "^4.1.0",
+        "json-stable-stringify-without-jsonify": "^1.0.1",
+        "levn": "^0.4.1",
+        "lodash.merge": "^4.6.2",
+        "minimatch": "^3.1.2",
+        "natural-compare": "^1.4.0",
+        "optionator": "^0.9.1",
+        "strip-ansi": "^6.0.1",
+        "strip-json-comments": "^3.1.0",
+        "text-table": "^0.2.0"
+      },
+      "bin": {
+        "eslint": "bin/eslint.js"
       },
       "engines": {
-        "node": ">=14.14"
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+      },
+      "funding": {
+        "url": "https://opencollective.com/eslint"
       }
     },
-    "node_modules/fs-minipass": {
-      "version": "3.0.3",
-      "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz",
-      "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==",
-      "inBundle": true,
+    "node_modules/eslint-import-resolver-node": {
+      "version": "0.3.7",
+      "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz",
+      "integrity": "sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==",
+      "dev": true,
+      "peer": true,
       "dependencies": {
-        "minipass": "^7.0.3"
-      },
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "debug": "^3.2.7",
+        "is-core-module": "^2.11.0",
+        "resolve": "^1.22.1"
       }
     },
-    "node_modules/fs.realpath": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
-      "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
-      "inBundle": true
-    },
-    "node_modules/fsevents": {
-      "version": "2.3.2",
-      "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
-      "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
+    "node_modules/eslint-import-resolver-node/node_modules/debug": {
+      "version": "3.2.7",
+      "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+      "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
       "dev": true,
-      "hasInstallScript": true,
-      "optional": true,
-      "os": [
-        "darwin"
-      ],
-      "engines": {
-        "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+      "peer": true,
+      "dependencies": {
+        "ms": "^2.1.1"
       }
     },
-    "node_modules/function-bind": {
-      "version": "1.1.1",
-      "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
-      "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
-      "inBundle": true
-    },
-    "node_modules/function-loop": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/function-loop/-/function-loop-2.0.1.tgz",
-      "integrity": "sha512-ktIR+O6i/4h+j/ZhZJNdzeI4i9lEPeEK6UPR2EVyTVBqOwcU3Za9xYKLH64ZR9HmcROyRrOkizNyjjtWJzDDkQ==",
-      "dev": true
-    },
-    "node_modules/function.prototype.name": {
-      "version": "1.1.5",
-      "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz",
-      "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==",
+    "node_modules/eslint-module-utils": {
+      "version": "2.8.0",
+      "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz",
+      "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "call-bind": "^1.0.2",
-        "define-properties": "^1.1.3",
-        "es-abstract": "^1.19.0",
-        "functions-have-names": "^1.2.2"
+        "debug": "^3.2.7"
       },
       "engines": {
-        "node": ">= 0.4"
+        "node": ">=4"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
-      }
-    },
-    "node_modules/functions-have-names": {
-      "version": "1.2.3",
-      "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz",
-      "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==",
-      "dev": true,
-      "peer": true,
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
-      }
-    },
-    "node_modules/gauge": {
-      "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/gauge/-/gauge-5.0.1.tgz",
-      "integrity": "sha512-CmykPMJGuNan/3S4kZOpvvPYSNqSHANiWnh9XcMU2pSjtBfF0XzZ2p1bFAxTbnFxyBuPxQYHhzwaoOmUdqzvxQ==",
-      "inBundle": true,
-      "dependencies": {
-        "aproba": "^1.0.3 || ^2.0.0",
-        "color-support": "^1.1.3",
-        "console-control-strings": "^1.1.0",
-        "has-unicode": "^2.0.1",
-        "signal-exit": "^4.0.1",
-        "string-width": "^4.2.3",
-        "strip-ansi": "^6.0.1",
-        "wide-align": "^1.1.5"
-      },
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
-      }
-    },
-    "node_modules/gensync": {
-      "version": "1.0.0-beta.2",
-      "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
-      "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
-      "dev": true,
-      "engines": {
-        "node": ">=6.9.0"
+      "peerDependenciesMeta": {
+        "eslint": {
+          "optional": true
+        }
       }
     },
-    "node_modules/get-caller-file": {
-      "version": "2.0.5",
-      "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
-      "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+    "node_modules/eslint-module-utils/node_modules/debug": {
+      "version": "3.2.7",
+      "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+      "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
       "dev": true,
-      "engines": {
-        "node": "6.* || 8.* || >= 10.*"
+      "peer": true,
+      "dependencies": {
+        "ms": "^2.1.1"
       }
     },
-    "node_modules/get-intrinsic": {
-      "version": "1.2.0",
-      "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
-      "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
+    "node_modules/eslint-plugin-es": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz",
+      "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "function-bind": "^1.1.1",
-        "has": "^1.0.3",
-        "has-symbols": "^1.0.3"
+        "eslint-utils": "^2.0.0",
+        "regexpp": "^3.0.0"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
-      }
-    },
-    "node_modules/get-package-type": {
-      "version": "0.1.0",
-      "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz",
-      "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==",
-      "dev": true,
-      "engines": {
-        "node": ">=8.0.0"
-      }
-    },
-    "node_modules/get-stream": {
-      "version": "6.0.1",
-      "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
-      "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
-      "dev": true,
       "engines": {
-        "node": ">=10"
+        "node": ">=8.10.0"
       },
       "funding": {
-        "url": "https://github.com/sponsors/sindresorhus"
+        "url": "https://github.com/sponsors/mysticatea"
+      },
+      "peerDependencies": {
+        "eslint": ">=4.19.1"
       }
     },
-    "node_modules/get-symbol-description": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz",
-      "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==",
+    "node_modules/eslint-plugin-import": {
+      "version": "2.27.5",
+      "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz",
+      "integrity": "sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "call-bind": "^1.0.2",
-        "get-intrinsic": "^1.1.1"
+        "array-includes": "^3.1.6",
+        "array.prototype.flat": "^1.3.1",
+        "array.prototype.flatmap": "^1.3.1",
+        "debug": "^3.2.7",
+        "doctrine": "^2.1.0",
+        "eslint-import-resolver-node": "^0.3.7",
+        "eslint-module-utils": "^2.7.4",
+        "has": "^1.0.3",
+        "is-core-module": "^2.11.0",
+        "is-glob": "^4.0.3",
+        "minimatch": "^3.1.2",
+        "object.values": "^1.1.6",
+        "resolve": "^1.22.1",
+        "semver": "^6.3.0",
+        "tsconfig-paths": "^3.14.1"
       },
       "engines": {
-        "node": ">= 0.4"
+        "node": ">=4"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+      "peerDependencies": {
+        "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8"
       }
     },
-    "node_modules/git-raw-commits": {
-      "version": "2.0.11",
-      "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.11.tgz",
-      "integrity": "sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A==",
+    "node_modules/eslint-plugin-import/node_modules/brace-expansion": {
+      "version": "1.1.11",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "dargs": "^7.0.0",
-        "lodash": "^4.17.15",
-        "meow": "^8.0.0",
-        "split2": "^3.0.0",
-        "through2": "^4.0.0"
-      },
-      "bin": {
-        "git-raw-commits": "cli.js"
-      },
-      "engines": {
-        "node": ">=10"
+        "balanced-match": "^1.0.0",
+        "concat-map": "0.0.1"
       }
     },
-    "node_modules/github-slugger": {
-      "version": "1.5.0",
-      "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-1.5.0.tgz",
-      "integrity": "sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==",
-      "dev": true
-    },
-    "node_modules/glob": {
-      "version": "10.3.10",
-      "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz",
-      "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==",
-      "inBundle": true,
+    "node_modules/eslint-plugin-import/node_modules/debug": {
+      "version": "3.2.7",
+      "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+      "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+      "dev": true,
+      "peer": true,
       "dependencies": {
-        "foreground-child": "^3.1.0",
-        "jackspeak": "^2.3.5",
-        "minimatch": "^9.0.1",
-        "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0",
-        "path-scurry": "^1.10.1"
-      },
-      "bin": {
-        "glob": "dist/esm/bin.mjs"
-      },
-      "engines": {
-        "node": ">=16 || 14 >=14.17"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
+        "ms": "^2.1.1"
       }
     },
-    "node_modules/glob-parent": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
-      "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
+    "node_modules/eslint-plugin-import/node_modules/doctrine": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
+      "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "is-glob": "^4.0.3"
+        "esutils": "^2.0.2"
       },
       "engines": {
-        "node": ">=10.13.0"
+        "node": ">=0.10.0"
       }
     },
-    "node_modules/global-dirs": {
-      "version": "0.1.1",
-      "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz",
-      "integrity": "sha512-NknMLn7F2J7aflwFOlGdNIuCDpN3VGoSoB+aap3KABFWbHVn1TCgFC+np23J8W2BiZbjfEw3BFBycSMv1AFblg==",
+    "node_modules/eslint-plugin-import/node_modules/minimatch": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "ini": "^1.3.4"
+        "brace-expansion": "^1.1.7"
       },
       "engines": {
-        "node": ">=4"
+        "node": "*"
       }
     },
-    "node_modules/global-dirs/node_modules/ini": {
-      "version": "1.3.8",
-      "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
-      "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
-      "dev": true
-    },
-    "node_modules/globals": {
-      "version": "13.20.0",
-      "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz",
-      "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==",
+    "node_modules/eslint-plugin-import/node_modules/semver": {
+      "version": "6.3.1",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+      "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
       "dev": true,
       "peer": true,
-      "dependencies": {
-        "type-fest": "^0.20.2"
-      },
-      "engines": {
-        "node": ">=8"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/sindresorhus"
+      "bin": {
+        "semver": "bin/semver.js"
       }
     },
-    "node_modules/globalthis": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz",
-      "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==",
+    "node_modules/eslint-plugin-node": {
+      "version": "11.1.0",
+      "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz",
+      "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "define-properties": "^1.1.3"
+        "eslint-plugin-es": "^3.0.0",
+        "eslint-utils": "^2.0.0",
+        "ignore": "^5.1.1",
+        "minimatch": "^3.0.4",
+        "resolve": "^1.10.1",
+        "semver": "^6.1.0"
       },
       "engines": {
-        "node": ">= 0.4"
+        "node": ">=8.10.0"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+      "peerDependencies": {
+        "eslint": ">=5.16.0"
       }
     },
-    "node_modules/gopd": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
-      "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
+    "node_modules/eslint-plugin-node/node_modules/brace-expansion": {
+      "version": "1.1.11",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "get-intrinsic": "^1.1.3"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "balanced-match": "^1.0.0",
+        "concat-map": "0.0.1"
       }
     },
-    "node_modules/graceful-fs": {
-      "version": "4.2.11",
-      "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
-      "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
-      "inBundle": true
-    },
-    "node_modules/grapheme-splitter": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz",
-      "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==",
-      "dev": true,
-      "peer": true
-    },
-    "node_modules/groff-escape": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/groff-escape/-/groff-escape-2.0.1.tgz",
-      "integrity": "sha512-S0nG+mLFTu1buDKQsRlBtIxZU/dMvrdCURJg/zSLKpL333yi1Fs5bLUYk+v3pRYlc+qmHtukMAM2slB0AKFKAw==",
+    "node_modules/eslint-plugin-node/node_modules/minimatch": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
       "dev": true,
-      "funding": {
-        "type": "github",
-        "url": "https://github.com/sponsors/wooorm"
+      "peer": true,
+      "dependencies": {
+        "brace-expansion": "^1.1.7"
+      },
+      "engines": {
+        "node": "*"
       }
     },
-    "node_modules/handlebars": {
-      "version": "4.7.7",
-      "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz",
-      "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==",
+    "node_modules/eslint-plugin-node/node_modules/semver": {
+      "version": "6.3.1",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+      "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
       "dev": true,
-      "dependencies": {
-        "minimist": "^1.2.5",
-        "neo-async": "^2.6.0",
-        "source-map": "^0.6.1",
-        "wordwrap": "^1.0.0"
-      },
+      "peer": true,
       "bin": {
-        "handlebars": "bin/handlebars"
-      },
-      "engines": {
-        "node": ">=0.4.7"
-      },
-      "optionalDependencies": {
-        "uglify-js": "^3.1.4"
+        "semver": "bin/semver.js"
       }
     },
-    "node_modules/hard-rejection": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz",
-      "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==",
+    "node_modules/eslint-plugin-promise": {
+      "version": "6.1.1",
+      "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz",
+      "integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==",
       "dev": true,
+      "peer": true,
       "engines": {
-        "node": ">=6"
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+      },
+      "peerDependencies": {
+        "eslint": "^7.0.0 || ^8.0.0"
       }
     },
-    "node_modules/has": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
-      "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
-      "inBundle": true,
+    "node_modules/eslint-scope": {
+      "version": "7.2.0",
+      "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz",
+      "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==",
+      "dev": true,
+      "peer": true,
       "dependencies": {
-        "function-bind": "^1.1.1"
+        "esrecurse": "^4.3.0",
+        "estraverse": "^5.2.0"
       },
       "engines": {
-        "node": ">= 0.4.0"
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+      },
+      "funding": {
+        "url": "https://opencollective.com/eslint"
       }
     },
-    "node_modules/has-bigints": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz",
-      "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==",
+    "node_modules/eslint-utils": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
+      "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
       "dev": true,
       "peer": true,
+      "dependencies": {
+        "eslint-visitor-keys": "^1.1.0"
+      },
+      "engines": {
+        "node": ">=6"
+      },
       "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "url": "https://github.com/sponsors/mysticatea"
       }
     },
-    "node_modules/has-flag": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
-      "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+    "node_modules/eslint-utils/node_modules/eslint-visitor-keys": {
+      "version": "1.3.0",
+      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
+      "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
       "dev": true,
+      "peer": true,
       "engines": {
-        "node": ">=8"
+        "node": ">=4"
       }
     },
-    "node_modules/has-property-descriptors": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz",
-      "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==",
+    "node_modules/eslint-visitor-keys": {
+      "version": "3.4.0",
+      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz",
+      "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==",
       "dev": true,
       "peer": true,
-      "dependencies": {
-        "get-intrinsic": "^1.1.1"
+      "engines": {
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
       },
       "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "url": "https://opencollective.com/eslint"
       }
     },
-    "node_modules/has-proto": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
-      "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
+    "node_modules/eslint/node_modules/ajv": {
+      "version": "6.12.6",
+      "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+      "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
       "dev": true,
       "peer": true,
-      "engines": {
-        "node": ">= 0.4"
+      "dependencies": {
+        "fast-deep-equal": "^3.1.1",
+        "fast-json-stable-stringify": "^2.0.0",
+        "json-schema-traverse": "^0.4.1",
+        "uri-js": "^4.2.2"
       },
       "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "type": "github",
+        "url": "https://github.com/sponsors/epoberezkin"
       }
     },
-    "node_modules/has-symbols": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
-      "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
+    "node_modules/eslint/node_modules/brace-expansion": {
+      "version": "1.1.11",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
       "dev": true,
       "peer": true,
-      "engines": {
-        "node": ">= 0.4"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+      "dependencies": {
+        "balanced-match": "^1.0.0",
+        "concat-map": "0.0.1"
       }
     },
-    "node_modules/has-tostringtag": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz",
-      "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==",
+    "node_modules/eslint/node_modules/chalk": {
+      "version": "4.1.2",
+      "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+      "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "has-symbols": "^1.0.2"
+        "ansi-styles": "^4.1.0",
+        "supports-color": "^7.1.0"
       },
       "engines": {
-        "node": ">= 0.4"
+        "node": ">=10"
       },
       "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "url": "https://github.com/chalk/chalk?sponsor=1"
       }
     },
-    "node_modules/has-unicode": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
-      "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
-      "inBundle": true
+    "node_modules/eslint/node_modules/json-schema-traverse": {
+      "version": "0.4.1",
+      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+      "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+      "dev": true,
+      "peer": true
     },
-    "node_modules/hasha": {
-      "version": "5.2.2",
-      "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz",
-      "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==",
+    "node_modules/eslint/node_modules/minimatch": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "is-stream": "^2.0.0",
-        "type-fest": "^0.8.0"
+        "brace-expansion": "^1.1.7"
       },
       "engines": {
-        "node": ">=8"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/sindresorhus"
+        "node": "*"
       }
     },
-    "node_modules/hasha/node_modules/type-fest": {
-      "version": "0.8.1",
-      "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
-      "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
+    "node_modules/eslint/node_modules/supports-color": {
+      "version": "7.2.0",
+      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+      "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
       "dev": true,
+      "peer": true,
+      "dependencies": {
+        "has-flag": "^4.0.0"
+      },
       "engines": {
         "node": ">=8"
       }
     },
-    "node_modules/hast-util-from-parse5": {
-      "version": "7.1.2",
-      "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-7.1.2.tgz",
-      "integrity": "sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw==",
+    "node_modules/espree": {
+      "version": "9.5.1",
+      "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz",
+      "integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "@types/hast": "^2.0.0",
-        "@types/unist": "^2.0.0",
-        "hastscript": "^7.0.0",
-        "property-information": "^6.0.0",
-        "vfile": "^5.0.0",
-        "vfile-location": "^4.0.0",
-        "web-namespaces": "^2.0.0"
+        "acorn": "^8.8.0",
+        "acorn-jsx": "^5.3.2",
+        "eslint-visitor-keys": "^3.4.0"
       },
-      "funding": {
-        "type": "opencollective",
-        "url": "https://opencollective.com/unified"
-      }
-    },
-    "node_modules/hast-util-parse-selector": {
-      "version": "3.1.1",
-      "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz",
-      "integrity": "sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==",
-      "dev": true,
-      "dependencies": {
-        "@types/hast": "^2.0.0"
+      "engines": {
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
       },
       "funding": {
-        "type": "opencollective",
-        "url": "https://opencollective.com/unified"
+        "url": "https://opencollective.com/eslint"
       }
     },
-    "node_modules/hast-util-raw": {
-      "version": "7.2.3",
-      "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-7.2.3.tgz",
-      "integrity": "sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==",
-      "dev": true,
-      "dependencies": {
-        "@types/hast": "^2.0.0",
-        "@types/parse5": "^6.0.0",
-        "hast-util-from-parse5": "^7.0.0",
-        "hast-util-to-parse5": "^7.0.0",
-        "html-void-elements": "^2.0.0",
-        "parse5": "^6.0.0",
-        "unist-util-position": "^4.0.0",
-        "unist-util-visit": "^4.0.0",
-        "vfile": "^5.0.0",
-        "web-namespaces": "^2.0.0",
-        "zwitch": "^2.0.0"
-      },
-      "funding": {
-        "type": "opencollective",
-        "url": "https://opencollective.com/unified"
-      }
-    },
-    "node_modules/hast-util-raw/node_modules/parse5": {
-      "version": "6.0.1",
-      "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
-      "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==",
-      "dev": true
-    },
-    "node_modules/hast-util-raw/node_modules/unist-util-visit": {
-      "version": "4.1.2",
-      "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz",
-      "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==",
+    "node_modules/esprima": {
+      "version": "1.2.2",
+      "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.2.tgz",
+      "integrity": "sha512-+JpPZam9w5DuJ3Q67SqsMGtiHKENSMRVoxvArfJZK01/BfLEObtZ6orJa/MtoGNR/rfMgp5837T41PAmTwAv/A==",
       "dev": true,
-      "dependencies": {
-        "@types/unist": "^2.0.0",
-        "unist-util-is": "^5.0.0",
-        "unist-util-visit-parents": "^5.1.1"
+      "bin": {
+        "esparse": "bin/esparse.js",
+        "esvalidate": "bin/esvalidate.js"
       },
-      "funding": {
-        "type": "opencollective",
-        "url": "https://opencollective.com/unified"
+      "engines": {
+        "node": ">=0.4.0"
       }
     },
-    "node_modules/hast-util-raw/node_modules/unist-util-visit-parents": {
-      "version": "5.1.3",
-      "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz",
-      "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==",
+    "node_modules/esquery": {
+      "version": "1.5.0",
+      "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
+      "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "@types/unist": "^2.0.0",
-        "unist-util-is": "^5.0.0"
+        "estraverse": "^5.1.0"
       },
-      "funding": {
-        "type": "opencollective",
-        "url": "https://opencollective.com/unified"
+      "engines": {
+        "node": ">=0.10"
       }
     },
-    "node_modules/hast-util-to-html": {
-      "version": "8.0.4",
-      "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-8.0.4.tgz",
-      "integrity": "sha512-4tpQTUOr9BMjtYyNlt0P50mH7xj0Ks2xpo8M943Vykljf99HW6EzulIoJP1N3eKOSScEHzyzi9dm7/cn0RfGwA==",
+    "node_modules/esrecurse": {
+      "version": "4.3.0",
+      "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+      "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "@types/hast": "^2.0.0",
-        "@types/unist": "^2.0.0",
-        "ccount": "^2.0.0",
-        "comma-separated-tokens": "^2.0.0",
-        "hast-util-raw": "^7.0.0",
-        "hast-util-whitespace": "^2.0.0",
-        "html-void-elements": "^2.0.0",
-        "property-information": "^6.0.0",
-        "space-separated-tokens": "^2.0.0",
-        "stringify-entities": "^4.0.0",
-        "zwitch": "^2.0.4"
+        "estraverse": "^5.2.0"
       },
-      "funding": {
-        "type": "opencollective",
-        "url": "https://opencollective.com/unified"
+      "engines": {
+        "node": ">=4.0"
       }
     },
-    "node_modules/hast-util-to-parse5": {
-      "version": "7.1.0",
-      "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-7.1.0.tgz",
-      "integrity": "sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==",
+    "node_modules/estraverse": {
+      "version": "5.3.0",
+      "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+      "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
       "dev": true,
-      "dependencies": {
-        "@types/hast": "^2.0.0",
-        "comma-separated-tokens": "^2.0.0",
-        "property-information": "^6.0.0",
-        "space-separated-tokens": "^2.0.0",
-        "web-namespaces": "^2.0.0",
-        "zwitch": "^2.0.0"
-      },
-      "funding": {
-        "type": "opencollective",
-        "url": "https://opencollective.com/unified"
+      "engines": {
+        "node": ">=4.0"
       }
     },
-    "node_modules/hast-util-whitespace": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz",
-      "integrity": "sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==",
+    "node_modules/esutils": {
+      "version": "2.0.3",
+      "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+      "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
       "dev": true,
-      "funding": {
-        "type": "opencollective",
-        "url": "https://opencollective.com/unified"
+      "engines": {
+        "node": ">=0.10.0"
       }
     },
-    "node_modules/hastscript": {
-      "version": "7.2.0",
-      "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-7.2.0.tgz",
-      "integrity": "sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==",
-      "dev": true,
-      "dependencies": {
-        "@types/hast": "^2.0.0",
-        "comma-separated-tokens": "^2.0.0",
-        "hast-util-parse-selector": "^3.0.0",
-        "property-information": "^6.0.0",
-        "space-separated-tokens": "^2.0.0"
-      },
-      "funding": {
-        "type": "opencollective",
-        "url": "https://opencollective.com/unified"
+    "node_modules/event-target-shim": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
+      "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
+      "inBundle": true,
+      "engines": {
+        "node": ">=6"
       }
     },
-    "node_modules/he": {
-      "version": "1.2.0",
-      "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
-      "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
-      "dev": true,
-      "bin": {
-        "he": "bin/he"
-      }
+    "node_modules/eventemitter3": {
+      "version": "4.0.7",
+      "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
+      "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
+      "dev": true
     },
-    "node_modules/hosted-git-info": {
-      "version": "7.0.1",
-      "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz",
-      "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==",
+    "node_modules/events": {
+      "version": "3.3.0",
+      "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
+      "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
       "inBundle": true,
-      "dependencies": {
-        "lru-cache": "^10.0.1"
-      },
       "engines": {
-        "node": "^16.14.0 || >=18.0.0"
+        "node": ">=0.8.x"
       }
     },
-    "node_modules/html-encoding-sniffer": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz",
-      "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==",
+    "node_modules/events-to-array": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/events-to-array/-/events-to-array-1.1.2.tgz",
+      "integrity": "sha512-inRWzRY7nG+aXZxBzEqYKB3HPgwflZRopAjDCHv0whhRx+MTUr1ei0ICZUypdyE0HRm4L2d5VEcIqLD6yl+BFA==",
+      "dev": true
+    },
+    "node_modules/execa": {
+      "version": "5.1.1",
+      "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
+      "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
       "dev": true,
       "dependencies": {
-        "whatwg-encoding": "^2.0.0"
+        "cross-spawn": "^7.0.3",
+        "get-stream": "^6.0.0",
+        "human-signals": "^2.1.0",
+        "is-stream": "^2.0.0",
+        "merge-stream": "^2.0.0",
+        "npm-run-path": "^4.0.1",
+        "onetime": "^5.1.2",
+        "signal-exit": "^3.0.3",
+        "strip-final-newline": "^2.0.0"
       },
       "engines": {
-        "node": ">=12"
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sindresorhus/execa?sponsor=1"
       }
     },
-    "node_modules/html-escaper": {
-      "version": "2.0.2",
-      "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
-      "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
+    "node_modules/execa/node_modules/signal-exit": {
+      "version": "3.0.7",
+      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
+      "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
       "dev": true
     },
-    "node_modules/html-void-elements": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz",
-      "integrity": "sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==",
-      "dev": true,
-      "funding": {
-        "type": "github",
-        "url": "https://github.com/sponsors/wooorm"
-      }
-    },
-    "node_modules/http-cache-semantics": {
-      "version": "4.1.1",
-      "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
-      "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",
+    "node_modules/exponential-backoff": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz",
+      "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==",
       "inBundle": true
     },
-    "node_modules/http-proxy-agent": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz",
-      "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==",
-      "inBundle": true,
-      "dependencies": {
-        "@tootallnate/once": "2",
-        "agent-base": "6",
-        "debug": "4"
-      },
-      "engines": {
-        "node": ">= 6"
-      }
+    "node_modules/extend": {
+      "version": "3.0.2",
+      "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+      "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+      "dev": true
     },
-    "node_modules/https-proxy-agent": {
-      "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
-      "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
-      "inBundle": true,
-      "dependencies": {
-        "agent-base": "6",
-        "debug": "4"
-      },
-      "engines": {
-        "node": ">= 6"
-      }
+    "node_modules/fast-deep-equal": {
+      "version": "3.1.3",
+      "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+      "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+      "dev": true
     },
-    "node_modules/human-signals": {
+    "node_modules/fast-fifo": {
+      "version": "1.3.0",
+      "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.0.tgz",
+      "integrity": "sha512-IgfweLvEpwyA4WgiQe9Nx6VV2QkML2NkvZnk1oKnIzXgXdWxuhF7zw4DvLTPZJn6PIUneiAXPF24QmoEqHTjyw==",
+      "dev": true
+    },
+    "node_modules/fast-json-stable-stringify": {
       "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
-      "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
+      "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+      "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
       "dev": true,
-      "engines": {
-        "node": ">=10.17.0"
-      }
+      "peer": true
     },
-    "node_modules/humanize-ms": {
-      "version": "1.2.1",
-      "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
-      "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",
-      "inBundle": true,
-      "dependencies": {
-        "ms": "^2.0.0"
-      }
+    "node_modules/fast-levenshtein": {
+      "version": "2.0.6",
+      "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+      "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
+      "dev": true
     },
-    "node_modules/iconv-lite": {
-      "version": "0.6.3",
-      "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
-      "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
-      "devOptional": true,
+    "node_modules/fastest-levenshtein": {
+      "version": "1.0.16",
+      "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz",
+      "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==",
       "inBundle": true,
-      "dependencies": {
-        "safer-buffer": ">= 2.1.2 < 3.0.0"
-      },
       "engines": {
-        "node": ">=0.10.0"
+        "node": ">= 4.9.1"
       }
     },
-    "node_modules/ieee754": {
-      "version": "1.2.1",
-      "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
-      "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
-      "funding": [
-        {
-          "type": "github",
-          "url": "https://github.com/sponsors/feross"
-        },
-        {
-          "type": "patreon",
-          "url": "https://www.patreon.com/feross"
-        },
-        {
-          "type": "consulting",
-          "url": "https://feross.org/support"
-        }
-      ],
-      "inBundle": true
-    },
-    "node_modules/ignore": {
-      "version": "5.2.4",
-      "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz",
-      "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==",
+    "node_modules/fastq": {
+      "version": "1.15.0",
+      "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz",
+      "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==",
       "dev": true,
       "peer": true,
-      "engines": {
-        "node": ">= 4"
-      }
-    },
-    "node_modules/ignore-walk": {
-      "version": "6.0.3",
-      "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-6.0.3.tgz",
-      "integrity": "sha512-C7FfFoTA+bI10qfeydT8aZbvr91vAEU+2W5BZUlzPec47oNb07SsOfwYrtxuvOYdUApPP/Qlh4DtAO51Ekk2QA==",
-      "inBundle": true,
       "dependencies": {
-        "minimatch": "^9.0.0"
-      },
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "reusify": "^1.0.4"
       }
     },
-    "node_modules/import-fresh": {
-      "version": "3.3.0",
-      "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
-      "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
+    "node_modules/figures": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
+      "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
       "dev": true,
       "dependencies": {
-        "parent-module": "^1.0.0",
-        "resolve-from": "^4.0.0"
+        "escape-string-regexp": "^1.0.5"
       },
       "engines": {
-        "node": ">=6"
+        "node": ">=8"
       },
       "funding": {
         "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/import-fresh/node_modules/resolve-from": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
-      "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+    "node_modules/figures/node_modules/escape-string-regexp": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+      "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
       "dev": true,
       "engines": {
-        "node": ">=4"
-      }
-    },
-    "node_modules/imurmurhash": {
-      "version": "0.1.4",
-      "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
-      "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
-      "inBundle": true,
-      "engines": {
-        "node": ">=0.8.19"
-      }
-    },
-    "node_modules/indent-string": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
-      "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
-      "inBundle": true,
-      "engines": {
-        "node": ">=8"
+        "node": ">=0.8.0"
       }
     },
-    "node_modules/inflight": {
-      "version": "1.0.6",
-      "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
-      "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
-      "inBundle": true,
+    "node_modules/file-entry-cache": {
+      "version": "6.0.1",
+      "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
+      "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==",
+      "dev": true,
+      "peer": true,
       "dependencies": {
-        "once": "^1.3.0",
-        "wrappy": "1"
-      }
-    },
-    "node_modules/inherits": {
-      "version": "2.0.4",
-      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
-      "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
-      "inBundle": true
-    },
-    "node_modules/ini": {
-      "version": "4.1.1",
-      "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.1.tgz",
-      "integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==",
-      "inBundle": true,
+        "flat-cache": "^3.0.4"
+      },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^10.12.0 || >=12.0.0"
       }
     },
-    "node_modules/init-package-json": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/init-package-json/-/init-package-json-6.0.0.tgz",
-      "integrity": "sha512-AmXD+Aht5iZGo/y1KUtZSUQ1SltesXHxQuc7qeNz0eUGx/8WgkHeeQLSFdM8l9YpmnnamGIbAxVdAs2xoLRKRQ==",
-      "inBundle": true,
+    "node_modules/fill-range": {
+      "version": "7.0.1",
+      "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+      "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+      "dev": true,
       "dependencies": {
-        "npm-package-arg": "^11.0.0",
-        "promzard": "^1.0.0",
-        "read": "^2.0.0",
-        "read-package-json": "^7.0.0",
-        "semver": "^7.3.5",
-        "validate-npm-package-license": "^3.0.4",
-        "validate-npm-package-name": "^5.0.0"
+        "to-regex-range": "^5.0.1"
       },
       "engines": {
-        "node": "^16.14.0 || >=18.0.0"
+        "node": ">=8"
       }
     },
-    "node_modules/internal-slot": {
-      "version": "1.0.5",
-      "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz",
-      "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==",
+    "node_modules/find-cache-dir": {
+      "version": "3.3.2",
+      "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz",
+      "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "get-intrinsic": "^1.2.0",
-        "has": "^1.0.3",
-        "side-channel": "^1.0.4"
+        "commondir": "^1.0.1",
+        "make-dir": "^3.0.2",
+        "pkg-dir": "^4.1.0"
       },
-      "engines": {
-        "node": ">= 0.4"
-      }
-    },
-    "node_modules/ip": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
-      "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==",
-      "inBundle": true
-    },
-    "node_modules/ip-regex": {
-      "version": "4.3.0",
-      "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz",
-      "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==",
-      "inBundle": true,
       "engines": {
         "node": ">=8"
+      },
+      "funding": {
+        "url": "https://github.com/avajs/find-cache-dir?sponsor=1"
       }
     },
-    "node_modules/is-array-buffer": {
-      "version": "3.0.2",
-      "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz",
-      "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==",
+    "node_modules/find-up": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+      "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "call-bind": "^1.0.2",
-        "get-intrinsic": "^1.2.0",
-        "is-typed-array": "^1.1.10"
+        "locate-path": "^6.0.0",
+        "path-exists": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=10"
       },
       "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/is-arrayish": {
-      "version": "0.2.1",
-      "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
-      "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==",
+    "node_modules/findit": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/findit/-/findit-2.0.0.tgz",
+      "integrity": "sha512-ENZS237/Hr8bjczn5eKuBohLgaD0JyUd0arxretR1f9RO46vZHA1b2y0VorgGV3WaOT3c+78P8h7v4JGJ1i/rg==",
       "dev": true
     },
-    "node_modules/is-bigint": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz",
-      "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==",
+    "node_modules/flat-cache": {
+      "version": "3.0.4",
+      "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
+      "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "has-bigints": "^1.0.1"
+        "flatted": "^3.1.0",
+        "rimraf": "^3.0.2"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+      "engines": {
+        "node": "^10.12.0 || >=12.0.0"
       }
     },
-    "node_modules/is-binary-path": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
-      "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+    "node_modules/flatted": {
+      "version": "3.2.7",
+      "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
+      "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==",
+      "dev": true,
+      "peer": true
+    },
+    "node_modules/for-each": {
+      "version": "0.3.3",
+      "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
+      "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "binary-extensions": "^2.0.0"
+        "is-callable": "^1.1.3"
+      }
+    },
+    "node_modules/foreground-child": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz",
+      "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==",
+      "inBundle": true,
+      "dependencies": {
+        "cross-spawn": "^7.0.0",
+        "signal-exit": "^4.0.1"
       },
       "engines": {
-        "node": ">=8"
+        "node": ">=14"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
       }
     },
-    "node_modules/is-boolean-object": {
-      "version": "1.1.2",
-      "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz",
-      "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==",
+    "node_modules/form-data": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+      "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "call-bind": "^1.0.2",
-        "has-tostringtag": "^1.0.0"
+        "asynckit": "^0.4.0",
+        "combined-stream": "^1.0.8",
+        "mime-types": "^2.1.12"
       },
       "engines": {
-        "node": ">= 0.4"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "node": ">= 6"
       }
     },
-    "node_modules/is-buffer": {
-      "version": "2.0.5",
-      "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
-      "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==",
+    "node_modules/fromentries": {
+      "version": "1.3.2",
+      "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz",
+      "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==",
       "dev": true,
       "funding": [
         {
@@ -7534,130 +7243,127 @@
           "type": "consulting",
           "url": "https://feross.org/support"
         }
-      ],
-      "engines": {
-        "node": ">=4"
-      }
+      ]
     },
-    "node_modules/is-callable": {
-      "version": "1.2.7",
-      "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz",
-      "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==",
+    "node_modules/front-matter": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/front-matter/-/front-matter-4.0.2.tgz",
+      "integrity": "sha512-I8ZuJ/qG92NWX8i5x1Y8qyj3vizhXS31OxjKDu3LKP+7/qBgfIKValiZIEwoVoJKUHlhWtYrktkxV1XsX+pPlg==",
       "dev": true,
-      "peer": true,
-      "engines": {
-        "node": ">= 0.4"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+      "dependencies": {
+        "js-yaml": "^3.13.1"
       }
     },
-    "node_modules/is-cidr": {
-      "version": "4.0.2",
-      "resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-4.0.2.tgz",
-      "integrity": "sha512-z4a1ENUajDbEl/Q6/pVBpTR1nBjjEE1X7qb7bmWYanNnPoKAvUCPFKeXV6Fe4mgTkWKBqiHIcwsI3SndiO5FeA==",
-      "inBundle": true,
+    "node_modules/front-matter/node_modules/argparse": {
+      "version": "1.0.10",
+      "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+      "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+      "dev": true,
       "dependencies": {
-        "cidr-regex": "^3.1.1"
-      },
-      "engines": {
-        "node": ">=10"
+        "sprintf-js": "~1.0.2"
       }
     },
-    "node_modules/is-core-module": {
-      "version": "2.13.0",
-      "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz",
-      "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==",
-      "inBundle": true,
-      "dependencies": {
-        "has": "^1.0.3"
+    "node_modules/front-matter/node_modules/esprima": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+      "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+      "dev": true,
+      "bin": {
+        "esparse": "bin/esparse.js",
+        "esvalidate": "bin/esvalidate.js"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+      "engines": {
+        "node": ">=4"
       }
     },
-    "node_modules/is-date-object": {
-      "version": "1.0.5",
-      "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz",
-      "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==",
+    "node_modules/front-matter/node_modules/js-yaml": {
+      "version": "3.14.1",
+      "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
+      "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "has-tostringtag": "^1.0.0"
-      },
-      "engines": {
-        "node": ">= 0.4"
+        "argparse": "^1.0.7",
+        "esprima": "^4.0.0"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+      "bin": {
+        "js-yaml": "bin/js-yaml.js"
       }
     },
-    "node_modules/is-extglob": {
-      "version": "2.1.1",
-      "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
-      "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+    "node_modules/fs-exists-cached": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/fs-exists-cached/-/fs-exists-cached-1.0.0.tgz",
+      "integrity": "sha512-kSxoARUDn4F2RPXX48UXnaFKwVU7Ivd/6qpzZL29MCDmr9sTvybv4gFCp+qaI4fM9m0z9fgz/yJvi56GAz+BZg==",
+      "dev": true
+    },
+    "node_modules/fs-extra": {
+      "version": "11.1.1",
+      "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz",
+      "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==",
       "dev": true,
+      "dependencies": {
+        "graceful-fs": "^4.2.0",
+        "jsonfile": "^6.0.1",
+        "universalify": "^2.0.0"
+      },
       "engines": {
-        "node": ">=0.10.0"
+        "node": ">=14.14"
       }
     },
-    "node_modules/is-fullwidth-code-point": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
-      "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+    "node_modules/fs-minipass": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz",
+      "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==",
       "inBundle": true,
-      "engines": {
-        "node": ">=8"
-      }
-    },
-    "node_modules/is-glob": {
-      "version": "4.0.3",
-      "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
-      "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
-      "dev": true,
       "dependencies": {
-        "is-extglob": "^2.1.1"
+        "minipass": "^7.0.3"
       },
       "engines": {
-        "node": ">=0.10.0"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/is-lambda": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz",
-      "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==",
+    "node_modules/fs.realpath": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+      "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
       "inBundle": true
     },
-    "node_modules/is-negative-zero": {
-      "version": "2.0.2",
-      "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz",
-      "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==",
+    "node_modules/fsevents": {
+      "version": "2.3.2",
+      "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
+      "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
       "dev": true,
-      "peer": true,
+      "hasInstallScript": true,
+      "optional": true,
+      "os": [
+        "darwin"
+      ],
       "engines": {
-        "node": ">= 0.4"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
       }
     },
-    "node_modules/is-number": {
-      "version": "7.0.0",
-      "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
-      "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
-      "dev": true,
-      "engines": {
-        "node": ">=0.12.0"
-      }
+    "node_modules/function-bind": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+      "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+      "inBundle": true
     },
-    "node_modules/is-number-object": {
-      "version": "1.0.7",
-      "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz",
-      "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==",
+    "node_modules/function-loop": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/function-loop/-/function-loop-2.0.1.tgz",
+      "integrity": "sha512-ktIR+O6i/4h+j/ZhZJNdzeI4i9lEPeEK6UPR2EVyTVBqOwcU3Za9xYKLH64ZR9HmcROyRrOkizNyjjtWJzDDkQ==",
+      "dev": true
+    },
+    "node_modules/function.prototype.name": {
+      "version": "1.1.5",
+      "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz",
+      "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "has-tostringtag": "^1.0.0"
+        "call-bind": "^1.0.2",
+        "define-properties": "^1.1.3",
+        "es-abstract": "^1.19.0",
+        "functions-have-names": "^1.2.2"
       },
       "engines": {
         "node": ">= 0.4"
@@ -7666,99 +7372,98 @@
         "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/is-obj": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
-      "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==",
+    "node_modules/functions-have-names": {
+      "version": "1.2.3",
+      "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz",
+      "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==",
       "dev": true,
-      "engines": {
-        "node": ">=8"
+      "peer": true,
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/is-path-inside": {
-      "version": "3.0.3",
-      "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
-      "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
-      "dev": true,
-      "peer": true,
+    "node_modules/gauge": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/gauge/-/gauge-5.0.1.tgz",
+      "integrity": "sha512-CmykPMJGuNan/3S4kZOpvvPYSNqSHANiWnh9XcMU2pSjtBfF0XzZ2p1bFAxTbnFxyBuPxQYHhzwaoOmUdqzvxQ==",
+      "inBundle": true,
+      "dependencies": {
+        "aproba": "^1.0.3 || ^2.0.0",
+        "color-support": "^1.1.3",
+        "console-control-strings": "^1.1.0",
+        "has-unicode": "^2.0.1",
+        "signal-exit": "^4.0.1",
+        "string-width": "^4.2.3",
+        "strip-ansi": "^6.0.1",
+        "wide-align": "^1.1.5"
+      },
       "engines": {
-        "node": ">=8"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/is-plain-obj": {
-      "version": "1.1.0",
-      "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
-      "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==",
+    "node_modules/gensync": {
+      "version": "1.0.0-beta.2",
+      "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
+      "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
       "dev": true,
       "engines": {
-        "node": ">=0.10.0"
+        "node": ">=6.9.0"
       }
     },
-    "node_modules/is-plain-object": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
-      "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==",
+    "node_modules/get-caller-file": {
+      "version": "2.0.5",
+      "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+      "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
       "dev": true,
       "engines": {
-        "node": ">=0.10.0"
+        "node": "6.* || 8.* || >= 10.*"
       }
     },
-    "node_modules/is-potential-custom-element-name": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
-      "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
-      "dev": true
-    },
-    "node_modules/is-regex": {
-      "version": "1.1.4",
-      "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
-      "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==",
+    "node_modules/get-intrinsic": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
+      "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "call-bind": "^1.0.2",
-        "has-tostringtag": "^1.0.0"
-      },
-      "engines": {
-        "node": ">= 0.4"
+        "function-bind": "^1.1.1",
+        "has": "^1.0.3",
+        "has-symbols": "^1.0.3"
       },
       "funding": {
         "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/is-shared-array-buffer": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz",
-      "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==",
+    "node_modules/get-package-type": {
+      "version": "0.1.0",
+      "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz",
+      "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==",
       "dev": true,
-      "peer": true,
-      "dependencies": {
-        "call-bind": "^1.0.2"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+      "engines": {
+        "node": ">=8.0.0"
       }
     },
-    "node_modules/is-stream": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
-      "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+    "node_modules/get-stream": {
+      "version": "6.0.1",
+      "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
+      "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
       "dev": true,
       "engines": {
-        "node": ">=8"
+        "node": ">=10"
       },
       "funding": {
         "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/is-string": {
-      "version": "1.0.7",
-      "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz",
-      "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==",
+    "node_modules/get-symbol-description": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz",
+      "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "has-tostringtag": "^1.0.0"
+        "call-bind": "^1.0.2",
+        "get-intrinsic": "^1.1.1"
       },
       "engines": {
         "node": ">= 0.4"
@@ -7767,1000 +7472,2366 @@
         "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/is-symbol": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz",
-      "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==",
+    "node_modules/git-raw-commits": {
+      "version": "2.0.11",
+      "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.11.tgz",
+      "integrity": "sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "has-symbols": "^1.0.2"
-      },
-      "engines": {
-        "node": ">= 0.4"
+        "dargs": "^7.0.0",
+        "lodash": "^4.17.15",
+        "meow": "^8.0.0",
+        "split2": "^3.0.0",
+        "through2": "^4.0.0"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
-      }
-    },
-    "node_modules/is-text-path": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz",
-      "integrity": "sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w==",
-      "dev": true,
-      "dependencies": {
-        "text-extensions": "^1.0.0"
+      "bin": {
+        "git-raw-commits": "cli.js"
       },
       "engines": {
-        "node": ">=0.10.0"
+        "node": ">=10"
       }
     },
-    "node_modules/is-typed-array": {
-      "version": "1.1.10",
-      "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz",
-      "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==",
-      "dev": true,
-      "peer": true,
+    "node_modules/github-slugger": {
+      "version": "1.5.0",
+      "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-1.5.0.tgz",
+      "integrity": "sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==",
+      "dev": true
+    },
+    "node_modules/glob": {
+      "version": "10.3.10",
+      "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz",
+      "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==",
+      "inBundle": true,
       "dependencies": {
-        "available-typed-arrays": "^1.0.5",
-        "call-bind": "^1.0.2",
-        "for-each": "^0.3.3",
-        "gopd": "^1.0.1",
-        "has-tostringtag": "^1.0.0"
+        "foreground-child": "^3.1.0",
+        "jackspeak": "^2.3.5",
+        "minimatch": "^9.0.1",
+        "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0",
+        "path-scurry": "^1.10.1"
+      },
+      "bin": {
+        "glob": "dist/esm/bin.mjs"
       },
       "engines": {
-        "node": ">= 0.4"
+        "node": ">=16 || 14 >=14.17"
       },
       "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+        "url": "https://github.com/sponsors/isaacs"
       }
     },
-    "node_modules/is-typedarray": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
-      "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==",
-      "dev": true
-    },
-    "node_modules/is-weakref": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz",
-      "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==",
+    "node_modules/glob-parent": {
+      "version": "6.0.2",
+      "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
+      "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
       "dev": true,
       "peer": true,
       "dependencies": {
-        "call-bind": "^1.0.2"
+        "is-glob": "^4.0.3"
       },
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
+      "engines": {
+        "node": ">=10.13.0"
       }
     },
-    "node_modules/is-windows": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
-      "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
+    "node_modules/global-dirs": {
+      "version": "0.1.1",
+      "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz",
+      "integrity": "sha512-NknMLn7F2J7aflwFOlGdNIuCDpN3VGoSoB+aap3KABFWbHVn1TCgFC+np23J8W2BiZbjfEw3BFBycSMv1AFblg==",
       "dev": true,
+      "dependencies": {
+        "ini": "^1.3.4"
+      },
       "engines": {
-        "node": ">=0.10.0"
+        "node": ">=4"
       }
     },
-    "node_modules/isarray": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
-      "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
+    "node_modules/global-dirs/node_modules/ini": {
+      "version": "1.3.8",
+      "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
+      "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
       "dev": true
     },
-    "node_modules/isexe": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
-      "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
-      "inBundle": true
-    },
-    "node_modules/istanbul-lib-coverage": {
-      "version": "3.2.0",
-      "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz",
-      "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==",
+    "node_modules/globals": {
+      "version": "13.20.0",
+      "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz",
+      "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==",
       "dev": true,
+      "peer": true,
+      "dependencies": {
+        "type-fest": "^0.20.2"
+      },
       "engines": {
         "node": ">=8"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/istanbul-lib-hook": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz",
-      "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==",
+    "node_modules/globalthis": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz",
+      "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "append-transform": "^2.0.0"
+        "define-properties": "^1.1.3"
       },
       "engines": {
-        "node": ">=8"
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/istanbul-lib-instrument": {
-      "version": "4.0.3",
-      "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz",
-      "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==",
+    "node_modules/gopd": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
+      "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "@babel/core": "^7.7.5",
-        "@istanbuljs/schema": "^0.1.2",
-        "istanbul-lib-coverage": "^3.0.0",
-        "semver": "^6.3.0"
+        "get-intrinsic": "^1.1.3"
       },
-      "engines": {
-        "node": ">=8"
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/istanbul-lib-instrument/node_modules/semver": {
-      "version": "6.3.1",
-      "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
-      "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
+    "node_modules/graceful-fs": {
+      "version": "4.2.11",
+      "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
+      "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
+      "inBundle": true
+    },
+    "node_modules/grapheme-splitter": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz",
+      "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==",
       "dev": true,
-      "bin": {
-        "semver": "bin/semver.js"
+      "peer": true
+    },
+    "node_modules/groff-escape": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/groff-escape/-/groff-escape-2.0.1.tgz",
+      "integrity": "sha512-S0nG+mLFTu1buDKQsRlBtIxZU/dMvrdCURJg/zSLKpL333yi1Fs5bLUYk+v3pRYlc+qmHtukMAM2slB0AKFKAw==",
+      "dev": true,
+      "funding": {
+        "type": "github",
+        "url": "https://github.com/sponsors/wooorm"
       }
     },
-    "node_modules/istanbul-lib-processinfo": {
-      "version": "2.0.3",
-      "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.3.tgz",
-      "integrity": "sha512-NkwHbo3E00oybX6NGJi6ar0B29vxyvNwoC7eJ4G4Yq28UfY758Hgn/heV8VRFhevPED4LXfFz0DQ8z/0kw9zMg==",
+    "node_modules/handlebars": {
+      "version": "4.7.7",
+      "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz",
+      "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==",
       "dev": true,
       "dependencies": {
-        "archy": "^1.0.0",
-        "cross-spawn": "^7.0.3",
-        "istanbul-lib-coverage": "^3.2.0",
-        "p-map": "^3.0.0",
-        "rimraf": "^3.0.0",
-        "uuid": "^8.3.2"
+        "minimist": "^1.2.5",
+        "neo-async": "^2.6.0",
+        "source-map": "^0.6.1",
+        "wordwrap": "^1.0.0"
+      },
+      "bin": {
+        "handlebars": "bin/handlebars"
       },
       "engines": {
-        "node": ">=8"
+        "node": ">=0.4.7"
+      },
+      "optionalDependencies": {
+        "uglify-js": "^3.1.4"
       }
     },
-    "node_modules/istanbul-lib-processinfo/node_modules/p-map": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz",
-      "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==",
+    "node_modules/hard-rejection": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz",
+      "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==",
       "dev": true,
+      "engines": {
+        "node": ">=6"
+      }
+    },
+    "node_modules/has": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+      "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+      "inBundle": true,
       "dependencies": {
-        "aggregate-error": "^3.0.0"
+        "function-bind": "^1.1.1"
       },
       "engines": {
-        "node": ">=8"
+        "node": ">= 0.4.0"
       }
     },
-    "node_modules/istanbul-lib-report": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
-      "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==",
+    "node_modules/has-bigints": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz",
+      "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==",
+      "dev": true,
+      "peer": true,
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/has-flag": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+      "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
       "dev": true,
-      "dependencies": {
-        "istanbul-lib-coverage": "^3.0.0",
-        "make-dir": "^3.0.0",
-        "supports-color": "^7.1.0"
-      },
       "engines": {
         "node": ">=8"
       }
     },
-    "node_modules/istanbul-lib-report/node_modules/supports-color": {
-      "version": "7.2.0",
-      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
-      "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+    "node_modules/has-property-descriptors": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz",
+      "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "has-flag": "^4.0.0"
+        "get-intrinsic": "^1.1.1"
       },
-      "engines": {
-        "node": ">=8"
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/istanbul-lib-source-maps": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz",
-      "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==",
+    "node_modules/has-proto": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
+      "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
       "dev": true,
-      "dependencies": {
-        "debug": "^4.1.1",
-        "istanbul-lib-coverage": "^3.0.0",
-        "source-map": "^0.6.1"
+      "peer": true,
+      "engines": {
+        "node": ">= 0.4"
       },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/has-symbols": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
+      "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
+      "dev": true,
+      "peer": true,
       "engines": {
-        "node": ">=10"
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/istanbul-reports": {
-      "version": "3.1.5",
-      "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz",
-      "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==",
+    "node_modules/has-tostringtag": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz",
+      "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==",
       "dev": true,
+      "peer": true,
       "dependencies": {
-        "html-escaper": "^2.0.0",
-        "istanbul-lib-report": "^3.0.0"
+        "has-symbols": "^1.0.2"
       },
       "engines": {
-        "node": ">=8"
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
       }
     },
-    "node_modules/jackspeak": {
-      "version": "2.3.6",
-      "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz",
-      "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==",
-      "inBundle": true,
+    "node_modules/has-unicode": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
+      "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
+      "inBundle": true
+    },
+    "node_modules/hasha": {
+      "version": "5.2.2",
+      "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz",
+      "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==",
+      "dev": true,
       "dependencies": {
-        "@isaacs/cliui": "^8.0.2"
+        "is-stream": "^2.0.0",
+        "type-fest": "^0.8.0"
       },
       "engines": {
-        "node": ">=14"
+        "node": ">=8"
       },
       "funding": {
-        "url": "https://github.com/sponsors/isaacs"
-      },
-      "optionalDependencies": {
-        "@pkgjs/parseargs": "^0.11.0"
+        "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/js-sdsl": {
-      "version": "4.4.0",
-      "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz",
-      "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==",
+    "node_modules/hasha/node_modules/type-fest": {
+      "version": "0.8.1",
+      "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
+      "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
       "dev": true,
-      "peer": true,
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/hast-util-from-parse5": {
+      "version": "7.1.2",
+      "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-7.1.2.tgz",
+      "integrity": "sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw==",
+      "dev": true,
+      "dependencies": {
+        "@types/hast": "^2.0.0",
+        "@types/unist": "^2.0.0",
+        "hastscript": "^7.0.0",
+        "property-information": "^6.0.0",
+        "vfile": "^5.0.0",
+        "vfile-location": "^4.0.0",
+        "web-namespaces": "^2.0.0"
+      },
       "funding": {
         "type": "opencollective",
-        "url": "https://opencollective.com/js-sdsl"
+        "url": "https://opencollective.com/unified"
       }
     },
-    "node_modules/js-tokens": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
-      "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
-      "dev": true
-    },
-    "node_modules/js-yaml": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
-      "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+    "node_modules/hast-util-parse-selector": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz",
+      "integrity": "sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==",
       "dev": true,
       "dependencies": {
-        "argparse": "^2.0.1"
+        "@types/hast": "^2.0.0"
       },
-      "bin": {
-        "js-yaml": "bin/js-yaml.js"
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/unified"
       }
     },
-    "node_modules/jsdom": {
-      "version": "21.1.2",
-      "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.2.tgz",
-      "integrity": "sha512-sCpFmK2jv+1sjff4u7fzft+pUh2KSUbUrEHYHyfSIbGTIcmnjyp83qg6qLwdJ/I3LpTXx33ACxeRL7Lsyc6lGQ==",
+    "node_modules/hast-util-raw": {
+      "version": "7.2.3",
+      "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-7.2.3.tgz",
+      "integrity": "sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==",
       "dev": true,
       "dependencies": {
-        "abab": "^2.0.6",
-        "acorn": "^8.8.2",
-        "acorn-globals": "^7.0.0",
-        "cssstyle": "^3.0.0",
-        "data-urls": "^4.0.0",
-        "decimal.js": "^10.4.3",
-        "domexception": "^4.0.0",
-        "escodegen": "^2.0.0",
-        "form-data": "^4.0.0",
-        "html-encoding-sniffer": "^3.0.0",
-        "http-proxy-agent": "^5.0.0",
-        "https-proxy-agent": "^5.0.1",
-        "is-potential-custom-element-name": "^1.0.1",
-        "nwsapi": "^2.2.4",
-        "parse5": "^7.1.2",
-        "rrweb-cssom": "^0.6.0",
-        "saxes": "^6.0.0",
-        "symbol-tree": "^3.2.4",
-        "tough-cookie": "^4.1.2",
-        "w3c-xmlserializer": "^4.0.0",
-        "webidl-conversions": "^7.0.0",
-        "whatwg-encoding": "^2.0.0",
-        "whatwg-mimetype": "^3.0.0",
-        "whatwg-url": "^12.0.1",
-        "ws": "^8.13.0",
-        "xml-name-validator": "^4.0.0"
+        "@types/hast": "^2.0.0",
+        "@types/parse5": "^6.0.0",
+        "hast-util-from-parse5": "^7.0.0",
+        "hast-util-to-parse5": "^7.0.0",
+        "html-void-elements": "^2.0.0",
+        "parse5": "^6.0.0",
+        "unist-util-position": "^4.0.0",
+        "unist-util-visit": "^4.0.0",
+        "vfile": "^5.0.0",
+        "web-namespaces": "^2.0.0",
+        "zwitch": "^2.0.0"
       },
-      "engines": {
-        "node": ">=14"
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/unified"
+      }
+    },
+    "node_modules/hast-util-raw/node_modules/parse5": {
+      "version": "6.0.1",
+      "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
+      "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==",
+      "dev": true
+    },
+    "node_modules/hast-util-raw/node_modules/unist-util-visit": {
+      "version": "4.1.2",
+      "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz",
+      "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==",
+      "dev": true,
+      "dependencies": {
+        "@types/unist": "^2.0.0",
+        "unist-util-is": "^5.0.0",
+        "unist-util-visit-parents": "^5.1.1"
       },
-      "peerDependencies": {
-        "canvas": "^2.5.0"
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/unified"
+      }
+    },
+    "node_modules/hast-util-raw/node_modules/unist-util-visit-parents": {
+      "version": "5.1.3",
+      "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz",
+      "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==",
+      "dev": true,
+      "dependencies": {
+        "@types/unist": "^2.0.0",
+        "unist-util-is": "^5.0.0"
       },
-      "peerDependenciesMeta": {
-        "canvas": {
-          "optional": true
-        }
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/unified"
       }
     },
-    "node_modules/jsdom/node_modules/escodegen": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz",
-      "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==",
+    "node_modules/hast-util-to-html": {
+      "version": "8.0.4",
+      "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-8.0.4.tgz",
+      "integrity": "sha512-4tpQTUOr9BMjtYyNlt0P50mH7xj0Ks2xpo8M943Vykljf99HW6EzulIoJP1N3eKOSScEHzyzi9dm7/cn0RfGwA==",
       "dev": true,
       "dependencies": {
-        "esprima": "^4.0.1",
-        "estraverse": "^5.2.0",
-        "esutils": "^2.0.2",
-        "optionator": "^0.8.1"
+        "@types/hast": "^2.0.0",
+        "@types/unist": "^2.0.0",
+        "ccount": "^2.0.0",
+        "comma-separated-tokens": "^2.0.0",
+        "hast-util-raw": "^7.0.0",
+        "hast-util-whitespace": "^2.0.0",
+        "html-void-elements": "^2.0.0",
+        "property-information": "^6.0.0",
+        "space-separated-tokens": "^2.0.0",
+        "stringify-entities": "^4.0.0",
+        "zwitch": "^2.0.4"
       },
-      "bin": {
-        "escodegen": "bin/escodegen.js",
-        "esgenerate": "bin/esgenerate.js"
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/unified"
+      }
+    },
+    "node_modules/hast-util-to-parse5": {
+      "version": "7.1.0",
+      "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-7.1.0.tgz",
+      "integrity": "sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==",
+      "dev": true,
+      "dependencies": {
+        "@types/hast": "^2.0.0",
+        "comma-separated-tokens": "^2.0.0",
+        "property-information": "^6.0.0",
+        "space-separated-tokens": "^2.0.0",
+        "web-namespaces": "^2.0.0",
+        "zwitch": "^2.0.0"
       },
-      "engines": {
-        "node": ">=6.0"
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/unified"
+      }
+    },
+    "node_modules/hast-util-whitespace": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz",
+      "integrity": "sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==",
+      "dev": true,
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/unified"
+      }
+    },
+    "node_modules/hastscript": {
+      "version": "7.2.0",
+      "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-7.2.0.tgz",
+      "integrity": "sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==",
+      "dev": true,
+      "dependencies": {
+        "@types/hast": "^2.0.0",
+        "comma-separated-tokens": "^2.0.0",
+        "hast-util-parse-selector": "^3.0.0",
+        "property-information": "^6.0.0",
+        "space-separated-tokens": "^2.0.0"
       },
-      "optionalDependencies": {
-        "source-map": "~0.6.1"
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/unified"
       }
     },
-    "node_modules/jsdom/node_modules/esprima": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
-      "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+    "node_modules/he": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
+      "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
       "dev": true,
       "bin": {
-        "esparse": "bin/esparse.js",
-        "esvalidate": "bin/esvalidate.js"
+        "he": "bin/he"
+      }
+    },
+    "node_modules/hosted-git-info": {
+      "version": "7.0.1",
+      "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz",
+      "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==",
+      "inBundle": true,
+      "dependencies": {
+        "lru-cache": "^10.0.1"
       },
       "engines": {
-        "node": ">=4"
+        "node": "^16.14.0 || >=18.0.0"
       }
     },
-    "node_modules/jsdom/node_modules/levn": {
-      "version": "0.3.0",
-      "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
-      "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==",
+    "node_modules/html-encoding-sniffer": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz",
+      "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==",
       "dev": true,
       "dependencies": {
-        "prelude-ls": "~1.1.2",
-        "type-check": "~0.3.2"
+        "whatwg-encoding": "^2.0.0"
       },
       "engines": {
-        "node": ">= 0.8.0"
+        "node": ">=12"
       }
     },
-    "node_modules/jsdom/node_modules/optionator": {
-      "version": "0.8.3",
-      "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
-      "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
+    "node_modules/html-escaper": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
+      "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
+      "dev": true
+    },
+    "node_modules/html-void-elements": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz",
+      "integrity": "sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==",
       "dev": true,
+      "funding": {
+        "type": "github",
+        "url": "https://github.com/sponsors/wooorm"
+      }
+    },
+    "node_modules/http-cache-semantics": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
+      "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",
+      "inBundle": true
+    },
+    "node_modules/http-proxy-agent": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz",
+      "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==",
+      "inBundle": true,
       "dependencies": {
-        "deep-is": "~0.1.3",
-        "fast-levenshtein": "~2.0.6",
-        "levn": "~0.3.0",
-        "prelude-ls": "~1.1.2",
-        "type-check": "~0.3.2",
-        "word-wrap": "~1.2.3"
+        "@tootallnate/once": "2",
+        "agent-base": "6",
+        "debug": "4"
       },
       "engines": {
-        "node": ">= 0.8.0"
+        "node": ">= 6"
       }
     },
-    "node_modules/jsdom/node_modules/prelude-ls": {
-      "version": "1.1.2",
-      "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
-      "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==",
+    "node_modules/https-proxy-agent": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
+      "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
+      "inBundle": true,
+      "dependencies": {
+        "agent-base": "6",
+        "debug": "4"
+      },
+      "engines": {
+        "node": ">= 6"
+      }
+    },
+    "node_modules/human-signals": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
+      "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
       "dev": true,
       "engines": {
-        "node": ">= 0.8.0"
+        "node": ">=10.17.0"
+      }
+    },
+    "node_modules/humanize-ms": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
+      "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",
+      "inBundle": true,
+      "dependencies": {
+        "ms": "^2.0.0"
+      }
+    },
+    "node_modules/iconv-lite": {
+      "version": "0.6.3",
+      "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
+      "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+      "devOptional": true,
+      "inBundle": true,
+      "dependencies": {
+        "safer-buffer": ">= 2.1.2 < 3.0.0"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/ieee754": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+      "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/feross"
+        },
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/feross"
+        },
+        {
+          "type": "consulting",
+          "url": "https://feross.org/support"
+        }
+      ],
+      "inBundle": true
+    },
+    "node_modules/ignore": {
+      "version": "5.2.4",
+      "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz",
+      "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==",
+      "dev": true,
+      "peer": true,
+      "engines": {
+        "node": ">= 4"
+      }
+    },
+    "node_modules/ignore-walk": {
+      "version": "6.0.3",
+      "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-6.0.3.tgz",
+      "integrity": "sha512-C7FfFoTA+bI10qfeydT8aZbvr91vAEU+2W5BZUlzPec47oNb07SsOfwYrtxuvOYdUApPP/Qlh4DtAO51Ekk2QA==",
+      "inBundle": true,
+      "dependencies": {
+        "minimatch": "^9.0.0"
+      },
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+      }
+    },
+    "node_modules/import-fresh": {
+      "version": "3.3.0",
+      "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
+      "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
+      "dev": true,
+      "dependencies": {
+        "parent-module": "^1.0.0",
+        "resolve-from": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=6"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
+    "node_modules/import-fresh/node_modules/resolve-from": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+      "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+      "dev": true,
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/imurmurhash": {
+      "version": "0.1.4",
+      "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+      "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
+      "inBundle": true,
+      "engines": {
+        "node": ">=0.8.19"
+      }
+    },
+    "node_modules/indent-string": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
+      "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
+      "inBundle": true,
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/infer-owner": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz",
+      "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==",
+      "inBundle": true
+    },
+    "node_modules/inflight": {
+      "version": "1.0.6",
+      "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+      "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
+      "inBundle": true,
+      "dependencies": {
+        "once": "^1.3.0",
+        "wrappy": "1"
+      }
+    },
+    "node_modules/inherits": {
+      "version": "2.0.4",
+      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+      "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+      "inBundle": true
+    },
+    "node_modules/ini": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.1.tgz",
+      "integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==",
+      "inBundle": true,
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+      }
+    },
+    "node_modules/init-package-json": {
+      "version": "6.0.0",
+      "resolved": "https://registry.npmjs.org/init-package-json/-/init-package-json-6.0.0.tgz",
+      "integrity": "sha512-AmXD+Aht5iZGo/y1KUtZSUQ1SltesXHxQuc7qeNz0eUGx/8WgkHeeQLSFdM8l9YpmnnamGIbAxVdAs2xoLRKRQ==",
+      "inBundle": true,
+      "dependencies": {
+        "npm-package-arg": "^11.0.0",
+        "promzard": "^1.0.0",
+        "read": "^2.0.0",
+        "read-package-json": "^7.0.0",
+        "semver": "^7.3.5",
+        "validate-npm-package-license": "^3.0.4",
+        "validate-npm-package-name": "^5.0.0"
+      },
+      "engines": {
+        "node": "^16.14.0 || >=18.0.0"
+      }
+    },
+    "node_modules/internal-slot": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz",
+      "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "get-intrinsic": "^1.2.0",
+        "has": "^1.0.3",
+        "side-channel": "^1.0.4"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/ip": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
+      "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==",
+      "inBundle": true
+    },
+    "node_modules/ip-regex": {
+      "version": "4.3.0",
+      "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz",
+      "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==",
+      "inBundle": true,
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/is-array-buffer": {
+      "version": "3.0.2",
+      "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz",
+      "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "call-bind": "^1.0.2",
+        "get-intrinsic": "^1.2.0",
+        "is-typed-array": "^1.1.10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-arrayish": {
+      "version": "0.2.1",
+      "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+      "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==",
+      "dev": true
+    },
+    "node_modules/is-bigint": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz",
+      "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "has-bigints": "^1.0.1"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-binary-path": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+      "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+      "dev": true,
+      "dependencies": {
+        "binary-extensions": "^2.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/is-boolean-object": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz",
+      "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "call-bind": "^1.0.2",
+        "has-tostringtag": "^1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-buffer": {
+      "version": "2.0.5",
+      "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
+      "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==",
+      "dev": true,
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/feross"
+        },
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/feross"
+        },
+        {
+          "type": "consulting",
+          "url": "https://feross.org/support"
+        }
+      ],
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/is-callable": {
+      "version": "1.2.7",
+      "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz",
+      "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==",
+      "dev": true,
+      "peer": true,
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-cidr": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-4.0.2.tgz",
+      "integrity": "sha512-z4a1ENUajDbEl/Q6/pVBpTR1nBjjEE1X7qb7bmWYanNnPoKAvUCPFKeXV6Fe4mgTkWKBqiHIcwsI3SndiO5FeA==",
+      "inBundle": true,
+      "dependencies": {
+        "cidr-regex": "^3.1.1"
+      },
+      "engines": {
+        "node": ">=10"
+      }
+    },
+    "node_modules/is-core-module": {
+      "version": "2.13.0",
+      "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz",
+      "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==",
+      "inBundle": true,
+      "dependencies": {
+        "has": "^1.0.3"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-date-object": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz",
+      "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "has-tostringtag": "^1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-extglob": {
+      "version": "2.1.1",
+      "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+      "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/is-fullwidth-code-point": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+      "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+      "inBundle": true,
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/is-glob": {
+      "version": "4.0.3",
+      "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+      "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+      "dev": true,
+      "dependencies": {
+        "is-extglob": "^2.1.1"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/is-lambda": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz",
+      "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==",
+      "inBundle": true
+    },
+    "node_modules/is-negative-zero": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz",
+      "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==",
+      "dev": true,
+      "peer": true,
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-number": {
+      "version": "7.0.0",
+      "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+      "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.12.0"
+      }
+    },
+    "node_modules/is-number-object": {
+      "version": "1.0.7",
+      "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz",
+      "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "has-tostringtag": "^1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-obj": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
+      "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==",
+      "dev": true,
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/is-path-inside": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
+      "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
+      "dev": true,
+      "peer": true,
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/is-plain-obj": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
+      "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/is-plain-object": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
+      "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/is-potential-custom-element-name": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
+      "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
+      "dev": true
+    },
+    "node_modules/is-regex": {
+      "version": "1.1.4",
+      "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
+      "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "call-bind": "^1.0.2",
+        "has-tostringtag": "^1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-shared-array-buffer": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz",
+      "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "call-bind": "^1.0.2"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-stream": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
+      "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+      "dev": true,
+      "engines": {
+        "node": ">=8"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
+    "node_modules/is-string": {
+      "version": "1.0.7",
+      "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz",
+      "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "has-tostringtag": "^1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-symbol": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz",
+      "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "has-symbols": "^1.0.2"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-text-path": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz",
+      "integrity": "sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w==",
+      "dev": true,
+      "dependencies": {
+        "text-extensions": "^1.0.0"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/is-typed-array": {
+      "version": "1.1.10",
+      "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz",
+      "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "available-typed-arrays": "^1.0.5",
+        "call-bind": "^1.0.2",
+        "for-each": "^0.3.3",
+        "gopd": "^1.0.1",
+        "has-tostringtag": "^1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-typedarray": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
+      "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==",
+      "dev": true
+    },
+    "node_modules/is-weakref": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz",
+      "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "call-bind": "^1.0.2"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/is-windows": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
+      "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/isarray": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+      "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
+      "dev": true
+    },
+    "node_modules/isexe": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+      "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
+      "inBundle": true
+    },
+    "node_modules/istanbul-lib-coverage": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz",
+      "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==",
+      "dev": true,
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/istanbul-lib-hook": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz",
+      "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==",
+      "dev": true,
+      "dependencies": {
+        "append-transform": "^2.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/istanbul-lib-instrument": {
+      "version": "4.0.3",
+      "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz",
+      "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==",
+      "dev": true,
+      "dependencies": {
+        "@babel/core": "^7.7.5",
+        "@istanbuljs/schema": "^0.1.2",
+        "istanbul-lib-coverage": "^3.0.0",
+        "semver": "^6.3.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/istanbul-lib-instrument/node_modules/semver": {
+      "version": "6.3.1",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+      "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
+      "dev": true,
+      "bin": {
+        "semver": "bin/semver.js"
+      }
+    },
+    "node_modules/istanbul-lib-processinfo": {
+      "version": "2.0.3",
+      "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.3.tgz",
+      "integrity": "sha512-NkwHbo3E00oybX6NGJi6ar0B29vxyvNwoC7eJ4G4Yq28UfY758Hgn/heV8VRFhevPED4LXfFz0DQ8z/0kw9zMg==",
+      "dev": true,
+      "dependencies": {
+        "archy": "^1.0.0",
+        "cross-spawn": "^7.0.3",
+        "istanbul-lib-coverage": "^3.2.0",
+        "p-map": "^3.0.0",
+        "rimraf": "^3.0.0",
+        "uuid": "^8.3.2"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/istanbul-lib-processinfo/node_modules/p-map": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz",
+      "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==",
+      "dev": true,
+      "dependencies": {
+        "aggregate-error": "^3.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/istanbul-lib-report": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
+      "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==",
+      "dev": true,
+      "dependencies": {
+        "istanbul-lib-coverage": "^3.0.0",
+        "make-dir": "^3.0.0",
+        "supports-color": "^7.1.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/istanbul-lib-report/node_modules/supports-color": {
+      "version": "7.2.0",
+      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+      "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+      "dev": true,
+      "dependencies": {
+        "has-flag": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/istanbul-lib-source-maps": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz",
+      "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==",
+      "dev": true,
+      "dependencies": {
+        "debug": "^4.1.1",
+        "istanbul-lib-coverage": "^3.0.0",
+        "source-map": "^0.6.1"
+      },
+      "engines": {
+        "node": ">=10"
+      }
+    },
+    "node_modules/istanbul-reports": {
+      "version": "3.1.5",
+      "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz",
+      "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==",
+      "dev": true,
+      "dependencies": {
+        "html-escaper": "^2.0.0",
+        "istanbul-lib-report": "^3.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/jackspeak": {
+      "version": "2.3.6",
+      "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz",
+      "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==",
+      "inBundle": true,
+      "dependencies": {
+        "@isaacs/cliui": "^8.0.2"
+      },
+      "engines": {
+        "node": ">=14"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
+      },
+      "optionalDependencies": {
+        "@pkgjs/parseargs": "^0.11.0"
+      }
+    },
+    "node_modules/js-sdsl": {
+      "version": "4.4.0",
+      "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz",
+      "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==",
+      "dev": true,
+      "peer": true,
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/js-sdsl"
+      }
+    },
+    "node_modules/js-tokens": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+      "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+      "dev": true
+    },
+    "node_modules/js-yaml": {
+      "version": "4.1.0",
+      "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+      "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+      "dev": true,
+      "dependencies": {
+        "argparse": "^2.0.1"
+      },
+      "bin": {
+        "js-yaml": "bin/js-yaml.js"
+      }
+    },
+    "node_modules/jsdom": {
+      "version": "21.1.2",
+      "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.2.tgz",
+      "integrity": "sha512-sCpFmK2jv+1sjff4u7fzft+pUh2KSUbUrEHYHyfSIbGTIcmnjyp83qg6qLwdJ/I3LpTXx33ACxeRL7Lsyc6lGQ==",
+      "dev": true,
+      "dependencies": {
+        "abab": "^2.0.6",
+        "acorn": "^8.8.2",
+        "acorn-globals": "^7.0.0",
+        "cssstyle": "^3.0.0",
+        "data-urls": "^4.0.0",
+        "decimal.js": "^10.4.3",
+        "domexception": "^4.0.0",
+        "escodegen": "^2.0.0",
+        "form-data": "^4.0.0",
+        "html-encoding-sniffer": "^3.0.0",
+        "http-proxy-agent": "^5.0.0",
+        "https-proxy-agent": "^5.0.1",
+        "is-potential-custom-element-name": "^1.0.1",
+        "nwsapi": "^2.2.4",
+        "parse5": "^7.1.2",
+        "rrweb-cssom": "^0.6.0",
+        "saxes": "^6.0.0",
+        "symbol-tree": "^3.2.4",
+        "tough-cookie": "^4.1.2",
+        "w3c-xmlserializer": "^4.0.0",
+        "webidl-conversions": "^7.0.0",
+        "whatwg-encoding": "^2.0.0",
+        "whatwg-mimetype": "^3.0.0",
+        "whatwg-url": "^12.0.1",
+        "ws": "^8.13.0",
+        "xml-name-validator": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=14"
+      },
+      "peerDependencies": {
+        "canvas": "^2.5.0"
+      },
+      "peerDependenciesMeta": {
+        "canvas": {
+          "optional": true
+        }
+      }
+    },
+    "node_modules/jsdom/node_modules/escodegen": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz",
+      "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==",
+      "dev": true,
+      "dependencies": {
+        "esprima": "^4.0.1",
+        "estraverse": "^5.2.0",
+        "esutils": "^2.0.2",
+        "optionator": "^0.8.1"
+      },
+      "bin": {
+        "escodegen": "bin/escodegen.js",
+        "esgenerate": "bin/esgenerate.js"
+      },
+      "engines": {
+        "node": ">=6.0"
+      },
+      "optionalDependencies": {
+        "source-map": "~0.6.1"
+      }
+    },
+    "node_modules/jsdom/node_modules/esprima": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+      "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+      "dev": true,
+      "bin": {
+        "esparse": "bin/esparse.js",
+        "esvalidate": "bin/esvalidate.js"
+      },
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/jsdom/node_modules/levn": {
+      "version": "0.3.0",
+      "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
+      "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==",
+      "dev": true,
+      "dependencies": {
+        "prelude-ls": "~1.1.2",
+        "type-check": "~0.3.2"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/jsdom/node_modules/optionator": {
+      "version": "0.8.3",
+      "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
+      "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
+      "dev": true,
+      "dependencies": {
+        "deep-is": "~0.1.3",
+        "fast-levenshtein": "~2.0.6",
+        "levn": "~0.3.0",
+        "prelude-ls": "~1.1.2",
+        "type-check": "~0.3.2",
+        "word-wrap": "~1.2.3"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/jsdom/node_modules/prelude-ls": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
+      "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==",
+      "dev": true,
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/jsdom/node_modules/tr46": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
+      "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
+      "dev": true,
+      "dependencies": {
+        "punycode": "^2.3.0"
+      },
+      "engines": {
+        "node": ">=14"
+      }
+    },
+    "node_modules/jsdom/node_modules/type-check": {
+      "version": "0.3.2",
+      "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
+      "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==",
+      "dev": true,
+      "dependencies": {
+        "prelude-ls": "~1.1.2"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/jsdom/node_modules/webidl-conversions": {
+      "version": "7.0.0",
+      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
+      "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
+      "dev": true,
+      "engines": {
+        "node": ">=12"
+      }
+    },
+    "node_modules/jsdom/node_modules/whatwg-url": {
+      "version": "12.0.1",
+      "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz",
+      "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==",
+      "dev": true,
+      "dependencies": {
+        "tr46": "^4.1.1",
+        "webidl-conversions": "^7.0.0"
+      },
+      "engines": {
+        "node": ">=14"
+      }
+    },
+    "node_modules/jsesc": {
+      "version": "2.5.2",
+      "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
+      "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
+      "dev": true,
+      "bin": {
+        "jsesc": "bin/jsesc"
+      },
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/json-parse-even-better-errors": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.0.tgz",
+      "integrity": "sha512-iZbGHafX/59r39gPwVPRBGw0QQKnA7tte5pSMrhWOW7swGsVvVTjmfyAV9pNqk8YGT7tRCdxRu8uzcgZwoDooA==",
+      "inBundle": true,
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+      }
+    },
+    "node_modules/json-schema-traverse": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+      "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
+      "dev": true
+    },
+    "node_modules/json-stable-stringify-without-jsonify": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+      "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
+      "dev": true,
+      "peer": true
+    },
+    "node_modules/json-stringify-nice": {
+      "version": "1.1.4",
+      "resolved": "https://registry.npmjs.org/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz",
+      "integrity": "sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw==",
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
+      }
+    },
+    "node_modules/json-stringify-safe": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
+      "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
+      "dev": true
+    },
+    "node_modules/json5": {
+      "version": "2.2.3",
+      "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+      "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
+      "dev": true,
+      "bin": {
+        "json5": "lib/cli.js"
+      },
+      "engines": {
+        "node": ">=6"
+      }
+    },
+    "node_modules/jsonfile": {
+      "version": "6.1.0",
+      "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
+      "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
+      "dev": true,
+      "dependencies": {
+        "universalify": "^2.0.0"
+      },
+      "optionalDependencies": {
+        "graceful-fs": "^4.1.6"
+      }
+    },
+    "node_modules/jsonparse": {
+      "version": "1.3.1",
+      "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz",
+      "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==",
+      "engines": [
+        "node >= 0.2.0"
+      ],
+      "inBundle": true
+    },
+    "node_modules/jsonpath": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/jsonpath/-/jsonpath-1.1.1.tgz",
+      "integrity": "sha512-l6Cg7jRpixfbgoWgkrl77dgEj8RPvND0wMH6TwQmi9Qs4TFfS9u5cUFnbeKTwj5ga5Y3BTGGNI28k117LJ009w==",
+      "dev": true,
+      "dependencies": {
+        "esprima": "1.2.2",
+        "static-eval": "2.0.2",
+        "underscore": "1.12.1"
+      }
+    },
+    "node_modules/JSONStream": {
+      "version": "1.3.5",
+      "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz",
+      "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==",
+      "dev": true,
+      "dependencies": {
+        "jsonparse": "^1.2.0",
+        "through": ">=2.2.7 <3"
+      },
+      "bin": {
+        "JSONStream": "bin.js"
+      },
+      "engines": {
+        "node": "*"
+      }
+    },
+    "node_modules/just-deep-map-values": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/just-deep-map-values/-/just-deep-map-values-1.2.0.tgz",
+      "integrity": "sha512-4vpPBzHHis4UW/EbH5kHZn0gJvKP+EiMpbjD669ZSxdwx+EoAlQLMbLR08SEtydcq/MjDPPtwGiPo9R893iHVA==",
+      "dev": true
+    },
+    "node_modules/just-diff": {
+      "version": "6.0.2",
+      "resolved": "https://registry.npmjs.org/just-diff/-/just-diff-6.0.2.tgz",
+      "integrity": "sha512-S59eriX5u3/QhMNq3v/gm8Kd0w8OS6Tz2FS1NG4blv+z0MuQcBRJyFWjdovM0Rad4/P4aUPFtnkNjMjyMlMSYA==",
+      "inBundle": true
+    },
+    "node_modules/just-diff-apply": {
+      "version": "5.5.0",
+      "resolved": "https://registry.npmjs.org/just-diff-apply/-/just-diff-apply-5.5.0.tgz",
+      "integrity": "sha512-OYTthRfSh55WOItVqwpefPtNt2VdKsq5AnAK6apdtR6yCH8pr0CmSr710J0Mf+WdQy7K/OzMy7K2MgAfdQURDw==",
+      "inBundle": true
+    },
+    "node_modules/just-extend": {
+      "version": "6.2.0",
+      "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz",
+      "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==",
+      "dev": true
+    },
+    "node_modules/just-safe-set": {
+      "version": "4.2.1",
+      "resolved": "https://registry.npmjs.org/just-safe-set/-/just-safe-set-4.2.1.tgz",
+      "integrity": "sha512-La5CP41Ycv52+E4g7w1sRV8XXk7Sp8a/TwWQAYQKn6RsQz1FD4Z/rDRRmqV3wJznS1MDF3YxK7BCudX1J8FxLg==",
+      "dev": true
+    },
+    "node_modules/kind-of": {
+      "version": "6.0.3",
+      "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
+      "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/kleur": {
+      "version": "4.1.5",
+      "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz",
+      "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==",
+      "dev": true,
+      "engines": {
+        "node": ">=6"
+      }
+    },
+    "node_modules/leven": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz",
+      "integrity": "sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/levn": {
+      "version": "0.4.1",
+      "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+      "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
+      "dev": true,
+      "peer": true,
+      "dependencies": {
+        "prelude-ls": "^1.2.1",
+        "type-check": "~0.4.0"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/libnpmaccess": {
+      "resolved": "workspaces/libnpmaccess",
+      "link": true
+    },
+    "node_modules/libnpmdiff": {
+      "resolved": "workspaces/libnpmdiff",
+      "link": true
+    },
+    "node_modules/libnpmexec": {
+      "resolved": "workspaces/libnpmexec",
+      "link": true
+    },
+    "node_modules/libnpmfund": {
+      "resolved": "workspaces/libnpmfund",
+      "link": true
+    },
+    "node_modules/libnpmhook": {
+      "resolved": "workspaces/libnpmhook",
+      "link": true
+    },
+    "node_modules/libnpmorg": {
+      "resolved": "workspaces/libnpmorg",
+      "link": true
+    },
+    "node_modules/libnpmpack": {
+      "resolved": "workspaces/libnpmpack",
+      "link": true
+    },
+    "node_modules/libnpmpublish": {
+      "resolved": "workspaces/libnpmpublish",
+      "link": true
+    },
+    "node_modules/libnpmsearch": {
+      "resolved": "workspaces/libnpmsearch",
+      "link": true
+    },
+    "node_modules/libnpmteam": {
+      "resolved": "workspaces/libnpmteam",
+      "link": true
+    },
+    "node_modules/libnpmversion": {
+      "resolved": "workspaces/libnpmversion",
+      "link": true
+    },
+    "node_modules/libtap": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/libtap/-/libtap-1.4.0.tgz",
+      "integrity": "sha512-STLFynswQ2A6W14JkabgGetBNk6INL1REgJ9UeNKw5llXroC2cGLgKTqavv0sl8OLVztLLipVKMcQ7yeUcqpmg==",
+      "dev": true,
+      "dependencies": {
+        "async-hook-domain": "^2.0.4",
+        "bind-obj-methods": "^3.0.0",
+        "diff": "^4.0.2",
+        "function-loop": "^2.0.1",
+        "minipass": "^3.1.5",
+        "own-or": "^1.0.0",
+        "own-or-env": "^1.0.2",
+        "signal-exit": "^3.0.4",
+        "stack-utils": "^2.0.4",
+        "tap-parser": "^11.0.0",
+        "tap-yaml": "^1.0.0",
+        "tcompare": "^5.0.6",
+        "trivial-deferred": "^1.0.1"
+      },
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
+      }
+    },
+    "node_modules/libtap/node_modules/diff": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
+      "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
+      "dev": true,
+      "engines": {
+        "node": ">=0.3.1"
+      }
+    },
+    "node_modules/libtap/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+      "dev": true,
+      "dependencies": {
+        "yallist": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/libtap/node_modules/signal-exit": {
+      "version": "3.0.7",
+      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
+      "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+      "dev": true
+    },
+    "node_modules/licensee": {
+      "version": "10.0.0",
+      "resolved": "https://registry.npmjs.org/licensee/-/licensee-10.0.0.tgz",
+      "integrity": "sha512-gvn5JHCNuchGGjjIm6FsK4qSOTtHkbUfo8YKW61hhEIk3osEf3fKlCH9ma0j+HaVESrOt0YUOmsi/wusKSnneQ==",
+      "dev": true,
+      "dependencies": {
+        "@blueoak/list": "^9.0.0",
+        "@npmcli/arborist": "^6.1.2",
+        "correct-license-metadata": "^1.4.0",
+        "docopt": "^0.6.2",
+        "has": "^1.0.3",
+        "npm-license-corrections": "^1.6.2",
+        "semver": "^7.3.8",
+        "spdx-expression-parse": "^3.0.1",
+        "spdx-expression-validate": "^2.0.0",
+        "spdx-osi": "^3.0.0",
+        "spdx-whitelisted": "^1.0.0"
+      },
+      "bin": {
+        "licensee": "licensee"
+      },
+      "engines": {
+        "node": ">= 14.17"
+      }
+    },
+    "node_modules/licensee/node_modules/@npmcli/arborist": {
+      "version": "6.3.0",
+      "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-6.3.0.tgz",
+      "integrity": "sha512-XrS14qBDhK95RdGhjTSx8AgeZPNah949qp3b0v3GUFOugtPc9Z85rpWid57mONS8gHbuGIHjFzuA+5hSM7BuBA==",
+      "dev": true,
+      "dependencies": {
+        "@isaacs/string-locale-compare": "^1.1.0",
+        "@npmcli/fs": "^3.1.0",
+        "@npmcli/installed-package-contents": "^2.0.2",
+        "@npmcli/map-workspaces": "^3.0.2",
+        "@npmcli/metavuln-calculator": "^5.0.0",
+        "@npmcli/name-from-folder": "^2.0.0",
+        "@npmcli/node-gyp": "^3.0.0",
+        "@npmcli/package-json": "^4.0.0",
+        "@npmcli/query": "^3.0.0",
+        "@npmcli/run-script": "^6.0.0",
+        "bin-links": "^4.0.1",
+        "cacache": "^17.0.4",
+        "common-ancestor-path": "^1.0.1",
+        "hosted-git-info": "^6.1.1",
+        "json-parse-even-better-errors": "^3.0.0",
+        "json-stringify-nice": "^1.1.4",
+        "minimatch": "^9.0.0",
+        "nopt": "^7.0.0",
+        "npm-install-checks": "^6.0.0",
+        "npm-package-arg": "^10.1.0",
+        "npm-pick-manifest": "^8.0.1",
+        "npm-registry-fetch": "^14.0.3",
+        "npmlog": "^7.0.1",
+        "pacote": "^15.0.8",
+        "parse-conflict-json": "^3.0.0",
+        "proc-log": "^3.0.0",
+        "promise-all-reject-late": "^1.0.0",
+        "promise-call-limit": "^1.0.2",
+        "read-package-json-fast": "^3.0.2",
+        "semver": "^7.3.7",
+        "ssri": "^10.0.1",
+        "treeverse": "^3.0.0",
+        "walk-up-path": "^3.0.1"
+      },
+      "bin": {
+        "arborist": "bin/index.js"
+      },
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/jsdom/node_modules/tr46": {
-      "version": "4.1.1",
-      "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
-      "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
+    "node_modules/licensee/node_modules/@npmcli/git": {
+      "version": "4.1.0",
+      "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-4.1.0.tgz",
+      "integrity": "sha512-9hwoB3gStVfa0N31ymBmrX+GuDGdVA/QWShZVqE0HK2Af+7QGGrCTbZia/SW0ImUTjTne7SP91qxDmtXvDHRPQ==",
       "dev": true,
       "dependencies": {
-        "punycode": "^2.3.0"
+        "@npmcli/promise-spawn": "^6.0.0",
+        "lru-cache": "^7.4.4",
+        "npm-pick-manifest": "^8.0.0",
+        "proc-log": "^3.0.0",
+        "promise-inflight": "^1.0.1",
+        "promise-retry": "^2.0.1",
+        "semver": "^7.3.5",
+        "which": "^3.0.0"
       },
       "engines": {
-        "node": ">=14"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/jsdom/node_modules/type-check": {
-      "version": "0.3.2",
-      "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
-      "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==",
+    "node_modules/licensee/node_modules/@npmcli/metavuln-calculator": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-5.0.1.tgz",
+      "integrity": "sha512-qb8Q9wIIlEPj3WeA1Lba91R4ZboPL0uspzV0F9uwP+9AYMVB2zOoa7Pbk12g6D2NHAinSbHh6QYmGuRyHZ874Q==",
       "dev": true,
       "dependencies": {
-        "prelude-ls": "~1.1.2"
+        "cacache": "^17.0.0",
+        "json-parse-even-better-errors": "^3.0.0",
+        "pacote": "^15.0.0",
+        "semver": "^7.3.5"
       },
       "engines": {
-        "node": ">= 0.8.0"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/jsdom/node_modules/webidl-conversions": {
-      "version": "7.0.0",
-      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
-      "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
+    "node_modules/licensee/node_modules/@npmcli/package-json": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-4.0.1.tgz",
+      "integrity": "sha512-lRCEGdHZomFsURroh522YvA/2cVb9oPIJrjHanCJZkiasz1BzcnLr3tBJhlV7S86MBJBuAQ33is2D60YitZL2Q==",
       "dev": true,
+      "dependencies": {
+        "@npmcli/git": "^4.1.0",
+        "glob": "^10.2.2",
+        "hosted-git-info": "^6.1.1",
+        "json-parse-even-better-errors": "^3.0.0",
+        "normalize-package-data": "^5.0.0",
+        "proc-log": "^3.0.0",
+        "semver": "^7.5.3"
+      },
       "engines": {
-        "node": ">=12"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/jsdom/node_modules/whatwg-url": {
-      "version": "12.0.1",
-      "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz",
-      "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==",
+    "node_modules/licensee/node_modules/@npmcli/promise-spawn": {
+      "version": "6.0.2",
+      "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-6.0.2.tgz",
+      "integrity": "sha512-gGq0NJkIGSwdbUt4yhdF8ZrmkGKVz9vAdVzpOfnom+V8PLSmSOVhZwbNvZZS1EYcJN5hzzKBxmmVVAInM6HQLg==",
       "dev": true,
       "dependencies": {
-        "tr46": "^4.1.1",
-        "webidl-conversions": "^7.0.0"
+        "which": "^3.0.0"
       },
       "engines": {
-        "node": ">=14"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/jsesc": {
-      "version": "2.5.2",
-      "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
-      "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
+    "node_modules/licensee/node_modules/@npmcli/run-script": {
+      "version": "6.0.2",
+      "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-6.0.2.tgz",
+      "integrity": "sha512-NCcr1uQo1k5U+SYlnIrbAh3cxy+OQT1VtqiAbxdymSlptbzBb62AjH2xXgjNCoP073hoa1CfCAcwoZ8k96C4nA==",
       "dev": true,
-      "bin": {
-        "jsesc": "bin/jsesc"
+      "dependencies": {
+        "@npmcli/node-gyp": "^3.0.0",
+        "@npmcli/promise-spawn": "^6.0.0",
+        "node-gyp": "^9.0.0",
+        "read-package-json-fast": "^3.0.0",
+        "which": "^3.0.0"
       },
       "engines": {
-        "node": ">=4"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/json-parse-even-better-errors": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.0.tgz",
-      "integrity": "sha512-iZbGHafX/59r39gPwVPRBGw0QQKnA7tte5pSMrhWOW7swGsVvVTjmfyAV9pNqk8YGT7tRCdxRu8uzcgZwoDooA==",
-      "inBundle": true,
+    "node_modules/licensee/node_modules/@sigstore/bundle": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-1.1.0.tgz",
+      "integrity": "sha512-PFutXEy0SmQxYI4texPw3dd2KewuNqv7OuK1ZFtY2fM754yhvG2KdgwIhRnoEE2uHdtdGNQ8s0lb94dW9sELog==",
+      "dev": true,
+      "dependencies": {
+        "@sigstore/protobuf-specs": "^0.2.0"
+      },
       "engines": {
         "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/json-schema-traverse": {
+    "node_modules/licensee/node_modules/@sigstore/sign": {
       "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
-      "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
-      "dev": true
-    },
-    "node_modules/json-stable-stringify-without-jsonify": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
-      "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
-      "dev": true,
-      "peer": true
-    },
-    "node_modules/json-stringify-nice": {
-      "version": "1.1.4",
-      "resolved": "https://registry.npmjs.org/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz",
-      "integrity": "sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw==",
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
-      }
-    },
-    "node_modules/json-stringify-safe": {
-      "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
-      "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
-      "dev": true
-    },
-    "node_modules/json5": {
-      "version": "2.2.3",
-      "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
-      "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
+      "resolved": "https://registry.npmjs.org/@sigstore/sign/-/sign-1.0.0.tgz",
+      "integrity": "sha512-INxFVNQteLtcfGmcoldzV6Je0sbbfh9I16DM4yJPw3j5+TFP8X6uIiA18mvpEa9yyeycAKgPmOA3X9hVdVTPUA==",
       "dev": true,
-      "bin": {
-        "json5": "lib/cli.js"
+      "dependencies": {
+        "@sigstore/bundle": "^1.1.0",
+        "@sigstore/protobuf-specs": "^0.2.0",
+        "make-fetch-happen": "^11.0.1"
       },
       "engines": {
-        "node": ">=6"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/jsonfile": {
-      "version": "6.1.0",
-      "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
-      "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
+    "node_modules/licensee/node_modules/@sigstore/tuf": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/@sigstore/tuf/-/tuf-1.0.3.tgz",
+      "integrity": "sha512-2bRovzs0nJZFlCN3rXirE4gwxCn97JNjMmwpecqlbgV9WcxX7WRuIrgzx/X7Ib7MYRbyUTpBYE0s2x6AmZXnlg==",
       "dev": true,
       "dependencies": {
-        "universalify": "^2.0.0"
+        "@sigstore/protobuf-specs": "^0.2.0",
+        "tuf-js": "^1.1.7"
       },
-      "optionalDependencies": {
-        "graceful-fs": "^4.1.6"
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/jsonparse": {
-      "version": "1.3.1",
-      "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz",
-      "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==",
-      "engines": [
-        "node >= 0.2.0"
-      ],
-      "inBundle": true
-    },
-    "node_modules/jsonpath": {
-      "version": "1.1.1",
-      "resolved": "https://registry.npmjs.org/jsonpath/-/jsonpath-1.1.1.tgz",
-      "integrity": "sha512-l6Cg7jRpixfbgoWgkrl77dgEj8RPvND0wMH6TwQmi9Qs4TFfS9u5cUFnbeKTwj5ga5Y3BTGGNI28k117LJ009w==",
+    "node_modules/licensee/node_modules/@tufjs/canonical-json": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz",
+      "integrity": "sha512-QTnf++uxunWvG2z3UFNzAoQPHxnSXOwtaI3iJ+AohhV+5vONuArPjJE7aPXPVXfXJsqrVbZBu9b81AJoSd09IQ==",
       "dev": true,
-      "dependencies": {
-        "esprima": "1.2.2",
-        "static-eval": "2.0.2",
-        "underscore": "1.12.1"
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/JSONStream": {
-      "version": "1.3.5",
-      "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz",
-      "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==",
+    "node_modules/licensee/node_modules/@tufjs/models": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/@tufjs/models/-/models-1.0.4.tgz",
+      "integrity": "sha512-qaGV9ltJP0EO25YfFUPhxRVK0evXFIAGicsVXuRim4Ed9cjPxYhNnNJ49SFmbeLgtxpslIkX317IgpfcHPVj/A==",
       "dev": true,
       "dependencies": {
-        "jsonparse": "^1.2.0",
-        "through": ">=2.2.7 <3"
-      },
-      "bin": {
-        "JSONStream": "bin.js"
+        "@tufjs/canonical-json": "1.0.0",
+        "minimatch": "^9.0.0"
       },
       "engines": {
-        "node": "*"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/just-deep-map-values": {
-      "version": "1.2.0",
-      "resolved": "https://registry.npmjs.org/just-deep-map-values/-/just-deep-map-values-1.2.0.tgz",
-      "integrity": "sha512-4vpPBzHHis4UW/EbH5kHZn0gJvKP+EiMpbjD669ZSxdwx+EoAlQLMbLR08SEtydcq/MjDPPtwGiPo9R893iHVA==",
-      "dev": true
-    },
-    "node_modules/just-diff": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/just-diff/-/just-diff-6.0.2.tgz",
-      "integrity": "sha512-S59eriX5u3/QhMNq3v/gm8Kd0w8OS6Tz2FS1NG4blv+z0MuQcBRJyFWjdovM0Rad4/P4aUPFtnkNjMjyMlMSYA==",
-      "inBundle": true
-    },
-    "node_modules/just-diff-apply": {
-      "version": "5.5.0",
-      "resolved": "https://registry.npmjs.org/just-diff-apply/-/just-diff-apply-5.5.0.tgz",
-      "integrity": "sha512-OYTthRfSh55WOItVqwpefPtNt2VdKsq5AnAK6apdtR6yCH8pr0CmSr710J0Mf+WdQy7K/OzMy7K2MgAfdQURDw==",
-      "inBundle": true
-    },
-    "node_modules/just-extend": {
-      "version": "6.2.0",
-      "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz",
-      "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==",
-      "dev": true
-    },
-    "node_modules/just-safe-set": {
-      "version": "4.2.1",
-      "resolved": "https://registry.npmjs.org/just-safe-set/-/just-safe-set-4.2.1.tgz",
-      "integrity": "sha512-La5CP41Ycv52+E4g7w1sRV8XXk7Sp8a/TwWQAYQKn6RsQz1FD4Z/rDRRmqV3wJznS1MDF3YxK7BCudX1J8FxLg==",
+    "node_modules/licensee/node_modules/abbrev": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
+      "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
       "dev": true
     },
-    "node_modules/kind-of": {
-      "version": "6.0.3",
-      "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
-      "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
+    "node_modules/licensee/node_modules/are-we-there-yet": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz",
+      "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==",
       "dev": true,
+      "dependencies": {
+        "delegates": "^1.0.0",
+        "readable-stream": "^3.6.0"
+      },
       "engines": {
-        "node": ">=0.10.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/kleur": {
-      "version": "4.1.5",
-      "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz",
-      "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==",
+    "node_modules/licensee/node_modules/brace-expansion": {
+      "version": "1.1.11",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
       "dev": true,
-      "engines": {
-        "node": ">=6"
+      "dependencies": {
+        "balanced-match": "^1.0.0",
+        "concat-map": "0.0.1"
       }
     },
-    "node_modules/leven": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz",
-      "integrity": "sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==",
+    "node_modules/licensee/node_modules/cacache": {
+      "version": "17.1.4",
+      "resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.4.tgz",
+      "integrity": "sha512-/aJwG2l3ZMJ1xNAnqbMpA40of9dj/pIH3QfiuQSqjfPJF747VR0J/bHn+/KdNnHKc6XQcWt/AfRSBft82W1d2A==",
       "dev": true,
+      "dependencies": {
+        "@npmcli/fs": "^3.1.0",
+        "fs-minipass": "^3.0.0",
+        "glob": "^10.2.2",
+        "lru-cache": "^7.7.1",
+        "minipass": "^7.0.3",
+        "minipass-collect": "^1.0.2",
+        "minipass-flush": "^1.0.5",
+        "minipass-pipeline": "^1.2.4",
+        "p-map": "^4.0.0",
+        "ssri": "^10.0.0",
+        "tar": "^6.1.11",
+        "unique-filename": "^3.0.0"
+      },
       "engines": {
-        "node": ">=0.10.0"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/levn": {
-      "version": "0.4.1",
-      "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
-      "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
+    "node_modules/licensee/node_modules/gauge": {
+      "version": "4.0.4",
+      "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz",
+      "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==",
       "dev": true,
-      "peer": true,
       "dependencies": {
-        "prelude-ls": "^1.2.1",
-        "type-check": "~0.4.0"
+        "aproba": "^1.0.3 || ^2.0.0",
+        "color-support": "^1.1.3",
+        "console-control-strings": "^1.1.0",
+        "has-unicode": "^2.0.1",
+        "signal-exit": "^3.0.7",
+        "string-width": "^4.2.3",
+        "strip-ansi": "^6.0.1",
+        "wide-align": "^1.1.5"
       },
       "engines": {
-        "node": ">= 0.8.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/libnpmaccess": {
-      "resolved": "workspaces/libnpmaccess",
-      "link": true
-    },
-    "node_modules/libnpmdiff": {
-      "resolved": "workspaces/libnpmdiff",
-      "link": true
-    },
-    "node_modules/libnpmexec": {
-      "resolved": "workspaces/libnpmexec",
-      "link": true
-    },
-    "node_modules/libnpmfund": {
-      "resolved": "workspaces/libnpmfund",
-      "link": true
-    },
-    "node_modules/libnpmhook": {
-      "resolved": "workspaces/libnpmhook",
-      "link": true
-    },
-    "node_modules/libnpmorg": {
-      "resolved": "workspaces/libnpmorg",
-      "link": true
-    },
-    "node_modules/libnpmpack": {
-      "resolved": "workspaces/libnpmpack",
-      "link": true
-    },
-    "node_modules/libnpmpublish": {
-      "resolved": "workspaces/libnpmpublish",
-      "link": true
-    },
-    "node_modules/libnpmsearch": {
-      "resolved": "workspaces/libnpmsearch",
-      "link": true
-    },
-    "node_modules/libnpmteam": {
-      "resolved": "workspaces/libnpmteam",
-      "link": true
-    },
-    "node_modules/libnpmversion": {
-      "resolved": "workspaces/libnpmversion",
-      "link": true
-    },
-    "node_modules/libtap": {
-      "version": "1.4.0",
-      "resolved": "https://registry.npmjs.org/libtap/-/libtap-1.4.0.tgz",
-      "integrity": "sha512-STLFynswQ2A6W14JkabgGetBNk6INL1REgJ9UeNKw5llXroC2cGLgKTqavv0sl8OLVztLLipVKMcQ7yeUcqpmg==",
+    "node_modules/licensee/node_modules/hosted-git-info": {
+      "version": "6.1.1",
+      "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-6.1.1.tgz",
+      "integrity": "sha512-r0EI+HBMcXadMrugk0GCQ+6BQV39PiWAZVfq7oIckeGiN7sjRGyQxPdft3nQekFTCQbYxLBH+/axZMeH8UX6+w==",
       "dev": true,
       "dependencies": {
-        "async-hook-domain": "^2.0.4",
-        "bind-obj-methods": "^3.0.0",
-        "diff": "^4.0.2",
-        "function-loop": "^2.0.1",
-        "minipass": "^3.1.5",
-        "own-or": "^1.0.0",
-        "own-or-env": "^1.0.2",
-        "signal-exit": "^3.0.4",
-        "stack-utils": "^2.0.4",
-        "tap-parser": "^11.0.0",
-        "tap-yaml": "^1.0.0",
-        "tcompare": "^5.0.6",
-        "trivial-deferred": "^1.0.1"
+        "lru-cache": "^7.5.1"
       },
       "engines": {
-        "node": ">=10"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/libtap/node_modules/diff": {
-      "version": "4.0.2",
-      "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
-      "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
+    "node_modules/licensee/node_modules/lru-cache": {
+      "version": "7.18.3",
+      "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+      "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
       "dev": true,
       "engines": {
-        "node": ">=0.3.1"
+        "node": ">=12"
       }
     },
-    "node_modules/libtap/node_modules/minipass": {
-      "version": "3.3.6",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
-      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+    "node_modules/licensee/node_modules/make-fetch-happen": {
+      "version": "11.1.1",
+      "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz",
+      "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==",
       "dev": true,
       "dependencies": {
-        "yallist": "^4.0.0"
+        "agentkeepalive": "^4.2.1",
+        "cacache": "^17.0.0",
+        "http-cache-semantics": "^4.1.1",
+        "http-proxy-agent": "^5.0.0",
+        "https-proxy-agent": "^5.0.0",
+        "is-lambda": "^1.0.1",
+        "lru-cache": "^7.7.1",
+        "minipass": "^5.0.0",
+        "minipass-fetch": "^3.0.0",
+        "minipass-flush": "^1.0.5",
+        "minipass-pipeline": "^1.2.4",
+        "negotiator": "^0.6.3",
+        "promise-retry": "^2.0.1",
+        "socks-proxy-agent": "^7.0.0",
+        "ssri": "^10.0.0"
       },
       "engines": {
-        "node": ">=8"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/libtap/node_modules/signal-exit": {
-      "version": "3.0.7",
-      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
-      "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
-      "dev": true
+    "node_modules/licensee/node_modules/make-fetch-happen/node_modules/minipass": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
+      "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
+      "dev": true,
+      "engines": {
+        "node": ">=8"
+      }
     },
-    "node_modules/licensee": {
-      "version": "10.0.0",
-      "resolved": "https://registry.npmjs.org/licensee/-/licensee-10.0.0.tgz",
-      "integrity": "sha512-gvn5JHCNuchGGjjIm6FsK4qSOTtHkbUfo8YKW61hhEIk3osEf3fKlCH9ma0j+HaVESrOt0YUOmsi/wusKSnneQ==",
+    "node_modules/licensee/node_modules/node-gyp": {
+      "version": "9.4.1",
+      "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.1.tgz",
+      "integrity": "sha512-OQkWKbjQKbGkMf/xqI1jjy3oCTgMKJac58G2+bjZb3fza6gW2YrCSdMQYaoTb70crvE//Gngr4f0AgVHmqHvBQ==",
       "dev": true,
       "dependencies": {
-        "@blueoak/list": "^9.0.0",
-        "@npmcli/arborist": "^6.1.2",
-        "correct-license-metadata": "^1.4.0",
-        "docopt": "^0.6.2",
-        "has": "^1.0.3",
-        "npm-license-corrections": "^1.6.2",
-        "semver": "^7.3.8",
-        "spdx-expression-parse": "^3.0.1",
-        "spdx-expression-validate": "^2.0.0",
-        "spdx-osi": "^3.0.0",
-        "spdx-whitelisted": "^1.0.0"
+        "env-paths": "^2.2.0",
+        "exponential-backoff": "^3.1.1",
+        "glob": "^7.1.4",
+        "graceful-fs": "^4.2.6",
+        "make-fetch-happen": "^10.0.3",
+        "nopt": "^6.0.0",
+        "npmlog": "^6.0.0",
+        "rimraf": "^3.0.2",
+        "semver": "^7.3.5",
+        "tar": "^6.1.2",
+        "which": "^2.0.2"
       },
       "bin": {
-        "licensee": "licensee"
+        "node-gyp": "bin/node-gyp.js"
       },
       "engines": {
-        "node": ">= 14.17"
+        "node": "^12.13 || ^14.13 || >=16"
       }
     },
-    "node_modules/licensee/node_modules/@npmcli/arborist": {
-      "version": "6.3.0",
-      "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-6.3.0.tgz",
-      "integrity": "sha512-XrS14qBDhK95RdGhjTSx8AgeZPNah949qp3b0v3GUFOugtPc9Z85rpWid57mONS8gHbuGIHjFzuA+5hSM7BuBA==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/@npmcli/fs": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz",
+      "integrity": "sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==",
       "dev": true,
       "dependencies": {
-        "@isaacs/string-locale-compare": "^1.1.0",
-        "@npmcli/fs": "^3.1.0",
-        "@npmcli/installed-package-contents": "^2.0.2",
-        "@npmcli/map-workspaces": "^3.0.2",
-        "@npmcli/metavuln-calculator": "^5.0.0",
-        "@npmcli/name-from-folder": "^2.0.0",
-        "@npmcli/node-gyp": "^3.0.0",
-        "@npmcli/package-json": "^4.0.0",
-        "@npmcli/query": "^3.0.0",
-        "@npmcli/run-script": "^6.0.0",
-        "bin-links": "^4.0.1",
-        "cacache": "^17.0.4",
-        "common-ancestor-path": "^1.0.1",
-        "hosted-git-info": "^6.1.1",
-        "json-parse-even-better-errors": "^3.0.0",
-        "json-stringify-nice": "^1.1.4",
-        "minimatch": "^9.0.0",
-        "nopt": "^7.0.0",
-        "npm-install-checks": "^6.0.0",
-        "npm-package-arg": "^10.1.0",
-        "npm-pick-manifest": "^8.0.1",
-        "npm-registry-fetch": "^14.0.3",
-        "npmlog": "^7.0.1",
-        "pacote": "^15.0.8",
-        "parse-conflict-json": "^3.0.0",
-        "proc-log": "^3.0.0",
-        "promise-all-reject-late": "^1.0.0",
-        "promise-call-limit": "^1.0.2",
-        "read-package-json-fast": "^3.0.2",
-        "semver": "^7.3.7",
-        "ssri": "^10.0.1",
-        "treeverse": "^3.0.0",
-        "walk-up-path": "^3.0.1"
-      },
-      "bin": {
-        "arborist": "bin/index.js"
+        "@gar/promisify": "^1.1.3",
+        "semver": "^7.3.5"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/licensee/node_modules/@npmcli/git": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-4.1.0.tgz",
-      "integrity": "sha512-9hwoB3gStVfa0N31ymBmrX+GuDGdVA/QWShZVqE0HK2Af+7QGGrCTbZia/SW0ImUTjTne7SP91qxDmtXvDHRPQ==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/cacache": {
+      "version": "16.1.3",
+      "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.3.tgz",
+      "integrity": "sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==",
       "dev": true,
       "dependencies": {
-        "@npmcli/promise-spawn": "^6.0.0",
-        "lru-cache": "^7.4.4",
-        "npm-pick-manifest": "^8.0.0",
-        "proc-log": "^3.0.0",
+        "@npmcli/fs": "^2.1.0",
+        "@npmcli/move-file": "^2.0.0",
+        "chownr": "^2.0.0",
+        "fs-minipass": "^2.1.0",
+        "glob": "^8.0.1",
+        "infer-owner": "^1.0.4",
+        "lru-cache": "^7.7.1",
+        "minipass": "^3.1.6",
+        "minipass-collect": "^1.0.2",
+        "minipass-flush": "^1.0.5",
+        "minipass-pipeline": "^1.2.4",
+        "mkdirp": "^1.0.4",
+        "p-map": "^4.0.0",
         "promise-inflight": "^1.0.1",
-        "promise-retry": "^2.0.1",
-        "semver": "^7.3.5",
-        "which": "^3.0.0"
+        "rimraf": "^3.0.2",
+        "ssri": "^9.0.0",
+        "tar": "^6.1.11",
+        "unique-filename": "^2.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/licensee/node_modules/@npmcli/metavuln-calculator": {
-      "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-5.0.1.tgz",
-      "integrity": "sha512-qb8Q9wIIlEPj3WeA1Lba91R4ZboPL0uspzV0F9uwP+9AYMVB2zOoa7Pbk12g6D2NHAinSbHh6QYmGuRyHZ874Q==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+      "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
       "dev": true,
       "dependencies": {
-        "cacache": "^17.0.0",
-        "json-parse-even-better-errors": "^3.0.0",
-        "pacote": "^15.0.0",
-        "semver": "^7.3.5"
-      },
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "balanced-match": "^1.0.0"
       }
     },
-    "node_modules/licensee/node_modules/@npmcli/package-json": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-4.0.1.tgz",
-      "integrity": "sha512-lRCEGdHZomFsURroh522YvA/2cVb9oPIJrjHanCJZkiasz1BzcnLr3tBJhlV7S86MBJBuAQ33is2D60YitZL2Q==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/cacache/node_modules/glob": {
+      "version": "8.1.0",
+      "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
+      "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
       "dev": true,
       "dependencies": {
-        "@npmcli/git": "^4.1.0",
-        "glob": "^10.2.2",
-        "hosted-git-info": "^6.1.1",
-        "json-parse-even-better-errors": "^3.0.0",
-        "normalize-package-data": "^5.0.0",
-        "proc-log": "^3.0.0",
-        "semver": "^7.5.3"
+        "fs.realpath": "^1.0.0",
+        "inflight": "^1.0.4",
+        "inherits": "2",
+        "minimatch": "^5.0.1",
+        "once": "^1.3.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">=12"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
       }
     },
-    "node_modules/licensee/node_modules/@npmcli/promise-spawn": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-6.0.2.tgz",
-      "integrity": "sha512-gGq0NJkIGSwdbUt4yhdF8ZrmkGKVz9vAdVzpOfnom+V8PLSmSOVhZwbNvZZS1EYcJN5hzzKBxmmVVAInM6HQLg==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch": {
+      "version": "5.1.6",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
+      "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
       "dev": true,
       "dependencies": {
-        "which": "^3.0.0"
+        "brace-expansion": "^2.0.1"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">=10"
       }
     },
-    "node_modules/licensee/node_modules/@npmcli/run-script": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-6.0.2.tgz",
-      "integrity": "sha512-NCcr1uQo1k5U+SYlnIrbAh3cxy+OQT1VtqiAbxdymSlptbzBb62AjH2xXgjNCoP073hoa1CfCAcwoZ8k96C4nA==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/fs-minipass": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
+      "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
       "dev": true,
       "dependencies": {
-        "@npmcli/node-gyp": "^3.0.0",
-        "@npmcli/promise-spawn": "^6.0.0",
-        "node-gyp": "^9.0.0",
-        "read-package-json-fast": "^3.0.0",
-        "which": "^3.0.0"
+        "minipass": "^3.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">= 8"
       }
     },
-    "node_modules/licensee/node_modules/@sigstore/bundle": {
-      "version": "1.1.0",
-      "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-1.1.0.tgz",
-      "integrity": "sha512-PFutXEy0SmQxYI4texPw3dd2KewuNqv7OuK1ZFtY2fM754yhvG2KdgwIhRnoEE2uHdtdGNQ8s0lb94dW9sELog==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/glob": {
+      "version": "7.2.3",
+      "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+      "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
       "dev": true,
       "dependencies": {
-        "@sigstore/protobuf-specs": "^0.2.0"
+        "fs.realpath": "^1.0.0",
+        "inflight": "^1.0.4",
+        "inherits": "2",
+        "minimatch": "^3.1.1",
+        "once": "^1.3.0",
+        "path-is-absolute": "^1.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "*"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
       }
     },
-    "node_modules/licensee/node_modules/@sigstore/sign": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/@sigstore/sign/-/sign-1.0.0.tgz",
-      "integrity": "sha512-INxFVNQteLtcfGmcoldzV6Je0sbbfh9I16DM4yJPw3j5+TFP8X6uIiA18mvpEa9yyeycAKgPmOA3X9hVdVTPUA==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/make-fetch-happen": {
+      "version": "10.2.1",
+      "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz",
+      "integrity": "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==",
       "dev": true,
       "dependencies": {
-        "@sigstore/bundle": "^1.1.0",
-        "@sigstore/protobuf-specs": "^0.2.0",
-        "make-fetch-happen": "^11.0.1"
+        "agentkeepalive": "^4.2.1",
+        "cacache": "^16.1.0",
+        "http-cache-semantics": "^4.1.0",
+        "http-proxy-agent": "^5.0.0",
+        "https-proxy-agent": "^5.0.0",
+        "is-lambda": "^1.0.1",
+        "lru-cache": "^7.7.1",
+        "minipass": "^3.1.6",
+        "minipass-collect": "^1.0.2",
+        "minipass-fetch": "^2.0.3",
+        "minipass-flush": "^1.0.5",
+        "minipass-pipeline": "^1.2.4",
+        "negotiator": "^0.6.3",
+        "promise-retry": "^2.0.1",
+        "socks-proxy-agent": "^7.0.0",
+        "ssri": "^9.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/licensee/node_modules/@sigstore/tuf": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/@sigstore/tuf/-/tuf-1.0.3.tgz",
-      "integrity": "sha512-2bRovzs0nJZFlCN3rXirE4gwxCn97JNjMmwpecqlbgV9WcxX7WRuIrgzx/X7Ib7MYRbyUTpBYE0s2x6AmZXnlg==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/minimatch": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
       "dev": true,
       "dependencies": {
-        "@sigstore/protobuf-specs": "^0.2.0",
-        "tuf-js": "^1.1.7"
+        "brace-expansion": "^1.1.7"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "*"
       }
     },
-    "node_modules/licensee/node_modules/@tufjs/canonical-json": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz",
-      "integrity": "sha512-QTnf++uxunWvG2z3UFNzAoQPHxnSXOwtaI3iJ+AohhV+5vONuArPjJE7aPXPVXfXJsqrVbZBu9b81AJoSd09IQ==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
       "dev": true,
+      "dependencies": {
+        "yallist": "^4.0.0"
+      },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">=8"
       }
     },
-    "node_modules/licensee/node_modules/@tufjs/models": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/@tufjs/models/-/models-1.0.4.tgz",
-      "integrity": "sha512-qaGV9ltJP0EO25YfFUPhxRVK0evXFIAGicsVXuRim4Ed9cjPxYhNnNJ49SFmbeLgtxpslIkX317IgpfcHPVj/A==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/minipass-fetch": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.2.tgz",
+      "integrity": "sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==",
       "dev": true,
       "dependencies": {
-        "@tufjs/canonical-json": "1.0.0",
-        "minimatch": "^9.0.0"
+        "minipass": "^3.1.6",
+        "minipass-sized": "^1.0.3",
+        "minizlib": "^2.1.2"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+      },
+      "optionalDependencies": {
+        "encoding": "^0.1.13"
       }
     },
-    "node_modules/licensee/node_modules/cacache": {
-      "version": "17.1.4",
-      "resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.4.tgz",
-      "integrity": "sha512-/aJwG2l3ZMJ1xNAnqbMpA40of9dj/pIH3QfiuQSqjfPJF747VR0J/bHn+/KdNnHKc6XQcWt/AfRSBft82W1d2A==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/nopt": {
+      "version": "6.0.0",
+      "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz",
+      "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==",
       "dev": true,
       "dependencies": {
-        "@npmcli/fs": "^3.1.0",
-        "fs-minipass": "^3.0.0",
-        "glob": "^10.2.2",
-        "lru-cache": "^7.7.1",
-        "minipass": "^7.0.3",
-        "minipass-collect": "^1.0.2",
-        "minipass-flush": "^1.0.5",
-        "minipass-pipeline": "^1.2.4",
-        "p-map": "^4.0.0",
-        "ssri": "^10.0.0",
-        "tar": "^6.1.11",
-        "unique-filename": "^3.0.0"
+        "abbrev": "^1.0.0"
+      },
+      "bin": {
+        "nopt": "bin/nopt.js"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/licensee/node_modules/hosted-git-info": {
-      "version": "6.1.1",
-      "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-6.1.1.tgz",
-      "integrity": "sha512-r0EI+HBMcXadMrugk0GCQ+6BQV39PiWAZVfq7oIckeGiN7sjRGyQxPdft3nQekFTCQbYxLBH+/axZMeH8UX6+w==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/npmlog": {
+      "version": "6.0.2",
+      "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz",
+      "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==",
       "dev": true,
       "dependencies": {
-        "lru-cache": "^7.5.1"
+        "are-we-there-yet": "^3.0.0",
+        "console-control-strings": "^1.1.0",
+        "gauge": "^4.0.3",
+        "set-blocking": "^2.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/licensee/node_modules/lru-cache": {
-      "version": "7.18.3",
-      "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
-      "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/ssri": {
+      "version": "9.0.1",
+      "resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz",
+      "integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==",
       "dev": true,
+      "dependencies": {
+        "minipass": "^3.1.1"
+      },
       "engines": {
-        "node": ">=12"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/licensee/node_modules/make-fetch-happen": {
-      "version": "11.1.1",
-      "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz",
-      "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/unique-filename": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz",
+      "integrity": "sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==",
       "dev": true,
       "dependencies": {
-        "agentkeepalive": "^4.2.1",
-        "cacache": "^17.0.0",
-        "http-cache-semantics": "^4.1.1",
-        "http-proxy-agent": "^5.0.0",
-        "https-proxy-agent": "^5.0.0",
-        "is-lambda": "^1.0.1",
-        "lru-cache": "^7.7.1",
-        "minipass": "^5.0.0",
-        "minipass-fetch": "^3.0.0",
-        "minipass-flush": "^1.0.5",
-        "minipass-pipeline": "^1.2.4",
-        "negotiator": "^0.6.3",
-        "promise-retry": "^2.0.1",
-        "socks-proxy-agent": "^7.0.0",
-        "ssri": "^10.0.0"
+        "unique-slug": "^3.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
     },
-    "node_modules/licensee/node_modules/make-fetch-happen/node_modules/minipass": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
-      "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
+    "node_modules/licensee/node_modules/node-gyp/node_modules/which": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+      "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
       "dev": true,
+      "dependencies": {
+        "isexe": "^2.0.0"
+      },
+      "bin": {
+        "node-which": "bin/node-which"
+      },
       "engines": {
-        "node": ">=8"
+        "node": ">= 8"
       }
     },
     "node_modules/licensee/node_modules/normalize-package-data": {
@@ -8903,6 +9974,26 @@
         "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
+    "node_modules/licensee/node_modules/readable-stream": {
+      "version": "3.6.2",
+      "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+      "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
+      "dev": true,
+      "dependencies": {
+        "inherits": "^2.0.3",
+        "string_decoder": "^1.1.1",
+        "util-deprecate": "^1.0.1"
+      },
+      "engines": {
+        "node": ">= 6"
+      }
+    },
+    "node_modules/licensee/node_modules/signal-exit": {
+      "version": "3.0.7",
+      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
+      "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+      "dev": true
+    },
     "node_modules/licensee/node_modules/sigstore": {
       "version": "1.9.0",
       "resolved": "https://registry.npmjs.org/sigstore/-/sigstore-1.9.0.tgz",
@@ -8936,6 +10027,18 @@
         "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
+    "node_modules/licensee/node_modules/unique-slug": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-3.0.0.tgz",
+      "integrity": "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w==",
+      "dev": true,
+      "dependencies": {
+        "imurmurhash": "^0.1.4"
+      },
+      "engines": {
+        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+      }
+    },
     "node_modules/licensee/node_modules/which": {
       "version": "3.0.1",
       "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz",
@@ -10169,663 +11272,395 @@
       "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
       "dev": true,
       "engines": {
-        "node": ">=6"
-      }
-    },
-    "node_modules/min-indent": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
-      "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
-      "dev": true,
-      "engines": {
-        "node": ">=4"
-      }
-    },
-    "node_modules/minify-registry-metadata": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/minify-registry-metadata/-/minify-registry-metadata-3.0.0.tgz",
-      "integrity": "sha512-EvM09tT0saeVP2Tlu9WEUDUgTYi684LsBbC+nbU3XEENgnzz+aEskigZR+OYG8LJPat1FdSIKMkJLMojg0FIiQ==",
-      "dev": true,
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
-      }
-    },
-    "node_modules/minimatch": {
-      "version": "9.0.3",
-      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
-      "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
-      "inBundle": true,
-      "dependencies": {
-        "brace-expansion": "^2.0.1"
-      },
-      "engines": {
-        "node": ">=16 || 14 >=14.17"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
-      }
-    },
-    "node_modules/minimist": {
-      "version": "1.2.8",
-      "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
-      "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
-      "dev": true,
-      "funding": {
-        "url": "https://github.com/sponsors/ljharb"
-      }
-    },
-    "node_modules/minimist-options": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz",
-      "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==",
-      "dev": true,
-      "dependencies": {
-        "arrify": "^1.0.1",
-        "is-plain-obj": "^1.1.0",
-        "kind-of": "^6.0.3"
-      },
-      "engines": {
-        "node": ">= 6"
-      }
-    },
-    "node_modules/minipass": {
-      "version": "7.0.4",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz",
-      "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==",
-      "inBundle": true,
-      "engines": {
-        "node": ">=16 || 14 >=14.17"
-      }
-    },
-    "node_modules/minipass-collect": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz",
-      "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==",
-      "inBundle": true,
-      "dependencies": {
-        "minipass": "^3.0.0"
-      },
-      "engines": {
-        "node": ">= 8"
-      }
-    },
-    "node_modules/minipass-collect/node_modules/minipass": {
-      "version": "3.3.6",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
-      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
-      "inBundle": true,
-      "dependencies": {
-        "yallist": "^4.0.0"
-      },
-      "engines": {
-        "node": ">=8"
-      }
-    },
-    "node_modules/minipass-fetch": {
-      "version": "3.0.4",
-      "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.4.tgz",
-      "integrity": "sha512-jHAqnA728uUpIaFm7NWsCnqKT6UqZz7GcI/bDpPATuwYyKwJwW0remxSCxUlKiEty+eopHGa3oc8WxgQ1FFJqg==",
-      "inBundle": true,
-      "dependencies": {
-        "minipass": "^7.0.3",
-        "minipass-sized": "^1.0.3",
-        "minizlib": "^2.1.2"
-      },
-      "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
-      },
-      "optionalDependencies": {
-        "encoding": "^0.1.13"
-      }
-    },
-    "node_modules/minipass-flush": {
-      "version": "1.0.5",
-      "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz",
-      "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==",
-      "inBundle": true,
-      "dependencies": {
-        "minipass": "^3.0.0"
-      },
-      "engines": {
-        "node": ">= 8"
-      }
-    },
-    "node_modules/minipass-flush/node_modules/minipass": {
-      "version": "3.3.6",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
-      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
-      "inBundle": true,
-      "dependencies": {
-        "yallist": "^4.0.0"
-      },
-      "engines": {
-        "node": ">=8"
-      }
-    },
-    "node_modules/minipass-json-stream": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/minipass-json-stream/-/minipass-json-stream-1.0.1.tgz",
-      "integrity": "sha512-ODqY18UZt/I8k+b7rl2AENgbWE8IDYam+undIJONvigAz8KR5GWblsFTEfQs0WODsjbSXWlm+JHEv8Gr6Tfdbg==",
-      "inBundle": true,
-      "dependencies": {
-        "jsonparse": "^1.3.1",
-        "minipass": "^3.0.0"
-      }
-    },
-    "node_modules/minipass-json-stream/node_modules/minipass": {
-      "version": "3.3.6",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
-      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
-      "inBundle": true,
-      "dependencies": {
-        "yallist": "^4.0.0"
-      },
-      "engines": {
-        "node": ">=8"
-      }
-    },
-    "node_modules/minipass-pipeline": {
-      "version": "1.2.4",
-      "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz",
-      "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==",
-      "inBundle": true,
-      "dependencies": {
-        "minipass": "^3.0.0"
-      },
-      "engines": {
-        "node": ">=8"
-      }
-    },
-    "node_modules/minipass-pipeline/node_modules/minipass": {
-      "version": "3.3.6",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
-      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
-      "inBundle": true,
-      "dependencies": {
-        "yallist": "^4.0.0"
-      },
-      "engines": {
-        "node": ">=8"
-      }
-    },
-    "node_modules/minipass-sized": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz",
-      "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==",
-      "inBundle": true,
-      "dependencies": {
-        "minipass": "^3.0.0"
-      },
-      "engines": {
-        "node": ">=8"
-      }
-    },
-    "node_modules/minipass-sized/node_modules/minipass": {
-      "version": "3.3.6",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
-      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
-      "inBundle": true,
-      "dependencies": {
-        "yallist": "^4.0.0"
-      },
-      "engines": {
-        "node": ">=8"
-      }
-    },
-    "node_modules/minizlib": {
-      "version": "2.1.2",
-      "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
-      "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
-      "inBundle": true,
-      "dependencies": {
-        "minipass": "^3.0.0",
-        "yallist": "^4.0.0"
-      },
-      "engines": {
-        "node": ">= 8"
-      }
-    },
-    "node_modules/minizlib/node_modules/minipass": {
-      "version": "3.3.6",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
-      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
-      "inBundle": true,
-      "dependencies": {
-        "yallist": "^4.0.0"
-      },
-      "engines": {
-        "node": ">=8"
-      }
-    },
-    "node_modules/mkdirp": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
-      "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
-      "inBundle": true,
-      "bin": {
-        "mkdirp": "bin/cmd.js"
-      },
-      "engines": {
-        "node": ">=10"
-      }
-    },
-    "node_modules/modify-values": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz",
-      "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==",
-      "dev": true,
-      "engines": {
-        "node": ">=0.10.0"
-      }
-    },
-    "node_modules/months": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/months/-/months-2.1.0.tgz",
-      "integrity": "sha512-2M9gdDB/uVt304/hJ3k2UIquJhOV5dRjp9BovHmZSINaRp7pdJuHXxOcuSjmJaKNomFyYyu0y3LBigdWiAUEmQ==",
-      "dev": true,
-      "engines": {
-        "node": ">=0.10.0"
+        "node": ">=6"
       }
     },
-    "node_modules/moo": {
-      "version": "0.5.2",
-      "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz",
-      "integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==",
-      "dev": true
-    },
-    "node_modules/mri": {
-      "version": "1.2.0",
-      "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
-      "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
+    "node_modules/min-indent": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
+      "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
       "dev": true,
       "engines": {
         "node": ">=4"
       }
     },
-    "node_modules/ms": {
-      "version": "2.1.3",
-      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
-      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
-      "inBundle": true
+    "node_modules/minify-registry-metadata": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/minify-registry-metadata/-/minify-registry-metadata-3.0.0.tgz",
+      "integrity": "sha512-EvM09tT0saeVP2Tlu9WEUDUgTYi684LsBbC+nbU3XEENgnzz+aEskigZR+OYG8LJPat1FdSIKMkJLMojg0FIiQ==",
+      "dev": true,
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+      }
     },
-    "node_modules/mute-stream": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz",
-      "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==",
+    "node_modules/minimatch": {
+      "version": "9.0.3",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
+      "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
       "inBundle": true,
+      "dependencies": {
+        "brace-expansion": "^2.0.1"
+      },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">=16 || 14 >=14.17"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
       }
     },
-    "node_modules/natural-compare": {
-      "version": "1.4.0",
-      "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
-      "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
+    "node_modules/minimist": {
+      "version": "1.2.8",
+      "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
+      "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
       "dev": true,
-      "peer": true
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
     },
-    "node_modules/nearley": {
-      "version": "2.20.1",
-      "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz",
-      "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==",
+    "node_modules/minimist-options": {
+      "version": "4.1.0",
+      "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz",
+      "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==",
       "dev": true,
       "dependencies": {
-        "commander": "^2.19.0",
-        "moo": "^0.5.0",
-        "railroad-diagrams": "^1.0.0",
-        "randexp": "0.4.6"
-      },
-      "bin": {
-        "nearley-railroad": "bin/nearley-railroad.js",
-        "nearley-test": "bin/nearley-test.js",
-        "nearley-unparse": "bin/nearley-unparse.js",
-        "nearleyc": "bin/nearleyc.js"
+        "arrify": "^1.0.1",
+        "is-plain-obj": "^1.1.0",
+        "kind-of": "^6.0.3"
       },
-      "funding": {
-        "type": "individual",
-        "url": "https://nearley.js.org/#give-to-nearley"
+      "engines": {
+        "node": ">= 6"
       }
     },
-    "node_modules/negotiator": {
-      "version": "0.6.3",
-      "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
-      "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
+    "node_modules/minipass": {
+      "version": "7.0.4",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz",
+      "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==",
       "inBundle": true,
       "engines": {
-        "node": ">= 0.6"
+        "node": ">=16 || 14 >=14.17"
       }
     },
-    "node_modules/neo-async": {
-      "version": "2.6.2",
-      "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
-      "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
-      "dev": true
-    },
-    "node_modules/nock": {
-      "version": "13.3.3",
-      "resolved": "https://registry.npmjs.org/nock/-/nock-13.3.3.tgz",
-      "integrity": "sha512-z+KUlILy9SK/RjpeXDiDUEAq4T94ADPHE3qaRkf66mpEhzc/ytOMm3Bwdrbq6k1tMWkbdujiKim3G2tfQARuJw==",
-      "dev": true,
+    "node_modules/minipass-collect": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz",
+      "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==",
+      "inBundle": true,
       "dependencies": {
-        "debug": "^4.1.0",
-        "json-stringify-safe": "^5.0.1",
-        "lodash": "^4.17.21",
-        "propagate": "^2.0.0"
+        "minipass": "^3.0.0"
       },
       "engines": {
-        "node": ">= 10.13"
+        "node": ">= 8"
       }
     },
-    "node_modules/node-fetch": {
-      "version": "2.6.9",
-      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz",
-      "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==",
-      "dev": true,
+    "node_modules/minipass-collect/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+      "inBundle": true,
       "dependencies": {
-        "whatwg-url": "^5.0.0"
+        "yallist": "^4.0.0"
       },
       "engines": {
-        "node": "4.x || >=6.0.0"
+        "node": ">=8"
+      }
+    },
+    "node_modules/minipass-fetch": {
+      "version": "3.0.4",
+      "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.4.tgz",
+      "integrity": "sha512-jHAqnA728uUpIaFm7NWsCnqKT6UqZz7GcI/bDpPATuwYyKwJwW0remxSCxUlKiEty+eopHGa3oc8WxgQ1FFJqg==",
+      "inBundle": true,
+      "dependencies": {
+        "minipass": "^7.0.3",
+        "minipass-sized": "^1.0.3",
+        "minizlib": "^2.1.2"
       },
-      "peerDependencies": {
-        "encoding": "^0.1.0"
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       },
-      "peerDependenciesMeta": {
-        "encoding": {
-          "optional": true
-        }
+      "optionalDependencies": {
+        "encoding": "^0.1.13"
       }
     },
-    "node_modules/node-gyp": {
-      "version": "9.4.0",
-      "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.0.tgz",
-      "integrity": "sha512-dMXsYP6gc9rRbejLXmTbVRYjAHw7ppswsKyMxuxJxxOHzluIO1rGp9TOQgjFJ+2MCqcOcQTOPB/8Xwhr+7s4Eg==",
+    "node_modules/minipass-flush": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz",
+      "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==",
       "inBundle": true,
       "dependencies": {
-        "env-paths": "^2.2.0",
-        "exponential-backoff": "^3.1.1",
-        "glob": "^7.1.4",
-        "graceful-fs": "^4.2.6",
-        "make-fetch-happen": "^11.0.3",
-        "nopt": "^6.0.0",
-        "npmlog": "^6.0.0",
-        "rimraf": "^3.0.2",
-        "semver": "^7.3.5",
-        "tar": "^6.1.2",
-        "which": "^2.0.2"
-      },
-      "bin": {
-        "node-gyp": "bin/node-gyp.js"
+        "minipass": "^3.0.0"
       },
       "engines": {
-        "node": "^12.13 || ^14.13 || >=16"
+        "node": ">= 8"
       }
     },
-    "node_modules/node-gyp/node_modules/abbrev": {
-      "version": "1.1.1",
-      "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
-      "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
-      "inBundle": true
-    },
-    "node_modules/node-gyp/node_modules/are-we-there-yet": {
-      "version": "3.0.1",
-      "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz",
-      "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==",
+    "node_modules/minipass-flush/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
       "inBundle": true,
       "dependencies": {
-        "delegates": "^1.0.0",
-        "readable-stream": "^3.6.0"
+        "yallist": "^4.0.0"
       },
       "engines": {
-        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+        "node": ">=8"
       }
     },
-    "node_modules/node-gyp/node_modules/brace-expansion": {
-      "version": "1.1.11",
-      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
-      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+    "node_modules/minipass-json-stream": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/minipass-json-stream/-/minipass-json-stream-1.0.1.tgz",
+      "integrity": "sha512-ODqY18UZt/I8k+b7rl2AENgbWE8IDYam+undIJONvigAz8KR5GWblsFTEfQs0WODsjbSXWlm+JHEv8Gr6Tfdbg==",
       "inBundle": true,
       "dependencies": {
-        "balanced-match": "^1.0.0",
-        "concat-map": "0.0.1"
+        "jsonparse": "^1.3.1",
+        "minipass": "^3.0.0"
       }
     },
-    "node_modules/node-gyp/node_modules/cacache": {
-      "version": "17.1.4",
-      "resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.4.tgz",
-      "integrity": "sha512-/aJwG2l3ZMJ1xNAnqbMpA40of9dj/pIH3QfiuQSqjfPJF747VR0J/bHn+/KdNnHKc6XQcWt/AfRSBft82W1d2A==",
+    "node_modules/minipass-json-stream/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
       "inBundle": true,
       "dependencies": {
-        "@npmcli/fs": "^3.1.0",
-        "fs-minipass": "^3.0.0",
-        "glob": "^10.2.2",
-        "lru-cache": "^7.7.1",
-        "minipass": "^7.0.3",
-        "minipass-collect": "^1.0.2",
-        "minipass-flush": "^1.0.5",
-        "minipass-pipeline": "^1.2.4",
-        "p-map": "^4.0.0",
-        "ssri": "^10.0.0",
-        "tar": "^6.1.11",
-        "unique-filename": "^3.0.0"
+        "yallist": "^4.0.0"
       },
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">=8"
       }
     },
-    "node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
-      "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+    "node_modules/minipass-pipeline": {
+      "version": "1.2.4",
+      "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz",
+      "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==",
       "inBundle": true,
       "dependencies": {
-        "balanced-match": "^1.0.0"
+        "minipass": "^3.0.0"
+      },
+      "engines": {
+        "node": ">=8"
       }
     },
-    "node_modules/node-gyp/node_modules/cacache/node_modules/glob": {
-      "version": "10.3.3",
-      "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz",
-      "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==",
+    "node_modules/minipass-pipeline/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
       "inBundle": true,
       "dependencies": {
-        "foreground-child": "^3.1.0",
-        "jackspeak": "^2.0.3",
-        "minimatch": "^9.0.1",
-        "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0",
-        "path-scurry": "^1.10.1"
+        "yallist": "^4.0.0"
       },
-      "bin": {
-        "glob": "dist/cjs/src/bin.js"
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/minipass-sized": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz",
+      "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==",
+      "inBundle": true,
+      "dependencies": {
+        "minipass": "^3.0.0"
       },
       "engines": {
-        "node": ">=16 || 14 >=14.17"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
+        "node": ">=8"
       }
     },
-    "node_modules/node-gyp/node_modules/cacache/node_modules/minimatch": {
-      "version": "9.0.3",
-      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
-      "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
+    "node_modules/minipass-sized/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
       "inBundle": true,
       "dependencies": {
-        "brace-expansion": "^2.0.1"
+        "yallist": "^4.0.0"
       },
       "engines": {
-        "node": ">=16 || 14 >=14.17"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
+        "node": ">=8"
       }
     },
-    "node_modules/node-gyp/node_modules/cacache/node_modules/minipass": {
-      "version": "7.0.4",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz",
-      "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==",
+    "node_modules/minizlib": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
+      "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
       "inBundle": true,
+      "dependencies": {
+        "minipass": "^3.0.0",
+        "yallist": "^4.0.0"
+      },
       "engines": {
-        "node": ">=16 || 14 >=14.17"
+        "node": ">= 8"
       }
     },
-    "node_modules/node-gyp/node_modules/gauge": {
-      "version": "4.0.4",
-      "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz",
-      "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==",
+    "node_modules/minizlib/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
       "inBundle": true,
       "dependencies": {
-        "aproba": "^1.0.3 || ^2.0.0",
-        "color-support": "^1.1.3",
-        "console-control-strings": "^1.1.0",
-        "has-unicode": "^2.0.1",
-        "signal-exit": "^3.0.7",
-        "string-width": "^4.2.3",
-        "strip-ansi": "^6.0.1",
-        "wide-align": "^1.1.5"
+        "yallist": "^4.0.0"
       },
       "engines": {
-        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+        "node": ">=8"
       }
     },
-    "node_modules/node-gyp/node_modules/glob": {
-      "version": "7.2.3",
-      "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
-      "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
+    "node_modules/mkdirp": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+      "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
       "inBundle": true,
-      "dependencies": {
-        "fs.realpath": "^1.0.0",
-        "inflight": "^1.0.4",
-        "inherits": "2",
-        "minimatch": "^3.1.1",
-        "once": "^1.3.0",
-        "path-is-absolute": "^1.0.0"
+      "bin": {
+        "mkdirp": "bin/cmd.js"
       },
       "engines": {
-        "node": "*"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/isaacs"
+        "node": ">=10"
       }
     },
-    "node_modules/node-gyp/node_modules/lru-cache": {
-      "version": "7.18.3",
-      "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
-      "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
-      "inBundle": true,
+    "node_modules/modify-values": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz",
+      "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==",
+      "dev": true,
       "engines": {
-        "node": ">=12"
+        "node": ">=0.10.0"
       }
     },
-    "node_modules/node-gyp/node_modules/make-fetch-happen": {
-      "version": "11.1.1",
-      "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz",
-      "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==",
-      "inBundle": true,
-      "dependencies": {
-        "agentkeepalive": "^4.2.1",
-        "cacache": "^17.0.0",
-        "http-cache-semantics": "^4.1.1",
-        "http-proxy-agent": "^5.0.0",
-        "https-proxy-agent": "^5.0.0",
-        "is-lambda": "^1.0.1",
-        "lru-cache": "^7.7.1",
-        "minipass": "^5.0.0",
-        "minipass-fetch": "^3.0.0",
-        "minipass-flush": "^1.0.5",
-        "minipass-pipeline": "^1.2.4",
-        "negotiator": "^0.6.3",
-        "promise-retry": "^2.0.1",
-        "socks-proxy-agent": "^7.0.0",
-        "ssri": "^10.0.0"
-      },
+    "node_modules/months": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/months/-/months-2.1.0.tgz",
+      "integrity": "sha512-2M9gdDB/uVt304/hJ3k2UIquJhOV5dRjp9BovHmZSINaRp7pdJuHXxOcuSjmJaKNomFyYyu0y3LBigdWiAUEmQ==",
+      "dev": true,
       "engines": {
-        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+        "node": ">=0.10.0"
       }
     },
-    "node_modules/node-gyp/node_modules/minimatch": {
-      "version": "3.1.2",
-      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
-      "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
-      "inBundle": true,
-      "dependencies": {
-        "brace-expansion": "^1.1.7"
-      },
+    "node_modules/moo": {
+      "version": "0.5.2",
+      "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz",
+      "integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==",
+      "dev": true
+    },
+    "node_modules/mri": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
+      "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
+      "dev": true,
       "engines": {
-        "node": "*"
+        "node": ">=4"
       }
     },
-    "node_modules/node-gyp/node_modules/minipass": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
-      "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
+    "node_modules/ms": {
+      "version": "2.1.3",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+      "inBundle": true
+    },
+    "node_modules/mute-stream": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz",
+      "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==",
       "inBundle": true,
       "engines": {
-        "node": ">=8"
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
       }
     },
-    "node_modules/node-gyp/node_modules/nopt": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz",
-      "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==",
-      "inBundle": true,
+    "node_modules/natural-compare": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+      "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
+      "dev": true,
+      "peer": true
+    },
+    "node_modules/nearley": {
+      "version": "2.20.1",
+      "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz",
+      "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==",
+      "dev": true,
       "dependencies": {
-        "abbrev": "^1.0.0"
+        "commander": "^2.19.0",
+        "moo": "^0.5.0",
+        "railroad-diagrams": "^1.0.0",
+        "randexp": "0.4.6"
       },
       "bin": {
-        "nopt": "bin/nopt.js"
+        "nearley-railroad": "bin/nearley-railroad.js",
+        "nearley-test": "bin/nearley-test.js",
+        "nearley-unparse": "bin/nearley-unparse.js",
+        "nearleyc": "bin/nearleyc.js"
       },
-      "engines": {
-        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+      "funding": {
+        "type": "individual",
+        "url": "https://nearley.js.org/#give-to-nearley"
       }
     },
-    "node_modules/node-gyp/node_modules/npmlog": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz",
-      "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==",
+    "node_modules/negotiator": {
+      "version": "0.6.3",
+      "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
+      "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
       "inBundle": true,
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/neo-async": {
+      "version": "2.6.2",
+      "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
+      "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
+      "dev": true
+    },
+    "node_modules/nock": {
+      "version": "13.3.3",
+      "resolved": "https://registry.npmjs.org/nock/-/nock-13.3.3.tgz",
+      "integrity": "sha512-z+KUlILy9SK/RjpeXDiDUEAq4T94ADPHE3qaRkf66mpEhzc/ytOMm3Bwdrbq6k1tMWkbdujiKim3G2tfQARuJw==",
+      "dev": true,
       "dependencies": {
-        "are-we-there-yet": "^3.0.0",
-        "console-control-strings": "^1.1.0",
-        "gauge": "^4.0.3",
-        "set-blocking": "^2.0.0"
+        "debug": "^4.1.0",
+        "json-stringify-safe": "^5.0.1",
+        "lodash": "^4.17.21",
+        "propagate": "^2.0.0"
       },
       "engines": {
-        "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+        "node": ">= 10.13"
       }
     },
-    "node_modules/node-gyp/node_modules/readable-stream": {
-      "version": "3.6.2",
-      "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
-      "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
-      "inBundle": true,
+    "node_modules/node-fetch": {
+      "version": "2.6.9",
+      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz",
+      "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==",
+      "dev": true,
       "dependencies": {
-        "inherits": "^2.0.3",
-        "string_decoder": "^1.1.1",
-        "util-deprecate": "^1.0.1"
+        "whatwg-url": "^5.0.0"
       },
       "engines": {
-        "node": ">= 6"
+        "node": "4.x || >=6.0.0"
+      },
+      "peerDependencies": {
+        "encoding": "^0.1.0"
+      },
+      "peerDependenciesMeta": {
+        "encoding": {
+          "optional": true
+        }
       }
     },
-    "node_modules/node-gyp/node_modules/signal-exit": {
-      "version": "3.0.7",
-      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
-      "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
-      "inBundle": true
-    },
-    "node_modules/node-gyp/node_modules/which": {
-      "version": "2.0.2",
-      "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
-      "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+    "node_modules/node-gyp": {
+      "version": "10.0.0",
+      "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-10.0.0.tgz",
+      "integrity": "sha512-LkaKUbjyacJGRHiuhUeUblzZNxTF1/XNooyAl6aiaJ6ZpeurR4Mk9sjxncGNSI7pETqyqM+hLAER0788oSxt0A==",
       "inBundle": true,
       "dependencies": {
-        "isexe": "^2.0.0"
+        "env-paths": "^2.2.0",
+        "exponential-backoff": "^3.1.1",
+        "glob": "^10.3.10",
+        "graceful-fs": "^4.2.6",
+        "make-fetch-happen": "^13.0.0",
+        "nopt": "^7.0.0",
+        "proc-log": "^3.0.0",
+        "semver": "^7.3.5",
+        "tar": "^6.1.2",
+        "which": "^4.0.0"
       },
       "bin": {
-        "node-which": "bin/node-which"
+        "node-gyp": "bin/node-gyp.js"
       },
       "engines": {
-        "node": ">= 8"
+        "node": "^16.14.0 || >=18.0.0"
       }
     },
     "node_modules/node-html-parser": {
diff --git a/package.json b/package.json
index 4affae1428e3f..8dfb1de9f3fd8 100644
--- a/package.json
+++ b/package.json
@@ -93,7 +93,7 @@
     "minipass": "^7.0.4",
     "minipass-pipeline": "^1.2.4",
     "ms": "^2.1.2",
-    "node-gyp": "^9.4.0",
+    "node-gyp": "^10.0.0",
     "nopt": "^7.2.0",
     "normalize-package-data": "^6.0.0",
     "npm-audit-report": "^5.0.0",

From 2ec39440f2cb49139f2899b27c3ae6c172f99497 Mon Sep 17 00:00:00 2001
From: Luke Karrys 
Date: Sat, 28 Oct 2023 17:33:31 -0700
Subject: [PATCH 2/2] deps: @npmcli/run-script@7.0.2

---
 DEPENDENCIES.md                               |   37 +-
 node_modules/.gitignore                       |   60 -
 node_modules/@gar/promisify/LICENSE.md        |   10 -
 node_modules/@gar/promisify/index.js          |   36 -
 node_modules/@gar/promisify/package.json      |   32 -
 node_modules/@npmcli/move-file/LICENSE.md     |   22 -
 node_modules/@npmcli/move-file/lib/index.js   |  185 -
 node_modules/@npmcli/move-file/package.json   |   47 -
 .../node_modules/@npmcli/fs/LICENSE.md        |   20 -
 .../@npmcli/fs/lib/common/get-options.js      |   20 -
 .../@npmcli/fs/lib/common/node.js             |    9 -
 .../@npmcli/fs/lib/common/owner-sync.js       |   96 -
 .../@npmcli/fs/lib/common/owner.js            |   96 -
 .../node_modules/@npmcli/fs/lib/copy-file.js  |   16 -
 .../node_modules/@npmcli/fs/lib/cp/LICENSE    |   15 -
 .../node_modules/@npmcli/fs/lib/cp/index.js   |   22 -
 .../@npmcli/fs/lib/cp/polyfill.js             |  428 --
 .../node_modules/@npmcli/fs/lib/errors.js     |  129 -
 .../node_modules/@npmcli/fs/lib/fs.js         |   14 -
 .../node_modules/@npmcli/fs/lib/index.js      |   12 -
 .../node_modules/@npmcli/fs/lib/mkdir.js      |   19 -
 .../node_modules/@npmcli/fs/lib/mkdtemp.js    |   23 -
 .../node_modules/@npmcli/fs/lib/rm/index.js   |   22 -
 .../@npmcli/fs/lib/rm/polyfill.js             |  239 -
 .../@npmcli/fs/lib/with-owner-sync.js         |   21 -
 .../node_modules/@npmcli/fs/lib/with-owner.js |   21 -
 .../@npmcli/fs/lib/with-temp-dir.js           |   41 -
 .../node_modules/@npmcli/fs/lib/write-file.js |   14 -
 .../node_modules/@npmcli/fs/package.json      |   50 -
 .../run-script/node_modules/abbrev/LICENSE    |   46 -
 .../run-script/node_modules/abbrev/abbrev.js  |   61 -
 .../node_modules/abbrev/package.json          |   21 -
 .../node_modules/are-we-there-yet/LICENSE.md  |   18 -
 .../are-we-there-yet/lib/index.js             |    4 -
 .../are-we-there-yet/lib/tracker-base.js      |   11 -
 .../are-we-there-yet/lib/tracker-group.js     |  116 -
 .../are-we-there-yet/lib/tracker-stream.js    |   36 -
 .../are-we-there-yet/lib/tracker.js           |   32 -
 .../are-we-there-yet/package.json             |   56 -
 .../node_modules/brace-expansion/LICENSE      |   21 -
 .../node_modules/brace-expansion/index.js     |  201 -
 .../node_modules/brace-expansion/package.json |   47 -
 .../node_modules/cacache/LICENSE.md           |   16 -
 .../node_modules/cacache/lib/content/path.js  |   29 -
 .../node_modules/cacache/lib/content/read.js  |  241 -
 .../node_modules/cacache/lib/content/rm.js    |   20 -
 .../node_modules/cacache/lib/content/write.js |  189 -
 .../node_modules/cacache/lib/entry-index.js   |  404 --
 .../node_modules/cacache/lib/get.js           |  225 -
 .../node_modules/cacache/lib/index.js         |   45 -
 .../node_modules/cacache/lib/memoization.js   |   72 -
 .../node_modules/cacache/lib/put.js           |   80 -
 .../run-script/node_modules/cacache/lib/rm.js |   31 -
 .../cacache/lib/util/fix-owner.js             |  145 -
 .../cacache/lib/util/hash-to-segments.js      |    7 -
 .../cacache/lib/util/move-file.js             |   56 -
 .../node_modules/cacache/lib/util/tmp.js      |   33 -
 .../node_modules/cacache/lib/verify.js        |  257 --
 .../node_modules/brace-expansion/LICENSE      |   21 -
 .../node_modules/brace-expansion/index.js     |  203 -
 .../node_modules/brace-expansion/package.json |   46 -
 .../cacache/node_modules/glob/LICENSE         |   15 -
 .../cacache/node_modules/glob/common.js       |  244 -
 .../cacache/node_modules/glob/glob.js         |  790 ----
 .../cacache/node_modules/glob/package.json    |   55 -
 .../cacache/node_modules/glob/sync.js         |  486 --
 .../cacache/node_modules/minimatch/LICENSE    |   15 -
 .../node_modules/minimatch/lib/path.js        |    4 -
 .../node_modules/minimatch/minimatch.js       |  944 ----
 .../node_modules/minimatch/package.json       |   35 -
 .../node_modules/cacache/package.json         |   84 -
 .../node_modules/fs-minipass/LICENSE          |   15 -
 .../node_modules/fs-minipass/index.js         |  422 --
 .../node_modules/fs-minipass/package.json     |   39 -
 .../run-script/node_modules/gauge/LICENSE.md  |   20 -
 .../node_modules/gauge/lib/base-theme.js      |   18 -
 .../node_modules/gauge/lib/error.js           |   24 -
 .../node_modules/gauge/lib/has-color.js       |    4 -
 .../node_modules/gauge/lib/index.js           |  289 --
 .../node_modules/gauge/lib/plumbing.js        |   50 -
 .../node_modules/gauge/lib/process.js         |    3 -
 .../node_modules/gauge/lib/progress-bar.js    |   41 -
 .../node_modules/gauge/lib/render-template.js |  222 -
 .../node_modules/gauge/lib/set-immediate.js   |    7 -
 .../node_modules/gauge/lib/set-interval.js    |    3 -
 .../run-script/node_modules/gauge/lib/spin.js |    5 -
 .../node_modules/gauge/lib/template-item.js   |   87 -
 .../node_modules/gauge/lib/theme-set.js       |  122 -
 .../node_modules/gauge/lib/themes.js          |   56 -
 .../node_modules/gauge/lib/wide-truncate.js   |   31 -
 .../node_modules/gauge/package.json           |   66 -
 .../run-script/node_modules/glob/LICENSE      |   21 -
 .../run-script/node_modules/glob/common.js    |  238 -
 .../run-script/node_modules/glob/glob.js      |  790 ----
 .../run-script/node_modules/glob/package.json |   55 -
 .../run-script/node_modules/glob/sync.js      |  486 --
 .../run-script/node_modules/lru-cache/LICENSE |   15 -
 .../node_modules/lru-cache/index.js           | 1227 -----
 .../node_modules/lru-cache/index.mjs          | 1227 -----
 .../node_modules/lru-cache/package.json       |   96 -
 .../node_modules/make-fetch-happen/LICENSE    |   16 -
 .../make-fetch-happen/lib/agent.js            |  214 -
 .../make-fetch-happen/lib/cache/entry.js      |  444 --
 .../make-fetch-happen/lib/cache/errors.js     |   11 -
 .../make-fetch-happen/lib/cache/index.js      |   49 -
 .../make-fetch-happen/lib/cache/key.js        |   17 -
 .../make-fetch-happen/lib/cache/policy.js     |  161 -
 .../node_modules/make-fetch-happen/lib/dns.js |   49 -
 .../make-fetch-happen/lib/fetch.js            |  118 -
 .../make-fetch-happen/lib/index.js            |   41 -
 .../make-fetch-happen/lib/options.js          |   52 -
 .../make-fetch-happen/lib/pipeline.js         |   41 -
 .../make-fetch-happen/lib/remote.js           |  121 -
 .../make-fetch-happen/package.json            |   79 -
 .../run-script/node_modules/minimatch/LICENSE |   15 -
 .../node_modules/minimatch/minimatch.js       |  947 ----
 .../node_modules/minimatch/package.json       |   33 -
 .../node_modules/minipass-fetch/LICENSE       |   28 -
 .../minipass-fetch/lib/abort-error.js         |   17 -
 .../node_modules/minipass-fetch/lib/blob.js   |   97 -
 .../node_modules/minipass-fetch/lib/body.js   |  350 --
 .../minipass-fetch/lib/fetch-error.js         |   32 -
 .../minipass-fetch/lib/headers.js             |  267 --
 .../node_modules/minipass-fetch/lib/index.js  |  365 --
 .../minipass-fetch/lib/request.js             |  281 --
 .../minipass-fetch/lib/response.js            |   90 -
 .../node_modules/minipass-fetch/package.json  |   67 -
 .../run-script/node_modules/minipass/LICENSE  |   15 -
 .../run-script/node_modules/minipass/index.js |  649 ---
 .../node_modules/minipass/package.json        |   56 -
 .../node_modules/node-gyp/CONTRIBUTING.md     |   34 -
 .../run-script/node_modules/node-gyp/LICENSE  |   24 -
 .../node_modules/node-gyp/SECURITY.md         |    2 -
 .../node_modules/node-gyp/addon.gypi          |  204 -
 .../node_modules/node-gyp/bin/node-gyp.js     |  140 -
 ...re-versions-of-node-cannot-be-installed.md |   94 -
 .../docs/Force-npm-to-use-global-node-gyp.md  |   47 -
 .../node_modules/node-gyp/docs/Home.md        |    7 -
 .../node-gyp/docs/Linking-to-OpenSSL.md       |   86 -
 .../docs/Updating-npm-bundled-node-gyp.md     |   72 -
 .../docs/binding.gyp-files-in-the-wild.md     |   49 -
 .../node_modules/node-gyp/gyp/.flake8         |    4 -
 .../node_modules/node-gyp/gyp/AUTHORS         |   16 -
 .../node-gyp/gyp/CODE_OF_CONDUCT.md           |    4 -
 .../node_modules/node-gyp/gyp/CONTRIBUTING.md |   32 -
 .../node_modules/node-gyp/gyp/LICENSE         |   28 -
 .../node-gyp/gyp/data/win/large-pdb-shim.cc   |   12 -
 .../run-script/node_modules/node-gyp/gyp/gyp  |    8 -
 .../node_modules/node-gyp/gyp/gyp.bat         |    5 -
 .../node_modules/node-gyp/gyp/gyp_main.py     |   45 -
 .../node-gyp/gyp/pylib/gyp/MSVSNew.py         |  367 --
 .../node-gyp/gyp/pylib/gyp/MSVSProject.py     |  206 -
 .../node-gyp/gyp/pylib/gyp/MSVSSettings.py    | 1270 ------
 .../gyp/pylib/gyp/MSVSSettings_test.py        | 1547 -------
 .../node-gyp/gyp/pylib/gyp/MSVSToolFile.py    |   59 -
 .../node-gyp/gyp/pylib/gyp/MSVSUserFile.py    |  153 -
 .../node-gyp/gyp/pylib/gyp/MSVSUtil.py        |  271 --
 .../node-gyp/gyp/pylib/gyp/MSVSVersion.py     |  574 ---
 .../node-gyp/gyp/pylib/gyp/__init__.py        |  690 ---
 .../node-gyp/gyp/pylib/gyp/common.py          |  661 ---
 .../node-gyp/gyp/pylib/gyp/common_test.py     |   78 -
 .../node-gyp/gyp/pylib/gyp/easy_xml.py        |  165 -
 .../node-gyp/gyp/pylib/gyp/easy_xml_test.py   |  109 -
 .../node-gyp/gyp/pylib/gyp/flock_tool.py      |   55 -
 .../gyp/pylib/gyp/generator/__init__.py       |    0
 .../gyp/pylib/gyp/generator/analyzer.py       |  808 ----
 .../gyp/pylib/gyp/generator/android.py        | 1173 -----
 .../node-gyp/gyp/pylib/gyp/generator/cmake.py | 1321 ------
 .../gyp/generator/compile_commands_json.py    |  120 -
 .../gyp/generator/dump_dependency_json.py     |  103 -
 .../gyp/pylib/gyp/generator/eclipse.py        |  464 --
 .../node-gyp/gyp/pylib/gyp/generator/gypd.py  |   89 -
 .../node-gyp/gyp/pylib/gyp/generator/gypsh.py |   58 -
 .../node-gyp/gyp/pylib/gyp/generator/make.py  | 2714 -----------
 .../node-gyp/gyp/pylib/gyp/generator/msvs.py  | 3981 -----------------
 .../gyp/pylib/gyp/generator/msvs_test.py      |   44 -
 .../node-gyp/gyp/pylib/gyp/generator/ninja.py | 2936 ------------
 .../gyp/pylib/gyp/generator/ninja_test.py     |   55 -
 .../node-gyp/gyp/pylib/gyp/generator/xcode.py | 1394 ------
 .../gyp/pylib/gyp/generator/xcode_test.py     |   25 -
 .../node-gyp/gyp/pylib/gyp/input.py           | 3130 -------------
 .../node-gyp/gyp/pylib/gyp/input_test.py      |   98 -
 .../node-gyp/gyp/pylib/gyp/mac_tool.py        |  771 ----
 .../node-gyp/gyp/pylib/gyp/msvs_emulation.py  | 1271 ------
 .../node-gyp/gyp/pylib/gyp/ninja_syntax.py    |  174 -
 .../node-gyp/gyp/pylib/gyp/simple_copy.py     |   61 -
 .../node-gyp/gyp/pylib/gyp/win_tool.py        |  374 --
 .../node-gyp/gyp/pylib/gyp/xcode_emulation.py | 1939 --------
 .../node-gyp/gyp/pylib/gyp/xcode_ninja.py     |  302 --
 .../node-gyp/gyp/pylib/gyp/xcodeproj_file.py  | 3197 -------------
 .../node-gyp/gyp/pylib/gyp/xml_fix.py         |   65 -
 .../node_modules/node-gyp/gyp/pyproject.toml  |   41 -
 .../node_modules/node-gyp/gyp/test_gyp.py     |  261 --
 .../tools/Xcode/Specifications/gyp.pbfilespec |   27 -
 .../tools/Xcode/Specifications/gyp.xclangspec |  226 -
 .../node-gyp/gyp/tools/emacs/gyp-tests.el     |   63 -
 .../node-gyp/gyp/tools/emacs/gyp.el           |  275 --
 .../gyp/tools/emacs/run-unit-tests.sh         |    7 -
 .../gyp/tools/emacs/testdata/media.gyp        | 1105 -----
 .../tools/emacs/testdata/media.gyp.fontified  | 1107 -----
 .../node-gyp/gyp/tools/graphviz.py            |  102 -
 .../node-gyp/gyp/tools/pretty_gyp.py          |  156 -
 .../node-gyp/gyp/tools/pretty_sln.py          |  181 -
 .../node-gyp/gyp/tools/pretty_vcproj.py       |  339 --
 .../node-gyp/lib/Find-VisualStudio.cs         |  250 --
 .../node_modules/node-gyp/lib/build.js        |  213 -
 .../node_modules/node-gyp/lib/clean.js        |   15 -
 .../node_modules/node-gyp/lib/configure.js    |  360 --
 .../node-gyp/lib/create-config-gypi.js        |  147 -
 .../node-gyp/lib/find-node-directory.js       |   63 -
 .../node_modules/node-gyp/lib/find-python.js  |  344 --
 .../node-gyp/lib/find-visualstudio.js         |  463 --
 .../node_modules/node-gyp/lib/install.js      |  458 --
 .../node_modules/node-gyp/lib/list.js         |   27 -
 .../node_modules/node-gyp/lib/node-gyp.js     |  215 -
 .../node-gyp/lib/process-release.js           |  147 -
 .../node_modules/node-gyp/lib/rebuild.js      |   13 -
 .../node_modules/node-gyp/lib/remove.js       |   46 -
 .../node_modules/node-gyp/lib/util.js         |   64 -
 .../node_modules/node-gyp/macOS_Catalina.md   |  104 -
 .../node-gyp/macOS_Catalina_acid_test.sh      |   21 -
 .../node-gyp/node_modules/which/LICENSE       |   15 -
 .../node_modules/which/bin/node-which         |   52 -
 .../node-gyp/node_modules/which/package.json  |   43 -
 .../node-gyp/node_modules/which/which.js      |  125 -
 .../node_modules/node-gyp/package.json        |   51 -
 .../node-gyp/src/win_delay_load_hook.cc       |   39 -
 .../node_modules/node-gyp/test/common.js      |    3 -
 .../fixtures/VS_2017_BuildTools_minimal.txt   |    1 -
 .../fixtures/VS_2017_Community_workload.txt   |    1 -
 .../test/fixtures/VS_2017_Express.txt         |    1 -
 .../test/fixtures/VS_2017_Unusable.txt        |    1 -
 .../fixtures/VS_2019_BuildTools_minimal.txt   |    1 -
 .../fixtures/VS_2019_Community_workload.txt   |    1 -
 .../test/fixtures/VS_2019_Preview.txt         |    1 -
 .../fixtures/VS_2022_Community_workload.txt   |  569 ---
 .../node-gyp/test/fixtures/certs.js           |  151 -
 .../fixtures/nodedir/include/node/config.gypi |    6 -
 .../node-gyp/test/fixtures/test-charmap.py    |   31 -
 .../node-gyp/test/process-exec-sync.js        |  140 -
 .../node_modules/node-gyp/test/reporter.js    |   75 -
 .../node-gyp/test/simple-proxy.js             |   27 -
 .../node_modules/node-gyp/test/test-addon.js  |  152 -
 .../node-gyp/test/test-configure-python.js    |   81 -
 .../node-gyp/test/test-create-config-gypi.js  |   61 -
 .../node-gyp/test/test-download.js            |  210 -
 .../test/test-find-accessible-sync.js         |   73 -
 .../node-gyp/test/test-find-node-directory.js |  115 -
 .../node-gyp/test/test-find-python.js         |  213 -
 .../node-gyp/test/test-find-visualstudio.js   |  670 ---
 .../node-gyp/test/test-install.js             |  139 -
 .../node-gyp/test/test-options.js             |   41 -
 .../node-gyp/test/test-process-release.js     |  401 --
 .../node_modules/node-gyp/update-gyp.py       |   64 -
 .../run-script/node_modules/nopt/LICENSE      |   15 -
 .../run-script/node_modules/nopt/bin/nopt.js  |   56 -
 .../run-script/node_modules/nopt/lib/nopt.js  |  515 ---
 .../run-script/node_modules/nopt/package.json |   53 -
 .../run-script/node_modules/npmlog/LICENSE.md |   20 -
 .../run-script/node_modules/npmlog/lib/log.js |  404 --
 .../node_modules/npmlog/package.json          |   51 -
 .../readable-stream/CONTRIBUTING.md           |   38 -
 .../readable-stream/GOVERNANCE.md             |  136 -
 .../node_modules/readable-stream/LICENSE      |   47 -
 .../readable-stream/errors-browser.js         |  127 -
 .../node_modules/readable-stream/errors.js    |  116 -
 .../readable-stream/experimentalWarning.js    |   17 -
 .../readable-stream/lib/_stream_duplex.js     |  126 -
 .../lib/_stream_passthrough.js                |   37 -
 .../readable-stream/lib/_stream_readable.js   | 1027 -----
 .../readable-stream/lib/_stream_transform.js  |  190 -
 .../readable-stream/lib/_stream_writable.js   |  641 ---
 .../lib/internal/streams/async_iterator.js    |  180 -
 .../lib/internal/streams/buffer_list.js       |  183 -
 .../lib/internal/streams/destroy.js           |   96 -
 .../lib/internal/streams/end-of-stream.js     |   86 -
 .../lib/internal/streams/from-browser.js      |    3 -
 .../lib/internal/streams/from.js              |   52 -
 .../lib/internal/streams/pipeline.js          |   86 -
 .../lib/internal/streams/state.js             |   22 -
 .../lib/internal/streams/stream-browser.js    |    1 -
 .../lib/internal/streams/stream.js            |    1 -
 .../node_modules/readable-stream/package.json |   68 -
 .../readable-stream/readable-browser.js       |    9 -
 .../node_modules/readable-stream/readable.js  |   16 -
 .../node_modules/signal-exit/LICENSE.txt      |   16 -
 .../node_modules/signal-exit/index.js         |  202 -
 .../node_modules/signal-exit/package.json     |   38 -
 .../node_modules/signal-exit/signals.js       |   53 -
 .../run-script/node_modules/ssri/LICENSE.md   |   16 -
 .../run-script/node_modules/ssri/lib/index.js |  524 ---
 .../run-script/node_modules/ssri/package.json |   63 -
 .../node_modules/unique-filename/LICENSE      |    5 -
 .../node_modules/unique-filename/lib/index.js |    7 -
 .../node_modules/unique-filename/package.json |   48 -
 .../node_modules/unique-slug/LICENSE          |   15 -
 .../node_modules/unique-slug/lib/index.js     |   11 -
 .../node_modules/unique-slug/package.json     |   44 -
 node_modules/@npmcli/run-script/package.json  |   14 +-
 node_modules/@tootallnate/once/LICENSE        |   21 -
 node_modules/@tootallnate/once/dist/index.js  |   24 -
 .../once/dist/overloaded-parameters.js        |    3 -
 node_modules/@tootallnate/once/dist/types.js  |    3 -
 node_modules/@tootallnate/once/package.json   |   52 -
 node_modules/agent-base/dist/src/index.js     |  203 -
 node_modules/agent-base/dist/src/promisify.js |   18 -
 node_modules/agent-base/package.json          |   64 -
 node_modules/agentkeepalive/History.md        |  268 --
 node_modules/agentkeepalive/LICENSE           |   23 -
 node_modules/agentkeepalive/browser.js        |    5 -
 node_modules/agentkeepalive/index.js          |    5 -
 node_modules/agentkeepalive/lib/agent.js      |  402 --
 node_modules/agentkeepalive/lib/constants.js  |   14 -
 .../agentkeepalive/lib/https_agent.js         |   51 -
 node_modules/agentkeepalive/package.json      |   56 -
 node_modules/concat-map/LICENSE               |   18 -
 node_modules/concat-map/example/map.js        |    6 -
 node_modules/concat-map/index.js              |   13 -
 node_modules/concat-map/package.json          |   43 -
 node_modules/concat-map/test/map.js           |   39 -
 node_modules/fs.realpath/LICENSE              |   43 -
 node_modules/fs.realpath/index.js             |   66 -
 node_modules/fs.realpath/old.js               |  303 --
 node_modules/fs.realpath/package.json         |   26 -
 node_modules/http-proxy-agent/dist/agent.js   |  145 -
 node_modules/http-proxy-agent/dist/index.js   |   14 -
 node_modules/http-proxy-agent/package.json    |   57 -
 node_modules/https-proxy-agent/dist/agent.js  |  177 -
 node_modules/https-proxy-agent/dist/index.js  |   14 -
 .../dist/parse-proxy-response.js              |   66 -
 node_modules/https-proxy-agent/package.json   |   56 -
 node_modules/humanize-ms/History.md           |   25 -
 node_modules/humanize-ms/LICENSE              |   17 -
 node_modules/humanize-ms/index.js             |   24 -
 node_modules/humanize-ms/package.json         |   37 -
 node_modules/infer-owner/LICENSE              |   15 -
 node_modules/infer-owner/index.js             |   71 -
 node_modules/infer-owner/package.json         |   26 -
 node_modules/inflight/LICENSE                 |   15 -
 node_modules/inflight/inflight.js             |   54 -
 node_modules/inflight/package.json            |   29 -
 node_modules/inherits/LICENSE                 |   16 -
 node_modules/inherits/inherits.js             |    9 -
 node_modules/inherits/inherits_browser.js     |   27 -
 node_modules/inherits/package.json            |   29 -
 node_modules/once/LICENSE                     |   15 -
 node_modules/once/once.js                     |   42 -
 node_modules/once/package.json                |   33 -
 node_modules/path-is-absolute/index.js        |   20 -
 node_modules/path-is-absolute/license         |   21 -
 node_modules/path-is-absolute/package.json    |   43 -
 node_modules/rimraf/LICENSE                   |   15 -
 node_modules/rimraf/bin.js                    |   68 -
 .../node_modules/brace-expansion/LICENSE      |   21 -
 .../node_modules/brace-expansion/index.js     |  201 -
 .../node_modules/brace-expansion/package.json |   47 -
 node_modules/rimraf/node_modules/glob/LICENSE |   21 -
 .../rimraf/node_modules/glob/common.js        |  238 -
 node_modules/rimraf/node_modules/glob/glob.js |  790 ----
 .../rimraf/node_modules/glob/package.json     |   55 -
 node_modules/rimraf/node_modules/glob/sync.js |  486 --
 .../rimraf/node_modules/minimatch/LICENSE     |   15 -
 .../node_modules/minimatch/minimatch.js       |  947 ----
 .../node_modules/minimatch/package.json       |   33 -
 node_modules/rimraf/package.json              |   32 -
 node_modules/rimraf/rimraf.js                 |  360 --
 node_modules/socks-proxy-agent/dist/index.js  |  197 -
 node_modules/socks-proxy-agent/package.json   |  181 -
 node_modules/wrappy/LICENSE                   |   15 -
 node_modules/wrappy/package.json              |   29 -
 node_modules/wrappy/wrappy.js                 |   33 -
 package-lock.json                             |  428 +-
 package.json                                  |    2 +-
 workspaces/arborist/package.json              |    2 +-
 workspaces/libnpmexec/package.json            |    2 +-
 workspaces/libnpmpack/package.json            |    2 +-
 workspaces/libnpmversion/package.json         |    2 +-
 377 files changed, 47 insertions(+), 74314 deletions(-)
 delete mode 100644 node_modules/@gar/promisify/LICENSE.md
 delete mode 100644 node_modules/@gar/promisify/index.js
 delete mode 100644 node_modules/@gar/promisify/package.json
 delete mode 100644 node_modules/@npmcli/move-file/LICENSE.md
 delete mode 100644 node_modules/@npmcli/move-file/lib/index.js
 delete mode 100644 node_modules/@npmcli/move-file/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/LICENSE.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/get-options.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/node.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner-sync.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/copy-file.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/polyfill.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/errors.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/fs.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdir.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdtemp.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/polyfill.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner-sync.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-temp-dir.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/write-file.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/@npmcli/fs/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/abbrev/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/abbrev/abbrev.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/abbrev/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/are-we-there-yet/LICENSE.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-base.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-group.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-stream.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/are-we-there-yet/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/brace-expansion/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/brace-expansion/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/brace-expansion/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/LICENSE.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/content/path.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/content/read.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/content/rm.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/content/write.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/entry-index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/get.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/memoization.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/put.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/rm.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/util/fix-owner.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/util/hash-to-segments.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/util/move-file.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/util/tmp.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/lib/verify.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/common.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/glob.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/sync.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/lib/path.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/minimatch.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/cacache/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/fs-minipass/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/fs-minipass/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/fs-minipass/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/LICENSE.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/base-theme.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/error.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/has-color.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/plumbing.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/process.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/progress-bar.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/render-template.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/set-immediate.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/set-interval.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/spin.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/template-item.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/theme-set.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/themes.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/lib/wide-truncate.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/gauge/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/glob/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/glob/common.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/glob/glob.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/glob/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/glob/sync.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/lru-cache/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/lru-cache/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/lru-cache/index.mjs
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/lru-cache/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/agent.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/entry.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/errors.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/key.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/policy.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/dns.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/fetch.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/options.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/pipeline.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/remote.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/make-fetch-happen/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minimatch/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minimatch/minimatch.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minimatch/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/abort-error.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/blob.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/body.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/fetch-error.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/headers.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/request.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/response.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass-fetch/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/minipass/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/CONTRIBUTING.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/SECURITY.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/bin/node-gyp.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Error-pre-versions-of-node-cannot-be-installed.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Force-npm-to-use-global-node-gyp.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Home.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Linking-to-OpenSSL.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Updating-npm-bundled-node-gyp.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/docs/binding.gyp-files-in-the-wild.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/.flake8
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/AUTHORS
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CODE_OF_CONDUCT.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CONTRIBUTING.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp.bat
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/__init__.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common_test.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input_test.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pyproject.toml
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/test_gyp.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.pbfilespec
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.xclangspec
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/gyp-tests.el
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/gyp.el
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/run-unit-tests.sh
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp.fontified
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/graphviz.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_gyp.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_sln.py
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_vcproj.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/Find-VisualStudio.cs
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/clean.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/configure.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/create-config-gypi.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-node-directory.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-visualstudio.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/install.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/list.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/node-gyp.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/process-release.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/rebuild.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/remove.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/lib/util.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina_acid_test.sh
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/LICENSE
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/bin/node-which
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/which.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/src/win_delay_load_hook.cc
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/common.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_BuildTools_minimal.txt
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Community_workload.txt
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Express.txt
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Unusable.txt
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_BuildTools_minimal.txt
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Community_workload.txt
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Preview.txt
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2022_Community_workload.txt
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/certs.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/test-charmap.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/process-exec-sync.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/reporter.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/simple-proxy.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-addon.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-configure-python.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-create-config-gypi.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-download.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-accessible-sync.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-node-directory.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-python.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-visualstudio.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-install.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-options.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-process-release.js
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/node-gyp/update-gyp.py
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/nopt/LICENSE
 delete mode 100755 node_modules/@npmcli/run-script/node_modules/nopt/bin/nopt.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/nopt/lib/nopt.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/nopt/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/npmlog/LICENSE.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/npmlog/lib/log.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/npmlog/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/CONTRIBUTING.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/GOVERNANCE.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/errors-browser.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/errors.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/experimentalWarning.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_duplex.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_passthrough.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_readable.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_transform.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_writable.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/async_iterator.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/buffer_list.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/destroy.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/end-of-stream.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from-browser.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/pipeline.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/state.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream-browser.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/readable-browser.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/readable-stream/readable.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/signal-exit/LICENSE.txt
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/signal-exit/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/signal-exit/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/signal-exit/signals.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/ssri/LICENSE.md
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/ssri/lib/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/ssri/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/unique-filename/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/unique-filename/lib/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/unique-filename/package.json
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/unique-slug/LICENSE
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/unique-slug/lib/index.js
 delete mode 100644 node_modules/@npmcli/run-script/node_modules/unique-slug/package.json
 delete mode 100644 node_modules/@tootallnate/once/LICENSE
 delete mode 100644 node_modules/@tootallnate/once/dist/index.js
 delete mode 100644 node_modules/@tootallnate/once/dist/overloaded-parameters.js
 delete mode 100644 node_modules/@tootallnate/once/dist/types.js
 delete mode 100644 node_modules/@tootallnate/once/package.json
 delete mode 100644 node_modules/agent-base/dist/src/index.js
 delete mode 100644 node_modules/agent-base/dist/src/promisify.js
 delete mode 100644 node_modules/agent-base/package.json
 delete mode 100644 node_modules/agentkeepalive/History.md
 delete mode 100644 node_modules/agentkeepalive/LICENSE
 delete mode 100644 node_modules/agentkeepalive/browser.js
 delete mode 100644 node_modules/agentkeepalive/index.js
 delete mode 100644 node_modules/agentkeepalive/lib/agent.js
 delete mode 100644 node_modules/agentkeepalive/lib/constants.js
 delete mode 100644 node_modules/agentkeepalive/lib/https_agent.js
 delete mode 100644 node_modules/agentkeepalive/package.json
 delete mode 100644 node_modules/concat-map/LICENSE
 delete mode 100644 node_modules/concat-map/example/map.js
 delete mode 100644 node_modules/concat-map/index.js
 delete mode 100644 node_modules/concat-map/package.json
 delete mode 100644 node_modules/concat-map/test/map.js
 delete mode 100644 node_modules/fs.realpath/LICENSE
 delete mode 100644 node_modules/fs.realpath/index.js
 delete mode 100644 node_modules/fs.realpath/old.js
 delete mode 100644 node_modules/fs.realpath/package.json
 delete mode 100644 node_modules/http-proxy-agent/dist/agent.js
 delete mode 100644 node_modules/http-proxy-agent/dist/index.js
 delete mode 100644 node_modules/http-proxy-agent/package.json
 delete mode 100644 node_modules/https-proxy-agent/dist/agent.js
 delete mode 100644 node_modules/https-proxy-agent/dist/index.js
 delete mode 100644 node_modules/https-proxy-agent/dist/parse-proxy-response.js
 delete mode 100644 node_modules/https-proxy-agent/package.json
 delete mode 100644 node_modules/humanize-ms/History.md
 delete mode 100644 node_modules/humanize-ms/LICENSE
 delete mode 100644 node_modules/humanize-ms/index.js
 delete mode 100644 node_modules/humanize-ms/package.json
 delete mode 100644 node_modules/infer-owner/LICENSE
 delete mode 100644 node_modules/infer-owner/index.js
 delete mode 100644 node_modules/infer-owner/package.json
 delete mode 100644 node_modules/inflight/LICENSE
 delete mode 100644 node_modules/inflight/inflight.js
 delete mode 100644 node_modules/inflight/package.json
 delete mode 100644 node_modules/inherits/LICENSE
 delete mode 100644 node_modules/inherits/inherits.js
 delete mode 100644 node_modules/inherits/inherits_browser.js
 delete mode 100644 node_modules/inherits/package.json
 delete mode 100644 node_modules/once/LICENSE
 delete mode 100644 node_modules/once/once.js
 delete mode 100644 node_modules/once/package.json
 delete mode 100644 node_modules/path-is-absolute/index.js
 delete mode 100644 node_modules/path-is-absolute/license
 delete mode 100644 node_modules/path-is-absolute/package.json
 delete mode 100644 node_modules/rimraf/LICENSE
 delete mode 100755 node_modules/rimraf/bin.js
 delete mode 100644 node_modules/rimraf/node_modules/brace-expansion/LICENSE
 delete mode 100644 node_modules/rimraf/node_modules/brace-expansion/index.js
 delete mode 100644 node_modules/rimraf/node_modules/brace-expansion/package.json
 delete mode 100644 node_modules/rimraf/node_modules/glob/LICENSE
 delete mode 100644 node_modules/rimraf/node_modules/glob/common.js
 delete mode 100644 node_modules/rimraf/node_modules/glob/glob.js
 delete mode 100644 node_modules/rimraf/node_modules/glob/package.json
 delete mode 100644 node_modules/rimraf/node_modules/glob/sync.js
 delete mode 100644 node_modules/rimraf/node_modules/minimatch/LICENSE
 delete mode 100644 node_modules/rimraf/node_modules/minimatch/minimatch.js
 delete mode 100644 node_modules/rimraf/node_modules/minimatch/package.json
 delete mode 100644 node_modules/rimraf/package.json
 delete mode 100644 node_modules/rimraf/rimraf.js
 delete mode 100644 node_modules/socks-proxy-agent/dist/index.js
 delete mode 100644 node_modules/socks-proxy-agent/package.json
 delete mode 100644 node_modules/wrappy/LICENSE
 delete mode 100644 node_modules/wrappy/package.json
 delete mode 100644 node_modules/wrappy/wrappy.js

diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md
index 12cf0408f18b8..eae5ba28c760f 100644
--- a/DEPENDENCIES.md
+++ b/DEPENDENCIES.md
@@ -261,8 +261,8 @@ graph LR;
 ## all dependencies
 ```mermaid
 graph LR;
+  abort-controller-->event-target-shim;
   agent-base-->debug;
-  agentkeepalive-->humanize-ms;
   aggregate-error-->clean-stack;
   aggregate-error-->indent-string;
   ansi-styles-->color-convert;
@@ -273,22 +273,18 @@ graph LR;
   bin-links-->read-cmd-shim;
   bin-links-->write-file-atomic;
   brace-expansion-->balanced-match;
+  buffer-->base64-js;
+  buffer-->ieee754;
   builtins-->semver;
-  cacache-->chownr;
   cacache-->fs-minipass;
   cacache-->glob;
-  cacache-->infer-owner;
   cacache-->lru-cache;
   cacache-->minipass-collect;
   cacache-->minipass-flush;
   cacache-->minipass-pipeline;
   cacache-->minipass;
-  cacache-->mkdirp;
   cacache-->npmcli-fs["@npmcli/fs"];
-  cacache-->npmcli-move-file["@npmcli/move-file"];
   cacache-->p-map;
-  cacache-->promise-inflight;
-  cacache-->rimraf;
   cacache-->ssri;
   cacache-->tar;
   cacache-->unique-filename;
@@ -318,27 +314,18 @@ graph LR;
   gauge-->strip-ansi;
   gauge-->wide-align;
   glob-->foreground-child;
-  glob-->fs.realpath;
-  glob-->inflight;
-  glob-->inherits;
   glob-->jackspeak;
   glob-->minimatch;
   glob-->minipass;
-  glob-->once;
-  glob-->path-is-absolute;
   glob-->path-scurry;
   has-->function-bind;
   hosted-git-info-->lru-cache;
   http-proxy-agent-->agent-base;
   http-proxy-agent-->debug;
-  http-proxy-agent-->tootallnate-once["@tootallnate/once"];
   https-proxy-agent-->agent-base;
   https-proxy-agent-->debug;
-  humanize-ms-->ms;
   iconv-lite-->safer-buffer;
   ignore-walk-->minimatch;
-  inflight-->once;
-  inflight-->wrappy;
   init-package-json-->npm-package-arg;
   init-package-json-->promzard;
   init-package-json-->read-package-json;
@@ -455,14 +442,9 @@ graph LR;
   libnpmversion-->semver;
   libnpmversion-->tap;
   lru-cache-->yallist;
-  make-fetch-happen-->agentkeepalive;
   make-fetch-happen-->cacache;
   make-fetch-happen-->http-cache-semantics;
-  make-fetch-happen-->http-proxy-agent;
-  make-fetch-happen-->https-proxy-agent;
   make-fetch-happen-->is-lambda;
-  make-fetch-happen-->lru-cache;
-  make-fetch-happen-->minipass-collect;
   make-fetch-happen-->minipass-fetch;
   make-fetch-happen-->minipass-flush;
   make-fetch-happen-->minipass-pipeline;
@@ -470,7 +452,6 @@ graph LR;
   make-fetch-happen-->negotiator;
   make-fetch-happen-->npmcli-agent["@npmcli/agent"];
   make-fetch-happen-->promise-retry;
-  make-fetch-happen-->socks-proxy-agent;
   make-fetch-happen-->ssri;
   minimatch-->brace-expansion;
   minipass-->yallist;
@@ -492,9 +473,7 @@ graph LR;
   node-gyp-->graceful-fs;
   node-gyp-->make-fetch-happen;
   node-gyp-->nopt;
-  node-gyp-->npmlog;
   node-gyp-->proc-log;
-  node-gyp-->rimraf;
   node-gyp-->semver;
   node-gyp-->tar;
   node-gyp-->which;
@@ -718,8 +697,6 @@ graph LR;
   npmcli-mock-registry-->npmcli-template-oss["@npmcli/template-oss"];
   npmcli-mock-registry-->pacote;
   npmcli-mock-registry-->tap;
-  npmcli-move-file-->mkdirp;
-  npmcli-move-file-->rimraf;
   npmcli-package-json-->glob;
   npmcli-package-json-->hosted-git-info;
   npmcli-package-json-->json-parse-even-better-errors;
@@ -746,7 +723,6 @@ graph LR;
   npmlog-->console-control-strings;
   npmlog-->gauge;
   npmlog-->set-blocking;
-  once-->wrappy;
   p-map-->aggregate-error;
   pacote-->cacache;
   pacote-->fs-minipass;
@@ -783,10 +759,11 @@ graph LR;
   read-package-json-->npm-normalize-package-bin;
   read-package-json-fast-->json-parse-even-better-errors;
   read-package-json-fast-->npm-normalize-package-bin;
-  readable-stream-->inherits;
+  readable-stream-->abort-controller;
+  readable-stream-->buffer;
+  readable-stream-->events;
+  readable-stream-->process;
   readable-stream-->string_decoder;
-  readable-stream-->util-deprecate;
-  rimraf-->glob;
   semver-->lru-cache;
   shebang-command-->shebang-regex;
   sigstore-->sigstore-bundle["@sigstore/bundle"];
diff --git a/node_modules/.gitignore b/node_modules/.gitignore
index 0f4c4534aa2be..1721943df922a 100644
--- a/node_modules/.gitignore
+++ b/node_modules/.gitignore
@@ -6,9 +6,6 @@
 !/@colors/
 /@colors/*
 !/@colors/colors
-!/@gar/
-/@gar/*
-!/@gar/promisify
 !/@isaacs/
 /@isaacs/*
 !/@isaacs/cliui
@@ -34,46 +31,12 @@
 !/@npmcli/installed-package-contents
 !/@npmcli/map-workspaces
 !/@npmcli/metavuln-calculator
-!/@npmcli/move-file
 !/@npmcli/name-from-folder
 !/@npmcli/node-gyp
 !/@npmcli/package-json
 !/@npmcli/promise-spawn
 !/@npmcli/query
 !/@npmcli/run-script
-!/@npmcli/run-script/node_modules/
-/@npmcli/run-script/node_modules/*
-!/@npmcli/run-script/node_modules/@npmcli/
-/@npmcli/run-script/node_modules/@npmcli/*
-!/@npmcli/run-script/node_modules/@npmcli/fs
-!/@npmcli/run-script/node_modules/abbrev
-!/@npmcli/run-script/node_modules/are-we-there-yet
-!/@npmcli/run-script/node_modules/brace-expansion
-!/@npmcli/run-script/node_modules/cacache
-!/@npmcli/run-script/node_modules/cacache/node_modules/
-/@npmcli/run-script/node_modules/cacache/node_modules/*
-!/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion
-!/@npmcli/run-script/node_modules/cacache/node_modules/glob
-!/@npmcli/run-script/node_modules/cacache/node_modules/minimatch
-!/@npmcli/run-script/node_modules/fs-minipass
-!/@npmcli/run-script/node_modules/gauge
-!/@npmcli/run-script/node_modules/glob
-!/@npmcli/run-script/node_modules/lru-cache
-!/@npmcli/run-script/node_modules/make-fetch-happen
-!/@npmcli/run-script/node_modules/minimatch
-!/@npmcli/run-script/node_modules/minipass-fetch
-!/@npmcli/run-script/node_modules/minipass
-!/@npmcli/run-script/node_modules/node-gyp
-!/@npmcli/run-script/node_modules/node-gyp/node_modules/
-/@npmcli/run-script/node_modules/node-gyp/node_modules/*
-!/@npmcli/run-script/node_modules/node-gyp/node_modules/which
-!/@npmcli/run-script/node_modules/nopt
-!/@npmcli/run-script/node_modules/npmlog
-!/@npmcli/run-script/node_modules/readable-stream
-!/@npmcli/run-script/node_modules/signal-exit
-!/@npmcli/run-script/node_modules/ssri
-!/@npmcli/run-script/node_modules/unique-filename
-!/@npmcli/run-script/node_modules/unique-slug
 !/@pkgjs/
 /@pkgjs/*
 !/@pkgjs/parseargs
@@ -83,17 +46,12 @@
 !/@sigstore/protobuf-specs
 !/@sigstore/sign
 !/@sigstore/tuf
-!/@tootallnate/
-/@tootallnate/*
-!/@tootallnate/once
 !/@tufjs/
 /@tufjs/*
 !/@tufjs/canonical-json
 !/@tufjs/models
 !/abbrev
 !/abort-controller
-!/agent-base
-!/agentkeepalive
 !/aggregate-error
 !/ansi-regex
 !/ansi-styles
@@ -122,7 +80,6 @@
 !/color-support
 !/columnify
 !/common-ancestor-path
-!/concat-map
 !/console-control-strings
 !/cross-spawn
 !/cross-spawn/node_modules/
@@ -147,7 +104,6 @@
 !/fastest-levenshtein
 !/foreground-child
 !/fs-minipass
-!/fs.realpath
 !/function-bind
 !/gauge
 !/glob
@@ -156,17 +112,11 @@
 !/has
 !/hosted-git-info
 !/http-cache-semantics
-!/http-proxy-agent
-!/https-proxy-agent
-!/humanize-ms
 !/iconv-lite
 !/ieee754
 !/ignore-walk
 !/imurmurhash
 !/indent-string
-!/infer-owner
-!/inflight
-!/inherits
 !/ini
 !/init-package-json
 !/ip-regex
@@ -229,11 +179,9 @@
 !/npm-registry-fetch
 !/npm-user-validate
 !/npmlog
-!/once
 !/p-map
 !/pacote
 !/parse-conflict-json
-!/path-is-absolute
 !/path-key
 !/path-scurry
 !/postcss-selector-parser
@@ -251,12 +199,6 @@
 !/read
 !/readable-stream
 !/retry
-!/rimraf
-!/rimraf/node_modules/
-/rimraf/node_modules/*
-!/rimraf/node_modules/brace-expansion
-!/rimraf/node_modules/glob
-!/rimraf/node_modules/minimatch
 !/safe-buffer
 !/safer-buffer
 !/semver
@@ -269,7 +211,6 @@
 !/signal-exit
 !/sigstore
 !/smart-buffer
-!/socks-proxy-agent
 !/socks
 !/spdx-correct
 !/spdx-exceptions
@@ -315,7 +256,6 @@
 !/wrap-ansi/node_modules/emoji-regex
 !/wrap-ansi/node_modules/string-width
 !/wrap-ansi/node_modules/strip-ansi
-!/wrappy
 !/write-file-atomic
 !/yallist
 # Always ignore some specific patterns within any allowed package
diff --git a/node_modules/@gar/promisify/LICENSE.md b/node_modules/@gar/promisify/LICENSE.md
deleted file mode 100644
index 64f773240bed1..0000000000000
--- a/node_modules/@gar/promisify/LICENSE.md
+++ /dev/null
@@ -1,10 +0,0 @@
-The MIT License (MIT)
-
-Copyright © 2020-2022 Michael Garvin
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
diff --git a/node_modules/@gar/promisify/index.js b/node_modules/@gar/promisify/index.js
deleted file mode 100644
index d0be95f6fec61..0000000000000
--- a/node_modules/@gar/promisify/index.js
+++ /dev/null
@@ -1,36 +0,0 @@
-'use strict'
-
-const { promisify } = require('util')
-
-const handler = {
-  get: function (target, prop, receiver) {
-    if (typeof target[prop] !== 'function') {
-      return target[prop]
-    }
-    if (target[prop][promisify.custom]) {
-      return function () {
-        return Reflect.get(target, prop, receiver)[promisify.custom].apply(target, arguments)
-      }
-    }
-    return function () {
-      return new Promise((resolve, reject) => {
-        Reflect.get(target, prop, receiver).apply(target, [...arguments, function (err, result) {
-          if (err) {
-            return reject(err)
-          }
-          resolve(result)
-        }])
-      })
-    }
-  }
-}
-
-module.exports = function (thingToPromisify) {
-  if (typeof thingToPromisify === 'function') {
-    return promisify(thingToPromisify)
-  }
-  if (typeof thingToPromisify === 'object') {
-    return new Proxy(thingToPromisify, handler)
-  }
-  throw new TypeError('Can only promisify functions or objects')
-}
diff --git a/node_modules/@gar/promisify/package.json b/node_modules/@gar/promisify/package.json
deleted file mode 100644
index d0ce69b2f7c0e..0000000000000
--- a/node_modules/@gar/promisify/package.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
-  "name": "@gar/promisify",
-  "version": "1.1.3",
-  "description": "Promisify an entire class or object",
-  "main": "index.js",
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/wraithgar/gar-promisify.git"
-  },
-  "scripts": {
-    "lint": "standard",
-    "lint:fix": "standard --fix",
-    "test": "lab -a @hapi/code -t 100",
-    "posttest": "npm run lint"
-  },
-  "files": [
-    "index.js"
-  ],
-  "keywords": [
-    "promisify",
-    "all",
-    "class",
-    "object"
-  ],
-  "author": "Gar ",
-  "license": "MIT",
-  "devDependencies": {
-    "@hapi/code": "^8.0.1",
-    "@hapi/lab": "^24.1.0",
-    "standard": "^16.0.3"
-  }
-}
diff --git a/node_modules/@npmcli/move-file/LICENSE.md b/node_modules/@npmcli/move-file/LICENSE.md
deleted file mode 100644
index 072bf20840acd..0000000000000
--- a/node_modules/@npmcli/move-file/LICENSE.md
+++ /dev/null
@@ -1,22 +0,0 @@
-MIT License
-
-Copyright (c) Sindre Sorhus  (https://sindresorhus.com)
-Copyright (c) npm, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/@npmcli/move-file/lib/index.js b/node_modules/@npmcli/move-file/lib/index.js
deleted file mode 100644
index 5789bb127e096..0000000000000
--- a/node_modules/@npmcli/move-file/lib/index.js
+++ /dev/null
@@ -1,185 +0,0 @@
-const { dirname, join, resolve, relative, isAbsolute } = require('path')
-const rimraf_ = require('rimraf')
-const { promisify } = require('util')
-const {
-  access: access_,
-  accessSync,
-  copyFile: copyFile_,
-  copyFileSync,
-  readdir: readdir_,
-  readdirSync,
-  rename: rename_,
-  renameSync,
-  stat: stat_,
-  statSync,
-  lstat: lstat_,
-  lstatSync,
-  symlink: symlink_,
-  symlinkSync,
-  readlink: readlink_,
-  readlinkSync,
-} = require('fs')
-
-const access = promisify(access_)
-const copyFile = promisify(copyFile_)
-const readdir = promisify(readdir_)
-const rename = promisify(rename_)
-const stat = promisify(stat_)
-const lstat = promisify(lstat_)
-const symlink = promisify(symlink_)
-const readlink = promisify(readlink_)
-const rimraf = promisify(rimraf_)
-const rimrafSync = rimraf_.sync
-
-const mkdirp = require('mkdirp')
-
-const pathExists = async path => {
-  try {
-    await access(path)
-    return true
-  } catch (er) {
-    return er.code !== 'ENOENT'
-  }
-}
-
-const pathExistsSync = path => {
-  try {
-    accessSync(path)
-    return true
-  } catch (er) {
-    return er.code !== 'ENOENT'
-  }
-}
-
-const moveFile = async (source, destination, options = {}, root = true, symlinks = []) => {
-  if (!source || !destination) {
-    throw new TypeError('`source` and `destination` file required')
-  }
-
-  options = {
-    overwrite: true,
-    ...options,
-  }
-
-  if (!options.overwrite && await pathExists(destination)) {
-    throw new Error(`The destination file exists: ${destination}`)
-  }
-
-  await mkdirp(dirname(destination))
-
-  try {
-    await rename(source, destination)
-  } catch (error) {
-    if (error.code === 'EXDEV' || error.code === 'EPERM') {
-      const sourceStat = await lstat(source)
-      if (sourceStat.isDirectory()) {
-        const files = await readdir(source)
-        await Promise.all(files.map((file) =>
-          moveFile(join(source, file), join(destination, file), options, false, symlinks)
-        ))
-      } else if (sourceStat.isSymbolicLink()) {
-        symlinks.push({ source, destination })
-      } else {
-        await copyFile(source, destination)
-      }
-    } else {
-      throw error
-    }
-  }
-
-  if (root) {
-    await Promise.all(symlinks.map(async ({ source: symSource, destination: symDestination }) => {
-      let target = await readlink(symSource)
-      // junction symlinks in windows will be absolute paths, so we need to
-      // make sure they point to the symlink destination
-      if (isAbsolute(target)) {
-        target = resolve(symDestination, relative(symSource, target))
-      }
-      // try to determine what the actual file is so we can create the correct
-      // type of symlink in windows
-      let targetStat = 'file'
-      try {
-        targetStat = await stat(resolve(dirname(symSource), target))
-        if (targetStat.isDirectory()) {
-          targetStat = 'junction'
-        }
-      } catch {
-        // targetStat remains 'file'
-      }
-      await symlink(
-        target,
-        symDestination,
-        targetStat
-      )
-    }))
-    await rimraf(source)
-  }
-}
-
-const moveFileSync = (source, destination, options = {}, root = true, symlinks = []) => {
-  if (!source || !destination) {
-    throw new TypeError('`source` and `destination` file required')
-  }
-
-  options = {
-    overwrite: true,
-    ...options,
-  }
-
-  if (!options.overwrite && pathExistsSync(destination)) {
-    throw new Error(`The destination file exists: ${destination}`)
-  }
-
-  mkdirp.sync(dirname(destination))
-
-  try {
-    renameSync(source, destination)
-  } catch (error) {
-    if (error.code === 'EXDEV' || error.code === 'EPERM') {
-      const sourceStat = lstatSync(source)
-      if (sourceStat.isDirectory()) {
-        const files = readdirSync(source)
-        for (const file of files) {
-          moveFileSync(join(source, file), join(destination, file), options, false, symlinks)
-        }
-      } else if (sourceStat.isSymbolicLink()) {
-        symlinks.push({ source, destination })
-      } else {
-        copyFileSync(source, destination)
-      }
-    } else {
-      throw error
-    }
-  }
-
-  if (root) {
-    for (const { source: symSource, destination: symDestination } of symlinks) {
-      let target = readlinkSync(symSource)
-      // junction symlinks in windows will be absolute paths, so we need to
-      // make sure they point to the symlink destination
-      if (isAbsolute(target)) {
-        target = resolve(symDestination, relative(symSource, target))
-      }
-      // try to determine what the actual file is so we can create the correct
-      // type of symlink in windows
-      let targetStat = 'file'
-      try {
-        targetStat = statSync(resolve(dirname(symSource), target))
-        if (targetStat.isDirectory()) {
-          targetStat = 'junction'
-        }
-      } catch {
-        // targetStat remains 'file'
-      }
-      symlinkSync(
-        target,
-        symDestination,
-        targetStat
-      )
-    }
-    rimrafSync(source)
-  }
-}
-
-module.exports = moveFile
-module.exports.sync = moveFileSync
diff --git a/node_modules/@npmcli/move-file/package.json b/node_modules/@npmcli/move-file/package.json
deleted file mode 100644
index 58793b93a9ca0..0000000000000
--- a/node_modules/@npmcli/move-file/package.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
-  "name": "@npmcli/move-file",
-  "version": "2.0.1",
-  "files": [
-    "bin/",
-    "lib/"
-  ],
-  "main": "lib/index.js",
-  "description": "move a file (fork of move-file)",
-  "dependencies": {
-    "mkdirp": "^1.0.4",
-    "rimraf": "^3.0.2"
-  },
-  "devDependencies": {
-    "@npmcli/eslint-config": "^3.0.1",
-    "@npmcli/template-oss": "3.5.0",
-    "tap": "^16.0.1"
-  },
-  "scripts": {
-    "test": "tap",
-    "snap": "tap",
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "prepublishOnly": "git push origin --follow-tags",
-    "lint": "eslint \"**/*.js\"",
-    "postlint": "template-oss-check",
-    "template-oss-apply": "template-oss-apply --force",
-    "lintfix": "npm run lint -- --fix",
-    "posttest": "npm run lint"
-  },
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/npm/move-file.git"
-  },
-  "tap": {
-    "check-coverage": true
-  },
-  "license": "MIT",
-  "engines": {
-    "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
-  },
-  "author": "GitHub Inc.",
-  "templateOSS": {
-    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
-    "version": "3.5.0"
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/LICENSE.md
deleted file mode 100644
index 5fc208ff122e0..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/LICENSE.md
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-ISC License
-
-Copyright npm, Inc.
-
-Permission to use, copy, modify, and/or distribute this
-software for any purpose with or without fee is hereby
-granted, provided that the above copyright notice and this
-permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
-EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
-INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
-USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/get-options.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/get-options.js
deleted file mode 100644
index cb5982f79077a..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/get-options.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// given an input that may or may not be an object, return an object that has
-// a copy of every defined property listed in 'copy'. if the input is not an
-// object, assign it to the property named by 'wrap'
-const getOptions = (input, { copy, wrap }) => {
-  const result = {}
-
-  if (input && typeof input === 'object') {
-    for (const prop of copy) {
-      if (input[prop] !== undefined) {
-        result[prop] = input[prop]
-      }
-    }
-  } else {
-    result[wrap] = input
-  }
-
-  return result
-}
-
-module.exports = getOptions
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/node.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/node.js
deleted file mode 100644
index 4d13bc037359d..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/node.js
+++ /dev/null
@@ -1,9 +0,0 @@
-const semver = require('semver')
-
-const satisfies = (range) => {
-  return semver.satisfies(process.version, range, { includePrerelease: true })
-}
-
-module.exports = {
-  satisfies,
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner-sync.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner-sync.js
deleted file mode 100644
index 3704aa6d18e1e..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner-sync.js
+++ /dev/null
@@ -1,96 +0,0 @@
-const { dirname, resolve } = require('path')
-const url = require('url')
-
-const fs = require('../fs.js')
-
-// given a path, find the owner of the nearest parent
-const find = (path) => {
-  // if we have no getuid, permissions are irrelevant on this platform
-  if (!process.getuid) {
-    return {}
-  }
-
-  // fs methods accept URL objects with a scheme of file: so we need to unwrap
-  // those into an actual path string before we can resolve it
-  const resolved = path != null && path.href && path.origin
-    ? resolve(url.fileURLToPath(path))
-    : resolve(path)
-
-  let stat
-
-  try {
-    stat = fs.lstatSync(resolved)
-  } finally {
-    // if we got a stat, return its contents
-    if (stat) {
-      return { uid: stat.uid, gid: stat.gid }
-    }
-
-    // try the parent directory
-    if (resolved !== dirname(resolved)) {
-      return find(dirname(resolved))
-    }
-
-    // no more parents, never got a stat, just return an empty object
-    return {}
-  }
-}
-
-// given a path, uid, and gid update the ownership of the path if necessary
-const update = (path, uid, gid) => {
-  // nothing to update, just exit
-  if (uid === undefined && gid === undefined) {
-    return
-  }
-
-  try {
-    // see if the permissions are already the same, if they are we don't
-    // need to do anything, so return early
-    const stat = fs.statSync(path)
-    if (uid === stat.uid && gid === stat.gid) {
-      return
-    }
-  } catch {
-    // ignore errors
-  }
-
-  try {
-    fs.chownSync(path, uid, gid)
-  } catch {
-    // ignore errors
-  }
-}
-
-// accepts a `path` and the `owner` property of an options object and normalizes
-// it into an object with numerical `uid` and `gid`
-const validate = (path, input) => {
-  let uid
-  let gid
-
-  if (typeof input === 'string' || typeof input === 'number') {
-    uid = input
-    gid = input
-  } else if (input && typeof input === 'object') {
-    uid = input.uid
-    gid = input.gid
-  }
-
-  if (uid === 'inherit' || gid === 'inherit') {
-    const owner = find(path)
-    if (uid === 'inherit') {
-      uid = owner.uid
-    }
-
-    if (gid === 'inherit') {
-      gid = owner.gid
-    }
-  }
-
-  return { uid, gid }
-}
-
-module.exports = {
-  find,
-  update,
-  validate,
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner.js
deleted file mode 100644
index 9f02d41a5e4b3..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/common/owner.js
+++ /dev/null
@@ -1,96 +0,0 @@
-const { dirname, resolve } = require('path')
-const url = require('url')
-
-const fs = require('../fs.js')
-
-// given a path, find the owner of the nearest parent
-const find = async (path) => {
-  // if we have no getuid, permissions are irrelevant on this platform
-  if (!process.getuid) {
-    return {}
-  }
-
-  // fs methods accept URL objects with a scheme of file: so we need to unwrap
-  // those into an actual path string before we can resolve it
-  const resolved = path != null && path.href && path.origin
-    ? resolve(url.fileURLToPath(path))
-    : resolve(path)
-
-  let stat
-
-  try {
-    stat = await fs.lstat(resolved)
-  } finally {
-    // if we got a stat, return its contents
-    if (stat) {
-      return { uid: stat.uid, gid: stat.gid }
-    }
-
-    // try the parent directory
-    if (resolved !== dirname(resolved)) {
-      return find(dirname(resolved))
-    }
-
-    // no more parents, never got a stat, just return an empty object
-    return {}
-  }
-}
-
-// given a path, uid, and gid update the ownership of the path if necessary
-const update = async (path, uid, gid) => {
-  // nothing to update, just exit
-  if (uid === undefined && gid === undefined) {
-    return
-  }
-
-  try {
-    // see if the permissions are already the same, if they are we don't
-    // need to do anything, so return early
-    const stat = await fs.stat(path)
-    if (uid === stat.uid && gid === stat.gid) {
-      return
-    }
-  } catch {
-    // ignore errors
-  }
-
-  try {
-    await fs.chown(path, uid, gid)
-  } catch {
-    // ignore errors
-  }
-}
-
-// accepts a `path` and the `owner` property of an options object and normalizes
-// it into an object with numerical `uid` and `gid`
-const validate = async (path, input) => {
-  let uid
-  let gid
-
-  if (typeof input === 'string' || typeof input === 'number') {
-    uid = input
-    gid = input
-  } else if (input && typeof input === 'object') {
-    uid = input.uid
-    gid = input.gid
-  }
-
-  if (uid === 'inherit' || gid === 'inherit') {
-    const owner = await find(path)
-    if (uid === 'inherit') {
-      uid = owner.uid
-    }
-
-    if (gid === 'inherit') {
-      gid = owner.gid
-    }
-  }
-
-  return { uid, gid }
-}
-
-module.exports = {
-  find,
-  update,
-  validate,
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/copy-file.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/copy-file.js
deleted file mode 100644
index 8888266d627f0..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/copy-file.js
+++ /dev/null
@@ -1,16 +0,0 @@
-const fs = require('./fs.js')
-const getOptions = require('./common/get-options.js')
-const withOwner = require('./with-owner.js')
-
-const copyFile = async (src, dest, opts) => {
-  const options = getOptions(opts, {
-    copy: ['mode'],
-    wrap: 'mode',
-  })
-
-  // the node core method as of 16.5.0 does not support the mode being in an
-  // object, so we have to pass the mode value directly
-  return withOwner(dest, () => fs.copyFile(src, dest, options.mode), opts)
-}
-
-module.exports = copyFile
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/LICENSE b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/LICENSE
deleted file mode 100644
index 93546dfb7655b..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2011-2017 JP Richardson
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
-(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
- merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
-OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/index.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/index.js
deleted file mode 100644
index 5da4739bdd528..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-const fs = require('../fs.js')
-const getOptions = require('../common/get-options.js')
-const node = require('../common/node.js')
-const polyfill = require('./polyfill.js')
-
-// node 16.7.0 added fs.cp
-const useNative = node.satisfies('>=16.7.0')
-
-const cp = async (src, dest, opts) => {
-  const options = getOptions(opts, {
-    copy: ['dereference', 'errorOnExist', 'filter', 'force', 'preserveTimestamps', 'recursive'],
-  })
-
-  // the polyfill is tested separately from this module, no need to hack
-  // process.version to try to trigger it just for coverage
-  // istanbul ignore next
-  return useNative
-    ? fs.cp(src, dest, options)
-    : polyfill(src, dest, options)
-}
-
-module.exports = cp
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/polyfill.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/polyfill.js
deleted file mode 100644
index f83ccbf57ecc9..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/cp/polyfill.js
+++ /dev/null
@@ -1,428 +0,0 @@
-// this file is a modified version of the code in node 17.2.0
-// which is, in turn, a modified version of the fs-extra module on npm
-// node core changes:
-// - Use of the assert module has been replaced with core's error system.
-// - All code related to the glob dependency has been removed.
-// - Bring your own custom fs module is not currently supported.
-// - Some basic code cleanup.
-// changes here:
-// - remove all callback related code
-// - drop sync support
-// - change assertions back to non-internal methods (see options.js)
-// - throws ENOTDIR when rmdir gets an ENOENT for a path that exists in Windows
-'use strict'
-
-const {
-  ERR_FS_CP_DIR_TO_NON_DIR,
-  ERR_FS_CP_EEXIST,
-  ERR_FS_CP_EINVAL,
-  ERR_FS_CP_FIFO_PIPE,
-  ERR_FS_CP_NON_DIR_TO_DIR,
-  ERR_FS_CP_SOCKET,
-  ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY,
-  ERR_FS_CP_UNKNOWN,
-  ERR_FS_EISDIR,
-  ERR_INVALID_ARG_TYPE,
-} = require('../errors.js')
-const {
-  constants: {
-    errno: {
-      EEXIST,
-      EISDIR,
-      EINVAL,
-      ENOTDIR,
-    },
-  },
-} = require('os')
-const {
-  chmod,
-  copyFile,
-  lstat,
-  mkdir,
-  readdir,
-  readlink,
-  stat,
-  symlink,
-  unlink,
-  utimes,
-} = require('../fs.js')
-const {
-  dirname,
-  isAbsolute,
-  join,
-  parse,
-  resolve,
-  sep,
-  toNamespacedPath,
-} = require('path')
-const { fileURLToPath } = require('url')
-
-const defaultOptions = {
-  dereference: false,
-  errorOnExist: false,
-  filter: undefined,
-  force: true,
-  preserveTimestamps: false,
-  recursive: false,
-}
-
-async function cp (src, dest, opts) {
-  if (opts != null && typeof opts !== 'object') {
-    throw new ERR_INVALID_ARG_TYPE('options', ['Object'], opts)
-  }
-  return cpFn(
-    toNamespacedPath(getValidatedPath(src)),
-    toNamespacedPath(getValidatedPath(dest)),
-    { ...defaultOptions, ...opts })
-}
-
-function getValidatedPath (fileURLOrPath) {
-  const path = fileURLOrPath != null && fileURLOrPath.href
-      && fileURLOrPath.origin
-    ? fileURLToPath(fileURLOrPath)
-    : fileURLOrPath
-  return path
-}
-
-async function cpFn (src, dest, opts) {
-  // Warn about using preserveTimestamps on 32-bit node
-  // istanbul ignore next
-  if (opts.preserveTimestamps && process.arch === 'ia32') {
-    const warning = 'Using the preserveTimestamps option in 32-bit ' +
-      'node is not recommended'
-    process.emitWarning(warning, 'TimestampPrecisionWarning')
-  }
-  const stats = await checkPaths(src, dest, opts)
-  const { srcStat, destStat } = stats
-  await checkParentPaths(src, srcStat, dest)
-  if (opts.filter) {
-    return handleFilter(checkParentDir, destStat, src, dest, opts)
-  }
-  return checkParentDir(destStat, src, dest, opts)
-}
-
-async function checkPaths (src, dest, opts) {
-  const { 0: srcStat, 1: destStat } = await getStats(src, dest, opts)
-  if (destStat) {
-    if (areIdentical(srcStat, destStat)) {
-      throw new ERR_FS_CP_EINVAL({
-        message: 'src and dest cannot be the same',
-        path: dest,
-        syscall: 'cp',
-        errno: EINVAL,
-      })
-    }
-    if (srcStat.isDirectory() && !destStat.isDirectory()) {
-      throw new ERR_FS_CP_DIR_TO_NON_DIR({
-        message: `cannot overwrite directory ${src} ` +
-            `with non-directory ${dest}`,
-        path: dest,
-        syscall: 'cp',
-        errno: EISDIR,
-      })
-    }
-    if (!srcStat.isDirectory() && destStat.isDirectory()) {
-      throw new ERR_FS_CP_NON_DIR_TO_DIR({
-        message: `cannot overwrite non-directory ${src} ` +
-            `with directory ${dest}`,
-        path: dest,
-        syscall: 'cp',
-        errno: ENOTDIR,
-      })
-    }
-  }
-
-  if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
-    throw new ERR_FS_CP_EINVAL({
-      message: `cannot copy ${src} to a subdirectory of self ${dest}`,
-      path: dest,
-      syscall: 'cp',
-      errno: EINVAL,
-    })
-  }
-  return { srcStat, destStat }
-}
-
-function areIdentical (srcStat, destStat) {
-  return destStat.ino && destStat.dev && destStat.ino === srcStat.ino &&
-    destStat.dev === srcStat.dev
-}
-
-function getStats (src, dest, opts) {
-  const statFunc = opts.dereference ?
-    (file) => stat(file, { bigint: true }) :
-    (file) => lstat(file, { bigint: true })
-  return Promise.all([
-    statFunc(src),
-    statFunc(dest).catch((err) => {
-      // istanbul ignore next: unsure how to cover.
-      if (err.code === 'ENOENT') {
-        return null
-      }
-      // istanbul ignore next: unsure how to cover.
-      throw err
-    }),
-  ])
-}
-
-async function checkParentDir (destStat, src, dest, opts) {
-  const destParent = dirname(dest)
-  const dirExists = await pathExists(destParent)
-  if (dirExists) {
-    return getStatsForCopy(destStat, src, dest, opts)
-  }
-  await mkdir(destParent, { recursive: true })
-  return getStatsForCopy(destStat, src, dest, opts)
-}
-
-function pathExists (dest) {
-  return stat(dest).then(
-    () => true,
-    // istanbul ignore next: not sure when this would occur
-    (err) => (err.code === 'ENOENT' ? false : Promise.reject(err)))
-}
-
-// Recursively check if dest parent is a subdirectory of src.
-// It works for all file types including symlinks since it
-// checks the src and dest inodes. It starts from the deepest
-// parent and stops once it reaches the src parent or the root path.
-async function checkParentPaths (src, srcStat, dest) {
-  const srcParent = resolve(dirname(src))
-  const destParent = resolve(dirname(dest))
-  if (destParent === srcParent || destParent === parse(destParent).root) {
-    return
-  }
-  let destStat
-  try {
-    destStat = await stat(destParent, { bigint: true })
-  } catch (err) {
-    // istanbul ignore else: not sure when this would occur
-    if (err.code === 'ENOENT') {
-      return
-    }
-    // istanbul ignore next: not sure when this would occur
-    throw err
-  }
-  if (areIdentical(srcStat, destStat)) {
-    throw new ERR_FS_CP_EINVAL({
-      message: `cannot copy ${src} to a subdirectory of self ${dest}`,
-      path: dest,
-      syscall: 'cp',
-      errno: EINVAL,
-    })
-  }
-  return checkParentPaths(src, srcStat, destParent)
-}
-
-const normalizePathToArray = (path) =>
-  resolve(path).split(sep).filter(Boolean)
-
-// Return true if dest is a subdir of src, otherwise false.
-// It only checks the path strings.
-function isSrcSubdir (src, dest) {
-  const srcArr = normalizePathToArray(src)
-  const destArr = normalizePathToArray(dest)
-  return srcArr.every((cur, i) => destArr[i] === cur)
-}
-
-async function handleFilter (onInclude, destStat, src, dest, opts, cb) {
-  const include = await opts.filter(src, dest)
-  if (include) {
-    return onInclude(destStat, src, dest, opts, cb)
-  }
-}
-
-function startCopy (destStat, src, dest, opts) {
-  if (opts.filter) {
-    return handleFilter(getStatsForCopy, destStat, src, dest, opts)
-  }
-  return getStatsForCopy(destStat, src, dest, opts)
-}
-
-async function getStatsForCopy (destStat, src, dest, opts) {
-  const statFn = opts.dereference ? stat : lstat
-  const srcStat = await statFn(src)
-  // istanbul ignore else: can't portably test FIFO
-  if (srcStat.isDirectory() && opts.recursive) {
-    return onDir(srcStat, destStat, src, dest, opts)
-  } else if (srcStat.isDirectory()) {
-    throw new ERR_FS_EISDIR({
-      message: `${src} is a directory (not copied)`,
-      path: src,
-      syscall: 'cp',
-      errno: EINVAL,
-    })
-  } else if (srcStat.isFile() ||
-            srcStat.isCharacterDevice() ||
-            srcStat.isBlockDevice()) {
-    return onFile(srcStat, destStat, src, dest, opts)
-  } else if (srcStat.isSymbolicLink()) {
-    return onLink(destStat, src, dest)
-  } else if (srcStat.isSocket()) {
-    throw new ERR_FS_CP_SOCKET({
-      message: `cannot copy a socket file: ${dest}`,
-      path: dest,
-      syscall: 'cp',
-      errno: EINVAL,
-    })
-  } else if (srcStat.isFIFO()) {
-    throw new ERR_FS_CP_FIFO_PIPE({
-      message: `cannot copy a FIFO pipe: ${dest}`,
-      path: dest,
-      syscall: 'cp',
-      errno: EINVAL,
-    })
-  }
-  // istanbul ignore next: should be unreachable
-  throw new ERR_FS_CP_UNKNOWN({
-    message: `cannot copy an unknown file type: ${dest}`,
-    path: dest,
-    syscall: 'cp',
-    errno: EINVAL,
-  })
-}
-
-function onFile (srcStat, destStat, src, dest, opts) {
-  if (!destStat) {
-    return _copyFile(srcStat, src, dest, opts)
-  }
-  return mayCopyFile(srcStat, src, dest, opts)
-}
-
-async function mayCopyFile (srcStat, src, dest, opts) {
-  if (opts.force) {
-    await unlink(dest)
-    return _copyFile(srcStat, src, dest, opts)
-  } else if (opts.errorOnExist) {
-    throw new ERR_FS_CP_EEXIST({
-      message: `${dest} already exists`,
-      path: dest,
-      syscall: 'cp',
-      errno: EEXIST,
-    })
-  }
-}
-
-async function _copyFile (srcStat, src, dest, opts) {
-  await copyFile(src, dest)
-  if (opts.preserveTimestamps) {
-    return handleTimestampsAndMode(srcStat.mode, src, dest)
-  }
-  return setDestMode(dest, srcStat.mode)
-}
-
-async function handleTimestampsAndMode (srcMode, src, dest) {
-  // Make sure the file is writable before setting the timestamp
-  // otherwise open fails with EPERM when invoked with 'r+'
-  // (through utimes call)
-  if (fileIsNotWritable(srcMode)) {
-    await makeFileWritable(dest, srcMode)
-    return setDestTimestampsAndMode(srcMode, src, dest)
-  }
-  return setDestTimestampsAndMode(srcMode, src, dest)
-}
-
-function fileIsNotWritable (srcMode) {
-  return (srcMode & 0o200) === 0
-}
-
-function makeFileWritable (dest, srcMode) {
-  return setDestMode(dest, srcMode | 0o200)
-}
-
-async function setDestTimestampsAndMode (srcMode, src, dest) {
-  await setDestTimestamps(src, dest)
-  return setDestMode(dest, srcMode)
-}
-
-function setDestMode (dest, srcMode) {
-  return chmod(dest, srcMode)
-}
-
-async function setDestTimestamps (src, dest) {
-  // The initial srcStat.atime cannot be trusted
-  // because it is modified by the read(2) system call
-  // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
-  const updatedSrcStat = await stat(src)
-  return utimes(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
-}
-
-function onDir (srcStat, destStat, src, dest, opts) {
-  if (!destStat) {
-    return mkDirAndCopy(srcStat.mode, src, dest, opts)
-  }
-  return copyDir(src, dest, opts)
-}
-
-async function mkDirAndCopy (srcMode, src, dest, opts) {
-  await mkdir(dest)
-  await copyDir(src, dest, opts)
-  return setDestMode(dest, srcMode)
-}
-
-async function copyDir (src, dest, opts) {
-  const dir = await readdir(src)
-  for (let i = 0; i < dir.length; i++) {
-    const item = dir[i]
-    const srcItem = join(src, item)
-    const destItem = join(dest, item)
-    const { destStat } = await checkPaths(srcItem, destItem, opts)
-    await startCopy(destStat, srcItem, destItem, opts)
-  }
-}
-
-async function onLink (destStat, src, dest) {
-  let resolvedSrc = await readlink(src)
-  if (!isAbsolute(resolvedSrc)) {
-    resolvedSrc = resolve(dirname(src), resolvedSrc)
-  }
-  if (!destStat) {
-    return symlink(resolvedSrc, dest)
-  }
-  let resolvedDest
-  try {
-    resolvedDest = await readlink(dest)
-  } catch (err) {
-    // Dest exists and is a regular file or directory,
-    // Windows may throw UNKNOWN error. If dest already exists,
-    // fs throws error anyway, so no need to guard against it here.
-    // istanbul ignore next: can only test on windows
-    if (err.code === 'EINVAL' || err.code === 'UNKNOWN') {
-      return symlink(resolvedSrc, dest)
-    }
-    // istanbul ignore next: should not be possible
-    throw err
-  }
-  if (!isAbsolute(resolvedDest)) {
-    resolvedDest = resolve(dirname(dest), resolvedDest)
-  }
-  if (isSrcSubdir(resolvedSrc, resolvedDest)) {
-    throw new ERR_FS_CP_EINVAL({
-      message: `cannot copy ${resolvedSrc} to a subdirectory of self ` +
-            `${resolvedDest}`,
-      path: dest,
-      syscall: 'cp',
-      errno: EINVAL,
-    })
-  }
-  // Do not copy if src is a subdir of dest since unlinking
-  // dest in this case would result in removing src contents
-  // and therefore a broken symlink would be created.
-  const srcStat = await stat(src)
-  if (srcStat.isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
-    throw new ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY({
-      message: `cannot overwrite ${resolvedDest} with ${resolvedSrc}`,
-      path: dest,
-      syscall: 'cp',
-      errno: EINVAL,
-    })
-  }
-  return copyLink(resolvedSrc, dest)
-}
-
-async function copyLink (resolvedSrc, dest) {
-  await unlink(dest)
-  return symlink(resolvedSrc, dest)
-}
-
-module.exports = cp
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/errors.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/errors.js
deleted file mode 100644
index 1cd1e05d0c533..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/errors.js
+++ /dev/null
@@ -1,129 +0,0 @@
-'use strict'
-const { inspect } = require('util')
-
-// adapted from node's internal/errors
-// https://github.com/nodejs/node/blob/c8a04049/lib/internal/errors.js
-
-// close copy of node's internal SystemError class.
-class SystemError {
-  constructor (code, prefix, context) {
-    // XXX context.code is undefined in all constructors used in cp/polyfill
-    // that may be a bug copied from node, maybe the constructor should use
-    // `code` not `errno`?  nodejs/node#41104
-    let message = `${prefix}: ${context.syscall} returned ` +
-                  `${context.code} (${context.message})`
-
-    if (context.path !== undefined) {
-      message += ` ${context.path}`
-    }
-    if (context.dest !== undefined) {
-      message += ` => ${context.dest}`
-    }
-
-    this.code = code
-    Object.defineProperties(this, {
-      name: {
-        value: 'SystemError',
-        enumerable: false,
-        writable: true,
-        configurable: true,
-      },
-      message: {
-        value: message,
-        enumerable: false,
-        writable: true,
-        configurable: true,
-      },
-      info: {
-        value: context,
-        enumerable: true,
-        configurable: true,
-        writable: false,
-      },
-      errno: {
-        get () {
-          return context.errno
-        },
-        set (value) {
-          context.errno = value
-        },
-        enumerable: true,
-        configurable: true,
-      },
-      syscall: {
-        get () {
-          return context.syscall
-        },
-        set (value) {
-          context.syscall = value
-        },
-        enumerable: true,
-        configurable: true,
-      },
-    })
-
-    if (context.path !== undefined) {
-      Object.defineProperty(this, 'path', {
-        get () {
-          return context.path
-        },
-        set (value) {
-          context.path = value
-        },
-        enumerable: true,
-        configurable: true,
-      })
-    }
-
-    if (context.dest !== undefined) {
-      Object.defineProperty(this, 'dest', {
-        get () {
-          return context.dest
-        },
-        set (value) {
-          context.dest = value
-        },
-        enumerable: true,
-        configurable: true,
-      })
-    }
-  }
-
-  toString () {
-    return `${this.name} [${this.code}]: ${this.message}`
-  }
-
-  [Symbol.for('nodejs.util.inspect.custom')] (_recurseTimes, ctx) {
-    return inspect(this, {
-      ...ctx,
-      getters: true,
-      customInspect: false,
-    })
-  }
-}
-
-function E (code, message) {
-  module.exports[code] = class NodeError extends SystemError {
-    constructor (ctx) {
-      super(code, message, ctx)
-    }
-  }
-}
-
-E('ERR_FS_CP_DIR_TO_NON_DIR', 'Cannot overwrite directory with non-directory')
-E('ERR_FS_CP_EEXIST', 'Target already exists')
-E('ERR_FS_CP_EINVAL', 'Invalid src or dest')
-E('ERR_FS_CP_FIFO_PIPE', 'Cannot copy a FIFO pipe')
-E('ERR_FS_CP_NON_DIR_TO_DIR', 'Cannot overwrite non-directory with directory')
-E('ERR_FS_CP_SOCKET', 'Cannot copy a socket file')
-E('ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY', 'Cannot overwrite symlink in subdirectory of self')
-E('ERR_FS_CP_UNKNOWN', 'Cannot copy an unknown file type')
-E('ERR_FS_EISDIR', 'Path is a directory')
-
-module.exports.ERR_INVALID_ARG_TYPE = class ERR_INVALID_ARG_TYPE extends Error {
-  constructor (name, expected, actual) {
-    super()
-    this.code = 'ERR_INVALID_ARG_TYPE'
-    this.message = `The ${name} argument must be ${expected}. Received ${typeof actual}`
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/fs.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/fs.js
deleted file mode 100644
index 457da10eed03e..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/fs.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const fs = require('fs')
-const promisify = require('@gar/promisify')
-
-const isLower = (s) => s === s.toLowerCase() && s !== s.toUpperCase()
-
-const fsSync = Object.fromEntries(Object.entries(fs).filter(([k, v]) =>
-  typeof v === 'function' && (k.endsWith('Sync') || !isLower(k[0]))
-))
-
-// this module returns the core fs async fns wrapped in a proxy that promisifies
-// method calls within the getter. we keep it in a separate module so that the
-// overridden methods have a consistent way to get to promisified fs methods
-// without creating a circular dependency. the ctors and sync methods are kept untouched
-module.exports = { ...promisify(fs), ...fsSync }
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/index.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/index.js
deleted file mode 100644
index 3a98648eca9a1..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-module.exports = {
-  ...require('./fs.js'),
-  copyFile: require('./copy-file.js'),
-  cp: require('./cp/index.js'),
-  mkdir: require('./mkdir.js'),
-  mkdtemp: require('./mkdtemp.js'),
-  rm: require('./rm/index.js'),
-  withTempDir: require('./with-temp-dir.js'),
-  withOwner: require('./with-owner.js'),
-  withOwnerSync: require('./with-owner-sync.js'),
-  writeFile: require('./write-file.js'),
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdir.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdir.js
deleted file mode 100644
index 098d8d0a09ae3..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdir.js
+++ /dev/null
@@ -1,19 +0,0 @@
-const fs = require('./fs.js')
-const getOptions = require('./common/get-options.js')
-const withOwner = require('./with-owner.js')
-
-// extends mkdir with the ability to specify an owner of the new dir
-const mkdir = async (path, opts) => {
-  const options = getOptions(opts, {
-    copy: ['mode', 'recursive'],
-    wrap: 'mode',
-  })
-
-  return withOwner(
-    path,
-    () => fs.mkdir(path, options),
-    opts
-  )
-}
-
-module.exports = mkdir
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdtemp.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdtemp.js
deleted file mode 100644
index 60b12a788de90..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/mkdtemp.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const { dirname, sep } = require('path')
-
-const fs = require('./fs.js')
-const getOptions = require('./common/get-options.js')
-const withOwner = require('./with-owner.js')
-
-const mkdtemp = async (prefix, opts) => {
-  const options = getOptions(opts, {
-    copy: ['encoding'],
-    wrap: 'encoding',
-  })
-
-  // mkdtemp relies on the trailing path separator to indicate if it should
-  // create a directory inside of the prefix. if that's the case then the root
-  // we infer ownership from is the prefix itself, otherwise it's the dirname
-  // /tmp -> /tmpABCDEF, infers from /
-  // /tmp/ -> /tmp/ABCDEF, infers from /tmp
-  const root = prefix.endsWith(sep) ? prefix : dirname(prefix)
-
-  return withOwner(root, () => fs.mkdtemp(prefix, options), opts)
-}
-
-module.exports = mkdtemp
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/index.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/index.js
deleted file mode 100644
index cb81fbdf8cc47..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-const fs = require('../fs.js')
-const getOptions = require('../common/get-options.js')
-const node = require('../common/node.js')
-const polyfill = require('./polyfill.js')
-
-// node 14.14.0 added fs.rm, which allows both the force and recursive options
-const useNative = node.satisfies('>=14.14.0')
-
-const rm = async (path, opts) => {
-  const options = getOptions(opts, {
-    copy: ['retryDelay', 'maxRetries', 'recursive', 'force'],
-  })
-
-  // the polyfill is tested separately from this module, no need to hack
-  // process.version to try to trigger it just for coverage
-  // istanbul ignore next
-  return useNative
-    ? fs.rm(path, options)
-    : polyfill(path, options)
-}
-
-module.exports = rm
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/polyfill.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/polyfill.js
deleted file mode 100644
index a25c17483b001..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/rm/polyfill.js
+++ /dev/null
@@ -1,239 +0,0 @@
-// this file is a modified version of the code in node core >=14.14.0
-// which is, in turn, a modified version of the rimraf module on npm
-// node core changes:
-// - Use of the assert module has been replaced with core's error system.
-// - All code related to the glob dependency has been removed.
-// - Bring your own custom fs module is not currently supported.
-// - Some basic code cleanup.
-// changes here:
-// - remove all callback related code
-// - drop sync support
-// - change assertions back to non-internal methods (see options.js)
-// - throws ENOTDIR when rmdir gets an ENOENT for a path that exists in Windows
-const errnos = require('os').constants.errno
-const { join } = require('path')
-const fs = require('../fs.js')
-
-// error codes that mean we need to remove contents
-const notEmptyCodes = new Set([
-  'ENOTEMPTY',
-  'EEXIST',
-  'EPERM',
-])
-
-// error codes we can retry later
-const retryCodes = new Set([
-  'EBUSY',
-  'EMFILE',
-  'ENFILE',
-  'ENOTEMPTY',
-  'EPERM',
-])
-
-const isWindows = process.platform === 'win32'
-
-const defaultOptions = {
-  retryDelay: 100,
-  maxRetries: 0,
-  recursive: false,
-  force: false,
-}
-
-// this is drastically simplified, but should be roughly equivalent to what
-// node core throws
-class ERR_FS_EISDIR extends Error {
-  constructor (path) {
-    super()
-    this.info = {
-      code: 'EISDIR',
-      message: 'is a directory',
-      path,
-      syscall: 'rm',
-      errno: errnos.EISDIR,
-    }
-    this.name = 'SystemError'
-    this.code = 'ERR_FS_EISDIR'
-    this.errno = errnos.EISDIR
-    this.syscall = 'rm'
-    this.path = path
-    this.message = `Path is a directory: ${this.syscall} returned ` +
-      `${this.info.code} (is a directory) ${path}`
-  }
-
-  toString () {
-    return `${this.name} [${this.code}]: ${this.message}`
-  }
-}
-
-class ENOTDIR extends Error {
-  constructor (path) {
-    super()
-    this.name = 'Error'
-    this.code = 'ENOTDIR'
-    this.errno = errnos.ENOTDIR
-    this.syscall = 'rmdir'
-    this.path = path
-    this.message = `not a directory, ${this.syscall} '${this.path}'`
-  }
-
-  toString () {
-    return `${this.name}: ${this.code}: ${this.message}`
-  }
-}
-
-// force is passed separately here because we respect it for the first entry
-// into rimraf only, any further calls that are spawned as a result (i.e. to
-// delete content within the target) will ignore ENOENT errors
-const rimraf = async (path, options, isTop = false) => {
-  const force = isTop ? options.force : true
-  const stat = await fs.lstat(path)
-    .catch((err) => {
-      // we only ignore ENOENT if we're forcing this call
-      if (err.code === 'ENOENT' && force) {
-        return
-      }
-
-      if (isWindows && err.code === 'EPERM') {
-        return fixEPERM(path, options, err, isTop)
-      }
-
-      throw err
-    })
-
-  // no stat object here means either lstat threw an ENOENT, or lstat threw
-  // an EPERM and the fixPERM function took care of things. either way, we're
-  // already done, so return early
-  if (!stat) {
-    return
-  }
-
-  if (stat.isDirectory()) {
-    return rmdir(path, options, null, isTop)
-  }
-
-  return fs.unlink(path)
-    .catch((err) => {
-      if (err.code === 'ENOENT' && force) {
-        return
-      }
-
-      if (err.code === 'EISDIR') {
-        return rmdir(path, options, err, isTop)
-      }
-
-      if (err.code === 'EPERM') {
-        // in windows, we handle this through fixEPERM which will also try to
-        // delete things again. everywhere else since deleting the target as a
-        // file didn't work we go ahead and try to delete it as a directory
-        return isWindows
-          ? fixEPERM(path, options, err, isTop)
-          : rmdir(path, options, err, isTop)
-      }
-
-      throw err
-    })
-}
-
-const fixEPERM = async (path, options, originalErr, isTop) => {
-  const force = isTop ? options.force : true
-  const targetMissing = await fs.chmod(path, 0o666)
-    .catch((err) => {
-      if (err.code === 'ENOENT' && force) {
-        return true
-      }
-
-      throw originalErr
-    })
-
-  // got an ENOENT above, return now. no file = no problem
-  if (targetMissing) {
-    return
-  }
-
-  // this function does its own lstat rather than calling rimraf again to avoid
-  // infinite recursion for a repeating EPERM
-  const stat = await fs.lstat(path)
-    .catch((err) => {
-      if (err.code === 'ENOENT' && force) {
-        return
-      }
-
-      throw originalErr
-    })
-
-  if (!stat) {
-    return
-  }
-
-  if (stat.isDirectory()) {
-    return rmdir(path, options, originalErr, isTop)
-  }
-
-  return fs.unlink(path)
-}
-
-const rmdir = async (path, options, originalErr, isTop) => {
-  if (!options.recursive && isTop) {
-    throw originalErr || new ERR_FS_EISDIR(path)
-  }
-  const force = isTop ? options.force : true
-
-  return fs.rmdir(path)
-    .catch(async (err) => {
-      // in Windows, calling rmdir on a file path will fail with ENOENT rather
-      // than ENOTDIR. to determine if that's what happened, we have to do
-      // another lstat on the path. if the path isn't actually gone, we throw
-      // away the ENOENT and replace it with our own ENOTDIR
-      if (isWindows && err.code === 'ENOENT') {
-        const stillExists = await fs.lstat(path).then(() => true, () => false)
-        if (stillExists) {
-          err = new ENOTDIR(path)
-        }
-      }
-
-      // not there, not a problem
-      if (err.code === 'ENOENT' && force) {
-        return
-      }
-
-      // we may not have originalErr if lstat tells us our target is a
-      // directory but that changes before we actually remove it, so
-      // only throw it here if it's set
-      if (originalErr && err.code === 'ENOTDIR') {
-        throw originalErr
-      }
-
-      // the directory isn't empty, remove the contents and try again
-      if (notEmptyCodes.has(err.code)) {
-        const files = await fs.readdir(path)
-        await Promise.all(files.map((file) => {
-          const target = join(path, file)
-          return rimraf(target, options)
-        }))
-        return fs.rmdir(path)
-      }
-
-      throw err
-    })
-}
-
-const rm = async (path, opts) => {
-  const options = { ...defaultOptions, ...opts }
-  let retries = 0
-
-  const errHandler = async (err) => {
-    if (retryCodes.has(err.code) && ++retries < options.maxRetries) {
-      const delay = retries * options.retryDelay
-      await promiseTimeout(delay)
-      return rimraf(path, options, true).catch(errHandler)
-    }
-
-    throw err
-  }
-
-  return rimraf(path, options, true).catch(errHandler)
-}
-
-const promiseTimeout = (ms) => new Promise((r) => setTimeout(r, ms))
-
-module.exports = rm
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner-sync.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner-sync.js
deleted file mode 100644
index 3597d1c810475..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner-sync.js
+++ /dev/null
@@ -1,21 +0,0 @@
-const getOptions = require('./common/get-options.js')
-const owner = require('./common/owner-sync.js')
-
-const withOwnerSync = (path, fn, opts) => {
-  const options = getOptions(opts, {
-    copy: ['owner'],
-  })
-
-  const { uid, gid } = owner.validate(path, options.owner)
-
-  const result = fn({ uid, gid })
-
-  owner.update(path, uid, gid)
-  if (typeof result === 'string') {
-    owner.update(result, uid, gid)
-  }
-
-  return result
-}
-
-module.exports = withOwnerSync
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner.js
deleted file mode 100644
index a679102883dbb..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-owner.js
+++ /dev/null
@@ -1,21 +0,0 @@
-const getOptions = require('./common/get-options.js')
-const owner = require('./common/owner.js')
-
-const withOwner = async (path, fn, opts) => {
-  const options = getOptions(opts, {
-    copy: ['owner'],
-  })
-
-  const { uid, gid } = await owner.validate(path, options.owner)
-
-  const result = await fn({ uid, gid })
-
-  await Promise.all([
-    owner.update(path, uid, gid),
-    typeof result === 'string' ? owner.update(result, uid, gid) : null,
-  ])
-
-  return result
-}
-
-module.exports = withOwner
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-temp-dir.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-temp-dir.js
deleted file mode 100644
index 81db59dd054b4..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/with-temp-dir.js
+++ /dev/null
@@ -1,41 +0,0 @@
-const { join, sep } = require('path')
-
-const getOptions = require('./common/get-options.js')
-const mkdir = require('./mkdir.js')
-const mkdtemp = require('./mkdtemp.js')
-const rm = require('./rm/index.js')
-
-// create a temp directory, ensure its permissions match its parent, then call
-// the supplied function passing it the path to the directory. clean up after
-// the function finishes, whether it throws or not
-const withTempDir = async (root, fn, opts) => {
-  const options = getOptions(opts, {
-    copy: ['tmpPrefix'],
-  })
-  // create the directory, and fix its ownership
-  await mkdir(root, { recursive: true, owner: 'inherit' })
-
-  const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || ''), { owner: 'inherit' })
-  let err
-  let result
-
-  try {
-    result = await fn(target)
-  } catch (_err) {
-    err = _err
-  }
-
-  try {
-    await rm(target, { force: true, recursive: true })
-  } catch {
-    // ignore errors
-  }
-
-  if (err) {
-    throw err
-  }
-
-  return result
-}
-
-module.exports = withTempDir
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/write-file.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/write-file.js
deleted file mode 100644
index ff900571a1f28..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/lib/write-file.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const fs = require('./fs.js')
-const getOptions = require('./common/get-options.js')
-const withOwner = require('./with-owner.js')
-
-const writeFile = async (file, data, opts) => {
-  const options = getOptions(opts, {
-    copy: ['encoding', 'mode', 'flag', 'signal'],
-    wrap: 'encoding',
-  })
-
-  return withOwner(file, () => fs.writeFile(file, data, options), opts)
-}
-
-module.exports = writeFile
diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/package.json b/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/package.json
deleted file mode 100644
index 1512fd6e4b0ac..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/@npmcli/fs/package.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
-  "name": "@npmcli/fs",
-  "version": "2.1.2",
-  "description": "filesystem utilities for the npm cli",
-  "main": "lib/index.js",
-  "files": [
-    "bin/",
-    "lib/"
-  ],
-  "scripts": {
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "prepublishOnly": "git push origin --follow-tags",
-    "snap": "tap",
-    "test": "tap",
-    "npmclilint": "npmcli-lint",
-    "lint": "eslint \"**/*.js\"",
-    "lintfix": "npm run lint -- --fix",
-    "posttest": "npm run lint",
-    "postsnap": "npm run lintfix --",
-    "postlint": "template-oss-check",
-    "template-oss-apply": "template-oss-apply --force"
-  },
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/npm/fs.git"
-  },
-  "keywords": [
-    "npm",
-    "oss"
-  ],
-  "author": "GitHub Inc.",
-  "license": "ISC",
-  "devDependencies": {
-    "@npmcli/eslint-config": "^3.0.1",
-    "@npmcli/template-oss": "3.5.0",
-    "tap": "^16.0.1"
-  },
-  "dependencies": {
-    "@gar/promisify": "^1.1.3",
-    "semver": "^7.3.5"
-  },
-  "engines": {
-    "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
-  },
-  "templateOSS": {
-    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
-    "version": "3.5.0"
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/abbrev/LICENSE b/node_modules/@npmcli/run-script/node_modules/abbrev/LICENSE
deleted file mode 100644
index 9bcfa9d7d8d26..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/abbrev/LICENSE
+++ /dev/null
@@ -1,46 +0,0 @@
-This software is dual-licensed under the ISC and MIT licenses.
-You may use this software under EITHER of the following licenses.
-
-----------
-
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-----------
-
-Copyright Isaac Z. Schlueter and Contributors
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/abbrev/abbrev.js b/node_modules/@npmcli/run-script/node_modules/abbrev/abbrev.js
deleted file mode 100644
index 7b1dc5d67694a..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/abbrev/abbrev.js
+++ /dev/null
@@ -1,61 +0,0 @@
-module.exports = exports = abbrev.abbrev = abbrev
-
-abbrev.monkeyPatch = monkeyPatch
-
-function monkeyPatch () {
-  Object.defineProperty(Array.prototype, 'abbrev', {
-    value: function () { return abbrev(this) },
-    enumerable: false, configurable: true, writable: true
-  })
-
-  Object.defineProperty(Object.prototype, 'abbrev', {
-    value: function () { return abbrev(Object.keys(this)) },
-    enumerable: false, configurable: true, writable: true
-  })
-}
-
-function abbrev (list) {
-  if (arguments.length !== 1 || !Array.isArray(list)) {
-    list = Array.prototype.slice.call(arguments, 0)
-  }
-  for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
-    args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
-  }
-
-  // sort them lexicographically, so that they're next to their nearest kin
-  args = args.sort(lexSort)
-
-  // walk through each, seeing how much it has in common with the next and previous
-  var abbrevs = {}
-    , prev = ""
-  for (var i = 0, l = args.length ; i < l ; i ++) {
-    var current = args[i]
-      , next = args[i + 1] || ""
-      , nextMatches = true
-      , prevMatches = true
-    if (current === next) continue
-    for (var j = 0, cl = current.length ; j < cl ; j ++) {
-      var curChar = current.charAt(j)
-      nextMatches = nextMatches && curChar === next.charAt(j)
-      prevMatches = prevMatches && curChar === prev.charAt(j)
-      if (!nextMatches && !prevMatches) {
-        j ++
-        break
-      }
-    }
-    prev = current
-    if (j === cl) {
-      abbrevs[current] = current
-      continue
-    }
-    for (var a = current.substr(0, j) ; j <= cl ; j ++) {
-      abbrevs[a] = current
-      a += current.charAt(j)
-    }
-  }
-  return abbrevs
-}
-
-function lexSort (a, b) {
-  return a === b ? 0 : a > b ? 1 : -1
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/abbrev/package.json b/node_modules/@npmcli/run-script/node_modules/abbrev/package.json
deleted file mode 100644
index bf4e8015bba9d..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/abbrev/package.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
-  "name": "abbrev",
-  "version": "1.1.1",
-  "description": "Like ruby's abbrev module, but in js",
-  "author": "Isaac Z. Schlueter ",
-  "main": "abbrev.js",
-  "scripts": {
-    "test": "tap test.js --100",
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "postpublish": "git push origin --all; git push origin --tags"
-  },
-  "repository": "http://github.com/isaacs/abbrev-js",
-  "license": "ISC",
-  "devDependencies": {
-    "tap": "^10.1"
-  },
-  "files": [
-    "abbrev.js"
-  ]
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/LICENSE.md
deleted file mode 100644
index 845be76f64e78..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/LICENSE.md
+++ /dev/null
@@ -1,18 +0,0 @@
-ISC License
-
-Copyright npm, Inc.
-
-Permission to use, copy, modify, and/or distribute this
-software for any purpose with or without fee is hereby
-granted, provided that the above copyright notice and this
-permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
-EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
-INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
-USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/index.js b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/index.js
deleted file mode 100644
index 57d8743fdad17..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-'use strict'
-exports.TrackerGroup = require('./tracker-group.js')
-exports.Tracker = require('./tracker.js')
-exports.TrackerStream = require('./tracker-stream.js')
diff --git a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-base.js b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-base.js
deleted file mode 100644
index 6f436875578a7..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-base.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-var EventEmitter = require('events').EventEmitter
-var util = require('util')
-
-var trackerId = 0
-var TrackerBase = module.exports = function (name) {
-  EventEmitter.call(this)
-  this.id = ++trackerId
-  this.name = name
-}
-util.inherits(TrackerBase, EventEmitter)
diff --git a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-group.js b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-group.js
deleted file mode 100644
index a3c7af804c4d3..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-group.js
+++ /dev/null
@@ -1,116 +0,0 @@
-'use strict'
-var util = require('util')
-var TrackerBase = require('./tracker-base.js')
-var Tracker = require('./tracker.js')
-var TrackerStream = require('./tracker-stream.js')
-
-var TrackerGroup = module.exports = function (name) {
-  TrackerBase.call(this, name)
-  this.parentGroup = null
-  this.trackers = []
-  this.completion = {}
-  this.weight = {}
-  this.totalWeight = 0
-  this.finished = false
-  this.bubbleChange = bubbleChange(this)
-}
-util.inherits(TrackerGroup, TrackerBase)
-
-function bubbleChange (trackerGroup) {
-  return function (name, completed, tracker) {
-    trackerGroup.completion[tracker.id] = completed
-    if (trackerGroup.finished) {
-      return
-    }
-    trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup)
-  }
-}
-
-TrackerGroup.prototype.nameInTree = function () {
-  var names = []
-  var from = this
-  while (from) {
-    names.unshift(from.name)
-    from = from.parentGroup
-  }
-  return names.join('/')
-}
-
-TrackerGroup.prototype.addUnit = function (unit, weight) {
-  if (unit.addUnit) {
-    var toTest = this
-    while (toTest) {
-      if (unit === toTest) {
-        throw new Error(
-          'Attempted to add tracker group ' +
-          unit.name + ' to tree that already includes it ' +
-          this.nameInTree(this))
-      }
-      toTest = toTest.parentGroup
-    }
-    unit.parentGroup = this
-  }
-  this.weight[unit.id] = weight || 1
-  this.totalWeight += this.weight[unit.id]
-  this.trackers.push(unit)
-  this.completion[unit.id] = unit.completed()
-  unit.on('change', this.bubbleChange)
-  if (!this.finished) {
-    this.emit('change', unit.name, this.completion[unit.id], unit)
-  }
-  return unit
-}
-
-TrackerGroup.prototype.completed = function () {
-  if (this.trackers.length === 0) {
-    return 0
-  }
-  var valPerWeight = 1 / this.totalWeight
-  var completed = 0
-  for (var ii = 0; ii < this.trackers.length; ii++) {
-    var trackerId = this.trackers[ii].id
-    completed +=
-      valPerWeight * this.weight[trackerId] * this.completion[trackerId]
-  }
-  return completed
-}
-
-TrackerGroup.prototype.newGroup = function (name, weight) {
-  return this.addUnit(new TrackerGroup(name), weight)
-}
-
-TrackerGroup.prototype.newItem = function (name, todo, weight) {
-  return this.addUnit(new Tracker(name, todo), weight)
-}
-
-TrackerGroup.prototype.newStream = function (name, todo, weight) {
-  return this.addUnit(new TrackerStream(name, todo), weight)
-}
-
-TrackerGroup.prototype.finish = function () {
-  this.finished = true
-  if (!this.trackers.length) {
-    this.addUnit(new Tracker(), 1, true)
-  }
-  for (var ii = 0; ii < this.trackers.length; ii++) {
-    var tracker = this.trackers[ii]
-    tracker.finish()
-    tracker.removeListener('change', this.bubbleChange)
-  }
-  this.emit('change', this.name, 1, this)
-}
-
-var buffer = '                                  '
-TrackerGroup.prototype.debug = function (depth) {
-  depth = depth || 0
-  var indent = depth ? buffer.slice(0, depth) : ''
-  var output = indent + (this.name || 'top') + ': ' + this.completed() + '\n'
-  this.trackers.forEach(function (tracker) {
-    if (tracker instanceof TrackerGroup) {
-      output += tracker.debug(depth + 1)
-    } else {
-      output += indent + ' ' + tracker.name + ': ' + tracker.completed() + '\n'
-    }
-  })
-  return output
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-stream.js b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-stream.js
deleted file mode 100644
index e1cf85055702a..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker-stream.js
+++ /dev/null
@@ -1,36 +0,0 @@
-'use strict'
-var util = require('util')
-var stream = require('readable-stream')
-var delegate = require('delegates')
-var Tracker = require('./tracker.js')
-
-var TrackerStream = module.exports = function (name, size, options) {
-  stream.Transform.call(this, options)
-  this.tracker = new Tracker(name, size)
-  this.name = name
-  this.id = this.tracker.id
-  this.tracker.on('change', delegateChange(this))
-}
-util.inherits(TrackerStream, stream.Transform)
-
-function delegateChange (trackerStream) {
-  return function (name, completion, tracker) {
-    trackerStream.emit('change', name, completion, trackerStream)
-  }
-}
-
-TrackerStream.prototype._transform = function (data, encoding, cb) {
-  this.tracker.completeWork(data.length ? data.length : 1)
-  this.push(data)
-  cb()
-}
-
-TrackerStream.prototype._flush = function (cb) {
-  this.tracker.finish()
-  cb()
-}
-
-delegate(TrackerStream.prototype, 'tracker')
-  .method('completed')
-  .method('addWork')
-  .method('finish')
diff --git a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker.js b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker.js
deleted file mode 100644
index a8f8b3ba01391..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/lib/tracker.js
+++ /dev/null
@@ -1,32 +0,0 @@
-'use strict'
-var util = require('util')
-var TrackerBase = require('./tracker-base.js')
-
-var Tracker = module.exports = function (name, todo) {
-  TrackerBase.call(this, name)
-  this.workDone = 0
-  this.workTodo = todo || 0
-}
-util.inherits(Tracker, TrackerBase)
-
-Tracker.prototype.completed = function () {
-  return this.workTodo === 0 ? 0 : this.workDone / this.workTodo
-}
-
-Tracker.prototype.addWork = function (work) {
-  this.workTodo += work
-  this.emit('change', this.name, this.completed(), this)
-}
-
-Tracker.prototype.completeWork = function (work) {
-  this.workDone += work
-  if (this.workDone > this.workTodo) {
-    this.workDone = this.workTodo
-  }
-  this.emit('change', this.name, this.completed(), this)
-}
-
-Tracker.prototype.finish = function () {
-  this.workTodo = this.workDone = 1
-  this.emit('change', this.name, 1, this)
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/package.json b/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/package.json
deleted file mode 100644
index cc3d7504299fa..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/are-we-there-yet/package.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
-  "name": "are-we-there-yet",
-  "version": "3.0.1",
-  "description": "Keep track of the overall completion of many disparate processes",
-  "main": "lib/index.js",
-  "scripts": {
-    "test": "tap",
-    "npmclilint": "npmcli-lint",
-    "lint": "eslint \"**/*.js\"",
-    "lintfix": "npm run lint -- --fix",
-    "posttest": "npm run lint",
-    "postsnap": "npm run lintfix --",
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "prepublishOnly": "git push origin --follow-tags",
-    "snap": "tap",
-    "postlint": "template-oss-check",
-    "template-oss-apply": "template-oss-apply --force"
-  },
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/npm/are-we-there-yet.git"
-  },
-  "author": "GitHub Inc.",
-  "license": "ISC",
-  "bugs": {
-    "url": "https://github.com/npm/are-we-there-yet/issues"
-  },
-  "homepage": "https://github.com/npm/are-we-there-yet",
-  "devDependencies": {
-    "@npmcli/eslint-config": "^3.0.1",
-    "@npmcli/template-oss": "3.5.0",
-    "tap": "^16.0.1"
-  },
-  "dependencies": {
-    "delegates": "^1.0.0",
-    "readable-stream": "^3.6.0"
-  },
-  "files": [
-    "bin/",
-    "lib/"
-  ],
-  "engines": {
-    "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
-  },
-  "tap": {
-    "branches": 68,
-    "statements": 92,
-    "functions": 86,
-    "lines": 92
-  },
-  "templateOSS": {
-    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
-    "version": "3.5.0"
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/brace-expansion/LICENSE b/node_modules/@npmcli/run-script/node_modules/brace-expansion/LICENSE
deleted file mode 100644
index de3226673c387..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/brace-expansion/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2013 Julian Gruber 
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/brace-expansion/index.js b/node_modules/@npmcli/run-script/node_modules/brace-expansion/index.js
deleted file mode 100644
index 0478be81eabc2..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/brace-expansion/index.js
+++ /dev/null
@@ -1,201 +0,0 @@
-var concatMap = require('concat-map');
-var balanced = require('balanced-match');
-
-module.exports = expandTop;
-
-var escSlash = '\0SLASH'+Math.random()+'\0';
-var escOpen = '\0OPEN'+Math.random()+'\0';
-var escClose = '\0CLOSE'+Math.random()+'\0';
-var escComma = '\0COMMA'+Math.random()+'\0';
-var escPeriod = '\0PERIOD'+Math.random()+'\0';
-
-function numeric(str) {
-  return parseInt(str, 10) == str
-    ? parseInt(str, 10)
-    : str.charCodeAt(0);
-}
-
-function escapeBraces(str) {
-  return str.split('\\\\').join(escSlash)
-            .split('\\{').join(escOpen)
-            .split('\\}').join(escClose)
-            .split('\\,').join(escComma)
-            .split('\\.').join(escPeriod);
-}
-
-function unescapeBraces(str) {
-  return str.split(escSlash).join('\\')
-            .split(escOpen).join('{')
-            .split(escClose).join('}')
-            .split(escComma).join(',')
-            .split(escPeriod).join('.');
-}
-
-
-// Basically just str.split(","), but handling cases
-// where we have nested braced sections, which should be
-// treated as individual members, like {a,{b,c},d}
-function parseCommaParts(str) {
-  if (!str)
-    return [''];
-
-  var parts = [];
-  var m = balanced('{', '}', str);
-
-  if (!m)
-    return str.split(',');
-
-  var pre = m.pre;
-  var body = m.body;
-  var post = m.post;
-  var p = pre.split(',');
-
-  p[p.length-1] += '{' + body + '}';
-  var postParts = parseCommaParts(post);
-  if (post.length) {
-    p[p.length-1] += postParts.shift();
-    p.push.apply(p, postParts);
-  }
-
-  parts.push.apply(parts, p);
-
-  return parts;
-}
-
-function expandTop(str) {
-  if (!str)
-    return [];
-
-  // I don't know why Bash 4.3 does this, but it does.
-  // Anything starting with {} will have the first two bytes preserved
-  // but *only* at the top level, so {},a}b will not expand to anything,
-  // but a{},b}c will be expanded to [a}c,abc].
-  // One could argue that this is a bug in Bash, but since the goal of
-  // this module is to match Bash's rules, we escape a leading {}
-  if (str.substr(0, 2) === '{}') {
-    str = '\\{\\}' + str.substr(2);
-  }
-
-  return expand(escapeBraces(str), true).map(unescapeBraces);
-}
-
-function identity(e) {
-  return e;
-}
-
-function embrace(str) {
-  return '{' + str + '}';
-}
-function isPadded(el) {
-  return /^-?0\d/.test(el);
-}
-
-function lte(i, y) {
-  return i <= y;
-}
-function gte(i, y) {
-  return i >= y;
-}
-
-function expand(str, isTop) {
-  var expansions = [];
-
-  var m = balanced('{', '}', str);
-  if (!m || /\$$/.test(m.pre)) return [str];
-
-  var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
-  var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
-  var isSequence = isNumericSequence || isAlphaSequence;
-  var isOptions = m.body.indexOf(',') >= 0;
-  if (!isSequence && !isOptions) {
-    // {a},b}
-    if (m.post.match(/,.*\}/)) {
-      str = m.pre + '{' + m.body + escClose + m.post;
-      return expand(str);
-    }
-    return [str];
-  }
-
-  var n;
-  if (isSequence) {
-    n = m.body.split(/\.\./);
-  } else {
-    n = parseCommaParts(m.body);
-    if (n.length === 1) {
-      // x{{a,b}}y ==> x{a}y x{b}y
-      n = expand(n[0], false).map(embrace);
-      if (n.length === 1) {
-        var post = m.post.length
-          ? expand(m.post, false)
-          : [''];
-        return post.map(function(p) {
-          return m.pre + n[0] + p;
-        });
-      }
-    }
-  }
-
-  // at this point, n is the parts, and we know it's not a comma set
-  // with a single entry.
-
-  // no need to expand pre, since it is guaranteed to be free of brace-sets
-  var pre = m.pre;
-  var post = m.post.length
-    ? expand(m.post, false)
-    : [''];
-
-  var N;
-
-  if (isSequence) {
-    var x = numeric(n[0]);
-    var y = numeric(n[1]);
-    var width = Math.max(n[0].length, n[1].length)
-    var incr = n.length == 3
-      ? Math.abs(numeric(n[2]))
-      : 1;
-    var test = lte;
-    var reverse = y < x;
-    if (reverse) {
-      incr *= -1;
-      test = gte;
-    }
-    var pad = n.some(isPadded);
-
-    N = [];
-
-    for (var i = x; test(i, y); i += incr) {
-      var c;
-      if (isAlphaSequence) {
-        c = String.fromCharCode(i);
-        if (c === '\\')
-          c = '';
-      } else {
-        c = String(i);
-        if (pad) {
-          var need = width - c.length;
-          if (need > 0) {
-            var z = new Array(need + 1).join('0');
-            if (i < 0)
-              c = '-' + z + c.slice(1);
-            else
-              c = z + c;
-          }
-        }
-      }
-      N.push(c);
-    }
-  } else {
-    N = concatMap(n, function(el) { return expand(el, false) });
-  }
-
-  for (var j = 0; j < N.length; j++) {
-    for (var k = 0; k < post.length; k++) {
-      var expansion = pre + N[j] + post[k];
-      if (!isTop || isSequence || expansion)
-        expansions.push(expansion);
-    }
-  }
-
-  return expansions;
-}
-
diff --git a/node_modules/@npmcli/run-script/node_modules/brace-expansion/package.json b/node_modules/@npmcli/run-script/node_modules/brace-expansion/package.json
deleted file mode 100644
index a18faa8fd67b8..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/brace-expansion/package.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
-  "name": "brace-expansion",
-  "description": "Brace expansion as known from sh/bash",
-  "version": "1.1.11",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/juliangruber/brace-expansion.git"
-  },
-  "homepage": "https://github.com/juliangruber/brace-expansion",
-  "main": "index.js",
-  "scripts": {
-    "test": "tape test/*.js",
-    "gentest": "bash test/generate.sh",
-    "bench": "matcha test/perf/bench.js"
-  },
-  "dependencies": {
-    "balanced-match": "^1.0.0",
-    "concat-map": "0.0.1"
-  },
-  "devDependencies": {
-    "matcha": "^0.7.0",
-    "tape": "^4.6.0"
-  },
-  "keywords": [],
-  "author": {
-    "name": "Julian Gruber",
-    "email": "mail@juliangruber.com",
-    "url": "http://juliangruber.com"
-  },
-  "license": "MIT",
-  "testling": {
-    "files": "test/*.js",
-    "browsers": [
-      "ie/8..latest",
-      "firefox/20..latest",
-      "firefox/nightly",
-      "chrome/25..latest",
-      "chrome/canary",
-      "opera/12..latest",
-      "opera/next",
-      "safari/5.1..latest",
-      "ipad/6.0..latest",
-      "iphone/6.0..latest",
-      "android-browser/4.2..latest"
-    ]
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/cacache/LICENSE.md
deleted file mode 100644
index 8d28acf866d93..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/LICENSE.md
+++ /dev/null
@@ -1,16 +0,0 @@
-ISC License
-
-Copyright (c) npm, Inc.
-
-Permission to use, copy, modify, and/or distribute this software for
-any purpose with or without fee is hereby granted, provided that the
-above copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER DISCLAIMS
-ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
-OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
-USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/path.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/path.js
deleted file mode 100644
index ad5a76a4f73f2..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/path.js
+++ /dev/null
@@ -1,29 +0,0 @@
-'use strict'
-
-const contentVer = require('../../package.json')['cache-version'].content
-const hashToSegments = require('../util/hash-to-segments')
-const path = require('path')
-const ssri = require('ssri')
-
-// Current format of content file path:
-//
-// sha512-BaSE64Hex= ->
-// ~/.my-cache/content-v2/sha512/ba/da/55deadbeefc0ffee
-//
-module.exports = contentPath
-
-function contentPath (cache, integrity) {
-  const sri = ssri.parse(integrity, { single: true })
-  // contentPath is the *strongest* algo given
-  return path.join(
-    contentDir(cache),
-    sri.algorithm,
-    ...hashToSegments(sri.hexDigest())
-  )
-}
-
-module.exports.contentDir = contentDir
-
-function contentDir (cache) {
-  return path.join(cache, `content-v${contentVer}`)
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/read.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/read.js
deleted file mode 100644
index 7c20c75257b4f..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/read.js
+++ /dev/null
@@ -1,241 +0,0 @@
-'use strict'
-
-const fs = require('@npmcli/fs')
-const fsm = require('fs-minipass')
-const ssri = require('ssri')
-const contentPath = require('./path')
-const Pipeline = require('minipass-pipeline')
-
-module.exports = read
-
-const MAX_SINGLE_READ_SIZE = 64 * 1024 * 1024
-async function read (cache, integrity, opts = {}) {
-  const { size } = opts
-  const { stat, cpath, sri } = await withContentSri(cache, integrity, async (cpath, sri) => {
-    // get size
-    const stat = await fs.stat(cpath)
-    return { stat, cpath, sri }
-  })
-  if (typeof size === 'number' && stat.size !== size) {
-    throw sizeError(size, stat.size)
-  }
-
-  if (stat.size > MAX_SINGLE_READ_SIZE) {
-    return readPipeline(cpath, stat.size, sri, new Pipeline()).concat()
-  }
-
-  const data = await fs.readFile(cpath, { encoding: null })
-  if (!ssri.checkData(data, sri)) {
-    throw integrityError(sri, cpath)
-  }
-
-  return data
-}
-
-const readPipeline = (cpath, size, sri, stream) => {
-  stream.push(
-    new fsm.ReadStream(cpath, {
-      size,
-      readSize: MAX_SINGLE_READ_SIZE,
-    }),
-    ssri.integrityStream({
-      integrity: sri,
-      size,
-    })
-  )
-  return stream
-}
-
-module.exports.sync = readSync
-
-function readSync (cache, integrity, opts = {}) {
-  const { size } = opts
-  return withContentSriSync(cache, integrity, (cpath, sri) => {
-    const data = fs.readFileSync(cpath, { encoding: null })
-    if (typeof size === 'number' && size !== data.length) {
-      throw sizeError(size, data.length)
-    }
-
-    if (ssri.checkData(data, sri)) {
-      return data
-    }
-
-    throw integrityError(sri, cpath)
-  })
-}
-
-module.exports.stream = readStream
-module.exports.readStream = readStream
-
-function readStream (cache, integrity, opts = {}) {
-  const { size } = opts
-  const stream = new Pipeline()
-  // Set all this up to run on the stream and then just return the stream
-  Promise.resolve().then(async () => {
-    const { stat, cpath, sri } = await withContentSri(cache, integrity, async (cpath, sri) => {
-      // just stat to ensure it exists
-      const stat = await fs.stat(cpath)
-      return { stat, cpath, sri }
-    })
-    if (typeof size === 'number' && size !== stat.size) {
-      return stream.emit('error', sizeError(size, stat.size))
-    }
-
-    return readPipeline(cpath, stat.size, sri, stream)
-  }).catch(err => stream.emit('error', err))
-
-  return stream
-}
-
-module.exports.copy = copy
-module.exports.copy.sync = copySync
-
-function copy (cache, integrity, dest) {
-  return withContentSri(cache, integrity, (cpath, sri) => {
-    return fs.copyFile(cpath, dest)
-  })
-}
-
-function copySync (cache, integrity, dest) {
-  return withContentSriSync(cache, integrity, (cpath, sri) => {
-    return fs.copyFileSync(cpath, dest)
-  })
-}
-
-module.exports.hasContent = hasContent
-
-async function hasContent (cache, integrity) {
-  if (!integrity) {
-    return false
-  }
-
-  try {
-    return await withContentSri(cache, integrity, async (cpath, sri) => {
-      const stat = await fs.stat(cpath)
-      return { size: stat.size, sri, stat }
-    })
-  } catch (err) {
-    if (err.code === 'ENOENT') {
-      return false
-    }
-
-    if (err.code === 'EPERM') {
-      /* istanbul ignore else */
-      if (process.platform !== 'win32') {
-        throw err
-      } else {
-        return false
-      }
-    }
-  }
-}
-
-module.exports.hasContent.sync = hasContentSync
-
-function hasContentSync (cache, integrity) {
-  if (!integrity) {
-    return false
-  }
-
-  return withContentSriSync(cache, integrity, (cpath, sri) => {
-    try {
-      const stat = fs.statSync(cpath)
-      return { size: stat.size, sri, stat }
-    } catch (err) {
-      if (err.code === 'ENOENT') {
-        return false
-      }
-
-      if (err.code === 'EPERM') {
-        /* istanbul ignore else */
-        if (process.platform !== 'win32') {
-          throw err
-        } else {
-          return false
-        }
-      }
-    }
-  })
-}
-
-async function withContentSri (cache, integrity, fn) {
-  const sri = ssri.parse(integrity)
-  // If `integrity` has multiple entries, pick the first digest
-  // with available local data.
-  const algo = sri.pickAlgorithm()
-  const digests = sri[algo]
-
-  if (digests.length <= 1) {
-    const cpath = contentPath(cache, digests[0])
-    return fn(cpath, digests[0])
-  } else {
-    // Can't use race here because a generic error can happen before
-    // a ENOENT error, and can happen before a valid result
-    const results = await Promise.all(digests.map(async (meta) => {
-      try {
-        return await withContentSri(cache, meta, fn)
-      } catch (err) {
-        if (err.code === 'ENOENT') {
-          return Object.assign(
-            new Error('No matching content found for ' + sri.toString()),
-            { code: 'ENOENT' }
-          )
-        }
-        return err
-      }
-    }))
-    // Return the first non error if it is found
-    const result = results.find((r) => !(r instanceof Error))
-    if (result) {
-      return result
-    }
-
-    // Throw the No matching content found error
-    const enoentError = results.find((r) => r.code === 'ENOENT')
-    if (enoentError) {
-      throw enoentError
-    }
-
-    // Throw generic error
-    throw results.find((r) => r instanceof Error)
-  }
-}
-
-function withContentSriSync (cache, integrity, fn) {
-  const sri = ssri.parse(integrity)
-  // If `integrity` has multiple entries, pick the first digest
-  // with available local data.
-  const algo = sri.pickAlgorithm()
-  const digests = sri[algo]
-  if (digests.length <= 1) {
-    const cpath = contentPath(cache, digests[0])
-    return fn(cpath, digests[0])
-  } else {
-    let lastErr = null
-    for (const meta of digests) {
-      try {
-        return withContentSriSync(cache, meta, fn)
-      } catch (err) {
-        lastErr = err
-      }
-    }
-    throw lastErr
-  }
-}
-
-function sizeError (expected, found) {
-  /* eslint-disable-next-line max-len */
-  const err = new Error(`Bad data size: expected inserted data to be ${expected} bytes, but got ${found} instead`)
-  err.expected = expected
-  err.found = found
-  err.code = 'EBADSIZE'
-  return err
-}
-
-function integrityError (sri, path) {
-  const err = new Error(`Integrity verification failed for ${sri} (${path})`)
-  err.code = 'EINTEGRITY'
-  err.sri = sri
-  err.path = path
-  return err
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/rm.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/rm.js
deleted file mode 100644
index f7333053b393f..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/rm.js
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict'
-
-const util = require('util')
-
-const contentPath = require('./path')
-const { hasContent } = require('./read')
-const rimraf = util.promisify(require('rimraf'))
-
-module.exports = rm
-
-async function rm (cache, integrity) {
-  const content = await hasContent(cache, integrity)
-  // ~pretty~ sure we can't end up with a content lacking sri, but be safe
-  if (content && content.sri) {
-    await rimraf(contentPath(cache, content.sri))
-    return true
-  } else {
-    return false
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/write.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/write.js
deleted file mode 100644
index 0e8c0f4936064..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/content/write.js
+++ /dev/null
@@ -1,189 +0,0 @@
-'use strict'
-
-const events = require('events')
-const util = require('util')
-
-const contentPath = require('./path')
-const fixOwner = require('../util/fix-owner')
-const fs = require('@npmcli/fs')
-const moveFile = require('../util/move-file')
-const Minipass = require('minipass')
-const Pipeline = require('minipass-pipeline')
-const Flush = require('minipass-flush')
-const path = require('path')
-const rimraf = util.promisify(require('rimraf'))
-const ssri = require('ssri')
-const uniqueFilename = require('unique-filename')
-const fsm = require('fs-minipass')
-
-module.exports = write
-
-async function write (cache, data, opts = {}) {
-  const { algorithms, size, integrity } = opts
-  if (algorithms && algorithms.length > 1) {
-    throw new Error('opts.algorithms only supports a single algorithm for now')
-  }
-
-  if (typeof size === 'number' && data.length !== size) {
-    throw sizeError(size, data.length)
-  }
-
-  const sri = ssri.fromData(data, algorithms ? { algorithms } : {})
-  if (integrity && !ssri.checkData(data, integrity, opts)) {
-    throw checksumError(integrity, sri)
-  }
-
-  const tmp = await makeTmp(cache, opts)
-  try {
-    await fs.writeFile(tmp.target, data, { flag: 'wx' })
-    await moveToDestination(tmp, cache, sri, opts)
-    return { integrity: sri, size: data.length }
-  } finally {
-    if (!tmp.moved) {
-      await rimraf(tmp.target)
-    }
-  }
-}
-
-module.exports.stream = writeStream
-
-// writes proxied to the 'inputStream' that is passed to the Promise
-// 'end' is deferred until content is handled.
-class CacacheWriteStream extends Flush {
-  constructor (cache, opts) {
-    super()
-    this.opts = opts
-    this.cache = cache
-    this.inputStream = new Minipass()
-    this.inputStream.on('error', er => this.emit('error', er))
-    this.inputStream.on('drain', () => this.emit('drain'))
-    this.handleContentP = null
-  }
-
-  write (chunk, encoding, cb) {
-    if (!this.handleContentP) {
-      this.handleContentP = handleContent(
-        this.inputStream,
-        this.cache,
-        this.opts
-      )
-    }
-    return this.inputStream.write(chunk, encoding, cb)
-  }
-
-  flush (cb) {
-    this.inputStream.end(() => {
-      if (!this.handleContentP) {
-        const e = new Error('Cache input stream was empty')
-        e.code = 'ENODATA'
-        // empty streams are probably emitting end right away.
-        // defer this one tick by rejecting a promise on it.
-        return Promise.reject(e).catch(cb)
-      }
-      // eslint-disable-next-line promise/catch-or-return
-      this.handleContentP.then(
-        (res) => {
-          res.integrity && this.emit('integrity', res.integrity)
-          // eslint-disable-next-line promise/always-return
-          res.size !== null && this.emit('size', res.size)
-          cb()
-        },
-        (er) => cb(er)
-      )
-    })
-  }
-}
-
-function writeStream (cache, opts = {}) {
-  return new CacacheWriteStream(cache, opts)
-}
-
-async function handleContent (inputStream, cache, opts) {
-  const tmp = await makeTmp(cache, opts)
-  try {
-    const res = await pipeToTmp(inputStream, cache, tmp.target, opts)
-    await moveToDestination(
-      tmp,
-      cache,
-      res.integrity,
-      opts
-    )
-    return res
-  } finally {
-    if (!tmp.moved) {
-      await rimraf(tmp.target)
-    }
-  }
-}
-
-async function pipeToTmp (inputStream, cache, tmpTarget, opts) {
-  const outStream = new fsm.WriteStream(tmpTarget, {
-    flags: 'wx',
-  })
-
-  if (opts.integrityEmitter) {
-    // we need to create these all simultaneously since they can fire in any order
-    const [integrity, size] = await Promise.all([
-      events.once(opts.integrityEmitter, 'integrity').then(res => res[0]),
-      events.once(opts.integrityEmitter, 'size').then(res => res[0]),
-      new Pipeline(inputStream, outStream).promise(),
-    ])
-    return { integrity, size }
-  }
-
-  let integrity
-  let size
-  const hashStream = ssri.integrityStream({
-    integrity: opts.integrity,
-    algorithms: opts.algorithms,
-    size: opts.size,
-  })
-  hashStream.on('integrity', i => {
-    integrity = i
-  })
-  hashStream.on('size', s => {
-    size = s
-  })
-
-  const pipeline = new Pipeline(inputStream, hashStream, outStream)
-  await pipeline.promise()
-  return { integrity, size }
-}
-
-async function makeTmp (cache, opts) {
-  const tmpTarget = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix)
-  await fixOwner.mkdirfix(cache, path.dirname(tmpTarget))
-  return {
-    target: tmpTarget,
-    moved: false,
-  }
-}
-
-async function moveToDestination (tmp, cache, sri, opts) {
-  const destination = contentPath(cache, sri)
-  const destDir = path.dirname(destination)
-
-  await fixOwner.mkdirfix(cache, destDir)
-  await moveFile(tmp.target, destination)
-  tmp.moved = true
-  await fixOwner.chownr(cache, destination)
-}
-
-function sizeError (expected, found) {
-  /* eslint-disable-next-line max-len */
-  const err = new Error(`Bad data size: expected inserted data to be ${expected} bytes, but got ${found} instead`)
-  err.expected = expected
-  err.found = found
-  err.code = 'EBADSIZE'
-  return err
-}
-
-function checksumError (expected, found) {
-  const err = new Error(`Integrity check failed:
-  Wanted: ${expected}
-   Found: ${found}`)
-  err.code = 'EINTEGRITY'
-  err.expected = expected
-  err.found = found
-  return err
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/entry-index.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/entry-index.js
deleted file mode 100644
index 1dc73a93f6b29..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/entry-index.js
+++ /dev/null
@@ -1,404 +0,0 @@
-'use strict'
-
-const util = require('util')
-const crypto = require('crypto')
-const fs = require('@npmcli/fs')
-const Minipass = require('minipass')
-const path = require('path')
-const ssri = require('ssri')
-const uniqueFilename = require('unique-filename')
-
-const contentPath = require('./content/path')
-const fixOwner = require('./util/fix-owner')
-const hashToSegments = require('./util/hash-to-segments')
-const indexV = require('../package.json')['cache-version'].index
-const moveFile = require('@npmcli/move-file')
-const _rimraf = require('rimraf')
-const rimraf = util.promisify(_rimraf)
-rimraf.sync = _rimraf.sync
-
-module.exports.NotFoundError = class NotFoundError extends Error {
-  constructor (cache, key) {
-    super(`No cache entry for ${key} found in ${cache}`)
-    this.code = 'ENOENT'
-    this.cache = cache
-    this.key = key
-  }
-}
-
-module.exports.compact = compact
-
-async function compact (cache, key, matchFn, opts = {}) {
-  const bucket = bucketPath(cache, key)
-  const entries = await bucketEntries(bucket)
-  const newEntries = []
-  // we loop backwards because the bottom-most result is the newest
-  // since we add new entries with appendFile
-  for (let i = entries.length - 1; i >= 0; --i) {
-    const entry = entries[i]
-    // a null integrity could mean either a delete was appended
-    // or the user has simply stored an index that does not map
-    // to any content. we determine if the user wants to keep the
-    // null integrity based on the validateEntry function passed in options.
-    // if the integrity is null and no validateEntry is provided, we break
-    // as we consider the null integrity to be a deletion of everything
-    // that came before it.
-    if (entry.integrity === null && !opts.validateEntry) {
-      break
-    }
-
-    // if this entry is valid, and it is either the first entry or
-    // the newEntries array doesn't already include an entry that
-    // matches this one based on the provided matchFn, then we add
-    // it to the beginning of our list
-    if ((!opts.validateEntry || opts.validateEntry(entry) === true) &&
-      (newEntries.length === 0 ||
-        !newEntries.find((oldEntry) => matchFn(oldEntry, entry)))) {
-      newEntries.unshift(entry)
-    }
-  }
-
-  const newIndex = '\n' + newEntries.map((entry) => {
-    const stringified = JSON.stringify(entry)
-    const hash = hashEntry(stringified)
-    return `${hash}\t${stringified}`
-  }).join('\n')
-
-  const setup = async () => {
-    const target = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix)
-    await fixOwner.mkdirfix(cache, path.dirname(target))
-    return {
-      target,
-      moved: false,
-    }
-  }
-
-  const teardown = async (tmp) => {
-    if (!tmp.moved) {
-      return rimraf(tmp.target)
-    }
-  }
-
-  const write = async (tmp) => {
-    await fs.writeFile(tmp.target, newIndex, { flag: 'wx' })
-    await fixOwner.mkdirfix(cache, path.dirname(bucket))
-    // we use @npmcli/move-file directly here because we
-    // want to overwrite the existing file
-    await moveFile(tmp.target, bucket)
-    tmp.moved = true
-    try {
-      await fixOwner.chownr(cache, bucket)
-    } catch (err) {
-      if (err.code !== 'ENOENT') {
-        throw err
-      }
-    }
-  }
-
-  // write the file atomically
-  const tmp = await setup()
-  try {
-    await write(tmp)
-  } finally {
-    await teardown(tmp)
-  }
-
-  // we reverse the list we generated such that the newest
-  // entries come first in order to make looping through them easier
-  // the true passed to formatEntry tells it to keep null
-  // integrity values, if they made it this far it's because
-  // validateEntry returned true, and as such we should return it
-  return newEntries.reverse().map((entry) => formatEntry(cache, entry, true))
-}
-
-module.exports.insert = insert
-
-async function insert (cache, key, integrity, opts = {}) {
-  const { metadata, size } = opts
-  const bucket = bucketPath(cache, key)
-  const entry = {
-    key,
-    integrity: integrity && ssri.stringify(integrity),
-    time: Date.now(),
-    size,
-    metadata,
-  }
-  try {
-    await fixOwner.mkdirfix(cache, path.dirname(bucket))
-    const stringified = JSON.stringify(entry)
-    // NOTE - Cleverness ahoy!
-    //
-    // This works because it's tremendously unlikely for an entry to corrupt
-    // another while still preserving the string length of the JSON in
-    // question. So, we just slap the length in there and verify it on read.
-    //
-    // Thanks to @isaacs for the whiteboarding session that ended up with
-    // this.
-    await fs.appendFile(bucket, `\n${hashEntry(stringified)}\t${stringified}`)
-    await fixOwner.chownr(cache, bucket)
-  } catch (err) {
-    if (err.code === 'ENOENT') {
-      return undefined
-    }
-
-    throw err
-    // There's a class of race conditions that happen when things get deleted
-    // during fixOwner, or between the two mkdirfix/chownr calls.
-    //
-    // It's perfectly fine to just not bother in those cases and lie
-    // that the index entry was written. Because it's a cache.
-  }
-  return formatEntry(cache, entry)
-}
-
-module.exports.insert.sync = insertSync
-
-function insertSync (cache, key, integrity, opts = {}) {
-  const { metadata, size } = opts
-  const bucket = bucketPath(cache, key)
-  const entry = {
-    key,
-    integrity: integrity && ssri.stringify(integrity),
-    time: Date.now(),
-    size,
-    metadata,
-  }
-  fixOwner.mkdirfix.sync(cache, path.dirname(bucket))
-  const stringified = JSON.stringify(entry)
-  fs.appendFileSync(bucket, `\n${hashEntry(stringified)}\t${stringified}`)
-  try {
-    fixOwner.chownr.sync(cache, bucket)
-  } catch (err) {
-    if (err.code !== 'ENOENT') {
-      throw err
-    }
-  }
-  return formatEntry(cache, entry)
-}
-
-module.exports.find = find
-
-async function find (cache, key) {
-  const bucket = bucketPath(cache, key)
-  try {
-    const entries = await bucketEntries(bucket)
-    return entries.reduce((latest, next) => {
-      if (next && next.key === key) {
-        return formatEntry(cache, next)
-      } else {
-        return latest
-      }
-    }, null)
-  } catch (err) {
-    if (err.code === 'ENOENT') {
-      return null
-    } else {
-      throw err
-    }
-  }
-}
-
-module.exports.find.sync = findSync
-
-function findSync (cache, key) {
-  const bucket = bucketPath(cache, key)
-  try {
-    return bucketEntriesSync(bucket).reduce((latest, next) => {
-      if (next && next.key === key) {
-        return formatEntry(cache, next)
-      } else {
-        return latest
-      }
-    }, null)
-  } catch (err) {
-    if (err.code === 'ENOENT') {
-      return null
-    } else {
-      throw err
-    }
-  }
-}
-
-module.exports.delete = del
-
-function del (cache, key, opts = {}) {
-  if (!opts.removeFully) {
-    return insert(cache, key, null, opts)
-  }
-
-  const bucket = bucketPath(cache, key)
-  return rimraf(bucket)
-}
-
-module.exports.delete.sync = delSync
-
-function delSync (cache, key, opts = {}) {
-  if (!opts.removeFully) {
-    return insertSync(cache, key, null, opts)
-  }
-
-  const bucket = bucketPath(cache, key)
-  return rimraf.sync(bucket)
-}
-
-module.exports.lsStream = lsStream
-
-function lsStream (cache) {
-  const indexDir = bucketDir(cache)
-  const stream = new Minipass({ objectMode: true })
-
-  // Set all this up to run on the stream and then just return the stream
-  Promise.resolve().then(async () => {
-    const buckets = await readdirOrEmpty(indexDir)
-    await Promise.all(buckets.map(async (bucket) => {
-      const bucketPath = path.join(indexDir, bucket)
-      const subbuckets = await readdirOrEmpty(bucketPath)
-      await Promise.all(subbuckets.map(async (subbucket) => {
-        const subbucketPath = path.join(bucketPath, subbucket)
-
-        // "/cachename//./*"
-        const subbucketEntries = await readdirOrEmpty(subbucketPath)
-        await Promise.all(subbucketEntries.map(async (entry) => {
-          const entryPath = path.join(subbucketPath, entry)
-          try {
-            const entries = await bucketEntries(entryPath)
-            // using a Map here prevents duplicate keys from showing up
-            // twice, I guess?
-            const reduced = entries.reduce((acc, entry) => {
-              acc.set(entry.key, entry)
-              return acc
-            }, new Map())
-            // reduced is a map of key => entry
-            for (const entry of reduced.values()) {
-              const formatted = formatEntry(cache, entry)
-              if (formatted) {
-                stream.write(formatted)
-              }
-            }
-          } catch (err) {
-            if (err.code === 'ENOENT') {
-              return undefined
-            }
-            throw err
-          }
-        }))
-      }))
-    }))
-    stream.end()
-    return stream
-  }).catch(err => stream.emit('error', err))
-
-  return stream
-}
-
-module.exports.ls = ls
-
-async function ls (cache) {
-  const entries = await lsStream(cache).collect()
-  return entries.reduce((acc, xs) => {
-    acc[xs.key] = xs
-    return acc
-  }, {})
-}
-
-module.exports.bucketEntries = bucketEntries
-
-async function bucketEntries (bucket, filter) {
-  const data = await fs.readFile(bucket, 'utf8')
-  return _bucketEntries(data, filter)
-}
-
-module.exports.bucketEntries.sync = bucketEntriesSync
-
-function bucketEntriesSync (bucket, filter) {
-  const data = fs.readFileSync(bucket, 'utf8')
-  return _bucketEntries(data, filter)
-}
-
-function _bucketEntries (data, filter) {
-  const entries = []
-  data.split('\n').forEach((entry) => {
-    if (!entry) {
-      return
-    }
-
-    const pieces = entry.split('\t')
-    if (!pieces[1] || hashEntry(pieces[1]) !== pieces[0]) {
-      // Hash is no good! Corruption or malice? Doesn't matter!
-      // EJECT EJECT
-      return
-    }
-    let obj
-    try {
-      obj = JSON.parse(pieces[1])
-    } catch (e) {
-      // Entry is corrupted!
-      return
-    }
-    if (obj) {
-      entries.push(obj)
-    }
-  })
-  return entries
-}
-
-module.exports.bucketDir = bucketDir
-
-function bucketDir (cache) {
-  return path.join(cache, `index-v${indexV}`)
-}
-
-module.exports.bucketPath = bucketPath
-
-function bucketPath (cache, key) {
-  const hashed = hashKey(key)
-  return path.join.apply(
-    path,
-    [bucketDir(cache)].concat(hashToSegments(hashed))
-  )
-}
-
-module.exports.hashKey = hashKey
-
-function hashKey (key) {
-  return hash(key, 'sha256')
-}
-
-module.exports.hashEntry = hashEntry
-
-function hashEntry (str) {
-  return hash(str, 'sha1')
-}
-
-function hash (str, digest) {
-  return crypto
-    .createHash(digest)
-    .update(str)
-    .digest('hex')
-}
-
-function formatEntry (cache, entry, keepAll) {
-  // Treat null digests as deletions. They'll shadow any previous entries.
-  if (!entry.integrity && !keepAll) {
-    return null
-  }
-
-  return {
-    key: entry.key,
-    integrity: entry.integrity,
-    path: entry.integrity ? contentPath(cache, entry.integrity) : undefined,
-    size: entry.size,
-    time: entry.time,
-    metadata: entry.metadata,
-  }
-}
-
-function readdirOrEmpty (dir) {
-  return fs.readdir(dir).catch((err) => {
-    if (err.code === 'ENOENT' || err.code === 'ENOTDIR') {
-      return []
-    }
-
-    throw err
-  })
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/get.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/get.js
deleted file mode 100644
index 254b4ecc38b57..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/get.js
+++ /dev/null
@@ -1,225 +0,0 @@
-'use strict'
-
-const Collect = require('minipass-collect')
-const Minipass = require('minipass')
-const Pipeline = require('minipass-pipeline')
-
-const index = require('./entry-index')
-const memo = require('./memoization')
-const read = require('./content/read')
-
-async function getData (cache, key, opts = {}) {
-  const { integrity, memoize, size } = opts
-  const memoized = memo.get(cache, key, opts)
-  if (memoized && memoize !== false) {
-    return {
-      metadata: memoized.entry.metadata,
-      data: memoized.data,
-      integrity: memoized.entry.integrity,
-      size: memoized.entry.size,
-    }
-  }
-
-  const entry = await index.find(cache, key, opts)
-  if (!entry) {
-    throw new index.NotFoundError(cache, key)
-  }
-  const data = await read(cache, entry.integrity, { integrity, size })
-  if (memoize) {
-    memo.put(cache, entry, data, opts)
-  }
-
-  return {
-    data,
-    metadata: entry.metadata,
-    size: entry.size,
-    integrity: entry.integrity,
-  }
-}
-module.exports = getData
-
-async function getDataByDigest (cache, key, opts = {}) {
-  const { integrity, memoize, size } = opts
-  const memoized = memo.get.byDigest(cache, key, opts)
-  if (memoized && memoize !== false) {
-    return memoized
-  }
-
-  const res = await read(cache, key, { integrity, size })
-  if (memoize) {
-    memo.put.byDigest(cache, key, res, opts)
-  }
-  return res
-}
-module.exports.byDigest = getDataByDigest
-
-function getDataSync (cache, key, opts = {}) {
-  const { integrity, memoize, size } = opts
-  const memoized = memo.get(cache, key, opts)
-
-  if (memoized && memoize !== false) {
-    return {
-      metadata: memoized.entry.metadata,
-      data: memoized.data,
-      integrity: memoized.entry.integrity,
-      size: memoized.entry.size,
-    }
-  }
-  const entry = index.find.sync(cache, key, opts)
-  if (!entry) {
-    throw new index.NotFoundError(cache, key)
-  }
-  const data = read.sync(cache, entry.integrity, {
-    integrity: integrity,
-    size: size,
-  })
-  const res = {
-    metadata: entry.metadata,
-    data: data,
-    size: entry.size,
-    integrity: entry.integrity,
-  }
-  if (memoize) {
-    memo.put(cache, entry, res.data, opts)
-  }
-
-  return res
-}
-
-module.exports.sync = getDataSync
-
-function getDataByDigestSync (cache, digest, opts = {}) {
-  const { integrity, memoize, size } = opts
-  const memoized = memo.get.byDigest(cache, digest, opts)
-
-  if (memoized && memoize !== false) {
-    return memoized
-  }
-
-  const res = read.sync(cache, digest, {
-    integrity: integrity,
-    size: size,
-  })
-  if (memoize) {
-    memo.put.byDigest(cache, digest, res, opts)
-  }
-
-  return res
-}
-module.exports.sync.byDigest = getDataByDigestSync
-
-const getMemoizedStream = (memoized) => {
-  const stream = new Minipass()
-  stream.on('newListener', function (ev, cb) {
-    ev === 'metadata' && cb(memoized.entry.metadata)
-    ev === 'integrity' && cb(memoized.entry.integrity)
-    ev === 'size' && cb(memoized.entry.size)
-  })
-  stream.end(memoized.data)
-  return stream
-}
-
-function getStream (cache, key, opts = {}) {
-  const { memoize, size } = opts
-  const memoized = memo.get(cache, key, opts)
-  if (memoized && memoize !== false) {
-    return getMemoizedStream(memoized)
-  }
-
-  const stream = new Pipeline()
-  // Set all this up to run on the stream and then just return the stream
-  Promise.resolve().then(async () => {
-    const entry = await index.find(cache, key)
-    if (!entry) {
-      throw new index.NotFoundError(cache, key)
-    }
-
-    stream.emit('metadata', entry.metadata)
-    stream.emit('integrity', entry.integrity)
-    stream.emit('size', entry.size)
-    stream.on('newListener', function (ev, cb) {
-      ev === 'metadata' && cb(entry.metadata)
-      ev === 'integrity' && cb(entry.integrity)
-      ev === 'size' && cb(entry.size)
-    })
-
-    const src = read.readStream(
-      cache,
-      entry.integrity,
-      { ...opts, size: typeof size !== 'number' ? entry.size : size }
-    )
-
-    if (memoize) {
-      const memoStream = new Collect.PassThrough()
-      memoStream.on('collect', data => memo.put(cache, entry, data, opts))
-      stream.unshift(memoStream)
-    }
-    stream.unshift(src)
-    return stream
-  }).catch((err) => stream.emit('error', err))
-
-  return stream
-}
-
-module.exports.stream = getStream
-
-function getStreamDigest (cache, integrity, opts = {}) {
-  const { memoize } = opts
-  const memoized = memo.get.byDigest(cache, integrity, opts)
-  if (memoized && memoize !== false) {
-    const stream = new Minipass()
-    stream.end(memoized)
-    return stream
-  } else {
-    const stream = read.readStream(cache, integrity, opts)
-    if (!memoize) {
-      return stream
-    }
-
-    const memoStream = new Collect.PassThrough()
-    memoStream.on('collect', data => memo.put.byDigest(
-      cache,
-      integrity,
-      data,
-      opts
-    ))
-    return new Pipeline(stream, memoStream)
-  }
-}
-
-module.exports.stream.byDigest = getStreamDigest
-
-function info (cache, key, opts = {}) {
-  const { memoize } = opts
-  const memoized = memo.get(cache, key, opts)
-  if (memoized && memoize !== false) {
-    return Promise.resolve(memoized.entry)
-  } else {
-    return index.find(cache, key)
-  }
-}
-module.exports.info = info
-
-async function copy (cache, key, dest, opts = {}) {
-  const entry = await index.find(cache, key, opts)
-  if (!entry) {
-    throw new index.NotFoundError(cache, key)
-  }
-  await read.copy(cache, entry.integrity, dest, opts)
-  return {
-    metadata: entry.metadata,
-    size: entry.size,
-    integrity: entry.integrity,
-  }
-}
-
-module.exports.copy = copy
-
-async function copyByDigest (cache, key, dest, opts = {}) {
-  await read.copy(cache, key, dest, opts)
-  return key
-}
-
-module.exports.copy.byDigest = copyByDigest
-
-module.exports.hasContent = read.hasContent
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/index.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/index.js
deleted file mode 100644
index 1c56be68dd8fd..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/index.js
+++ /dev/null
@@ -1,45 +0,0 @@
-'use strict'
-
-const get = require('./get.js')
-const put = require('./put.js')
-const rm = require('./rm.js')
-const verify = require('./verify.js')
-const { clearMemoized } = require('./memoization.js')
-const tmp = require('./util/tmp.js')
-const index = require('./entry-index.js')
-
-module.exports.index = {}
-module.exports.index.compact = index.compact
-module.exports.index.insert = index.insert
-
-module.exports.ls = index.ls
-module.exports.ls.stream = index.lsStream
-
-module.exports.get = get
-module.exports.get.byDigest = get.byDigest
-module.exports.get.sync = get.sync
-module.exports.get.sync.byDigest = get.sync.byDigest
-module.exports.get.stream = get.stream
-module.exports.get.stream.byDigest = get.stream.byDigest
-module.exports.get.copy = get.copy
-module.exports.get.copy.byDigest = get.copy.byDigest
-module.exports.get.info = get.info
-module.exports.get.hasContent = get.hasContent
-module.exports.get.hasContent.sync = get.hasContent.sync
-
-module.exports.put = put
-module.exports.put.stream = put.stream
-
-module.exports.rm = rm.entry
-module.exports.rm.all = rm.all
-module.exports.rm.entry = module.exports.rm
-module.exports.rm.content = rm.content
-
-module.exports.clearMemoized = clearMemoized
-
-module.exports.tmp = {}
-module.exports.tmp.mkdir = tmp.mkdir
-module.exports.tmp.withTmp = tmp.withTmp
-
-module.exports.verify = verify
-module.exports.verify.lastRun = verify.lastRun
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/memoization.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/memoization.js
deleted file mode 100644
index 0ff604a479c9c..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/memoization.js
+++ /dev/null
@@ -1,72 +0,0 @@
-'use strict'
-
-const LRU = require('lru-cache')
-
-const MEMOIZED = new LRU({
-  max: 500,
-  maxSize: 50 * 1024 * 1024, // 50MB
-  ttl: 3 * 60 * 1000, // 3 minutes
-  sizeCalculation: (entry, key) => key.startsWith('key:') ? entry.data.length : entry.length,
-})
-
-module.exports.clearMemoized = clearMemoized
-
-function clearMemoized () {
-  const old = {}
-  MEMOIZED.forEach((v, k) => {
-    old[k] = v
-  })
-  MEMOIZED.clear()
-  return old
-}
-
-module.exports.put = put
-
-function put (cache, entry, data, opts) {
-  pickMem(opts).set(`key:${cache}:${entry.key}`, { entry, data })
-  putDigest(cache, entry.integrity, data, opts)
-}
-
-module.exports.put.byDigest = putDigest
-
-function putDigest (cache, integrity, data, opts) {
-  pickMem(opts).set(`digest:${cache}:${integrity}`, data)
-}
-
-module.exports.get = get
-
-function get (cache, key, opts) {
-  return pickMem(opts).get(`key:${cache}:${key}`)
-}
-
-module.exports.get.byDigest = getDigest
-
-function getDigest (cache, integrity, opts) {
-  return pickMem(opts).get(`digest:${cache}:${integrity}`)
-}
-
-class ObjProxy {
-  constructor (obj) {
-    this.obj = obj
-  }
-
-  get (key) {
-    return this.obj[key]
-  }
-
-  set (key, val) {
-    this.obj[key] = val
-  }
-}
-
-function pickMem (opts) {
-  if (!opts || !opts.memoize) {
-    return MEMOIZED
-  } else if (opts.memoize.get && opts.memoize.set) {
-    return opts.memoize
-  } else if (typeof opts.memoize === 'object') {
-    return new ObjProxy(opts.memoize)
-  } else {
-    return MEMOIZED
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/put.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/put.js
deleted file mode 100644
index 9fc932d5f6dec..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/put.js
+++ /dev/null
@@ -1,80 +0,0 @@
-'use strict'
-
-const index = require('./entry-index')
-const memo = require('./memoization')
-const write = require('./content/write')
-const Flush = require('minipass-flush')
-const { PassThrough } = require('minipass-collect')
-const Pipeline = require('minipass-pipeline')
-
-const putOpts = (opts) => ({
-  algorithms: ['sha512'],
-  ...opts,
-})
-
-module.exports = putData
-
-async function putData (cache, key, data, opts = {}) {
-  const { memoize } = opts
-  opts = putOpts(opts)
-  const res = await write(cache, data, opts)
-  const entry = await index.insert(cache, key, res.integrity, { ...opts, size: res.size })
-  if (memoize) {
-    memo.put(cache, entry, data, opts)
-  }
-
-  return res.integrity
-}
-
-module.exports.stream = putStream
-
-function putStream (cache, key, opts = {}) {
-  const { memoize } = opts
-  opts = putOpts(opts)
-  let integrity
-  let size
-  let error
-
-  let memoData
-  const pipeline = new Pipeline()
-  // first item in the pipeline is the memoizer, because we need
-  // that to end first and get the collected data.
-  if (memoize) {
-    const memoizer = new PassThrough().on('collect', data => {
-      memoData = data
-    })
-    pipeline.push(memoizer)
-  }
-
-  // contentStream is a write-only, not a passthrough
-  // no data comes out of it.
-  const contentStream = write.stream(cache, opts)
-    .on('integrity', (int) => {
-      integrity = int
-    })
-    .on('size', (s) => {
-      size = s
-    })
-    .on('error', (err) => {
-      error = err
-    })
-
-  pipeline.push(contentStream)
-
-  // last but not least, we write the index and emit hash and size,
-  // and memoize if we're doing that
-  pipeline.push(new Flush({
-    async flush () {
-      if (!error) {
-        const entry = await index.insert(cache, key, integrity, { ...opts, size })
-        if (memoize && memoData) {
-          memo.put(cache, entry, memoData, opts)
-        }
-        pipeline.emit('integrity', integrity)
-        pipeline.emit('size', size)
-      }
-    },
-  }))
-
-  return pipeline
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/rm.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/rm.js
deleted file mode 100644
index 5f00071770b8d..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/rm.js
+++ /dev/null
@@ -1,31 +0,0 @@
-'use strict'
-
-const util = require('util')
-
-const index = require('./entry-index')
-const memo = require('./memoization')
-const path = require('path')
-const rimraf = util.promisify(require('rimraf'))
-const rmContent = require('./content/rm')
-
-module.exports = entry
-module.exports.entry = entry
-
-function entry (cache, key, opts) {
-  memo.clearMemoized()
-  return index.delete(cache, key, opts)
-}
-
-module.exports.content = content
-
-function content (cache, integrity) {
-  memo.clearMemoized()
-  return rmContent(cache, integrity)
-}
-
-module.exports.all = all
-
-function all (cache) {
-  memo.clearMemoized()
-  return rimraf(path.join(cache, '*(content-*|index-*)'))
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/fix-owner.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/fix-owner.js
deleted file mode 100644
index 182fcb028f06c..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/fix-owner.js
+++ /dev/null
@@ -1,145 +0,0 @@
-'use strict'
-
-const util = require('util')
-
-const chownr = util.promisify(require('chownr'))
-const mkdirp = require('mkdirp')
-const inflight = require('promise-inflight')
-const inferOwner = require('infer-owner')
-
-// Memoize getuid()/getgid() calls.
-// patch process.setuid/setgid to invalidate cached value on change
-const self = { uid: null, gid: null }
-const getSelf = () => {
-  if (typeof self.uid !== 'number') {
-    self.uid = process.getuid()
-    const setuid = process.setuid
-    process.setuid = (uid) => {
-      self.uid = null
-      process.setuid = setuid
-      return process.setuid(uid)
-    }
-  }
-  if (typeof self.gid !== 'number') {
-    self.gid = process.getgid()
-    const setgid = process.setgid
-    process.setgid = (gid) => {
-      self.gid = null
-      process.setgid = setgid
-      return process.setgid(gid)
-    }
-  }
-}
-
-module.exports.chownr = fixOwner
-
-async function fixOwner (cache, filepath) {
-  if (!process.getuid) {
-    // This platform doesn't need ownership fixing
-    return
-  }
-
-  getSelf()
-  if (self.uid !== 0) {
-    // almost certainly can't chown anyway
-    return
-  }
-
-  const { uid, gid } = await inferOwner(cache)
-
-  // No need to override if it's already what we used.
-  if (self.uid === uid && self.gid === gid) {
-    return
-  }
-
-  return inflight('fixOwner: fixing ownership on ' + filepath, () =>
-    chownr(
-      filepath,
-      typeof uid === 'number' ? uid : self.uid,
-      typeof gid === 'number' ? gid : self.gid
-    ).catch((err) => {
-      if (err.code === 'ENOENT') {
-        return null
-      }
-
-      throw err
-    })
-  )
-}
-
-module.exports.chownr.sync = fixOwnerSync
-
-function fixOwnerSync (cache, filepath) {
-  if (!process.getuid) {
-    // This platform doesn't need ownership fixing
-    return
-  }
-  const { uid, gid } = inferOwner.sync(cache)
-  getSelf()
-  if (self.uid !== 0) {
-    // almost certainly can't chown anyway
-    return
-  }
-
-  if (self.uid === uid && self.gid === gid) {
-    // No need to override if it's already what we used.
-    return
-  }
-  try {
-    chownr.sync(
-      filepath,
-      typeof uid === 'number' ? uid : self.uid,
-      typeof gid === 'number' ? gid : self.gid
-    )
-  } catch (err) {
-    // only catch ENOENT, any other error is a problem.
-    if (err.code === 'ENOENT') {
-      return null
-    }
-
-    throw err
-  }
-}
-
-module.exports.mkdirfix = mkdirfix
-
-async function mkdirfix (cache, p, cb) {
-  // we have to infer the owner _before_ making the directory, even though
-  // we aren't going to use the results, since the cache itself might not
-  // exist yet.  If we mkdirp it, then our current uid/gid will be assumed
-  // to be correct if it creates the cache folder in the process.
-  await inferOwner(cache)
-  try {
-    const made = await mkdirp(p)
-    if (made) {
-      await fixOwner(cache, made)
-      return made
-    }
-  } catch (err) {
-    if (err.code === 'EEXIST') {
-      await fixOwner(cache, p)
-      return null
-    }
-    throw err
-  }
-}
-
-module.exports.mkdirfix.sync = mkdirfixSync
-
-function mkdirfixSync (cache, p) {
-  try {
-    inferOwner.sync(cache)
-    const made = mkdirp.sync(p)
-    if (made) {
-      fixOwnerSync(cache, made)
-      return made
-    }
-  } catch (err) {
-    if (err.code === 'EEXIST') {
-      fixOwnerSync(cache, p)
-      return null
-    } else {
-      throw err
-    }
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/hash-to-segments.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/hash-to-segments.js
deleted file mode 100644
index 445599b503808..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/hash-to-segments.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict'
-
-module.exports = hashToSegments
-
-function hashToSegments (hash) {
-  return [hash.slice(0, 2), hash.slice(2, 4), hash.slice(4)]
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/move-file.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/move-file.js
deleted file mode 100644
index a0b40413cb56e..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/move-file.js
+++ /dev/null
@@ -1,56 +0,0 @@
-'use strict'
-
-const fs = require('@npmcli/fs')
-const move = require('@npmcli/move-file')
-const pinflight = require('promise-inflight')
-
-module.exports = moveFile
-
-async function moveFile (src, dest) {
-  const isWindows = process.platform === 'win32'
-
-  // This isn't quite an fs.rename -- the assumption is that
-  // if `dest` already exists, and we get certain errors while
-  // trying to move it, we should just not bother.
-  //
-  // In the case of cache corruption, users will receive an
-  // EINTEGRITY error elsewhere, and can remove the offending
-  // content their own way.
-  //
-  // Note that, as the name suggests, this strictly only supports file moves.
-  try {
-    await fs.link(src, dest)
-  } catch (err) {
-    if (isWindows && err.code === 'EPERM') {
-      // XXX This is a really weird way to handle this situation, as it
-      // results in the src file being deleted even though the dest
-      // might not exist.  Since we pretty much always write files to
-      // deterministic locations based on content hash, this is likely
-      // ok (or at worst, just ends in a future cache miss).  But it would
-      // be worth investigating at some time in the future if this is
-      // really what we want to do here.
-    } else if (err.code === 'EEXIST' || err.code === 'EBUSY') {
-      // file already exists, so whatever
-    } else {
-      throw err
-    }
-  }
-  try {
-    await Promise.all([
-      fs.unlink(src),
-      !isWindows && fs.chmod(dest, '0444'),
-    ])
-  } catch (e) {
-    return pinflight('cacache-move-file:' + dest, async () => {
-      await fs.stat(dest).catch((err) => {
-        if (err.code !== 'ENOENT') {
-          // Something else is wrong here. Bail bail bail
-          throw err
-        }
-      })
-      // file doesn't already exist! let's try a rename -> copy fallback
-      // only delete if it successfully copies
-      return move(src, dest)
-    })
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/tmp.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/tmp.js
deleted file mode 100644
index b4437cfcbeed6..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/util/tmp.js
+++ /dev/null
@@ -1,33 +0,0 @@
-'use strict'
-
-const fs = require('@npmcli/fs')
-
-const fixOwner = require('./fix-owner')
-const path = require('path')
-
-module.exports.mkdir = mktmpdir
-
-async function mktmpdir (cache, opts = {}) {
-  const { tmpPrefix } = opts
-  const tmpDir = path.join(cache, 'tmp')
-  await fs.mkdir(tmpDir, { recursive: true, owner: 'inherit' })
-  // do not use path.join(), it drops the trailing / if tmpPrefix is unset
-  const target = `${tmpDir}${path.sep}${tmpPrefix || ''}`
-  return fs.mkdtemp(target, { owner: 'inherit' })
-}
-
-module.exports.withTmp = withTmp
-
-function withTmp (cache, opts, cb) {
-  if (!cb) {
-    cb = opts
-    opts = {}
-  }
-  return fs.withTempDir(path.join(cache, 'tmp'), cb, opts)
-}
-
-module.exports.fix = fixtmpdir
-
-function fixtmpdir (cache) {
-  return fixOwner(cache, path.join(cache, 'tmp'))
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/lib/verify.js b/node_modules/@npmcli/run-script/node_modules/cacache/lib/verify.js
deleted file mode 100644
index 52692a01d192f..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/lib/verify.js
+++ /dev/null
@@ -1,257 +0,0 @@
-'use strict'
-
-const util = require('util')
-
-const pMap = require('p-map')
-const contentPath = require('./content/path')
-const fixOwner = require('./util/fix-owner')
-const fs = require('@npmcli/fs')
-const fsm = require('fs-minipass')
-const glob = util.promisify(require('glob'))
-const index = require('./entry-index')
-const path = require('path')
-const rimraf = util.promisify(require('rimraf'))
-const ssri = require('ssri')
-
-const globify = pattern => pattern.split('\\').join('/')
-
-const hasOwnProperty = (obj, key) =>
-  Object.prototype.hasOwnProperty.call(obj, key)
-
-const verifyOpts = (opts) => ({
-  concurrency: 20,
-  log: { silly () {} },
-  ...opts,
-})
-
-module.exports = verify
-
-async function verify (cache, opts) {
-  opts = verifyOpts(opts)
-  opts.log.silly('verify', 'verifying cache at', cache)
-
-  const steps = [
-    markStartTime,
-    fixPerms,
-    garbageCollect,
-    rebuildIndex,
-    cleanTmp,
-    writeVerifile,
-    markEndTime,
-  ]
-
-  const stats = {}
-  for (const step of steps) {
-    const label = step.name
-    const start = new Date()
-    const s = await step(cache, opts)
-    if (s) {
-      Object.keys(s).forEach((k) => {
-        stats[k] = s[k]
-      })
-    }
-    const end = new Date()
-    if (!stats.runTime) {
-      stats.runTime = {}
-    }
-    stats.runTime[label] = end - start
-  }
-  stats.runTime.total = stats.endTime - stats.startTime
-  opts.log.silly(
-    'verify',
-    'verification finished for',
-    cache,
-    'in',
-    `${stats.runTime.total}ms`
-  )
-  return stats
-}
-
-async function markStartTime (cache, opts) {
-  return { startTime: new Date() }
-}
-
-async function markEndTime (cache, opts) {
-  return { endTime: new Date() }
-}
-
-async function fixPerms (cache, opts) {
-  opts.log.silly('verify', 'fixing cache permissions')
-  await fixOwner.mkdirfix(cache, cache)
-  // TODO - fix file permissions too
-  await fixOwner.chownr(cache, cache)
-  return null
-}
-
-// Implements a naive mark-and-sweep tracing garbage collector.
-//
-// The algorithm is basically as follows:
-// 1. Read (and filter) all index entries ("pointers")
-// 2. Mark each integrity value as "live"
-// 3. Read entire filesystem tree in `content-vX/` dir
-// 4. If content is live, verify its checksum and delete it if it fails
-// 5. If content is not marked as live, rimraf it.
-//
-async function garbageCollect (cache, opts) {
-  opts.log.silly('verify', 'garbage collecting content')
-  const indexStream = index.lsStream(cache)
-  const liveContent = new Set()
-  indexStream.on('data', (entry) => {
-    if (opts.filter && !opts.filter(entry)) {
-      return
-    }
-
-    liveContent.add(entry.integrity.toString())
-  })
-  await new Promise((resolve, reject) => {
-    indexStream.on('end', resolve).on('error', reject)
-  })
-  const contentDir = contentPath.contentDir(cache)
-  const files = await glob(globify(path.join(contentDir, '**')), {
-    follow: false,
-    nodir: true,
-    nosort: true,
-  })
-  const stats = {
-    verifiedContent: 0,
-    reclaimedCount: 0,
-    reclaimedSize: 0,
-    badContentCount: 0,
-    keptSize: 0,
-  }
-  await pMap(
-    files,
-    async (f) => {
-      const split = f.split(/[/\\]/)
-      const digest = split.slice(split.length - 3).join('')
-      const algo = split[split.length - 4]
-      const integrity = ssri.fromHex(digest, algo)
-      if (liveContent.has(integrity.toString())) {
-        const info = await verifyContent(f, integrity)
-        if (!info.valid) {
-          stats.reclaimedCount++
-          stats.badContentCount++
-          stats.reclaimedSize += info.size
-        } else {
-          stats.verifiedContent++
-          stats.keptSize += info.size
-        }
-      } else {
-        // No entries refer to this content. We can delete.
-        stats.reclaimedCount++
-        const s = await fs.stat(f)
-        await rimraf(f)
-        stats.reclaimedSize += s.size
-      }
-      return stats
-    },
-    { concurrency: opts.concurrency }
-  )
-  return stats
-}
-
-async function verifyContent (filepath, sri) {
-  const contentInfo = {}
-  try {
-    const { size } = await fs.stat(filepath)
-    contentInfo.size = size
-    contentInfo.valid = true
-    await ssri.checkStream(new fsm.ReadStream(filepath), sri)
-  } catch (err) {
-    if (err.code === 'ENOENT') {
-      return { size: 0, valid: false }
-    }
-    if (err.code !== 'EINTEGRITY') {
-      throw err
-    }
-
-    await rimraf(filepath)
-    contentInfo.valid = false
-  }
-  return contentInfo
-}
-
-async function rebuildIndex (cache, opts) {
-  opts.log.silly('verify', 'rebuilding index')
-  const entries = await index.ls(cache)
-  const stats = {
-    missingContent: 0,
-    rejectedEntries: 0,
-    totalEntries: 0,
-  }
-  const buckets = {}
-  for (const k in entries) {
-    /* istanbul ignore else */
-    if (hasOwnProperty(entries, k)) {
-      const hashed = index.hashKey(k)
-      const entry = entries[k]
-      const excluded = opts.filter && !opts.filter(entry)
-      excluded && stats.rejectedEntries++
-      if (buckets[hashed] && !excluded) {
-        buckets[hashed].push(entry)
-      } else if (buckets[hashed] && excluded) {
-        // skip
-      } else if (excluded) {
-        buckets[hashed] = []
-        buckets[hashed]._path = index.bucketPath(cache, k)
-      } else {
-        buckets[hashed] = [entry]
-        buckets[hashed]._path = index.bucketPath(cache, k)
-      }
-    }
-  }
-  await pMap(
-    Object.keys(buckets),
-    (key) => {
-      return rebuildBucket(cache, buckets[key], stats, opts)
-    },
-    { concurrency: opts.concurrency }
-  )
-  return stats
-}
-
-async function rebuildBucket (cache, bucket, stats, opts) {
-  await fs.truncate(bucket._path)
-  // This needs to be serialized because cacache explicitly
-  // lets very racy bucket conflicts clobber each other.
-  for (const entry of bucket) {
-    const content = contentPath(cache, entry.integrity)
-    try {
-      await fs.stat(content)
-      await index.insert(cache, entry.key, entry.integrity, {
-        metadata: entry.metadata,
-        size: entry.size,
-      })
-      stats.totalEntries++
-    } catch (err) {
-      if (err.code === 'ENOENT') {
-        stats.rejectedEntries++
-        stats.missingContent++
-      } else {
-        throw err
-      }
-    }
-  }
-}
-
-function cleanTmp (cache, opts) {
-  opts.log.silly('verify', 'cleaning tmp directory')
-  return rimraf(path.join(cache, 'tmp'))
-}
-
-function writeVerifile (cache, opts) {
-  const verifile = path.join(cache, '_lastverified')
-  opts.log.silly('verify', 'writing verifile to ' + verifile)
-  try {
-    return fs.writeFile(verifile, `${Date.now()}`)
-  } finally {
-    fixOwner.chownr.sync(cache, verifile)
-  }
-}
-
-module.exports.lastRun = lastRun
-
-async function lastRun (cache) {
-  const data = await fs.readFile(path.join(cache, '_lastverified'), { encoding: 'utf8' })
-  return new Date(+data)
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/LICENSE b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/LICENSE
deleted file mode 100644
index de3226673c387..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2013 Julian Gruber 
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/index.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/index.js
deleted file mode 100644
index 4af9ddee463f4..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/index.js
+++ /dev/null
@@ -1,203 +0,0 @@
-var balanced = require('balanced-match');
-
-module.exports = expandTop;
-
-var escSlash = '\0SLASH'+Math.random()+'\0';
-var escOpen = '\0OPEN'+Math.random()+'\0';
-var escClose = '\0CLOSE'+Math.random()+'\0';
-var escComma = '\0COMMA'+Math.random()+'\0';
-var escPeriod = '\0PERIOD'+Math.random()+'\0';
-
-function numeric(str) {
-  return parseInt(str, 10) == str
-    ? parseInt(str, 10)
-    : str.charCodeAt(0);
-}
-
-function escapeBraces(str) {
-  return str.split('\\\\').join(escSlash)
-            .split('\\{').join(escOpen)
-            .split('\\}').join(escClose)
-            .split('\\,').join(escComma)
-            .split('\\.').join(escPeriod);
-}
-
-function unescapeBraces(str) {
-  return str.split(escSlash).join('\\')
-            .split(escOpen).join('{')
-            .split(escClose).join('}')
-            .split(escComma).join(',')
-            .split(escPeriod).join('.');
-}
-
-
-// Basically just str.split(","), but handling cases
-// where we have nested braced sections, which should be
-// treated as individual members, like {a,{b,c},d}
-function parseCommaParts(str) {
-  if (!str)
-    return [''];
-
-  var parts = [];
-  var m = balanced('{', '}', str);
-
-  if (!m)
-    return str.split(',');
-
-  var pre = m.pre;
-  var body = m.body;
-  var post = m.post;
-  var p = pre.split(',');
-
-  p[p.length-1] += '{' + body + '}';
-  var postParts = parseCommaParts(post);
-  if (post.length) {
-    p[p.length-1] += postParts.shift();
-    p.push.apply(p, postParts);
-  }
-
-  parts.push.apply(parts, p);
-
-  return parts;
-}
-
-function expandTop(str) {
-  if (!str)
-    return [];
-
-  // I don't know why Bash 4.3 does this, but it does.
-  // Anything starting with {} will have the first two bytes preserved
-  // but *only* at the top level, so {},a}b will not expand to anything,
-  // but a{},b}c will be expanded to [a}c,abc].
-  // One could argue that this is a bug in Bash, but since the goal of
-  // this module is to match Bash's rules, we escape a leading {}
-  if (str.substr(0, 2) === '{}') {
-    str = '\\{\\}' + str.substr(2);
-  }
-
-  return expand(escapeBraces(str), true).map(unescapeBraces);
-}
-
-function embrace(str) {
-  return '{' + str + '}';
-}
-function isPadded(el) {
-  return /^-?0\d/.test(el);
-}
-
-function lte(i, y) {
-  return i <= y;
-}
-function gte(i, y) {
-  return i >= y;
-}
-
-function expand(str, isTop) {
-  var expansions = [];
-
-  var m = balanced('{', '}', str);
-  if (!m) return [str];
-
-  // no need to expand pre, since it is guaranteed to be free of brace-sets
-  var pre = m.pre;
-  var post = m.post.length
-    ? expand(m.post, false)
-    : [''];
-
-  if (/\$$/.test(m.pre)) {    
-    for (var k = 0; k < post.length; k++) {
-      var expansion = pre+ '{' + m.body + '}' + post[k];
-      expansions.push(expansion);
-    }
-  } else {
-    var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
-    var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
-    var isSequence = isNumericSequence || isAlphaSequence;
-    var isOptions = m.body.indexOf(',') >= 0;
-    if (!isSequence && !isOptions) {
-      // {a},b}
-      if (m.post.match(/,.*\}/)) {
-        str = m.pre + '{' + m.body + escClose + m.post;
-        return expand(str);
-      }
-      return [str];
-    }
-
-    var n;
-    if (isSequence) {
-      n = m.body.split(/\.\./);
-    } else {
-      n = parseCommaParts(m.body);
-      if (n.length === 1) {
-        // x{{a,b}}y ==> x{a}y x{b}y
-        n = expand(n[0], false).map(embrace);
-        if (n.length === 1) {
-          return post.map(function(p) {
-            return m.pre + n[0] + p;
-          });
-        }
-      }
-    }
-
-    // at this point, n is the parts, and we know it's not a comma set
-    // with a single entry.
-    var N;
-
-    if (isSequence) {
-      var x = numeric(n[0]);
-      var y = numeric(n[1]);
-      var width = Math.max(n[0].length, n[1].length)
-      var incr = n.length == 3
-        ? Math.abs(numeric(n[2]))
-        : 1;
-      var test = lte;
-      var reverse = y < x;
-      if (reverse) {
-        incr *= -1;
-        test = gte;
-      }
-      var pad = n.some(isPadded);
-
-      N = [];
-
-      for (var i = x; test(i, y); i += incr) {
-        var c;
-        if (isAlphaSequence) {
-          c = String.fromCharCode(i);
-          if (c === '\\')
-            c = '';
-        } else {
-          c = String(i);
-          if (pad) {
-            var need = width - c.length;
-            if (need > 0) {
-              var z = new Array(need + 1).join('0');
-              if (i < 0)
-                c = '-' + z + c.slice(1);
-              else
-                c = z + c;
-            }
-          }
-        }
-        N.push(c);
-      }
-    } else {
-      N = [];
-
-      for (var j = 0; j < n.length; j++) {
-        N.push.apply(N, expand(n[j], false));
-      }
-    }
-
-    for (var j = 0; j < N.length; j++) {
-      for (var k = 0; k < post.length; k++) {
-        var expansion = pre + N[j] + post[k];
-        if (!isTop || isSequence || expansion)
-          expansions.push(expansion);
-      }
-    }
-  }
-
-  return expansions;
-}
-
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/package.json b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/package.json
deleted file mode 100644
index 7097d41e39de5..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion/package.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
-  "name": "brace-expansion",
-  "description": "Brace expansion as known from sh/bash",
-  "version": "2.0.1",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/juliangruber/brace-expansion.git"
-  },
-  "homepage": "https://github.com/juliangruber/brace-expansion",
-  "main": "index.js",
-  "scripts": {
-    "test": "tape test/*.js",
-    "gentest": "bash test/generate.sh",
-    "bench": "matcha test/perf/bench.js"
-  },
-  "dependencies": {
-    "balanced-match": "^1.0.0"
-  },
-  "devDependencies": {
-    "@c4312/matcha": "^1.3.1",
-    "tape": "^4.6.0"
-  },
-  "keywords": [],
-  "author": {
-    "name": "Julian Gruber",
-    "email": "mail@juliangruber.com",
-    "url": "http://juliangruber.com"
-  },
-  "license": "MIT",
-  "testling": {
-    "files": "test/*.js",
-    "browsers": [
-      "ie/8..latest",
-      "firefox/20..latest",
-      "firefox/nightly",
-      "chrome/25..latest",
-      "chrome/canary",
-      "opera/12..latest",
-      "opera/next",
-      "safari/5.1..latest",
-      "ipad/6.0..latest",
-      "iphone/6.0..latest",
-      "android-browser/4.2..latest"
-    ]
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/LICENSE b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/LICENSE
deleted file mode 100644
index 39e8fe16f665a..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) 2009-2022 Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/common.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/common.js
deleted file mode 100644
index 61a4452f097dc..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/common.js
+++ /dev/null
@@ -1,244 +0,0 @@
-exports.setopts = setopts
-exports.ownProp = ownProp
-exports.makeAbs = makeAbs
-exports.finish = finish
-exports.mark = mark
-exports.isIgnored = isIgnored
-exports.childrenIgnored = childrenIgnored
-
-function ownProp (obj, field) {
-  return Object.prototype.hasOwnProperty.call(obj, field)
-}
-
-var fs = require("fs")
-var path = require("path")
-var minimatch = require("minimatch")
-var isAbsolute = require("path").isAbsolute
-var Minimatch = minimatch.Minimatch
-
-function alphasort (a, b) {
-  return a.localeCompare(b, 'en')
-}
-
-function setupIgnores (self, options) {
-  self.ignore = options.ignore || []
-
-  if (!Array.isArray(self.ignore))
-    self.ignore = [self.ignore]
-
-  if (self.ignore.length) {
-    self.ignore = self.ignore.map(ignoreMap)
-  }
-}
-
-// ignore patterns are always in dot:true mode.
-function ignoreMap (pattern) {
-  var gmatcher = null
-  if (pattern.slice(-3) === '/**') {
-    var gpattern = pattern.replace(/(\/\*\*)+$/, '')
-    gmatcher = new Minimatch(gpattern, { dot: true })
-  }
-
-  return {
-    matcher: new Minimatch(pattern, { dot: true }),
-    gmatcher: gmatcher
-  }
-}
-
-function setopts (self, pattern, options) {
-  if (!options)
-    options = {}
-
-  // base-matching: just use globstar for that.
-  if (options.matchBase && -1 === pattern.indexOf("/")) {
-    if (options.noglobstar) {
-      throw new Error("base matching requires globstar")
-    }
-    pattern = "**/" + pattern
-  }
-
-  self.windowsPathsNoEscape = !!options.windowsPathsNoEscape ||
-    options.allowWindowsEscape === false
-  if (self.windowsPathsNoEscape) {
-    pattern = pattern.replace(/\\/g, '/')
-  }
-
-  self.silent = !!options.silent
-  self.pattern = pattern
-  self.strict = options.strict !== false
-  self.realpath = !!options.realpath
-  self.realpathCache = options.realpathCache || Object.create(null)
-  self.follow = !!options.follow
-  self.dot = !!options.dot
-  self.mark = !!options.mark
-  self.nodir = !!options.nodir
-  if (self.nodir)
-    self.mark = true
-  self.sync = !!options.sync
-  self.nounique = !!options.nounique
-  self.nonull = !!options.nonull
-  self.nosort = !!options.nosort
-  self.nocase = !!options.nocase
-  self.stat = !!options.stat
-  self.noprocess = !!options.noprocess
-  self.absolute = !!options.absolute
-  self.fs = options.fs || fs
-
-  self.maxLength = options.maxLength || Infinity
-  self.cache = options.cache || Object.create(null)
-  self.statCache = options.statCache || Object.create(null)
-  self.symlinks = options.symlinks || Object.create(null)
-
-  setupIgnores(self, options)
-
-  self.changedCwd = false
-  var cwd = process.cwd()
-  if (!ownProp(options, "cwd"))
-    self.cwd = path.resolve(cwd)
-  else {
-    self.cwd = path.resolve(options.cwd)
-    self.changedCwd = self.cwd !== cwd
-  }
-
-  self.root = options.root || path.resolve(self.cwd, "/")
-  self.root = path.resolve(self.root)
-
-  // TODO: is an absolute `cwd` supposed to be resolved against `root`?
-  // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
-  self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
-  self.nomount = !!options.nomount
-
-  if (process.platform === "win32") {
-    self.root = self.root.replace(/\\/g, "/")
-    self.cwd = self.cwd.replace(/\\/g, "/")
-    self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
-  }
-
-  // disable comments and negation in Minimatch.
-  // Note that they are not supported in Glob itself anyway.
-  options.nonegate = true
-  options.nocomment = true
-
-  self.minimatch = new Minimatch(pattern, options)
-  self.options = self.minimatch.options
-}
-
-function finish (self) {
-  var nou = self.nounique
-  var all = nou ? [] : Object.create(null)
-
-  for (var i = 0, l = self.matches.length; i < l; i ++) {
-    var matches = self.matches[i]
-    if (!matches || Object.keys(matches).length === 0) {
-      if (self.nonull) {
-        // do like the shell, and spit out the literal glob
-        var literal = self.minimatch.globSet[i]
-        if (nou)
-          all.push(literal)
-        else
-          all[literal] = true
-      }
-    } else {
-      // had matches
-      var m = Object.keys(matches)
-      if (nou)
-        all.push.apply(all, m)
-      else
-        m.forEach(function (m) {
-          all[m] = true
-        })
-    }
-  }
-
-  if (!nou)
-    all = Object.keys(all)
-
-  if (!self.nosort)
-    all = all.sort(alphasort)
-
-  // at *some* point we statted all of these
-  if (self.mark) {
-    for (var i = 0; i < all.length; i++) {
-      all[i] = self._mark(all[i])
-    }
-    if (self.nodir) {
-      all = all.filter(function (e) {
-        var notDir = !(/\/$/.test(e))
-        var c = self.cache[e] || self.cache[makeAbs(self, e)]
-        if (notDir && c)
-          notDir = c !== 'DIR' && !Array.isArray(c)
-        return notDir
-      })
-    }
-  }
-
-  if (self.ignore.length)
-    all = all.filter(function(m) {
-      return !isIgnored(self, m)
-    })
-
-  self.found = all
-}
-
-function mark (self, p) {
-  var abs = makeAbs(self, p)
-  var c = self.cache[abs]
-  var m = p
-  if (c) {
-    var isDir = c === 'DIR' || Array.isArray(c)
-    var slash = p.slice(-1) === '/'
-
-    if (isDir && !slash)
-      m += '/'
-    else if (!isDir && slash)
-      m = m.slice(0, -1)
-
-    if (m !== p) {
-      var mabs = makeAbs(self, m)
-      self.statCache[mabs] = self.statCache[abs]
-      self.cache[mabs] = self.cache[abs]
-    }
-  }
-
-  return m
-}
-
-// lotta situps...
-function makeAbs (self, f) {
-  var abs = f
-  if (f.charAt(0) === '/') {
-    abs = path.join(self.root, f)
-  } else if (isAbsolute(f) || f === '') {
-    abs = f
-  } else if (self.changedCwd) {
-    abs = path.resolve(self.cwd, f)
-  } else {
-    abs = path.resolve(f)
-  }
-
-  if (process.platform === 'win32')
-    abs = abs.replace(/\\/g, '/')
-
-  return abs
-}
-
-
-// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
-// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
-function isIgnored (self, path) {
-  if (!self.ignore.length)
-    return false
-
-  return self.ignore.some(function(item) {
-    return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
-  })
-}
-
-function childrenIgnored (self, path) {
-  if (!self.ignore.length)
-    return false
-
-  return self.ignore.some(function(item) {
-    return !!(item.gmatcher && item.gmatcher.match(path))
-  })
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/glob.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/glob.js
deleted file mode 100644
index 2112a957dc501..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/glob.js
+++ /dev/null
@@ -1,790 +0,0 @@
-// Approach:
-//
-// 1. Get the minimatch set
-// 2. For each pattern in the set, PROCESS(pattern, false)
-// 3. Store matches per-set, then uniq them
-//
-// PROCESS(pattern, inGlobStar)
-// Get the first [n] items from pattern that are all strings
-// Join these together.  This is PREFIX.
-//   If there is no more remaining, then stat(PREFIX) and
-//   add to matches if it succeeds.  END.
-//
-// If inGlobStar and PREFIX is symlink and points to dir
-//   set ENTRIES = []
-// else readdir(PREFIX) as ENTRIES
-//   If fail, END
-//
-// with ENTRIES
-//   If pattern[n] is GLOBSTAR
-//     // handle the case where the globstar match is empty
-//     // by pruning it out, and testing the resulting pattern
-//     PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
-//     // handle other cases.
-//     for ENTRY in ENTRIES (not dotfiles)
-//       // attach globstar + tail onto the entry
-//       // Mark that this entry is a globstar match
-//       PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
-//
-//   else // not globstar
-//     for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
-//       Test ENTRY against pattern[n]
-//       If fails, continue
-//       If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
-//
-// Caveat:
-//   Cache all stats and readdirs results to minimize syscall.  Since all
-//   we ever care about is existence and directory-ness, we can just keep
-//   `true` for files, and [children,...] for directories, or `false` for
-//   things that don't exist.
-
-module.exports = glob
-
-var rp = require('fs.realpath')
-var minimatch = require('minimatch')
-var Minimatch = minimatch.Minimatch
-var inherits = require('inherits')
-var EE = require('events').EventEmitter
-var path = require('path')
-var assert = require('assert')
-var isAbsolute = require('path').isAbsolute
-var globSync = require('./sync.js')
-var common = require('./common.js')
-var setopts = common.setopts
-var ownProp = common.ownProp
-var inflight = require('inflight')
-var util = require('util')
-var childrenIgnored = common.childrenIgnored
-var isIgnored = common.isIgnored
-
-var once = require('once')
-
-function glob (pattern, options, cb) {
-  if (typeof options === 'function') cb = options, options = {}
-  if (!options) options = {}
-
-  if (options.sync) {
-    if (cb)
-      throw new TypeError('callback provided to sync glob')
-    return globSync(pattern, options)
-  }
-
-  return new Glob(pattern, options, cb)
-}
-
-glob.sync = globSync
-var GlobSync = glob.GlobSync = globSync.GlobSync
-
-// old api surface
-glob.glob = glob
-
-function extend (origin, add) {
-  if (add === null || typeof add !== 'object') {
-    return origin
-  }
-
-  var keys = Object.keys(add)
-  var i = keys.length
-  while (i--) {
-    origin[keys[i]] = add[keys[i]]
-  }
-  return origin
-}
-
-glob.hasMagic = function (pattern, options_) {
-  var options = extend({}, options_)
-  options.noprocess = true
-
-  var g = new Glob(pattern, options)
-  var set = g.minimatch.set
-
-  if (!pattern)
-    return false
-
-  if (set.length > 1)
-    return true
-
-  for (var j = 0; j < set[0].length; j++) {
-    if (typeof set[0][j] !== 'string')
-      return true
-  }
-
-  return false
-}
-
-glob.Glob = Glob
-inherits(Glob, EE)
-function Glob (pattern, options, cb) {
-  if (typeof options === 'function') {
-    cb = options
-    options = null
-  }
-
-  if (options && options.sync) {
-    if (cb)
-      throw new TypeError('callback provided to sync glob')
-    return new GlobSync(pattern, options)
-  }
-
-  if (!(this instanceof Glob))
-    return new Glob(pattern, options, cb)
-
-  setopts(this, pattern, options)
-  this._didRealPath = false
-
-  // process each pattern in the minimatch set
-  var n = this.minimatch.set.length
-
-  // The matches are stored as {: true,...} so that
-  // duplicates are automagically pruned.
-  // Later, we do an Object.keys() on these.
-  // Keep them as a list so we can fill in when nonull is set.
-  this.matches = new Array(n)
-
-  if (typeof cb === 'function') {
-    cb = once(cb)
-    this.on('error', cb)
-    this.on('end', function (matches) {
-      cb(null, matches)
-    })
-  }
-
-  var self = this
-  this._processing = 0
-
-  this._emitQueue = []
-  this._processQueue = []
-  this.paused = false
-
-  if (this.noprocess)
-    return this
-
-  if (n === 0)
-    return done()
-
-  var sync = true
-  for (var i = 0; i < n; i ++) {
-    this._process(this.minimatch.set[i], i, false, done)
-  }
-  sync = false
-
-  function done () {
-    --self._processing
-    if (self._processing <= 0) {
-      if (sync) {
-        process.nextTick(function () {
-          self._finish()
-        })
-      } else {
-        self._finish()
-      }
-    }
-  }
-}
-
-Glob.prototype._finish = function () {
-  assert(this instanceof Glob)
-  if (this.aborted)
-    return
-
-  if (this.realpath && !this._didRealpath)
-    return this._realpath()
-
-  common.finish(this)
-  this.emit('end', this.found)
-}
-
-Glob.prototype._realpath = function () {
-  if (this._didRealpath)
-    return
-
-  this._didRealpath = true
-
-  var n = this.matches.length
-  if (n === 0)
-    return this._finish()
-
-  var self = this
-  for (var i = 0; i < this.matches.length; i++)
-    this._realpathSet(i, next)
-
-  function next () {
-    if (--n === 0)
-      self._finish()
-  }
-}
-
-Glob.prototype._realpathSet = function (index, cb) {
-  var matchset = this.matches[index]
-  if (!matchset)
-    return cb()
-
-  var found = Object.keys(matchset)
-  var self = this
-  var n = found.length
-
-  if (n === 0)
-    return cb()
-
-  var set = this.matches[index] = Object.create(null)
-  found.forEach(function (p, i) {
-    // If there's a problem with the stat, then it means that
-    // one or more of the links in the realpath couldn't be
-    // resolved.  just return the abs value in that case.
-    p = self._makeAbs(p)
-    rp.realpath(p, self.realpathCache, function (er, real) {
-      if (!er)
-        set[real] = true
-      else if (er.syscall === 'stat')
-        set[p] = true
-      else
-        self.emit('error', er) // srsly wtf right here
-
-      if (--n === 0) {
-        self.matches[index] = set
-        cb()
-      }
-    })
-  })
-}
-
-Glob.prototype._mark = function (p) {
-  return common.mark(this, p)
-}
-
-Glob.prototype._makeAbs = function (f) {
-  return common.makeAbs(this, f)
-}
-
-Glob.prototype.abort = function () {
-  this.aborted = true
-  this.emit('abort')
-}
-
-Glob.prototype.pause = function () {
-  if (!this.paused) {
-    this.paused = true
-    this.emit('pause')
-  }
-}
-
-Glob.prototype.resume = function () {
-  if (this.paused) {
-    this.emit('resume')
-    this.paused = false
-    if (this._emitQueue.length) {
-      var eq = this._emitQueue.slice(0)
-      this._emitQueue.length = 0
-      for (var i = 0; i < eq.length; i ++) {
-        var e = eq[i]
-        this._emitMatch(e[0], e[1])
-      }
-    }
-    if (this._processQueue.length) {
-      var pq = this._processQueue.slice(0)
-      this._processQueue.length = 0
-      for (var i = 0; i < pq.length; i ++) {
-        var p = pq[i]
-        this._processing--
-        this._process(p[0], p[1], p[2], p[3])
-      }
-    }
-  }
-}
-
-Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
-  assert(this instanceof Glob)
-  assert(typeof cb === 'function')
-
-  if (this.aborted)
-    return
-
-  this._processing++
-  if (this.paused) {
-    this._processQueue.push([pattern, index, inGlobStar, cb])
-    return
-  }
-
-  //console.error('PROCESS %d', this._processing, pattern)
-
-  // Get the first [n] parts of pattern that are all strings.
-  var n = 0
-  while (typeof pattern[n] === 'string') {
-    n ++
-  }
-  // now n is the index of the first one that is *not* a string.
-
-  // see if there's anything else
-  var prefix
-  switch (n) {
-    // if not, then this is rather simple
-    case pattern.length:
-      this._processSimple(pattern.join('/'), index, cb)
-      return
-
-    case 0:
-      // pattern *starts* with some non-trivial item.
-      // going to readdir(cwd), but not include the prefix in matches.
-      prefix = null
-      break
-
-    default:
-      // pattern has some string bits in the front.
-      // whatever it starts with, whether that's 'absolute' like /foo/bar,
-      // or 'relative' like '../baz'
-      prefix = pattern.slice(0, n).join('/')
-      break
-  }
-
-  var remain = pattern.slice(n)
-
-  // get the list of entries.
-  var read
-  if (prefix === null)
-    read = '.'
-  else if (isAbsolute(prefix) ||
-      isAbsolute(pattern.map(function (p) {
-        return typeof p === 'string' ? p : '[*]'
-      }).join('/'))) {
-    if (!prefix || !isAbsolute(prefix))
-      prefix = '/' + prefix
-    read = prefix
-  } else
-    read = prefix
-
-  var abs = this._makeAbs(read)
-
-  //if ignored, skip _processing
-  if (childrenIgnored(this, read))
-    return cb()
-
-  var isGlobStar = remain[0] === minimatch.GLOBSTAR
-  if (isGlobStar)
-    this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
-  else
-    this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
-}
-
-Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
-  var self = this
-  this._readdir(abs, inGlobStar, function (er, entries) {
-    return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
-  })
-}
-
-Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
-
-  // if the abs isn't a dir, then nothing can match!
-  if (!entries)
-    return cb()
-
-  // It will only match dot entries if it starts with a dot, or if
-  // dot is set.  Stuff like @(.foo|.bar) isn't allowed.
-  var pn = remain[0]
-  var negate = !!this.minimatch.negate
-  var rawGlob = pn._glob
-  var dotOk = this.dot || rawGlob.charAt(0) === '.'
-
-  var matchedEntries = []
-  for (var i = 0; i < entries.length; i++) {
-    var e = entries[i]
-    if (e.charAt(0) !== '.' || dotOk) {
-      var m
-      if (negate && !prefix) {
-        m = !e.match(pn)
-      } else {
-        m = e.match(pn)
-      }
-      if (m)
-        matchedEntries.push(e)
-    }
-  }
-
-  //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
-
-  var len = matchedEntries.length
-  // If there are no matched entries, then nothing matches.
-  if (len === 0)
-    return cb()
-
-  // if this is the last remaining pattern bit, then no need for
-  // an additional stat *unless* the user has specified mark or
-  // stat explicitly.  We know they exist, since readdir returned
-  // them.
-
-  if (remain.length === 1 && !this.mark && !this.stat) {
-    if (!this.matches[index])
-      this.matches[index] = Object.create(null)
-
-    for (var i = 0; i < len; i ++) {
-      var e = matchedEntries[i]
-      if (prefix) {
-        if (prefix !== '/')
-          e = prefix + '/' + e
-        else
-          e = prefix + e
-      }
-
-      if (e.charAt(0) === '/' && !this.nomount) {
-        e = path.join(this.root, e)
-      }
-      this._emitMatch(index, e)
-    }
-    // This was the last one, and no stats were needed
-    return cb()
-  }
-
-  // now test all matched entries as stand-ins for that part
-  // of the pattern.
-  remain.shift()
-  for (var i = 0; i < len; i ++) {
-    var e = matchedEntries[i]
-    var newPattern
-    if (prefix) {
-      if (prefix !== '/')
-        e = prefix + '/' + e
-      else
-        e = prefix + e
-    }
-    this._process([e].concat(remain), index, inGlobStar, cb)
-  }
-  cb()
-}
-
-Glob.prototype._emitMatch = function (index, e) {
-  if (this.aborted)
-    return
-
-  if (isIgnored(this, e))
-    return
-
-  if (this.paused) {
-    this._emitQueue.push([index, e])
-    return
-  }
-
-  var abs = isAbsolute(e) ? e : this._makeAbs(e)
-
-  if (this.mark)
-    e = this._mark(e)
-
-  if (this.absolute)
-    e = abs
-
-  if (this.matches[index][e])
-    return
-
-  if (this.nodir) {
-    var c = this.cache[abs]
-    if (c === 'DIR' || Array.isArray(c))
-      return
-  }
-
-  this.matches[index][e] = true
-
-  var st = this.statCache[abs]
-  if (st)
-    this.emit('stat', e, st)
-
-  this.emit('match', e)
-}
-
-Glob.prototype._readdirInGlobStar = function (abs, cb) {
-  if (this.aborted)
-    return
-
-  // follow all symlinked directories forever
-  // just proceed as if this is a non-globstar situation
-  if (this.follow)
-    return this._readdir(abs, false, cb)
-
-  var lstatkey = 'lstat\0' + abs
-  var self = this
-  var lstatcb = inflight(lstatkey, lstatcb_)
-
-  if (lstatcb)
-    self.fs.lstat(abs, lstatcb)
-
-  function lstatcb_ (er, lstat) {
-    if (er && er.code === 'ENOENT')
-      return cb()
-
-    var isSym = lstat && lstat.isSymbolicLink()
-    self.symlinks[abs] = isSym
-
-    // If it's not a symlink or a dir, then it's definitely a regular file.
-    // don't bother doing a readdir in that case.
-    if (!isSym && lstat && !lstat.isDirectory()) {
-      self.cache[abs] = 'FILE'
-      cb()
-    } else
-      self._readdir(abs, false, cb)
-  }
-}
-
-Glob.prototype._readdir = function (abs, inGlobStar, cb) {
-  if (this.aborted)
-    return
-
-  cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
-  if (!cb)
-    return
-
-  //console.error('RD %j %j', +inGlobStar, abs)
-  if (inGlobStar && !ownProp(this.symlinks, abs))
-    return this._readdirInGlobStar(abs, cb)
-
-  if (ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-    if (!c || c === 'FILE')
-      return cb()
-
-    if (Array.isArray(c))
-      return cb(null, c)
-  }
-
-  var self = this
-  self.fs.readdir(abs, readdirCb(this, abs, cb))
-}
-
-function readdirCb (self, abs, cb) {
-  return function (er, entries) {
-    if (er)
-      self._readdirError(abs, er, cb)
-    else
-      self._readdirEntries(abs, entries, cb)
-  }
-}
-
-Glob.prototype._readdirEntries = function (abs, entries, cb) {
-  if (this.aborted)
-    return
-
-  // if we haven't asked to stat everything, then just
-  // assume that everything in there exists, so we can avoid
-  // having to stat it a second time.
-  if (!this.mark && !this.stat) {
-    for (var i = 0; i < entries.length; i ++) {
-      var e = entries[i]
-      if (abs === '/')
-        e = abs + e
-      else
-        e = abs + '/' + e
-      this.cache[e] = true
-    }
-  }
-
-  this.cache[abs] = entries
-  return cb(null, entries)
-}
-
-Glob.prototype._readdirError = function (f, er, cb) {
-  if (this.aborted)
-    return
-
-  // handle errors, and cache the information
-  switch (er.code) {
-    case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
-    case 'ENOTDIR': // totally normal. means it *does* exist.
-      var abs = this._makeAbs(f)
-      this.cache[abs] = 'FILE'
-      if (abs === this.cwdAbs) {
-        var error = new Error(er.code + ' invalid cwd ' + this.cwd)
-        error.path = this.cwd
-        error.code = er.code
-        this.emit('error', error)
-        this.abort()
-      }
-      break
-
-    case 'ENOENT': // not terribly unusual
-    case 'ELOOP':
-    case 'ENAMETOOLONG':
-    case 'UNKNOWN':
-      this.cache[this._makeAbs(f)] = false
-      break
-
-    default: // some unusual error.  Treat as failure.
-      this.cache[this._makeAbs(f)] = false
-      if (this.strict) {
-        this.emit('error', er)
-        // If the error is handled, then we abort
-        // if not, we threw out of here
-        this.abort()
-      }
-      if (!this.silent)
-        console.error('glob error', er)
-      break
-  }
-
-  return cb()
-}
-
-Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
-  var self = this
-  this._readdir(abs, inGlobStar, function (er, entries) {
-    self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
-  })
-}
-
-
-Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
-  //console.error('pgs2', prefix, remain[0], entries)
-
-  // no entries means not a dir, so it can never have matches
-  // foo.txt/** doesn't match foo.txt
-  if (!entries)
-    return cb()
-
-  // test without the globstar, and with every child both below
-  // and replacing the globstar.
-  var remainWithoutGlobStar = remain.slice(1)
-  var gspref = prefix ? [ prefix ] : []
-  var noGlobStar = gspref.concat(remainWithoutGlobStar)
-
-  // the noGlobStar pattern exits the inGlobStar state
-  this._process(noGlobStar, index, false, cb)
-
-  var isSym = this.symlinks[abs]
-  var len = entries.length
-
-  // If it's a symlink, and we're in a globstar, then stop
-  if (isSym && inGlobStar)
-    return cb()
-
-  for (var i = 0; i < len; i++) {
-    var e = entries[i]
-    if (e.charAt(0) === '.' && !this.dot)
-      continue
-
-    // these two cases enter the inGlobStar state
-    var instead = gspref.concat(entries[i], remainWithoutGlobStar)
-    this._process(instead, index, true, cb)
-
-    var below = gspref.concat(entries[i], remain)
-    this._process(below, index, true, cb)
-  }
-
-  cb()
-}
-
-Glob.prototype._processSimple = function (prefix, index, cb) {
-  // XXX review this.  Shouldn't it be doing the mounting etc
-  // before doing stat?  kinda weird?
-  var self = this
-  this._stat(prefix, function (er, exists) {
-    self._processSimple2(prefix, index, er, exists, cb)
-  })
-}
-Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
-
-  //console.error('ps2', prefix, exists)
-
-  if (!this.matches[index])
-    this.matches[index] = Object.create(null)
-
-  // If it doesn't exist, then just mark the lack of results
-  if (!exists)
-    return cb()
-
-  if (prefix && isAbsolute(prefix) && !this.nomount) {
-    var trail = /[\/\\]$/.test(prefix)
-    if (prefix.charAt(0) === '/') {
-      prefix = path.join(this.root, prefix)
-    } else {
-      prefix = path.resolve(this.root, prefix)
-      if (trail)
-        prefix += '/'
-    }
-  }
-
-  if (process.platform === 'win32')
-    prefix = prefix.replace(/\\/g, '/')
-
-  // Mark this as a match
-  this._emitMatch(index, prefix)
-  cb()
-}
-
-// Returns either 'DIR', 'FILE', or false
-Glob.prototype._stat = function (f, cb) {
-  var abs = this._makeAbs(f)
-  var needDir = f.slice(-1) === '/'
-
-  if (f.length > this.maxLength)
-    return cb()
-
-  if (!this.stat && ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-
-    if (Array.isArray(c))
-      c = 'DIR'
-
-    // It exists, but maybe not how we need it
-    if (!needDir || c === 'DIR')
-      return cb(null, c)
-
-    if (needDir && c === 'FILE')
-      return cb()
-
-    // otherwise we have to stat, because maybe c=true
-    // if we know it exists, but not what it is.
-  }
-
-  var exists
-  var stat = this.statCache[abs]
-  if (stat !== undefined) {
-    if (stat === false)
-      return cb(null, stat)
-    else {
-      var type = stat.isDirectory() ? 'DIR' : 'FILE'
-      if (needDir && type === 'FILE')
-        return cb()
-      else
-        return cb(null, type, stat)
-    }
-  }
-
-  var self = this
-  var statcb = inflight('stat\0' + abs, lstatcb_)
-  if (statcb)
-    self.fs.lstat(abs, statcb)
-
-  function lstatcb_ (er, lstat) {
-    if (lstat && lstat.isSymbolicLink()) {
-      // If it's a symlink, then treat it as the target, unless
-      // the target does not exist, then treat it as a file.
-      return self.fs.stat(abs, function (er, stat) {
-        if (er)
-          self._stat2(f, abs, null, lstat, cb)
-        else
-          self._stat2(f, abs, er, stat, cb)
-      })
-    } else {
-      self._stat2(f, abs, er, lstat, cb)
-    }
-  }
-}
-
-Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
-  if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
-    this.statCache[abs] = false
-    return cb()
-  }
-
-  var needDir = f.slice(-1) === '/'
-  this.statCache[abs] = stat
-
-  if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
-    return cb(null, false, stat)
-
-  var c = true
-  if (stat)
-    c = stat.isDirectory() ? 'DIR' : 'FILE'
-  this.cache[abs] = this.cache[abs] || c
-
-  if (needDir && c === 'FILE')
-    return cb()
-
-  return cb(null, c, stat)
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/package.json b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/package.json
deleted file mode 100644
index ca0fd916211b5..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/package.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
-  "author": "Isaac Z. Schlueter  (http://blog.izs.me/)",
-  "name": "glob",
-  "description": "a little globber",
-  "version": "8.1.0",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/node-glob.git"
-  },
-  "main": "glob.js",
-  "files": [
-    "glob.js",
-    "sync.js",
-    "common.js"
-  ],
-  "engines": {
-    "node": ">=12"
-  },
-  "dependencies": {
-    "fs.realpath": "^1.0.0",
-    "inflight": "^1.0.4",
-    "inherits": "2",
-    "minimatch": "^5.0.1",
-    "once": "^1.3.0"
-  },
-  "devDependencies": {
-    "memfs": "^3.2.0",
-    "mkdirp": "0",
-    "rimraf": "^2.2.8",
-    "tap": "^16.0.1",
-    "tick": "0.0.6"
-  },
-  "tap": {
-    "before": "test/00-setup.js",
-    "after": "test/zz-cleanup.js",
-    "statements": 90,
-    "branches": 90,
-    "functions": 90,
-    "lines": 90,
-    "jobs": 1
-  },
-  "scripts": {
-    "prepublish": "npm run benchclean",
-    "profclean": "rm -f v8.log profile.txt",
-    "test": "tap",
-    "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js",
-    "bench": "bash benchmark.sh",
-    "prof": "bash prof.sh && cat profile.txt",
-    "benchclean": "node benchclean.js"
-  },
-  "license": "ISC",
-  "funding": {
-    "url": "https://github.com/sponsors/isaacs"
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/sync.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/sync.js
deleted file mode 100644
index af4600dd59508..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob/sync.js
+++ /dev/null
@@ -1,486 +0,0 @@
-module.exports = globSync
-globSync.GlobSync = GlobSync
-
-var rp = require('fs.realpath')
-var minimatch = require('minimatch')
-var Minimatch = minimatch.Minimatch
-var Glob = require('./glob.js').Glob
-var util = require('util')
-var path = require('path')
-var assert = require('assert')
-var isAbsolute = require('path').isAbsolute
-var common = require('./common.js')
-var setopts = common.setopts
-var ownProp = common.ownProp
-var childrenIgnored = common.childrenIgnored
-var isIgnored = common.isIgnored
-
-function globSync (pattern, options) {
-  if (typeof options === 'function' || arguments.length === 3)
-    throw new TypeError('callback provided to sync glob\n'+
-                        'See: https://github.com/isaacs/node-glob/issues/167')
-
-  return new GlobSync(pattern, options).found
-}
-
-function GlobSync (pattern, options) {
-  if (!pattern)
-    throw new Error('must provide pattern')
-
-  if (typeof options === 'function' || arguments.length === 3)
-    throw new TypeError('callback provided to sync glob\n'+
-                        'See: https://github.com/isaacs/node-glob/issues/167')
-
-  if (!(this instanceof GlobSync))
-    return new GlobSync(pattern, options)
-
-  setopts(this, pattern, options)
-
-  if (this.noprocess)
-    return this
-
-  var n = this.minimatch.set.length
-  this.matches = new Array(n)
-  for (var i = 0; i < n; i ++) {
-    this._process(this.minimatch.set[i], i, false)
-  }
-  this._finish()
-}
-
-GlobSync.prototype._finish = function () {
-  assert.ok(this instanceof GlobSync)
-  if (this.realpath) {
-    var self = this
-    this.matches.forEach(function (matchset, index) {
-      var set = self.matches[index] = Object.create(null)
-      for (var p in matchset) {
-        try {
-          p = self._makeAbs(p)
-          var real = rp.realpathSync(p, self.realpathCache)
-          set[real] = true
-        } catch (er) {
-          if (er.syscall === 'stat')
-            set[self._makeAbs(p)] = true
-          else
-            throw er
-        }
-      }
-    })
-  }
-  common.finish(this)
-}
-
-
-GlobSync.prototype._process = function (pattern, index, inGlobStar) {
-  assert.ok(this instanceof GlobSync)
-
-  // Get the first [n] parts of pattern that are all strings.
-  var n = 0
-  while (typeof pattern[n] === 'string') {
-    n ++
-  }
-  // now n is the index of the first one that is *not* a string.
-
-  // See if there's anything else
-  var prefix
-  switch (n) {
-    // if not, then this is rather simple
-    case pattern.length:
-      this._processSimple(pattern.join('/'), index)
-      return
-
-    case 0:
-      // pattern *starts* with some non-trivial item.
-      // going to readdir(cwd), but not include the prefix in matches.
-      prefix = null
-      break
-
-    default:
-      // pattern has some string bits in the front.
-      // whatever it starts with, whether that's 'absolute' like /foo/bar,
-      // or 'relative' like '../baz'
-      prefix = pattern.slice(0, n).join('/')
-      break
-  }
-
-  var remain = pattern.slice(n)
-
-  // get the list of entries.
-  var read
-  if (prefix === null)
-    read = '.'
-  else if (isAbsolute(prefix) ||
-      isAbsolute(pattern.map(function (p) {
-        return typeof p === 'string' ? p : '[*]'
-      }).join('/'))) {
-    if (!prefix || !isAbsolute(prefix))
-      prefix = '/' + prefix
-    read = prefix
-  } else
-    read = prefix
-
-  var abs = this._makeAbs(read)
-
-  //if ignored, skip processing
-  if (childrenIgnored(this, read))
-    return
-
-  var isGlobStar = remain[0] === minimatch.GLOBSTAR
-  if (isGlobStar)
-    this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
-  else
-    this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
-}
-
-
-GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
-  var entries = this._readdir(abs, inGlobStar)
-
-  // if the abs isn't a dir, then nothing can match!
-  if (!entries)
-    return
-
-  // It will only match dot entries if it starts with a dot, or if
-  // dot is set.  Stuff like @(.foo|.bar) isn't allowed.
-  var pn = remain[0]
-  var negate = !!this.minimatch.negate
-  var rawGlob = pn._glob
-  var dotOk = this.dot || rawGlob.charAt(0) === '.'
-
-  var matchedEntries = []
-  for (var i = 0; i < entries.length; i++) {
-    var e = entries[i]
-    if (e.charAt(0) !== '.' || dotOk) {
-      var m
-      if (negate && !prefix) {
-        m = !e.match(pn)
-      } else {
-        m = e.match(pn)
-      }
-      if (m)
-        matchedEntries.push(e)
-    }
-  }
-
-  var len = matchedEntries.length
-  // If there are no matched entries, then nothing matches.
-  if (len === 0)
-    return
-
-  // if this is the last remaining pattern bit, then no need for
-  // an additional stat *unless* the user has specified mark or
-  // stat explicitly.  We know they exist, since readdir returned
-  // them.
-
-  if (remain.length === 1 && !this.mark && !this.stat) {
-    if (!this.matches[index])
-      this.matches[index] = Object.create(null)
-
-    for (var i = 0; i < len; i ++) {
-      var e = matchedEntries[i]
-      if (prefix) {
-        if (prefix.slice(-1) !== '/')
-          e = prefix + '/' + e
-        else
-          e = prefix + e
-      }
-
-      if (e.charAt(0) === '/' && !this.nomount) {
-        e = path.join(this.root, e)
-      }
-      this._emitMatch(index, e)
-    }
-    // This was the last one, and no stats were needed
-    return
-  }
-
-  // now test all matched entries as stand-ins for that part
-  // of the pattern.
-  remain.shift()
-  for (var i = 0; i < len; i ++) {
-    var e = matchedEntries[i]
-    var newPattern
-    if (prefix)
-      newPattern = [prefix, e]
-    else
-      newPattern = [e]
-    this._process(newPattern.concat(remain), index, inGlobStar)
-  }
-}
-
-
-GlobSync.prototype._emitMatch = function (index, e) {
-  if (isIgnored(this, e))
-    return
-
-  var abs = this._makeAbs(e)
-
-  if (this.mark)
-    e = this._mark(e)
-
-  if (this.absolute) {
-    e = abs
-  }
-
-  if (this.matches[index][e])
-    return
-
-  if (this.nodir) {
-    var c = this.cache[abs]
-    if (c === 'DIR' || Array.isArray(c))
-      return
-  }
-
-  this.matches[index][e] = true
-
-  if (this.stat)
-    this._stat(e)
-}
-
-
-GlobSync.prototype._readdirInGlobStar = function (abs) {
-  // follow all symlinked directories forever
-  // just proceed as if this is a non-globstar situation
-  if (this.follow)
-    return this._readdir(abs, false)
-
-  var entries
-  var lstat
-  var stat
-  try {
-    lstat = this.fs.lstatSync(abs)
-  } catch (er) {
-    if (er.code === 'ENOENT') {
-      // lstat failed, doesn't exist
-      return null
-    }
-  }
-
-  var isSym = lstat && lstat.isSymbolicLink()
-  this.symlinks[abs] = isSym
-
-  // If it's not a symlink or a dir, then it's definitely a regular file.
-  // don't bother doing a readdir in that case.
-  if (!isSym && lstat && !lstat.isDirectory())
-    this.cache[abs] = 'FILE'
-  else
-    entries = this._readdir(abs, false)
-
-  return entries
-}
-
-GlobSync.prototype._readdir = function (abs, inGlobStar) {
-  var entries
-
-  if (inGlobStar && !ownProp(this.symlinks, abs))
-    return this._readdirInGlobStar(abs)
-
-  if (ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-    if (!c || c === 'FILE')
-      return null
-
-    if (Array.isArray(c))
-      return c
-  }
-
-  try {
-    return this._readdirEntries(abs, this.fs.readdirSync(abs))
-  } catch (er) {
-    this._readdirError(abs, er)
-    return null
-  }
-}
-
-GlobSync.prototype._readdirEntries = function (abs, entries) {
-  // if we haven't asked to stat everything, then just
-  // assume that everything in there exists, so we can avoid
-  // having to stat it a second time.
-  if (!this.mark && !this.stat) {
-    for (var i = 0; i < entries.length; i ++) {
-      var e = entries[i]
-      if (abs === '/')
-        e = abs + e
-      else
-        e = abs + '/' + e
-      this.cache[e] = true
-    }
-  }
-
-  this.cache[abs] = entries
-
-  // mark and cache dir-ness
-  return entries
-}
-
-GlobSync.prototype._readdirError = function (f, er) {
-  // handle errors, and cache the information
-  switch (er.code) {
-    case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
-    case 'ENOTDIR': // totally normal. means it *does* exist.
-      var abs = this._makeAbs(f)
-      this.cache[abs] = 'FILE'
-      if (abs === this.cwdAbs) {
-        var error = new Error(er.code + ' invalid cwd ' + this.cwd)
-        error.path = this.cwd
-        error.code = er.code
-        throw error
-      }
-      break
-
-    case 'ENOENT': // not terribly unusual
-    case 'ELOOP':
-    case 'ENAMETOOLONG':
-    case 'UNKNOWN':
-      this.cache[this._makeAbs(f)] = false
-      break
-
-    default: // some unusual error.  Treat as failure.
-      this.cache[this._makeAbs(f)] = false
-      if (this.strict)
-        throw er
-      if (!this.silent)
-        console.error('glob error', er)
-      break
-  }
-}
-
-GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
-
-  var entries = this._readdir(abs, inGlobStar)
-
-  // no entries means not a dir, so it can never have matches
-  // foo.txt/** doesn't match foo.txt
-  if (!entries)
-    return
-
-  // test without the globstar, and with every child both below
-  // and replacing the globstar.
-  var remainWithoutGlobStar = remain.slice(1)
-  var gspref = prefix ? [ prefix ] : []
-  var noGlobStar = gspref.concat(remainWithoutGlobStar)
-
-  // the noGlobStar pattern exits the inGlobStar state
-  this._process(noGlobStar, index, false)
-
-  var len = entries.length
-  var isSym = this.symlinks[abs]
-
-  // If it's a symlink, and we're in a globstar, then stop
-  if (isSym && inGlobStar)
-    return
-
-  for (var i = 0; i < len; i++) {
-    var e = entries[i]
-    if (e.charAt(0) === '.' && !this.dot)
-      continue
-
-    // these two cases enter the inGlobStar state
-    var instead = gspref.concat(entries[i], remainWithoutGlobStar)
-    this._process(instead, index, true)
-
-    var below = gspref.concat(entries[i], remain)
-    this._process(below, index, true)
-  }
-}
-
-GlobSync.prototype._processSimple = function (prefix, index) {
-  // XXX review this.  Shouldn't it be doing the mounting etc
-  // before doing stat?  kinda weird?
-  var exists = this._stat(prefix)
-
-  if (!this.matches[index])
-    this.matches[index] = Object.create(null)
-
-  // If it doesn't exist, then just mark the lack of results
-  if (!exists)
-    return
-
-  if (prefix && isAbsolute(prefix) && !this.nomount) {
-    var trail = /[\/\\]$/.test(prefix)
-    if (prefix.charAt(0) === '/') {
-      prefix = path.join(this.root, prefix)
-    } else {
-      prefix = path.resolve(this.root, prefix)
-      if (trail)
-        prefix += '/'
-    }
-  }
-
-  if (process.platform === 'win32')
-    prefix = prefix.replace(/\\/g, '/')
-
-  // Mark this as a match
-  this._emitMatch(index, prefix)
-}
-
-// Returns either 'DIR', 'FILE', or false
-GlobSync.prototype._stat = function (f) {
-  var abs = this._makeAbs(f)
-  var needDir = f.slice(-1) === '/'
-
-  if (f.length > this.maxLength)
-    return false
-
-  if (!this.stat && ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-
-    if (Array.isArray(c))
-      c = 'DIR'
-
-    // It exists, but maybe not how we need it
-    if (!needDir || c === 'DIR')
-      return c
-
-    if (needDir && c === 'FILE')
-      return false
-
-    // otherwise we have to stat, because maybe c=true
-    // if we know it exists, but not what it is.
-  }
-
-  var exists
-  var stat = this.statCache[abs]
-  if (!stat) {
-    var lstat
-    try {
-      lstat = this.fs.lstatSync(abs)
-    } catch (er) {
-      if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
-        this.statCache[abs] = false
-        return false
-      }
-    }
-
-    if (lstat && lstat.isSymbolicLink()) {
-      try {
-        stat = this.fs.statSync(abs)
-      } catch (er) {
-        stat = lstat
-      }
-    } else {
-      stat = lstat
-    }
-  }
-
-  this.statCache[abs] = stat
-
-  var c = true
-  if (stat)
-    c = stat.isDirectory() ? 'DIR' : 'FILE'
-
-  this.cache[abs] = this.cache[abs] || c
-
-  if (needDir && c === 'FILE')
-    return false
-
-  return c
-}
-
-GlobSync.prototype._mark = function (p) {
-  return common.mark(this, p)
-}
-
-GlobSync.prototype._makeAbs = function (f) {
-  return common.makeAbs(this, f)
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/LICENSE b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/LICENSE
deleted file mode 100644
index 1493534e60dce..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/lib/path.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/lib/path.js
deleted file mode 100644
index ffe453d9e0557..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/lib/path.js
+++ /dev/null
@@ -1,4 +0,0 @@
-const isWindows = typeof process === 'object' &&
-  process &&
-  process.platform === 'win32'
-module.exports = isWindows ? { sep: '\\' } : { sep: '/' }
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/minimatch.js b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/minimatch.js
deleted file mode 100644
index 6c8bfc35181c6..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/minimatch.js
+++ /dev/null
@@ -1,944 +0,0 @@
-const minimatch = module.exports = (p, pattern, options = {}) => {
-  assertValidPattern(pattern)
-
-  // shortcut: comments match nothing.
-  if (!options.nocomment && pattern.charAt(0) === '#') {
-    return false
-  }
-
-  return new Minimatch(pattern, options).match(p)
-}
-
-module.exports = minimatch
-
-const path = require('./lib/path.js')
-minimatch.sep = path.sep
-
-const GLOBSTAR = Symbol('globstar **')
-minimatch.GLOBSTAR = GLOBSTAR
-const expand = require('brace-expansion')
-
-const plTypes = {
-  '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
-  '?': { open: '(?:', close: ')?' },
-  '+': { open: '(?:', close: ')+' },
-  '*': { open: '(?:', close: ')*' },
-  '@': { open: '(?:', close: ')' }
-}
-
-// any single thing other than /
-// don't need to escape / when using new RegExp()
-const qmark = '[^/]'
-
-// * => any number of characters
-const star = qmark + '*?'
-
-// ** when dots are allowed.  Anything goes, except .. and .
-// not (^ or / followed by one or two dots followed by $ or /),
-// followed by anything, any number of times.
-const twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
-
-// not a ^ or / followed by a dot,
-// followed by anything, any number of times.
-const twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
-
-// "abc" -> { a:true, b:true, c:true }
-const charSet = s => s.split('').reduce((set, c) => {
-  set[c] = true
-  return set
-}, {})
-
-// characters that need to be escaped in RegExp.
-const reSpecials = charSet('().*{}+?[]^$\\!')
-
-// characters that indicate we have to add the pattern start
-const addPatternStartSet = charSet('[.(')
-
-// normalizes slashes.
-const slashSplit = /\/+/
-
-minimatch.filter = (pattern, options = {}) =>
-  (p, i, list) => minimatch(p, pattern, options)
-
-const ext = (a, b = {}) => {
-  const t = {}
-  Object.keys(a).forEach(k => t[k] = a[k])
-  Object.keys(b).forEach(k => t[k] = b[k])
-  return t
-}
-
-minimatch.defaults = def => {
-  if (!def || typeof def !== 'object' || !Object.keys(def).length) {
-    return minimatch
-  }
-
-  const orig = minimatch
-
-  const m = (p, pattern, options) => orig(p, pattern, ext(def, options))
-  m.Minimatch = class Minimatch extends orig.Minimatch {
-    constructor (pattern, options) {
-      super(pattern, ext(def, options))
-    }
-  }
-  m.Minimatch.defaults = options => orig.defaults(ext(def, options)).Minimatch
-  m.filter = (pattern, options) => orig.filter(pattern, ext(def, options))
-  m.defaults = options => orig.defaults(ext(def, options))
-  m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options))
-  m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options))
-  m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options))
-
-  return m
-}
-
-
-
-
-
-// Brace expansion:
-// a{b,c}d -> abd acd
-// a{b,}c -> abc ac
-// a{0..3}d -> a0d a1d a2d a3d
-// a{b,c{d,e}f}g -> abg acdfg acefg
-// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
-//
-// Invalid sets are not expanded.
-// a{2..}b -> a{2..}b
-// a{b}c -> a{b}c
-minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options)
-
-const braceExpand = (pattern, options = {}) => {
-  assertValidPattern(pattern)
-
-  // Thanks to Yeting Li  for
-  // improving this regexp to avoid a ReDOS vulnerability.
-  if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
-    // shortcut. no need to expand.
-    return [pattern]
-  }
-
-  return expand(pattern)
-}
-
-const MAX_PATTERN_LENGTH = 1024 * 64
-const assertValidPattern = pattern => {
-  if (typeof pattern !== 'string') {
-    throw new TypeError('invalid pattern')
-  }
-
-  if (pattern.length > MAX_PATTERN_LENGTH) {
-    throw new TypeError('pattern is too long')
-  }
-}
-
-// parse a component of the expanded set.
-// At this point, no pattern may contain "/" in it
-// so we're going to return a 2d array, where each entry is the full
-// pattern, split on '/', and then turned into a regular expression.
-// A regexp is made at the end which joins each array with an
-// escaped /, and another full one which joins each regexp with |.
-//
-// Following the lead of Bash 4.1, note that "**" only has special meaning
-// when it is the *only* thing in a path portion.  Otherwise, any series
-// of * is equivalent to a single *.  Globstar behavior is enabled by
-// default, and can be disabled by setting options.noglobstar.
-const SUBPARSE = Symbol('subparse')
-
-minimatch.makeRe = (pattern, options) =>
-  new Minimatch(pattern, options || {}).makeRe()
-
-minimatch.match = (list, pattern, options = {}) => {
-  const mm = new Minimatch(pattern, options)
-  list = list.filter(f => mm.match(f))
-  if (mm.options.nonull && !list.length) {
-    list.push(pattern)
-  }
-  return list
-}
-
-// replace stuff like \* with *
-const globUnescape = s => s.replace(/\\(.)/g, '$1')
-const charUnescape = s => s.replace(/\\([^-\]])/g, '$1')
-const regExpEscape = s => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
-const braExpEscape = s => s.replace(/[[\]\\]/g, '\\$&')
-
-class Minimatch {
-  constructor (pattern, options) {
-    assertValidPattern(pattern)
-
-    if (!options) options = {}
-
-    this.options = options
-    this.set = []
-    this.pattern = pattern
-    this.windowsPathsNoEscape = !!options.windowsPathsNoEscape ||
-      options.allowWindowsEscape === false
-    if (this.windowsPathsNoEscape) {
-      this.pattern = this.pattern.replace(/\\/g, '/')
-    }
-    this.regexp = null
-    this.negate = false
-    this.comment = false
-    this.empty = false
-    this.partial = !!options.partial
-
-    // make the set of regexps etc.
-    this.make()
-  }
-
-  debug () {}
-
-  make () {
-    const pattern = this.pattern
-    const options = this.options
-
-    // empty patterns and comments match nothing.
-    if (!options.nocomment && pattern.charAt(0) === '#') {
-      this.comment = true
-      return
-    }
-    if (!pattern) {
-      this.empty = true
-      return
-    }
-
-    // step 1: figure out negation, etc.
-    this.parseNegate()
-
-    // step 2: expand braces
-    let set = this.globSet = this.braceExpand()
-
-    if (options.debug) this.debug = (...args) => console.error(...args)
-
-    this.debug(this.pattern, set)
-
-    // step 3: now we have a set, so turn each one into a series of path-portion
-    // matching patterns.
-    // These will be regexps, except in the case of "**", which is
-    // set to the GLOBSTAR object for globstar behavior,
-    // and will not contain any / characters
-    set = this.globParts = set.map(s => s.split(slashSplit))
-
-    this.debug(this.pattern, set)
-
-    // glob --> regexps
-    set = set.map((s, si, set) => s.map(this.parse, this))
-
-    this.debug(this.pattern, set)
-
-    // filter out everything that didn't compile properly.
-    set = set.filter(s => s.indexOf(false) === -1)
-
-    this.debug(this.pattern, set)
-
-    this.set = set
-  }
-
-  parseNegate () {
-    if (this.options.nonegate) return
-
-    const pattern = this.pattern
-    let negate = false
-    let negateOffset = 0
-
-    for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {
-      negate = !negate
-      negateOffset++
-    }
-
-    if (negateOffset) this.pattern = pattern.slice(negateOffset)
-    this.negate = negate
-  }
-
-  // set partial to true to test if, for example,
-  // "/a/b" matches the start of "/*/b/*/d"
-  // Partial means, if you run out of file before you run
-  // out of pattern, then that's fine, as long as all
-  // the parts match.
-  matchOne (file, pattern, partial) {
-    var options = this.options
-
-    this.debug('matchOne',
-      { 'this': this, file: file, pattern: pattern })
-
-    this.debug('matchOne', file.length, pattern.length)
-
-    for (var fi = 0,
-        pi = 0,
-        fl = file.length,
-        pl = pattern.length
-        ; (fi < fl) && (pi < pl)
-        ; fi++, pi++) {
-      this.debug('matchOne loop')
-      var p = pattern[pi]
-      var f = file[fi]
-
-      this.debug(pattern, p, f)
-
-      // should be impossible.
-      // some invalid regexp stuff in the set.
-      /* istanbul ignore if */
-      if (p === false) return false
-
-      if (p === GLOBSTAR) {
-        this.debug('GLOBSTAR', [pattern, p, f])
-
-        // "**"
-        // a/**/b/**/c would match the following:
-        // a/b/x/y/z/c
-        // a/x/y/z/b/c
-        // a/b/x/b/x/c
-        // a/b/c
-        // To do this, take the rest of the pattern after
-        // the **, and see if it would match the file remainder.
-        // If so, return success.
-        // If not, the ** "swallows" a segment, and try again.
-        // This is recursively awful.
-        //
-        // a/**/b/**/c matching a/b/x/y/z/c
-        // - a matches a
-        // - doublestar
-        //   - matchOne(b/x/y/z/c, b/**/c)
-        //     - b matches b
-        //     - doublestar
-        //       - matchOne(x/y/z/c, c) -> no
-        //       - matchOne(y/z/c, c) -> no
-        //       - matchOne(z/c, c) -> no
-        //       - matchOne(c, c) yes, hit
-        var fr = fi
-        var pr = pi + 1
-        if (pr === pl) {
-          this.debug('** at the end')
-          // a ** at the end will just swallow the rest.
-          // We have found a match.
-          // however, it will not swallow /.x, unless
-          // options.dot is set.
-          // . and .. are *never* matched by **, for explosively
-          // exponential reasons.
-          for (; fi < fl; fi++) {
-            if (file[fi] === '.' || file[fi] === '..' ||
-              (!options.dot && file[fi].charAt(0) === '.')) return false
-          }
-          return true
-        }
-
-        // ok, let's see if we can swallow whatever we can.
-        while (fr < fl) {
-          var swallowee = file[fr]
-
-          this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
-
-          // XXX remove this slice.  Just pass the start index.
-          if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
-            this.debug('globstar found match!', fr, fl, swallowee)
-            // found a match.
-            return true
-          } else {
-            // can't swallow "." or ".." ever.
-            // can only swallow ".foo" when explicitly asked.
-            if (swallowee === '.' || swallowee === '..' ||
-              (!options.dot && swallowee.charAt(0) === '.')) {
-              this.debug('dot detected!', file, fr, pattern, pr)
-              break
-            }
-
-            // ** swallows a segment, and continue.
-            this.debug('globstar swallow a segment, and continue')
-            fr++
-          }
-        }
-
-        // no match was found.
-        // However, in partial mode, we can't say this is necessarily over.
-        // If there's more *pattern* left, then
-        /* istanbul ignore if */
-        if (partial) {
-          // ran out of file
-          this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
-          if (fr === fl) return true
-        }
-        return false
-      }
-
-      // something other than **
-      // non-magic patterns just have to match exactly
-      // patterns with magic have been turned into regexps.
-      var hit
-      if (typeof p === 'string') {
-        hit = f === p
-        this.debug('string match', p, f, hit)
-      } else {
-        hit = f.match(p)
-        this.debug('pattern match', p, f, hit)
-      }
-
-      if (!hit) return false
-    }
-
-    // Note: ending in / means that we'll get a final ""
-    // at the end of the pattern.  This can only match a
-    // corresponding "" at the end of the file.
-    // If the file ends in /, then it can only match a
-    // a pattern that ends in /, unless the pattern just
-    // doesn't have any more for it. But, a/b/ should *not*
-    // match "a/b/*", even though "" matches against the
-    // [^/]*? pattern, except in partial mode, where it might
-    // simply not be reached yet.
-    // However, a/b/ should still satisfy a/*
-
-    // now either we fell off the end of the pattern, or we're done.
-    if (fi === fl && pi === pl) {
-      // ran out of pattern and filename at the same time.
-      // an exact hit!
-      return true
-    } else if (fi === fl) {
-      // ran out of file, but still had pattern left.
-      // this is ok if we're doing the match as part of
-      // a glob fs traversal.
-      return partial
-    } else /* istanbul ignore else */ if (pi === pl) {
-      // ran out of pattern, still have file left.
-      // this is only acceptable if we're on the very last
-      // empty segment of a file with a trailing slash.
-      // a/* should match a/b/
-      return (fi === fl - 1) && (file[fi] === '')
-    }
-
-    // should be unreachable.
-    /* istanbul ignore next */
-    throw new Error('wtf?')
-  }
-
-  braceExpand () {
-    return braceExpand(this.pattern, this.options)
-  }
-
-  parse (pattern, isSub) {
-    assertValidPattern(pattern)
-
-    const options = this.options
-
-    // shortcuts
-    if (pattern === '**') {
-      if (!options.noglobstar)
-        return GLOBSTAR
-      else
-        pattern = '*'
-    }
-    if (pattern === '') return ''
-
-    let re = ''
-    let hasMagic = false
-    let escaping = false
-    // ? => one single character
-    const patternListStack = []
-    const negativeLists = []
-    let stateChar
-    let inClass = false
-    let reClassStart = -1
-    let classStart = -1
-    let cs
-    let pl
-    let sp
-    // . and .. never match anything that doesn't start with .,
-    // even when options.dot is set.  However, if the pattern
-    // starts with ., then traversal patterns can match.
-    let dotTravAllowed = pattern.charAt(0) === '.'
-    let dotFileAllowed = options.dot || dotTravAllowed
-    const patternStart = () =>
-      dotTravAllowed
-        ? ''
-        : dotFileAllowed
-        ? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))'
-        : '(?!\\.)'
-    const subPatternStart = (p) =>
-      p.charAt(0) === '.'
-        ? ''
-        : options.dot
-        ? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))'
-        : '(?!\\.)'
-
-
-    const clearStateChar = () => {
-      if (stateChar) {
-        // we had some state-tracking character
-        // that wasn't consumed by this pass.
-        switch (stateChar) {
-          case '*':
-            re += star
-            hasMagic = true
-          break
-          case '?':
-            re += qmark
-            hasMagic = true
-          break
-          default:
-            re += '\\' + stateChar
-          break
-        }
-        this.debug('clearStateChar %j %j', stateChar, re)
-        stateChar = false
-      }
-    }
-
-    for (let i = 0, c; (i < pattern.length) && (c = pattern.charAt(i)); i++) {
-      this.debug('%s\t%s %s %j', pattern, i, re, c)
-
-      // skip over any that are escaped.
-      if (escaping) {
-        /* istanbul ignore next - completely not allowed, even escaped. */
-        if (c === '/') {
-          return false
-        }
-
-        if (reSpecials[c]) {
-          re += '\\'
-        }
-        re += c
-        escaping = false
-        continue
-      }
-
-      switch (c) {
-        /* istanbul ignore next */
-        case '/': {
-          // Should already be path-split by now.
-          return false
-        }
-
-        case '\\':
-          if (inClass && pattern.charAt(i + 1) === '-') {
-            re += c
-            continue
-          }
-
-          clearStateChar()
-          escaping = true
-        continue
-
-        // the various stateChar values
-        // for the "extglob" stuff.
-        case '?':
-        case '*':
-        case '+':
-        case '@':
-        case '!':
-          this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
-
-          // all of those are literals inside a class, except that
-          // the glob [!a] means [^a] in regexp
-          if (inClass) {
-            this.debug('  in class')
-            if (c === '!' && i === classStart + 1) c = '^'
-            re += c
-            continue
-          }
-
-          // if we already have a stateChar, then it means
-          // that there was something like ** or +? in there.
-          // Handle the stateChar, then proceed with this one.
-          this.debug('call clearStateChar %j', stateChar)
-          clearStateChar()
-          stateChar = c
-          // if extglob is disabled, then +(asdf|foo) isn't a thing.
-          // just clear the statechar *now*, rather than even diving into
-          // the patternList stuff.
-          if (options.noext) clearStateChar()
-        continue
-
-        case '(': {
-          if (inClass) {
-            re += '('
-            continue
-          }
-
-          if (!stateChar) {
-            re += '\\('
-            continue
-          }
-
-          const plEntry = {
-            type: stateChar,
-            start: i - 1,
-            reStart: re.length,
-            open: plTypes[stateChar].open,
-            close: plTypes[stateChar].close,
-          }
-          this.debug(this.pattern, '\t', plEntry)
-          patternListStack.push(plEntry)
-          // negation is (?:(?!(?:js)(?:))[^/]*)
-          re += plEntry.open
-          // next entry starts with a dot maybe?
-          if (plEntry.start === 0 && plEntry.type !== '!') {
-            dotTravAllowed = true
-            re += subPatternStart(pattern.slice(i + 1))
-          }
-          this.debug('plType %j %j', stateChar, re)
-          stateChar = false
-          continue
-        }
-
-        case ')': {
-          const plEntry = patternListStack[patternListStack.length - 1]
-          if (inClass || !plEntry) {
-            re += '\\)'
-            continue
-          }
-          patternListStack.pop()
-
-          // closing an extglob
-          clearStateChar()
-          hasMagic = true
-          pl = plEntry
-          // negation is (?:(?!js)[^/]*)
-          // The others are (?:)
-          re += pl.close
-          if (pl.type === '!') {
-            negativeLists.push(Object.assign(pl, { reEnd: re.length }))
-          }
-          continue
-        }
-
-        case '|': {
-          const plEntry = patternListStack[patternListStack.length - 1]
-          if (inClass || !plEntry) {
-            re += '\\|'
-            continue
-          }
-
-          clearStateChar()
-          re += '|'
-          // next subpattern can start with a dot?
-          if (plEntry.start === 0 && plEntry.type !== '!') {
-            dotTravAllowed = true
-            re += subPatternStart(pattern.slice(i + 1))
-          }
-          continue
-        }
-
-        // these are mostly the same in regexp and glob
-        case '[':
-          // swallow any state-tracking char before the [
-          clearStateChar()
-
-          if (inClass) {
-            re += '\\' + c
-            continue
-          }
-
-          inClass = true
-          classStart = i
-          reClassStart = re.length
-          re += c
-        continue
-
-        case ']':
-          //  a right bracket shall lose its special
-          //  meaning and represent itself in
-          //  a bracket expression if it occurs
-          //  first in the list.  -- POSIX.2 2.8.3.2
-          if (i === classStart + 1 || !inClass) {
-            re += '\\' + c
-            continue
-          }
-
-          // split where the last [ was, make sure we don't have
-          // an invalid re. if so, re-walk the contents of the
-          // would-be class to re-translate any characters that
-          // were passed through as-is
-          // TODO: It would probably be faster to determine this
-          // without a try/catch and a new RegExp, but it's tricky
-          // to do safely.  For now, this is safe and works.
-          cs = pattern.substring(classStart + 1, i)
-          try {
-            RegExp('[' + braExpEscape(charUnescape(cs)) + ']')
-            // looks good, finish up the class.
-            re += c
-          } catch (er) {
-            // out of order ranges in JS are errors, but in glob syntax,
-            // they're just a range that matches nothing.
-            re = re.substring(0, reClassStart) + '(?:$.)' // match nothing ever
-          }
-          hasMagic = true
-          inClass = false
-        continue
-
-        default:
-          // swallow any state char that wasn't consumed
-          clearStateChar()
-
-          if (reSpecials[c] && !(c === '^' && inClass)) {
-            re += '\\'
-          }
-
-          re += c
-          break
-
-      } // switch
-    } // for
-
-    // handle the case where we left a class open.
-    // "[abc" is valid, equivalent to "\[abc"
-    if (inClass) {
-      // split where the last [ was, and escape it
-      // this is a huge pita.  We now have to re-walk
-      // the contents of the would-be class to re-translate
-      // any characters that were passed through as-is
-      cs = pattern.slice(classStart + 1)
-      sp = this.parse(cs, SUBPARSE)
-      re = re.substring(0, reClassStart) + '\\[' + sp[0]
-      hasMagic = hasMagic || sp[1]
-    }
-
-    // handle the case where we had a +( thing at the *end*
-    // of the pattern.
-    // each pattern list stack adds 3 chars, and we need to go through
-    // and escape any | chars that were passed through as-is for the regexp.
-    // Go through and escape them, taking care not to double-escape any
-    // | chars that were already escaped.
-    for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
-      let tail
-      tail = re.slice(pl.reStart + pl.open.length)
-      this.debug('setting tail', re, pl)
-      // maybe some even number of \, then maybe 1 \, followed by a |
-      tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => {
-        /* istanbul ignore else - should already be done */
-        if (!$2) {
-          // the | isn't already escaped, so escape it.
-          $2 = '\\'
-        }
-
-        // need to escape all those slashes *again*, without escaping the
-        // one that we need for escaping the | character.  As it works out,
-        // escaping an even number of slashes can be done by simply repeating
-        // it exactly after itself.  That's why this trick works.
-        //
-        // I am sorry that you have to see this.
-        return $1 + $1 + $2 + '|'
-      })
-
-      this.debug('tail=%j\n   %s', tail, tail, pl, re)
-      const t = pl.type === '*' ? star
-        : pl.type === '?' ? qmark
-        : '\\' + pl.type
-
-      hasMagic = true
-      re = re.slice(0, pl.reStart) + t + '\\(' + tail
-    }
-
-    // handle trailing things that only matter at the very end.
-    clearStateChar()
-    if (escaping) {
-      // trailing \\
-      re += '\\\\'
-    }
-
-    // only need to apply the nodot start if the re starts with
-    // something that could conceivably capture a dot
-    const addPatternStart = addPatternStartSet[re.charAt(0)]
-
-    // Hack to work around lack of negative lookbehind in JS
-    // A pattern like: *.!(x).!(y|z) needs to ensure that a name
-    // like 'a.xyz.yz' doesn't match.  So, the first negative
-    // lookahead, has to look ALL the way ahead, to the end of
-    // the pattern.
-    for (let n = negativeLists.length - 1; n > -1; n--) {
-      const nl = negativeLists[n]
-
-      const nlBefore = re.slice(0, nl.reStart)
-      const nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
-      let nlAfter = re.slice(nl.reEnd)
-      const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter
-
-      // Handle nested stuff like *(*.js|!(*.json)), where open parens
-      // mean that we should *not* include the ) in the bit that is considered
-      // "after" the negated section.
-      const closeParensBefore = nlBefore.split(')').length
-      const openParensBefore = nlBefore.split('(').length - closeParensBefore
-      let cleanAfter = nlAfter
-      for (let i = 0; i < openParensBefore; i++) {
-        cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
-      }
-      nlAfter = cleanAfter
-
-      const dollar = nlAfter === '' && isSub !== SUBPARSE ? '(?:$|\\/)' : ''
-
-      re = nlBefore + nlFirst + nlAfter + dollar + nlLast
-    }
-
-    // if the re is not "" at this point, then we need to make sure
-    // it doesn't match against an empty path part.
-    // Otherwise a/* will match a/, which it should not.
-    if (re !== '' && hasMagic) {
-      re = '(?=.)' + re
-    }
-
-    if (addPatternStart) {
-      re = patternStart() + re
-    }
-
-    // parsing just a piece of a larger pattern.
-    if (isSub === SUBPARSE) {
-      return [re, hasMagic]
-    }
-
-    // if it's nocase, and the lcase/uppercase don't match, it's magic
-    if (options.nocase && !hasMagic) {
-      hasMagic = pattern.toUpperCase() !== pattern.toLowerCase()
-    }
-
-    // skip the regexp for non-magical patterns
-    // unescape anything in it, though, so that it'll be
-    // an exact match against a file etc.
-    if (!hasMagic) {
-      return globUnescape(pattern)
-    }
-
-    const flags = options.nocase ? 'i' : ''
-    try {
-      return Object.assign(new RegExp('^' + re + '$', flags), {
-        _glob: pattern,
-        _src: re,
-      })
-    } catch (er) /* istanbul ignore next - should be impossible */ {
-      // If it was an invalid regular expression, then it can't match
-      // anything.  This trick looks for a character after the end of
-      // the string, which is of course impossible, except in multi-line
-      // mode, but it's not a /m regex.
-      return new RegExp('$.')
-    }
-  }
-
-  makeRe () {
-    if (this.regexp || this.regexp === false) return this.regexp
-
-    // at this point, this.set is a 2d array of partial
-    // pattern strings, or "**".
-    //
-    // It's better to use .match().  This function shouldn't
-    // be used, really, but it's pretty convenient sometimes,
-    // when you just want to work with a regex.
-    const set = this.set
-
-    if (!set.length) {
-      this.regexp = false
-      return this.regexp
-    }
-    const options = this.options
-
-    const twoStar = options.noglobstar ? star
-      : options.dot ? twoStarDot
-      : twoStarNoDot
-    const flags = options.nocase ? 'i' : ''
-
-    // coalesce globstars and regexpify non-globstar patterns
-    // if it's the only item, then we just do one twoStar
-    // if it's the first, and there are more, prepend (\/|twoStar\/)? to next
-    // if it's the last, append (\/twoStar|) to previous
-    // if it's in the middle, append (\/|\/twoStar\/) to previous
-    // then filter out GLOBSTAR symbols
-    let re = set.map(pattern => {
-      pattern = pattern.map(p =>
-        typeof p === 'string' ? regExpEscape(p)
-        : p === GLOBSTAR ? GLOBSTAR
-        : p._src
-      ).reduce((set, p) => {
-        if (!(set[set.length - 1] === GLOBSTAR && p === GLOBSTAR)) {
-          set.push(p)
-        }
-        return set
-      }, [])
-      pattern.forEach((p, i) => {
-        if (p !== GLOBSTAR || pattern[i-1] === GLOBSTAR) {
-          return
-        }
-        if (i === 0) {
-          if (pattern.length > 1) {
-            pattern[i+1] = '(?:\\\/|' + twoStar + '\\\/)?' + pattern[i+1]
-          } else {
-            pattern[i] = twoStar
-          }
-        } else if (i === pattern.length - 1) {
-          pattern[i-1] += '(?:\\\/|' + twoStar + ')?'
-        } else {
-          pattern[i-1] += '(?:\\\/|\\\/' + twoStar + '\\\/)' + pattern[i+1]
-          pattern[i+1] = GLOBSTAR
-        }
-      })
-      return pattern.filter(p => p !== GLOBSTAR).join('/')
-    }).join('|')
-
-    // must match entire pattern
-    // ending in a * or ** will make it less strict.
-    re = '^(?:' + re + ')$'
-
-    // can match anything, as long as it's not this.
-    if (this.negate) re = '^(?!' + re + ').*$'
-
-    try {
-      this.regexp = new RegExp(re, flags)
-    } catch (ex) /* istanbul ignore next - should be impossible */ {
-      this.regexp = false
-    }
-    return this.regexp
-  }
-
-  match (f, partial = this.partial) {
-    this.debug('match', f, this.pattern)
-    // short-circuit in the case of busted things.
-    // comments, etc.
-    if (this.comment) return false
-    if (this.empty) return f === ''
-
-    if (f === '/' && partial) return true
-
-    const options = this.options
-
-    // windows: need to use /, not \
-    if (path.sep !== '/') {
-      f = f.split(path.sep).join('/')
-    }
-
-    // treat the test path as a set of pathparts.
-    f = f.split(slashSplit)
-    this.debug(this.pattern, 'split', f)
-
-    // just ONE of the pattern sets in this.set needs to match
-    // in order for it to be valid.  If negating, then just one
-    // match means that we have failed.
-    // Either way, return on the first hit.
-
-    const set = this.set
-    this.debug(this.pattern, 'set', set)
-
-    // Find the basename of the path by looking for the last non-empty segment
-    let filename
-    for (let i = f.length - 1; i >= 0; i--) {
-      filename = f[i]
-      if (filename) break
-    }
-
-    for (let i = 0; i < set.length; i++) {
-      const pattern = set[i]
-      let file = f
-      if (options.matchBase && pattern.length === 1) {
-        file = [filename]
-      }
-      const hit = this.matchOne(file, pattern, partial)
-      if (hit) {
-        if (options.flipNegate) return true
-        return !this.negate
-      }
-    }
-
-    // didn't get any hits.  this is success if it's a negative
-    // pattern, failure otherwise.
-    if (options.flipNegate) return false
-    return this.negate
-  }
-
-  static defaults (def) {
-    return minimatch.defaults(def).Minimatch
-  }
-}
-
-minimatch.Minimatch = Minimatch
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/package.json b/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/package.json
deleted file mode 100644
index c8809dbb3119d..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch/package.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
-  "author": "Isaac Z. Schlueter  (http://blog.izs.me)",
-  "name": "minimatch",
-  "description": "a glob matcher in javascript",
-  "publishConfig": {
-    "tag": "legacy-v5"
-  },
-  "version": "5.1.6",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/minimatch.git"
-  },
-  "main": "minimatch.js",
-  "scripts": {
-    "test": "tap",
-    "snap": "tap",
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "prepublishOnly": "git push origin --follow-tags"
-  },
-  "engines": {
-    "node": ">=10"
-  },
-  "dependencies": {
-    "brace-expansion": "^2.0.1"
-  },
-  "devDependencies": {
-    "tap": "^16.3.2"
-  },
-  "license": "ISC",
-  "files": [
-    "minimatch.js",
-    "lib"
-  ]
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/cacache/package.json b/node_modules/@npmcli/run-script/node_modules/cacache/package.json
deleted file mode 100644
index 7dbd407d8fccf..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/cacache/package.json
+++ /dev/null
@@ -1,84 +0,0 @@
-{
-  "name": "cacache",
-  "version": "16.1.3",
-  "cache-version": {
-    "content": "2",
-    "index": "5"
-  },
-  "description": "Fast, fault-tolerant, cross-platform, disk-based, data-agnostic, content-addressable cache.",
-  "main": "lib/index.js",
-  "files": [
-    "bin/",
-    "lib/"
-  ],
-  "scripts": {
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "prepublishOnly": "git push origin --follow-tags",
-    "test": "tap",
-    "snap": "tap",
-    "coverage": "tap",
-    "test-docker": "docker run -it --rm --name pacotest -v \"$PWD\":/tmp -w /tmp node:latest npm test",
-    "lint": "eslint \"**/*.js\"",
-    "npmclilint": "npmcli-lint",
-    "lintfix": "npm run lint -- --fix",
-    "postsnap": "npm run lintfix --",
-    "postlint": "template-oss-check",
-    "posttest": "npm run lint",
-    "template-oss-apply": "template-oss-apply --force"
-  },
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/npm/cacache.git"
-  },
-  "keywords": [
-    "cache",
-    "caching",
-    "content-addressable",
-    "sri",
-    "sri hash",
-    "subresource integrity",
-    "cache",
-    "storage",
-    "store",
-    "file store",
-    "filesystem",
-    "disk cache",
-    "disk storage"
-  ],
-  "license": "ISC",
-  "dependencies": {
-    "@npmcli/fs": "^2.1.0",
-    "@npmcli/move-file": "^2.0.0",
-    "chownr": "^2.0.0",
-    "fs-minipass": "^2.1.0",
-    "glob": "^8.0.1",
-    "infer-owner": "^1.0.4",
-    "lru-cache": "^7.7.1",
-    "minipass": "^3.1.6",
-    "minipass-collect": "^1.0.2",
-    "minipass-flush": "^1.0.5",
-    "minipass-pipeline": "^1.2.4",
-    "mkdirp": "^1.0.4",
-    "p-map": "^4.0.0",
-    "promise-inflight": "^1.0.1",
-    "rimraf": "^3.0.2",
-    "ssri": "^9.0.0",
-    "tar": "^6.1.11",
-    "unique-filename": "^2.0.0"
-  },
-  "devDependencies": {
-    "@npmcli/eslint-config": "^3.0.1",
-    "@npmcli/template-oss": "3.5.0",
-    "tap": "^16.0.0"
-  },
-  "engines": {
-    "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
-  },
-  "templateOSS": {
-    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
-    "windowsCI": false,
-    "version": "3.5.0"
-  },
-  "author": "GitHub Inc."
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/fs-minipass/LICENSE b/node_modules/@npmcli/run-script/node_modules/fs-minipass/LICENSE
deleted file mode 100644
index 19129e315fe59..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/fs-minipass/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/fs-minipass/index.js b/node_modules/@npmcli/run-script/node_modules/fs-minipass/index.js
deleted file mode 100644
index 9b0779c80c55e..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/fs-minipass/index.js
+++ /dev/null
@@ -1,422 +0,0 @@
-'use strict'
-const MiniPass = require('minipass')
-const EE = require('events').EventEmitter
-const fs = require('fs')
-
-let writev = fs.writev
-/* istanbul ignore next */
-if (!writev) {
-  // This entire block can be removed if support for earlier than Node.js
-  // 12.9.0 is not needed.
-  const binding = process.binding('fs')
-  const FSReqWrap = binding.FSReqWrap || binding.FSReqCallback
-
-  writev = (fd, iovec, pos, cb) => {
-    const done = (er, bw) => cb(er, bw, iovec)
-    const req = new FSReqWrap()
-    req.oncomplete = done
-    binding.writeBuffers(fd, iovec, pos, req)
-  }
-}
-
-const _autoClose = Symbol('_autoClose')
-const _close = Symbol('_close')
-const _ended = Symbol('_ended')
-const _fd = Symbol('_fd')
-const _finished = Symbol('_finished')
-const _flags = Symbol('_flags')
-const _flush = Symbol('_flush')
-const _handleChunk = Symbol('_handleChunk')
-const _makeBuf = Symbol('_makeBuf')
-const _mode = Symbol('_mode')
-const _needDrain = Symbol('_needDrain')
-const _onerror = Symbol('_onerror')
-const _onopen = Symbol('_onopen')
-const _onread = Symbol('_onread')
-const _onwrite = Symbol('_onwrite')
-const _open = Symbol('_open')
-const _path = Symbol('_path')
-const _pos = Symbol('_pos')
-const _queue = Symbol('_queue')
-const _read = Symbol('_read')
-const _readSize = Symbol('_readSize')
-const _reading = Symbol('_reading')
-const _remain = Symbol('_remain')
-const _size = Symbol('_size')
-const _write = Symbol('_write')
-const _writing = Symbol('_writing')
-const _defaultFlag = Symbol('_defaultFlag')
-const _errored = Symbol('_errored')
-
-class ReadStream extends MiniPass {
-  constructor (path, opt) {
-    opt = opt || {}
-    super(opt)
-
-    this.readable = true
-    this.writable = false
-
-    if (typeof path !== 'string')
-      throw new TypeError('path must be a string')
-
-    this[_errored] = false
-    this[_fd] = typeof opt.fd === 'number' ? opt.fd : null
-    this[_path] = path
-    this[_readSize] = opt.readSize || 16*1024*1024
-    this[_reading] = false
-    this[_size] = typeof opt.size === 'number' ? opt.size : Infinity
-    this[_remain] = this[_size]
-    this[_autoClose] = typeof opt.autoClose === 'boolean' ?
-      opt.autoClose : true
-
-    if (typeof this[_fd] === 'number')
-      this[_read]()
-    else
-      this[_open]()
-  }
-
-  get fd () { return this[_fd] }
-  get path () { return this[_path] }
-
-  write () {
-    throw new TypeError('this is a readable stream')
-  }
-
-  end () {
-    throw new TypeError('this is a readable stream')
-  }
-
-  [_open] () {
-    fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd))
-  }
-
-  [_onopen] (er, fd) {
-    if (er)
-      this[_onerror](er)
-    else {
-      this[_fd] = fd
-      this.emit('open', fd)
-      this[_read]()
-    }
-  }
-
-  [_makeBuf] () {
-    return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]))
-  }
-
-  [_read] () {
-    if (!this[_reading]) {
-      this[_reading] = true
-      const buf = this[_makeBuf]()
-      /* istanbul ignore if */
-      if (buf.length === 0)
-        return process.nextTick(() => this[_onread](null, 0, buf))
-      fs.read(this[_fd], buf, 0, buf.length, null, (er, br, buf) =>
-        this[_onread](er, br, buf))
-    }
-  }
-
-  [_onread] (er, br, buf) {
-    this[_reading] = false
-    if (er)
-      this[_onerror](er)
-    else if (this[_handleChunk](br, buf))
-      this[_read]()
-  }
-
-  [_close] () {
-    if (this[_autoClose] && typeof this[_fd] === 'number') {
-      const fd = this[_fd]
-      this[_fd] = null
-      fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'))
-    }
-  }
-
-  [_onerror] (er) {
-    this[_reading] = true
-    this[_close]()
-    this.emit('error', er)
-  }
-
-  [_handleChunk] (br, buf) {
-    let ret = false
-    // no effect if infinite
-    this[_remain] -= br
-    if (br > 0)
-      ret = super.write(br < buf.length ? buf.slice(0, br) : buf)
-
-    if (br === 0 || this[_remain] <= 0) {
-      ret = false
-      this[_close]()
-      super.end()
-    }
-
-    return ret
-  }
-
-  emit (ev, data) {
-    switch (ev) {
-      case 'prefinish':
-      case 'finish':
-        break
-
-      case 'drain':
-        if (typeof this[_fd] === 'number')
-          this[_read]()
-        break
-
-      case 'error':
-        if (this[_errored])
-          return
-        this[_errored] = true
-        return super.emit(ev, data)
-
-      default:
-        return super.emit(ev, data)
-    }
-  }
-}
-
-class ReadStreamSync extends ReadStream {
-  [_open] () {
-    let threw = true
-    try {
-      this[_onopen](null, fs.openSync(this[_path], 'r'))
-      threw = false
-    } finally {
-      if (threw)
-        this[_close]()
-    }
-  }
-
-  [_read] () {
-    let threw = true
-    try {
-      if (!this[_reading]) {
-        this[_reading] = true
-        do {
-          const buf = this[_makeBuf]()
-          /* istanbul ignore next */
-          const br = buf.length === 0 ? 0
-            : fs.readSync(this[_fd], buf, 0, buf.length, null)
-          if (!this[_handleChunk](br, buf))
-            break
-        } while (true)
-        this[_reading] = false
-      }
-      threw = false
-    } finally {
-      if (threw)
-        this[_close]()
-    }
-  }
-
-  [_close] () {
-    if (this[_autoClose] && typeof this[_fd] === 'number') {
-      const fd = this[_fd]
-      this[_fd] = null
-      fs.closeSync(fd)
-      this.emit('close')
-    }
-  }
-}
-
-class WriteStream extends EE {
-  constructor (path, opt) {
-    opt = opt || {}
-    super(opt)
-    this.readable = false
-    this.writable = true
-    this[_errored] = false
-    this[_writing] = false
-    this[_ended] = false
-    this[_needDrain] = false
-    this[_queue] = []
-    this[_path] = path
-    this[_fd] = typeof opt.fd === 'number' ? opt.fd : null
-    this[_mode] = opt.mode === undefined ? 0o666 : opt.mode
-    this[_pos] = typeof opt.start === 'number' ? opt.start : null
-    this[_autoClose] = typeof opt.autoClose === 'boolean' ?
-      opt.autoClose : true
-
-    // truncating makes no sense when writing into the middle
-    const defaultFlag = this[_pos] !== null ? 'r+' : 'w'
-    this[_defaultFlag] = opt.flags === undefined
-    this[_flags] = this[_defaultFlag] ? defaultFlag : opt.flags
-
-    if (this[_fd] === null)
-      this[_open]()
-  }
-
-  emit (ev, data) {
-    if (ev === 'error') {
-      if (this[_errored])
-        return
-      this[_errored] = true
-    }
-    return super.emit(ev, data)
-  }
-
-
-  get fd () { return this[_fd] }
-  get path () { return this[_path] }
-
-  [_onerror] (er) {
-    this[_close]()
-    this[_writing] = true
-    this.emit('error', er)
-  }
-
-  [_open] () {
-    fs.open(this[_path], this[_flags], this[_mode],
-      (er, fd) => this[_onopen](er, fd))
-  }
-
-  [_onopen] (er, fd) {
-    if (this[_defaultFlag] &&
-        this[_flags] === 'r+' &&
-        er && er.code === 'ENOENT') {
-      this[_flags] = 'w'
-      this[_open]()
-    } else if (er)
-      this[_onerror](er)
-    else {
-      this[_fd] = fd
-      this.emit('open', fd)
-      this[_flush]()
-    }
-  }
-
-  end (buf, enc) {
-    if (buf)
-      this.write(buf, enc)
-
-    this[_ended] = true
-
-    // synthetic after-write logic, where drain/finish live
-    if (!this[_writing] && !this[_queue].length &&
-        typeof this[_fd] === 'number')
-      this[_onwrite](null, 0)
-    return this
-  }
-
-  write (buf, enc) {
-    if (typeof buf === 'string')
-      buf = Buffer.from(buf, enc)
-
-    if (this[_ended]) {
-      this.emit('error', new Error('write() after end()'))
-      return false
-    }
-
-    if (this[_fd] === null || this[_writing] || this[_queue].length) {
-      this[_queue].push(buf)
-      this[_needDrain] = true
-      return false
-    }
-
-    this[_writing] = true
-    this[_write](buf)
-    return true
-  }
-
-  [_write] (buf) {
-    fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) =>
-      this[_onwrite](er, bw))
-  }
-
-  [_onwrite] (er, bw) {
-    if (er)
-      this[_onerror](er)
-    else {
-      if (this[_pos] !== null)
-        this[_pos] += bw
-      if (this[_queue].length)
-        this[_flush]()
-      else {
-        this[_writing] = false
-
-        if (this[_ended] && !this[_finished]) {
-          this[_finished] = true
-          this[_close]()
-          this.emit('finish')
-        } else if (this[_needDrain]) {
-          this[_needDrain] = false
-          this.emit('drain')
-        }
-      }
-    }
-  }
-
-  [_flush] () {
-    if (this[_queue].length === 0) {
-      if (this[_ended])
-        this[_onwrite](null, 0)
-    } else if (this[_queue].length === 1)
-      this[_write](this[_queue].pop())
-    else {
-      const iovec = this[_queue]
-      this[_queue] = []
-      writev(this[_fd], iovec, this[_pos],
-        (er, bw) => this[_onwrite](er, bw))
-    }
-  }
-
-  [_close] () {
-    if (this[_autoClose] && typeof this[_fd] === 'number') {
-      const fd = this[_fd]
-      this[_fd] = null
-      fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'))
-    }
-  }
-}
-
-class WriteStreamSync extends WriteStream {
-  [_open] () {
-    let fd
-    // only wrap in a try{} block if we know we'll retry, to avoid
-    // the rethrow obscuring the error's source frame in most cases.
-    if (this[_defaultFlag] && this[_flags] === 'r+') {
-      try {
-        fd = fs.openSync(this[_path], this[_flags], this[_mode])
-      } catch (er) {
-        if (er.code === 'ENOENT') {
-          this[_flags] = 'w'
-          return this[_open]()
-        } else
-          throw er
-      }
-    } else
-      fd = fs.openSync(this[_path], this[_flags], this[_mode])
-
-    this[_onopen](null, fd)
-  }
-
-  [_close] () {
-    if (this[_autoClose] && typeof this[_fd] === 'number') {
-      const fd = this[_fd]
-      this[_fd] = null
-      fs.closeSync(fd)
-      this.emit('close')
-    }
-  }
-
-  [_write] (buf) {
-    // throw the original, but try to close if it fails
-    let threw = true
-    try {
-      this[_onwrite](null,
-        fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos]))
-      threw = false
-    } finally {
-      if (threw)
-        try { this[_close]() } catch (_) {}
-    }
-  }
-}
-
-exports.ReadStream = ReadStream
-exports.ReadStreamSync = ReadStreamSync
-
-exports.WriteStream = WriteStream
-exports.WriteStreamSync = WriteStreamSync
diff --git a/node_modules/@npmcli/run-script/node_modules/fs-minipass/package.json b/node_modules/@npmcli/run-script/node_modules/fs-minipass/package.json
deleted file mode 100644
index 2f2436cb5c3b1..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/fs-minipass/package.json
+++ /dev/null
@@ -1,39 +0,0 @@
-{
-  "name": "fs-minipass",
-  "version": "2.1.0",
-  "main": "index.js",
-  "scripts": {
-    "test": "tap",
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "postpublish": "git push origin --follow-tags"
-  },
-  "keywords": [],
-  "author": "Isaac Z. Schlueter  (http://blog.izs.me/)",
-  "license": "ISC",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/fs-minipass.git"
-  },
-  "bugs": {
-    "url": "https://github.com/npm/fs-minipass/issues"
-  },
-  "homepage": "https://github.com/npm/fs-minipass#readme",
-  "description": "fs read and write streams based on minipass",
-  "dependencies": {
-    "minipass": "^3.0.0"
-  },
-  "devDependencies": {
-    "mutate-fs": "^2.0.1",
-    "tap": "^14.6.4"
-  },
-  "files": [
-    "index.js"
-  ],
-  "tap": {
-    "check-coverage": true
-  },
-  "engines": {
-    "node": ">= 8"
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/gauge/LICENSE.md
deleted file mode 100644
index 5fc208ff122e0..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/LICENSE.md
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-ISC License
-
-Copyright npm, Inc.
-
-Permission to use, copy, modify, and/or distribute this
-software for any purpose with or without fee is hereby
-granted, provided that the above copyright notice and this
-permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
-EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
-INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
-USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/base-theme.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/base-theme.js
deleted file mode 100644
index 00bf5684cddab..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/base-theme.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict'
-var spin = require('./spin.js')
-var progressBar = require('./progress-bar.js')
-
-module.exports = {
-  activityIndicator: function (values, theme, width) {
-    if (values.spun == null) {
-      return
-    }
-    return spin(theme, values.spun)
-  },
-  progressbar: function (values, theme, width) {
-    if (values.completed == null) {
-      return
-    }
-    return progressBar(theme, width, values.completed)
-  },
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/error.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/error.js
deleted file mode 100644
index d9914ba5335d2..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/error.js
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict'
-var util = require('util')
-
-var User = exports.User = function User (msg) {
-  var err = new Error(msg)
-  Error.captureStackTrace(err, User)
-  err.code = 'EGAUGE'
-  return err
-}
-
-exports.MissingTemplateValue = function MissingTemplateValue (item, values) {
-  var err = new User(util.format('Missing template value "%s"', item.type))
-  Error.captureStackTrace(err, MissingTemplateValue)
-  err.template = item
-  err.values = values
-  return err
-}
-
-exports.Internal = function Internal (msg) {
-  var err = new Error(msg)
-  Error.captureStackTrace(err, Internal)
-  err.code = 'EGAUGEINTERNAL'
-  return err
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/has-color.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/has-color.js
deleted file mode 100644
index 16cba0eb47d33..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/has-color.js
+++ /dev/null
@@ -1,4 +0,0 @@
-'use strict'
-var colorSupport = require('color-support')
-
-module.exports = colorSupport().hasBasic
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/index.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/index.js
deleted file mode 100644
index 37fc5ac60a16f..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/index.js
+++ /dev/null
@@ -1,289 +0,0 @@
-'use strict'
-var Plumbing = require('./plumbing.js')
-var hasUnicode = require('has-unicode')
-var hasColor = require('./has-color.js')
-var onExit = require('signal-exit')
-var defaultThemes = require('./themes')
-var setInterval = require('./set-interval.js')
-var process = require('./process.js')
-var setImmediate = require('./set-immediate')
-
-module.exports = Gauge
-
-function callWith (obj, method) {
-  return function () {
-    return method.call(obj)
-  }
-}
-
-function Gauge (arg1, arg2) {
-  var options, writeTo
-  if (arg1 && arg1.write) {
-    writeTo = arg1
-    options = arg2 || {}
-  } else if (arg2 && arg2.write) {
-    writeTo = arg2
-    options = arg1 || {}
-  } else {
-    writeTo = process.stderr
-    options = arg1 || arg2 || {}
-  }
-
-  this._status = {
-    spun: 0,
-    section: '',
-    subsection: '',
-  }
-  this._paused = false // are we paused for back pressure?
-  this._disabled = true // are all progress bar updates disabled?
-  this._showing = false // do we WANT the progress bar on screen
-  this._onScreen = false // IS the progress bar on screen
-  this._needsRedraw = false // should we print something at next tick?
-  this._hideCursor = options.hideCursor == null ? true : options.hideCursor
-  this._fixedFramerate = options.fixedFramerate == null
-    ? !(/^v0\.8\./.test(process.version))
-    : options.fixedFramerate
-  this._lastUpdateAt = null
-  this._updateInterval = options.updateInterval == null ? 50 : options.updateInterval
-
-  this._themes = options.themes || defaultThemes
-  this._theme = options.theme
-  var theme = this._computeTheme(options.theme)
-  var template = options.template || [
-    { type: 'progressbar', length: 20 },
-    { type: 'activityIndicator', kerning: 1, length: 1 },
-    { type: 'section', kerning: 1, default: '' },
-    { type: 'subsection', kerning: 1, default: '' },
-  ]
-  this.setWriteTo(writeTo, options.tty)
-  var PlumbingClass = options.Plumbing || Plumbing
-  this._gauge = new PlumbingClass(theme, template, this.getWidth())
-
-  this._$$doRedraw = callWith(this, this._doRedraw)
-  this._$$handleSizeChange = callWith(this, this._handleSizeChange)
-
-  this._cleanupOnExit = options.cleanupOnExit == null || options.cleanupOnExit
-  this._removeOnExit = null
-
-  if (options.enabled || (options.enabled == null && this._tty && this._tty.isTTY)) {
-    this.enable()
-  } else {
-    this.disable()
-  }
-}
-Gauge.prototype = {}
-
-Gauge.prototype.isEnabled = function () {
-  return !this._disabled
-}
-
-Gauge.prototype.setTemplate = function (template) {
-  this._gauge.setTemplate(template)
-  if (this._showing) {
-    this._requestRedraw()
-  }
-}
-
-Gauge.prototype._computeTheme = function (theme) {
-  if (!theme) {
-    theme = {}
-  }
-  if (typeof theme === 'string') {
-    theme = this._themes.getTheme(theme)
-  } else if (
-    Object.keys(theme).length === 0 || theme.hasUnicode != null || theme.hasColor != null
-  ) {
-    var useUnicode = theme.hasUnicode == null ? hasUnicode() : theme.hasUnicode
-    var useColor = theme.hasColor == null ? hasColor : theme.hasColor
-    theme = this._themes.getDefault({
-      hasUnicode: useUnicode,
-      hasColor: useColor,
-      platform: theme.platform,
-    })
-  }
-  return theme
-}
-
-Gauge.prototype.setThemeset = function (themes) {
-  this._themes = themes
-  this.setTheme(this._theme)
-}
-
-Gauge.prototype.setTheme = function (theme) {
-  this._gauge.setTheme(this._computeTheme(theme))
-  if (this._showing) {
-    this._requestRedraw()
-  }
-  this._theme = theme
-}
-
-Gauge.prototype._requestRedraw = function () {
-  this._needsRedraw = true
-  if (!this._fixedFramerate) {
-    this._doRedraw()
-  }
-}
-
-Gauge.prototype.getWidth = function () {
-  return ((this._tty && this._tty.columns) || 80) - 1
-}
-
-Gauge.prototype.setWriteTo = function (writeTo, tty) {
-  var enabled = !this._disabled
-  if (enabled) {
-    this.disable()
-  }
-  this._writeTo = writeTo
-  this._tty = tty ||
-    (writeTo === process.stderr && process.stdout.isTTY && process.stdout) ||
-    (writeTo.isTTY && writeTo) ||
-    this._tty
-  if (this._gauge) {
-    this._gauge.setWidth(this.getWidth())
-  }
-  if (enabled) {
-    this.enable()
-  }
-}
-
-Gauge.prototype.enable = function () {
-  if (!this._disabled) {
-    return
-  }
-  this._disabled = false
-  if (this._tty) {
-    this._enableEvents()
-  }
-  if (this._showing) {
-    this.show()
-  }
-}
-
-Gauge.prototype.disable = function () {
-  if (this._disabled) {
-    return
-  }
-  if (this._showing) {
-    this._lastUpdateAt = null
-    this._showing = false
-    this._doRedraw()
-    this._showing = true
-  }
-  this._disabled = true
-  if (this._tty) {
-    this._disableEvents()
-  }
-}
-
-Gauge.prototype._enableEvents = function () {
-  if (this._cleanupOnExit) {
-    this._removeOnExit = onExit(callWith(this, this.disable))
-  }
-  this._tty.on('resize', this._$$handleSizeChange)
-  if (this._fixedFramerate) {
-    this.redrawTracker = setInterval(this._$$doRedraw, this._updateInterval)
-    if (this.redrawTracker.unref) {
-      this.redrawTracker.unref()
-    }
-  }
-}
-
-Gauge.prototype._disableEvents = function () {
-  this._tty.removeListener('resize', this._$$handleSizeChange)
-  if (this._fixedFramerate) {
-    clearInterval(this.redrawTracker)
-  }
-  if (this._removeOnExit) {
-    this._removeOnExit()
-  }
-}
-
-Gauge.prototype.hide = function (cb) {
-  if (this._disabled) {
-    return cb && process.nextTick(cb)
-  }
-  if (!this._showing) {
-    return cb && process.nextTick(cb)
-  }
-  this._showing = false
-  this._doRedraw()
-  cb && setImmediate(cb)
-}
-
-Gauge.prototype.show = function (section, completed) {
-  this._showing = true
-  if (typeof section === 'string') {
-    this._status.section = section
-  } else if (typeof section === 'object') {
-    var sectionKeys = Object.keys(section)
-    for (var ii = 0; ii < sectionKeys.length; ++ii) {
-      var key = sectionKeys[ii]
-      this._status[key] = section[key]
-    }
-  }
-  if (completed != null) {
-    this._status.completed = completed
-  }
-  if (this._disabled) {
-    return
-  }
-  this._requestRedraw()
-}
-
-Gauge.prototype.pulse = function (subsection) {
-  this._status.subsection = subsection || ''
-  this._status.spun++
-  if (this._disabled) {
-    return
-  }
-  if (!this._showing) {
-    return
-  }
-  this._requestRedraw()
-}
-
-Gauge.prototype._handleSizeChange = function () {
-  this._gauge.setWidth(this._tty.columns - 1)
-  this._requestRedraw()
-}
-
-Gauge.prototype._doRedraw = function () {
-  if (this._disabled || this._paused) {
-    return
-  }
-  if (!this._fixedFramerate) {
-    var now = Date.now()
-    if (this._lastUpdateAt && now - this._lastUpdateAt < this._updateInterval) {
-      return
-    }
-    this._lastUpdateAt = now
-  }
-  if (!this._showing && this._onScreen) {
-    this._onScreen = false
-    var result = this._gauge.hide()
-    if (this._hideCursor) {
-      result += this._gauge.showCursor()
-    }
-    return this._writeTo.write(result)
-  }
-  if (!this._showing && !this._onScreen) {
-    return
-  }
-  if (this._showing && !this._onScreen) {
-    this._onScreen = true
-    this._needsRedraw = true
-    if (this._hideCursor) {
-      this._writeTo.write(this._gauge.hideCursor())
-    }
-  }
-  if (!this._needsRedraw) {
-    return
-  }
-  if (!this._writeTo.write(this._gauge.show(this._status))) {
-    this._paused = true
-    this._writeTo.on('drain', callWith(this, function () {
-      this._paused = false
-      this._doRedraw()
-    }))
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/plumbing.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/plumbing.js
deleted file mode 100644
index c4dc3e074b95e..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/plumbing.js
+++ /dev/null
@@ -1,50 +0,0 @@
-'use strict'
-var consoleControl = require('console-control-strings')
-var renderTemplate = require('./render-template.js')
-var validate = require('aproba')
-
-var Plumbing = module.exports = function (theme, template, width) {
-  if (!width) {
-    width = 80
-  }
-  validate('OAN', [theme, template, width])
-  this.showing = false
-  this.theme = theme
-  this.width = width
-  this.template = template
-}
-Plumbing.prototype = {}
-
-Plumbing.prototype.setTheme = function (theme) {
-  validate('O', [theme])
-  this.theme = theme
-}
-
-Plumbing.prototype.setTemplate = function (template) {
-  validate('A', [template])
-  this.template = template
-}
-
-Plumbing.prototype.setWidth = function (width) {
-  validate('N', [width])
-  this.width = width
-}
-
-Plumbing.prototype.hide = function () {
-  return consoleControl.gotoSOL() + consoleControl.eraseLine()
-}
-
-Plumbing.prototype.hideCursor = consoleControl.hideCursor
-
-Plumbing.prototype.showCursor = consoleControl.showCursor
-
-Plumbing.prototype.show = function (status) {
-  var values = Object.create(this.theme)
-  for (var key in status) {
-    values[key] = status[key]
-  }
-
-  return renderTemplate(this.width, this.template, values).trim() +
-         consoleControl.color('reset') +
-         consoleControl.eraseLine() + consoleControl.gotoSOL()
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/process.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/process.js
deleted file mode 100644
index 05e85694d755b..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/process.js
+++ /dev/null
@@ -1,3 +0,0 @@
-'use strict'
-// this exists so we can replace it during testing
-module.exports = process
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/progress-bar.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/progress-bar.js
deleted file mode 100644
index 184ff2500aae4..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/progress-bar.js
+++ /dev/null
@@ -1,41 +0,0 @@
-'use strict'
-var validate = require('aproba')
-var renderTemplate = require('./render-template.js')
-var wideTruncate = require('./wide-truncate')
-var stringWidth = require('string-width')
-
-module.exports = function (theme, width, completed) {
-  validate('ONN', [theme, width, completed])
-  if (completed < 0) {
-    completed = 0
-  }
-  if (completed > 1) {
-    completed = 1
-  }
-  if (width <= 0) {
-    return ''
-  }
-  var sofar = Math.round(width * completed)
-  var rest = width - sofar
-  var template = [
-    { type: 'complete', value: repeat(theme.complete, sofar), length: sofar },
-    { type: 'remaining', value: repeat(theme.remaining, rest), length: rest },
-  ]
-  return renderTemplate(width, template, theme)
-}
-
-// lodash's way of repeating
-function repeat (string, width) {
-  var result = ''
-  var n = width
-  do {
-    if (n % 2) {
-      result += string
-    }
-    n = Math.floor(n / 2)
-    /* eslint no-self-assign: 0 */
-    string += string
-  } while (n && stringWidth(result) < width)
-
-  return wideTruncate(result, width)
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/render-template.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/render-template.js
deleted file mode 100644
index d1b52c0f48095..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/render-template.js
+++ /dev/null
@@ -1,222 +0,0 @@
-'use strict'
-var align = require('wide-align')
-var validate = require('aproba')
-var wideTruncate = require('./wide-truncate')
-var error = require('./error')
-var TemplateItem = require('./template-item')
-
-function renderValueWithValues (values) {
-  return function (item) {
-    return renderValue(item, values)
-  }
-}
-
-var renderTemplate = module.exports = function (width, template, values) {
-  var items = prepareItems(width, template, values)
-  var rendered = items.map(renderValueWithValues(values)).join('')
-  return align.left(wideTruncate(rendered, width), width)
-}
-
-function preType (item) {
-  var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1)
-  return 'pre' + cappedTypeName
-}
-
-function postType (item) {
-  var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1)
-  return 'post' + cappedTypeName
-}
-
-function hasPreOrPost (item, values) {
-  if (!item.type) {
-    return
-  }
-  return values[preType(item)] || values[postType(item)]
-}
-
-function generatePreAndPost (baseItem, parentValues) {
-  var item = Object.assign({}, baseItem)
-  var values = Object.create(parentValues)
-  var template = []
-  var pre = preType(item)
-  var post = postType(item)
-  if (values[pre]) {
-    template.push({ value: values[pre] })
-    values[pre] = null
-  }
-  item.minLength = null
-  item.length = null
-  item.maxLength = null
-  template.push(item)
-  values[item.type] = values[item.type]
-  if (values[post]) {
-    template.push({ value: values[post] })
-    values[post] = null
-  }
-  return function ($1, $2, length) {
-    return renderTemplate(length, template, values)
-  }
-}
-
-function prepareItems (width, template, values) {
-  function cloneAndObjectify (item, index, arr) {
-    var cloned = new TemplateItem(item, width)
-    var type = cloned.type
-    if (cloned.value == null) {
-      if (!(type in values)) {
-        if (cloned.default == null) {
-          throw new error.MissingTemplateValue(cloned, values)
-        } else {
-          cloned.value = cloned.default
-        }
-      } else {
-        cloned.value = values[type]
-      }
-    }
-    if (cloned.value == null || cloned.value === '') {
-      return null
-    }
-    cloned.index = index
-    cloned.first = index === 0
-    cloned.last = index === arr.length - 1
-    if (hasPreOrPost(cloned, values)) {
-      cloned.value = generatePreAndPost(cloned, values)
-    }
-    return cloned
-  }
-
-  var output = template.map(cloneAndObjectify).filter(function (item) {
-    return item != null
-  })
-
-  var remainingSpace = width
-  var variableCount = output.length
-
-  function consumeSpace (length) {
-    if (length > remainingSpace) {
-      length = remainingSpace
-    }
-    remainingSpace -= length
-  }
-
-  function finishSizing (item, length) {
-    if (item.finished) {
-      throw new error.Internal('Tried to finish template item that was already finished')
-    }
-    if (length === Infinity) {
-      throw new error.Internal('Length of template item cannot be infinity')
-    }
-    if (length != null) {
-      item.length = length
-    }
-    item.minLength = null
-    item.maxLength = null
-    --variableCount
-    item.finished = true
-    if (item.length == null) {
-      item.length = item.getBaseLength()
-    }
-    if (item.length == null) {
-      throw new error.Internal('Finished template items must have a length')
-    }
-    consumeSpace(item.getLength())
-  }
-
-  output.forEach(function (item) {
-    if (!item.kerning) {
-      return
-    }
-    var prevPadRight = item.first ? 0 : output[item.index - 1].padRight
-    if (!item.first && prevPadRight < item.kerning) {
-      item.padLeft = item.kerning - prevPadRight
-    }
-    if (!item.last) {
-      item.padRight = item.kerning
-    }
-  })
-
-  // Finish any that have a fixed (literal or intuited) length
-  output.forEach(function (item) {
-    if (item.getBaseLength() == null) {
-      return
-    }
-    finishSizing(item)
-  })
-
-  var resized = 0
-  var resizing
-  var hunkSize
-  do {
-    resizing = false
-    hunkSize = Math.round(remainingSpace / variableCount)
-    output.forEach(function (item) {
-      if (item.finished) {
-        return
-      }
-      if (!item.maxLength) {
-        return
-      }
-      if (item.getMaxLength() < hunkSize) {
-        finishSizing(item, item.maxLength)
-        resizing = true
-      }
-    })
-  } while (resizing && resized++ < output.length)
-  if (resizing) {
-    throw new error.Internal('Resize loop iterated too many times while determining maxLength')
-  }
-
-  resized = 0
-  do {
-    resizing = false
-    hunkSize = Math.round(remainingSpace / variableCount)
-    output.forEach(function (item) {
-      if (item.finished) {
-        return
-      }
-      if (!item.minLength) {
-        return
-      }
-      if (item.getMinLength() >= hunkSize) {
-        finishSizing(item, item.minLength)
-        resizing = true
-      }
-    })
-  } while (resizing && resized++ < output.length)
-  if (resizing) {
-    throw new error.Internal('Resize loop iterated too many times while determining minLength')
-  }
-
-  hunkSize = Math.round(remainingSpace / variableCount)
-  output.forEach(function (item) {
-    if (item.finished) {
-      return
-    }
-    finishSizing(item, hunkSize)
-  })
-
-  return output
-}
-
-function renderFunction (item, values, length) {
-  validate('OON', arguments)
-  if (item.type) {
-    return item.value(values, values[item.type + 'Theme'] || {}, length)
-  } else {
-    return item.value(values, {}, length)
-  }
-}
-
-function renderValue (item, values) {
-  var length = item.getBaseLength()
-  var value = typeof item.value === 'function' ? renderFunction(item, values, length) : item.value
-  if (value == null || value === '') {
-    return ''
-  }
-  var alignWith = align[item.align] || align.left
-  var leftPadding = item.padLeft ? align.left('', item.padLeft) : ''
-  var rightPadding = item.padRight ? align.right('', item.padRight) : ''
-  var truncated = wideTruncate(String(value), length)
-  var aligned = alignWith(truncated, length)
-  return leftPadding + aligned + rightPadding
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/set-immediate.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/set-immediate.js
deleted file mode 100644
index 6650a485c4993..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/set-immediate.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict'
-var process = require('./process')
-try {
-  module.exports = setImmediate
-} catch (ex) {
-  module.exports = process.nextTick
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/set-interval.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/set-interval.js
deleted file mode 100644
index 576198793c550..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/set-interval.js
+++ /dev/null
@@ -1,3 +0,0 @@
-'use strict'
-// this exists so we can replace it during testing
-module.exports = setInterval
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/spin.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/spin.js
deleted file mode 100644
index 34142ee31acc7..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/spin.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict'
-
-module.exports = function spin (spinstr, spun) {
-  return spinstr[spun % spinstr.length]
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/template-item.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/template-item.js
deleted file mode 100644
index e307e9b7421e7..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/template-item.js
+++ /dev/null
@@ -1,87 +0,0 @@
-'use strict'
-var stringWidth = require('string-width')
-
-module.exports = TemplateItem
-
-function isPercent (num) {
-  if (typeof num !== 'string') {
-    return false
-  }
-  return num.slice(-1) === '%'
-}
-
-function percent (num) {
-  return Number(num.slice(0, -1)) / 100
-}
-
-function TemplateItem (values, outputLength) {
-  this.overallOutputLength = outputLength
-  this.finished = false
-  this.type = null
-  this.value = null
-  this.length = null
-  this.maxLength = null
-  this.minLength = null
-  this.kerning = null
-  this.align = 'left'
-  this.padLeft = 0
-  this.padRight = 0
-  this.index = null
-  this.first = null
-  this.last = null
-  if (typeof values === 'string') {
-    this.value = values
-  } else {
-    for (var prop in values) {
-      this[prop] = values[prop]
-    }
-  }
-  // Realize percents
-  if (isPercent(this.length)) {
-    this.length = Math.round(this.overallOutputLength * percent(this.length))
-  }
-  if (isPercent(this.minLength)) {
-    this.minLength = Math.round(this.overallOutputLength * percent(this.minLength))
-  }
-  if (isPercent(this.maxLength)) {
-    this.maxLength = Math.round(this.overallOutputLength * percent(this.maxLength))
-  }
-  return this
-}
-
-TemplateItem.prototype = {}
-
-TemplateItem.prototype.getBaseLength = function () {
-  var length = this.length
-  if (
-    length == null &&
-    typeof this.value === 'string' &&
-    this.maxLength == null &&
-    this.minLength == null
-  ) {
-    length = stringWidth(this.value)
-  }
-  return length
-}
-
-TemplateItem.prototype.getLength = function () {
-  var length = this.getBaseLength()
-  if (length == null) {
-    return null
-  }
-  return length + this.padLeft + this.padRight
-}
-
-TemplateItem.prototype.getMaxLength = function () {
-  if (this.maxLength == null) {
-    return null
-  }
-  return this.maxLength + this.padLeft + this.padRight
-}
-
-TemplateItem.prototype.getMinLength = function () {
-  if (this.minLength == null) {
-    return null
-  }
-  return this.minLength + this.padLeft + this.padRight
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/theme-set.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/theme-set.js
deleted file mode 100644
index 643d7dbb1da34..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/theme-set.js
+++ /dev/null
@@ -1,122 +0,0 @@
-'use strict'
-
-module.exports = function () {
-  return ThemeSetProto.newThemeSet()
-}
-
-var ThemeSetProto = {}
-
-ThemeSetProto.baseTheme = require('./base-theme.js')
-
-ThemeSetProto.newTheme = function (parent, theme) {
-  if (!theme) {
-    theme = parent
-    parent = this.baseTheme
-  }
-  return Object.assign({}, parent, theme)
-}
-
-ThemeSetProto.getThemeNames = function () {
-  return Object.keys(this.themes)
-}
-
-ThemeSetProto.addTheme = function (name, parent, theme) {
-  this.themes[name] = this.newTheme(parent, theme)
-}
-
-ThemeSetProto.addToAllThemes = function (theme) {
-  var themes = this.themes
-  Object.keys(themes).forEach(function (name) {
-    Object.assign(themes[name], theme)
-  })
-  Object.assign(this.baseTheme, theme)
-}
-
-ThemeSetProto.getTheme = function (name) {
-  if (!this.themes[name]) {
-    throw this.newMissingThemeError(name)
-  }
-  return this.themes[name]
-}
-
-ThemeSetProto.setDefault = function (opts, name) {
-  if (name == null) {
-    name = opts
-    opts = {}
-  }
-  var platform = opts.platform == null ? 'fallback' : opts.platform
-  var hasUnicode = !!opts.hasUnicode
-  var hasColor = !!opts.hasColor
-  if (!this.defaults[platform]) {
-    this.defaults[platform] = { true: {}, false: {} }
-  }
-  this.defaults[platform][hasUnicode][hasColor] = name
-}
-
-ThemeSetProto.getDefault = function (opts) {
-  if (!opts) {
-    opts = {}
-  }
-  var platformName = opts.platform || process.platform
-  var platform = this.defaults[platformName] || this.defaults.fallback
-  var hasUnicode = !!opts.hasUnicode
-  var hasColor = !!opts.hasColor
-  if (!platform) {
-    throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor)
-  }
-  if (!platform[hasUnicode][hasColor]) {
-    if (hasUnicode && hasColor && platform[!hasUnicode][hasColor]) {
-      hasUnicode = false
-    } else if (hasUnicode && hasColor && platform[hasUnicode][!hasColor]) {
-      hasColor = false
-    } else if (hasUnicode && hasColor && platform[!hasUnicode][!hasColor]) {
-      hasUnicode = false
-      hasColor = false
-    } else if (hasUnicode && !hasColor && platform[!hasUnicode][hasColor]) {
-      hasUnicode = false
-    } else if (!hasUnicode && hasColor && platform[hasUnicode][!hasColor]) {
-      hasColor = false
-    } else if (platform === this.defaults.fallback) {
-      throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor)
-    }
-  }
-  if (platform[hasUnicode][hasColor]) {
-    return this.getTheme(platform[hasUnicode][hasColor])
-  } else {
-    return this.getDefault(Object.assign({}, opts, { platform: 'fallback' }))
-  }
-}
-
-ThemeSetProto.newMissingThemeError = function newMissingThemeError (name) {
-  var err = new Error('Could not find a gauge theme named "' + name + '"')
-  Error.captureStackTrace.call(err, newMissingThemeError)
-  err.theme = name
-  err.code = 'EMISSINGTHEME'
-  return err
-}
-
-ThemeSetProto.newMissingDefaultThemeError =
-  function newMissingDefaultThemeError (platformName, hasUnicode, hasColor) {
-    var err = new Error(
-      'Could not find a gauge theme for your platform/unicode/color use combo:\n' +
-    '    platform = ' + platformName + '\n' +
-    '    hasUnicode = ' + hasUnicode + '\n' +
-    '    hasColor = ' + hasColor)
-    Error.captureStackTrace.call(err, newMissingDefaultThemeError)
-    err.platform = platformName
-    err.hasUnicode = hasUnicode
-    err.hasColor = hasColor
-    err.code = 'EMISSINGTHEME'
-    return err
-  }
-
-ThemeSetProto.newThemeSet = function () {
-  var themeset = function (opts) {
-    return themeset.getDefault(opts)
-  }
-  return Object.assign(themeset, ThemeSetProto, {
-    themes: Object.assign({}, this.themes),
-    baseTheme: Object.assign({}, this.baseTheme),
-    defaults: JSON.parse(JSON.stringify(this.defaults || {})),
-  })
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/themes.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/themes.js
deleted file mode 100644
index d2e62bbccb3d8..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/themes.js
+++ /dev/null
@@ -1,56 +0,0 @@
-'use strict'
-var color = require('console-control-strings').color
-var ThemeSet = require('./theme-set.js')
-
-var themes = module.exports = new ThemeSet()
-
-themes.addTheme('ASCII', {
-  preProgressbar: '[',
-  postProgressbar: ']',
-  progressbarTheme: {
-    complete: '#',
-    remaining: '.',
-  },
-  activityIndicatorTheme: '-\\|/',
-  preSubsection: '>',
-})
-
-themes.addTheme('colorASCII', themes.getTheme('ASCII'), {
-  progressbarTheme: {
-    preComplete: color('bgBrightWhite', 'brightWhite'),
-    complete: '#',
-    postComplete: color('reset'),
-    preRemaining: color('bgBrightBlack', 'brightBlack'),
-    remaining: '.',
-    postRemaining: color('reset'),
-  },
-})
-
-themes.addTheme('brailleSpinner', {
-  preProgressbar: '(',
-  postProgressbar: ')',
-  progressbarTheme: {
-    complete: '#',
-    remaining: '⠂',
-  },
-  activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏',
-  preSubsection: '>',
-})
-
-themes.addTheme('colorBrailleSpinner', themes.getTheme('brailleSpinner'), {
-  progressbarTheme: {
-    preComplete: color('bgBrightWhite', 'brightWhite'),
-    complete: '#',
-    postComplete: color('reset'),
-    preRemaining: color('bgBrightBlack', 'brightBlack'),
-    remaining: '⠂',
-    postRemaining: color('reset'),
-  },
-})
-
-themes.setDefault({}, 'ASCII')
-themes.setDefault({ hasColor: true }, 'colorASCII')
-themes.setDefault({ platform: 'darwin', hasUnicode: true }, 'brailleSpinner')
-themes.setDefault({ platform: 'darwin', hasUnicode: true, hasColor: true }, 'colorBrailleSpinner')
-themes.setDefault({ platform: 'linux', hasUnicode: true }, 'brailleSpinner')
-themes.setDefault({ platform: 'linux', hasUnicode: true, hasColor: true }, 'colorBrailleSpinner')
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/lib/wide-truncate.js b/node_modules/@npmcli/run-script/node_modules/gauge/lib/wide-truncate.js
deleted file mode 100644
index 5284a699ac3fb..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/lib/wide-truncate.js
+++ /dev/null
@@ -1,31 +0,0 @@
-'use strict'
-var stringWidth = require('string-width')
-var stripAnsi = require('strip-ansi')
-
-module.exports = wideTruncate
-
-function wideTruncate (str, target) {
-  if (stringWidth(str) === 0) {
-    return str
-  }
-  if (target <= 0) {
-    return ''
-  }
-  if (stringWidth(str) <= target) {
-    return str
-  }
-
-  // We compute the number of bytes of ansi sequences here and add
-  // that to our initial truncation to ensure that we don't slice one
-  // that we want to keep in half.
-  var noAnsi = stripAnsi(str)
-  var ansiSize = str.length + noAnsi.length
-  var truncated = str.slice(0, target + ansiSize)
-
-  // we have to shrink the result to account for our ansi sequence buffer
-  // (if an ansi sequence was truncated) and double width characters.
-  while (stringWidth(truncated) > target) {
-    truncated = truncated.slice(0, -1)
-  }
-  return truncated
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/gauge/package.json b/node_modules/@npmcli/run-script/node_modules/gauge/package.json
deleted file mode 100644
index bce3e68a33f69..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/gauge/package.json
+++ /dev/null
@@ -1,66 +0,0 @@
-{
-  "name": "gauge",
-  "version": "4.0.4",
-  "description": "A terminal based horizontal gauge",
-  "main": "lib",
-  "scripts": {
-    "test": "tap",
-    "lint": "eslint \"**/*.js\"",
-    "postlint": "template-oss-check",
-    "lintfix": "npm run lint -- --fix",
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "prepublishOnly": "git push origin --follow-tags",
-    "snap": "tap",
-    "posttest": "npm run lint",
-    "template-oss-apply": "template-oss-apply --force"
-  },
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/npm/gauge.git"
-  },
-  "keywords": [
-    "progressbar",
-    "progress",
-    "gauge"
-  ],
-  "author": "GitHub Inc.",
-  "license": "ISC",
-  "bugs": {
-    "url": "https://github.com/npm/gauge/issues"
-  },
-  "homepage": "https://github.com/npm/gauge",
-  "dependencies": {
-    "aproba": "^1.0.3 || ^2.0.0",
-    "color-support": "^1.1.3",
-    "console-control-strings": "^1.1.0",
-    "has-unicode": "^2.0.1",
-    "signal-exit": "^3.0.7",
-    "string-width": "^4.2.3",
-    "strip-ansi": "^6.0.1",
-    "wide-align": "^1.1.5"
-  },
-  "devDependencies": {
-    "@npmcli/eslint-config": "^3.0.1",
-    "@npmcli/template-oss": "3.2.0",
-    "readable-stream": "^3.6.0",
-    "tap": "^16.0.1"
-  },
-  "files": [
-    "bin/",
-    "lib/"
-  ],
-  "engines": {
-    "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
-  },
-  "tap": {
-    "branches": 79,
-    "statements": 89,
-    "functions": 92,
-    "lines": 90
-  },
-  "templateOSS": {
-    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
-    "version": "3.2.0"
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/glob/LICENSE b/node_modules/@npmcli/run-script/node_modules/glob/LICENSE
deleted file mode 100644
index 42ca266df1d52..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/glob/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-## Glob Logo
-
-Glob's logo created by Tanya Brassie , licensed
-under a Creative Commons Attribution-ShareAlike 4.0 International License
-https://creativecommons.org/licenses/by-sa/4.0/
diff --git a/node_modules/@npmcli/run-script/node_modules/glob/common.js b/node_modules/@npmcli/run-script/node_modules/glob/common.js
deleted file mode 100644
index 424c46e1dab1b..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/glob/common.js
+++ /dev/null
@@ -1,238 +0,0 @@
-exports.setopts = setopts
-exports.ownProp = ownProp
-exports.makeAbs = makeAbs
-exports.finish = finish
-exports.mark = mark
-exports.isIgnored = isIgnored
-exports.childrenIgnored = childrenIgnored
-
-function ownProp (obj, field) {
-  return Object.prototype.hasOwnProperty.call(obj, field)
-}
-
-var fs = require("fs")
-var path = require("path")
-var minimatch = require("minimatch")
-var isAbsolute = require("path-is-absolute")
-var Minimatch = minimatch.Minimatch
-
-function alphasort (a, b) {
-  return a.localeCompare(b, 'en')
-}
-
-function setupIgnores (self, options) {
-  self.ignore = options.ignore || []
-
-  if (!Array.isArray(self.ignore))
-    self.ignore = [self.ignore]
-
-  if (self.ignore.length) {
-    self.ignore = self.ignore.map(ignoreMap)
-  }
-}
-
-// ignore patterns are always in dot:true mode.
-function ignoreMap (pattern) {
-  var gmatcher = null
-  if (pattern.slice(-3) === '/**') {
-    var gpattern = pattern.replace(/(\/\*\*)+$/, '')
-    gmatcher = new Minimatch(gpattern, { dot: true })
-  }
-
-  return {
-    matcher: new Minimatch(pattern, { dot: true }),
-    gmatcher: gmatcher
-  }
-}
-
-function setopts (self, pattern, options) {
-  if (!options)
-    options = {}
-
-  // base-matching: just use globstar for that.
-  if (options.matchBase && -1 === pattern.indexOf("/")) {
-    if (options.noglobstar) {
-      throw new Error("base matching requires globstar")
-    }
-    pattern = "**/" + pattern
-  }
-
-  self.silent = !!options.silent
-  self.pattern = pattern
-  self.strict = options.strict !== false
-  self.realpath = !!options.realpath
-  self.realpathCache = options.realpathCache || Object.create(null)
-  self.follow = !!options.follow
-  self.dot = !!options.dot
-  self.mark = !!options.mark
-  self.nodir = !!options.nodir
-  if (self.nodir)
-    self.mark = true
-  self.sync = !!options.sync
-  self.nounique = !!options.nounique
-  self.nonull = !!options.nonull
-  self.nosort = !!options.nosort
-  self.nocase = !!options.nocase
-  self.stat = !!options.stat
-  self.noprocess = !!options.noprocess
-  self.absolute = !!options.absolute
-  self.fs = options.fs || fs
-
-  self.maxLength = options.maxLength || Infinity
-  self.cache = options.cache || Object.create(null)
-  self.statCache = options.statCache || Object.create(null)
-  self.symlinks = options.symlinks || Object.create(null)
-
-  setupIgnores(self, options)
-
-  self.changedCwd = false
-  var cwd = process.cwd()
-  if (!ownProp(options, "cwd"))
-    self.cwd = cwd
-  else {
-    self.cwd = path.resolve(options.cwd)
-    self.changedCwd = self.cwd !== cwd
-  }
-
-  self.root = options.root || path.resolve(self.cwd, "/")
-  self.root = path.resolve(self.root)
-  if (process.platform === "win32")
-    self.root = self.root.replace(/\\/g, "/")
-
-  // TODO: is an absolute `cwd` supposed to be resolved against `root`?
-  // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
-  self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
-  if (process.platform === "win32")
-    self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
-  self.nomount = !!options.nomount
-
-  // disable comments and negation in Minimatch.
-  // Note that they are not supported in Glob itself anyway.
-  options.nonegate = true
-  options.nocomment = true
-  // always treat \ in patterns as escapes, not path separators
-  options.allowWindowsEscape = false
-
-  self.minimatch = new Minimatch(pattern, options)
-  self.options = self.minimatch.options
-}
-
-function finish (self) {
-  var nou = self.nounique
-  var all = nou ? [] : Object.create(null)
-
-  for (var i = 0, l = self.matches.length; i < l; i ++) {
-    var matches = self.matches[i]
-    if (!matches || Object.keys(matches).length === 0) {
-      if (self.nonull) {
-        // do like the shell, and spit out the literal glob
-        var literal = self.minimatch.globSet[i]
-        if (nou)
-          all.push(literal)
-        else
-          all[literal] = true
-      }
-    } else {
-      // had matches
-      var m = Object.keys(matches)
-      if (nou)
-        all.push.apply(all, m)
-      else
-        m.forEach(function (m) {
-          all[m] = true
-        })
-    }
-  }
-
-  if (!nou)
-    all = Object.keys(all)
-
-  if (!self.nosort)
-    all = all.sort(alphasort)
-
-  // at *some* point we statted all of these
-  if (self.mark) {
-    for (var i = 0; i < all.length; i++) {
-      all[i] = self._mark(all[i])
-    }
-    if (self.nodir) {
-      all = all.filter(function (e) {
-        var notDir = !(/\/$/.test(e))
-        var c = self.cache[e] || self.cache[makeAbs(self, e)]
-        if (notDir && c)
-          notDir = c !== 'DIR' && !Array.isArray(c)
-        return notDir
-      })
-    }
-  }
-
-  if (self.ignore.length)
-    all = all.filter(function(m) {
-      return !isIgnored(self, m)
-    })
-
-  self.found = all
-}
-
-function mark (self, p) {
-  var abs = makeAbs(self, p)
-  var c = self.cache[abs]
-  var m = p
-  if (c) {
-    var isDir = c === 'DIR' || Array.isArray(c)
-    var slash = p.slice(-1) === '/'
-
-    if (isDir && !slash)
-      m += '/'
-    else if (!isDir && slash)
-      m = m.slice(0, -1)
-
-    if (m !== p) {
-      var mabs = makeAbs(self, m)
-      self.statCache[mabs] = self.statCache[abs]
-      self.cache[mabs] = self.cache[abs]
-    }
-  }
-
-  return m
-}
-
-// lotta situps...
-function makeAbs (self, f) {
-  var abs = f
-  if (f.charAt(0) === '/') {
-    abs = path.join(self.root, f)
-  } else if (isAbsolute(f) || f === '') {
-    abs = f
-  } else if (self.changedCwd) {
-    abs = path.resolve(self.cwd, f)
-  } else {
-    abs = path.resolve(f)
-  }
-
-  if (process.platform === 'win32')
-    abs = abs.replace(/\\/g, '/')
-
-  return abs
-}
-
-
-// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
-// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
-function isIgnored (self, path) {
-  if (!self.ignore.length)
-    return false
-
-  return self.ignore.some(function(item) {
-    return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
-  })
-}
-
-function childrenIgnored (self, path) {
-  if (!self.ignore.length)
-    return false
-
-  return self.ignore.some(function(item) {
-    return !!(item.gmatcher && item.gmatcher.match(path))
-  })
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/glob/glob.js b/node_modules/@npmcli/run-script/node_modules/glob/glob.js
deleted file mode 100644
index 37a4d7e60775a..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/glob/glob.js
+++ /dev/null
@@ -1,790 +0,0 @@
-// Approach:
-//
-// 1. Get the minimatch set
-// 2. For each pattern in the set, PROCESS(pattern, false)
-// 3. Store matches per-set, then uniq them
-//
-// PROCESS(pattern, inGlobStar)
-// Get the first [n] items from pattern that are all strings
-// Join these together.  This is PREFIX.
-//   If there is no more remaining, then stat(PREFIX) and
-//   add to matches if it succeeds.  END.
-//
-// If inGlobStar and PREFIX is symlink and points to dir
-//   set ENTRIES = []
-// else readdir(PREFIX) as ENTRIES
-//   If fail, END
-//
-// with ENTRIES
-//   If pattern[n] is GLOBSTAR
-//     // handle the case where the globstar match is empty
-//     // by pruning it out, and testing the resulting pattern
-//     PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
-//     // handle other cases.
-//     for ENTRY in ENTRIES (not dotfiles)
-//       // attach globstar + tail onto the entry
-//       // Mark that this entry is a globstar match
-//       PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
-//
-//   else // not globstar
-//     for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
-//       Test ENTRY against pattern[n]
-//       If fails, continue
-//       If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
-//
-// Caveat:
-//   Cache all stats and readdirs results to minimize syscall.  Since all
-//   we ever care about is existence and directory-ness, we can just keep
-//   `true` for files, and [children,...] for directories, or `false` for
-//   things that don't exist.
-
-module.exports = glob
-
-var rp = require('fs.realpath')
-var minimatch = require('minimatch')
-var Minimatch = minimatch.Minimatch
-var inherits = require('inherits')
-var EE = require('events').EventEmitter
-var path = require('path')
-var assert = require('assert')
-var isAbsolute = require('path-is-absolute')
-var globSync = require('./sync.js')
-var common = require('./common.js')
-var setopts = common.setopts
-var ownProp = common.ownProp
-var inflight = require('inflight')
-var util = require('util')
-var childrenIgnored = common.childrenIgnored
-var isIgnored = common.isIgnored
-
-var once = require('once')
-
-function glob (pattern, options, cb) {
-  if (typeof options === 'function') cb = options, options = {}
-  if (!options) options = {}
-
-  if (options.sync) {
-    if (cb)
-      throw new TypeError('callback provided to sync glob')
-    return globSync(pattern, options)
-  }
-
-  return new Glob(pattern, options, cb)
-}
-
-glob.sync = globSync
-var GlobSync = glob.GlobSync = globSync.GlobSync
-
-// old api surface
-glob.glob = glob
-
-function extend (origin, add) {
-  if (add === null || typeof add !== 'object') {
-    return origin
-  }
-
-  var keys = Object.keys(add)
-  var i = keys.length
-  while (i--) {
-    origin[keys[i]] = add[keys[i]]
-  }
-  return origin
-}
-
-glob.hasMagic = function (pattern, options_) {
-  var options = extend({}, options_)
-  options.noprocess = true
-
-  var g = new Glob(pattern, options)
-  var set = g.minimatch.set
-
-  if (!pattern)
-    return false
-
-  if (set.length > 1)
-    return true
-
-  for (var j = 0; j < set[0].length; j++) {
-    if (typeof set[0][j] !== 'string')
-      return true
-  }
-
-  return false
-}
-
-glob.Glob = Glob
-inherits(Glob, EE)
-function Glob (pattern, options, cb) {
-  if (typeof options === 'function') {
-    cb = options
-    options = null
-  }
-
-  if (options && options.sync) {
-    if (cb)
-      throw new TypeError('callback provided to sync glob')
-    return new GlobSync(pattern, options)
-  }
-
-  if (!(this instanceof Glob))
-    return new Glob(pattern, options, cb)
-
-  setopts(this, pattern, options)
-  this._didRealPath = false
-
-  // process each pattern in the minimatch set
-  var n = this.minimatch.set.length
-
-  // The matches are stored as {: true,...} so that
-  // duplicates are automagically pruned.
-  // Later, we do an Object.keys() on these.
-  // Keep them as a list so we can fill in when nonull is set.
-  this.matches = new Array(n)
-
-  if (typeof cb === 'function') {
-    cb = once(cb)
-    this.on('error', cb)
-    this.on('end', function (matches) {
-      cb(null, matches)
-    })
-  }
-
-  var self = this
-  this._processing = 0
-
-  this._emitQueue = []
-  this._processQueue = []
-  this.paused = false
-
-  if (this.noprocess)
-    return this
-
-  if (n === 0)
-    return done()
-
-  var sync = true
-  for (var i = 0; i < n; i ++) {
-    this._process(this.minimatch.set[i], i, false, done)
-  }
-  sync = false
-
-  function done () {
-    --self._processing
-    if (self._processing <= 0) {
-      if (sync) {
-        process.nextTick(function () {
-          self._finish()
-        })
-      } else {
-        self._finish()
-      }
-    }
-  }
-}
-
-Glob.prototype._finish = function () {
-  assert(this instanceof Glob)
-  if (this.aborted)
-    return
-
-  if (this.realpath && !this._didRealpath)
-    return this._realpath()
-
-  common.finish(this)
-  this.emit('end', this.found)
-}
-
-Glob.prototype._realpath = function () {
-  if (this._didRealpath)
-    return
-
-  this._didRealpath = true
-
-  var n = this.matches.length
-  if (n === 0)
-    return this._finish()
-
-  var self = this
-  for (var i = 0; i < this.matches.length; i++)
-    this._realpathSet(i, next)
-
-  function next () {
-    if (--n === 0)
-      self._finish()
-  }
-}
-
-Glob.prototype._realpathSet = function (index, cb) {
-  var matchset = this.matches[index]
-  if (!matchset)
-    return cb()
-
-  var found = Object.keys(matchset)
-  var self = this
-  var n = found.length
-
-  if (n === 0)
-    return cb()
-
-  var set = this.matches[index] = Object.create(null)
-  found.forEach(function (p, i) {
-    // If there's a problem with the stat, then it means that
-    // one or more of the links in the realpath couldn't be
-    // resolved.  just return the abs value in that case.
-    p = self._makeAbs(p)
-    rp.realpath(p, self.realpathCache, function (er, real) {
-      if (!er)
-        set[real] = true
-      else if (er.syscall === 'stat')
-        set[p] = true
-      else
-        self.emit('error', er) // srsly wtf right here
-
-      if (--n === 0) {
-        self.matches[index] = set
-        cb()
-      }
-    })
-  })
-}
-
-Glob.prototype._mark = function (p) {
-  return common.mark(this, p)
-}
-
-Glob.prototype._makeAbs = function (f) {
-  return common.makeAbs(this, f)
-}
-
-Glob.prototype.abort = function () {
-  this.aborted = true
-  this.emit('abort')
-}
-
-Glob.prototype.pause = function () {
-  if (!this.paused) {
-    this.paused = true
-    this.emit('pause')
-  }
-}
-
-Glob.prototype.resume = function () {
-  if (this.paused) {
-    this.emit('resume')
-    this.paused = false
-    if (this._emitQueue.length) {
-      var eq = this._emitQueue.slice(0)
-      this._emitQueue.length = 0
-      for (var i = 0; i < eq.length; i ++) {
-        var e = eq[i]
-        this._emitMatch(e[0], e[1])
-      }
-    }
-    if (this._processQueue.length) {
-      var pq = this._processQueue.slice(0)
-      this._processQueue.length = 0
-      for (var i = 0; i < pq.length; i ++) {
-        var p = pq[i]
-        this._processing--
-        this._process(p[0], p[1], p[2], p[3])
-      }
-    }
-  }
-}
-
-Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
-  assert(this instanceof Glob)
-  assert(typeof cb === 'function')
-
-  if (this.aborted)
-    return
-
-  this._processing++
-  if (this.paused) {
-    this._processQueue.push([pattern, index, inGlobStar, cb])
-    return
-  }
-
-  //console.error('PROCESS %d', this._processing, pattern)
-
-  // Get the first [n] parts of pattern that are all strings.
-  var n = 0
-  while (typeof pattern[n] === 'string') {
-    n ++
-  }
-  // now n is the index of the first one that is *not* a string.
-
-  // see if there's anything else
-  var prefix
-  switch (n) {
-    // if not, then this is rather simple
-    case pattern.length:
-      this._processSimple(pattern.join('/'), index, cb)
-      return
-
-    case 0:
-      // pattern *starts* with some non-trivial item.
-      // going to readdir(cwd), but not include the prefix in matches.
-      prefix = null
-      break
-
-    default:
-      // pattern has some string bits in the front.
-      // whatever it starts with, whether that's 'absolute' like /foo/bar,
-      // or 'relative' like '../baz'
-      prefix = pattern.slice(0, n).join('/')
-      break
-  }
-
-  var remain = pattern.slice(n)
-
-  // get the list of entries.
-  var read
-  if (prefix === null)
-    read = '.'
-  else if (isAbsolute(prefix) ||
-      isAbsolute(pattern.map(function (p) {
-        return typeof p === 'string' ? p : '[*]'
-      }).join('/'))) {
-    if (!prefix || !isAbsolute(prefix))
-      prefix = '/' + prefix
-    read = prefix
-  } else
-    read = prefix
-
-  var abs = this._makeAbs(read)
-
-  //if ignored, skip _processing
-  if (childrenIgnored(this, read))
-    return cb()
-
-  var isGlobStar = remain[0] === minimatch.GLOBSTAR
-  if (isGlobStar)
-    this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
-  else
-    this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
-}
-
-Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
-  var self = this
-  this._readdir(abs, inGlobStar, function (er, entries) {
-    return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
-  })
-}
-
-Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
-
-  // if the abs isn't a dir, then nothing can match!
-  if (!entries)
-    return cb()
-
-  // It will only match dot entries if it starts with a dot, or if
-  // dot is set.  Stuff like @(.foo|.bar) isn't allowed.
-  var pn = remain[0]
-  var negate = !!this.minimatch.negate
-  var rawGlob = pn._glob
-  var dotOk = this.dot || rawGlob.charAt(0) === '.'
-
-  var matchedEntries = []
-  for (var i = 0; i < entries.length; i++) {
-    var e = entries[i]
-    if (e.charAt(0) !== '.' || dotOk) {
-      var m
-      if (negate && !prefix) {
-        m = !e.match(pn)
-      } else {
-        m = e.match(pn)
-      }
-      if (m)
-        matchedEntries.push(e)
-    }
-  }
-
-  //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
-
-  var len = matchedEntries.length
-  // If there are no matched entries, then nothing matches.
-  if (len === 0)
-    return cb()
-
-  // if this is the last remaining pattern bit, then no need for
-  // an additional stat *unless* the user has specified mark or
-  // stat explicitly.  We know they exist, since readdir returned
-  // them.
-
-  if (remain.length === 1 && !this.mark && !this.stat) {
-    if (!this.matches[index])
-      this.matches[index] = Object.create(null)
-
-    for (var i = 0; i < len; i ++) {
-      var e = matchedEntries[i]
-      if (prefix) {
-        if (prefix !== '/')
-          e = prefix + '/' + e
-        else
-          e = prefix + e
-      }
-
-      if (e.charAt(0) === '/' && !this.nomount) {
-        e = path.join(this.root, e)
-      }
-      this._emitMatch(index, e)
-    }
-    // This was the last one, and no stats were needed
-    return cb()
-  }
-
-  // now test all matched entries as stand-ins for that part
-  // of the pattern.
-  remain.shift()
-  for (var i = 0; i < len; i ++) {
-    var e = matchedEntries[i]
-    var newPattern
-    if (prefix) {
-      if (prefix !== '/')
-        e = prefix + '/' + e
-      else
-        e = prefix + e
-    }
-    this._process([e].concat(remain), index, inGlobStar, cb)
-  }
-  cb()
-}
-
-Glob.prototype._emitMatch = function (index, e) {
-  if (this.aborted)
-    return
-
-  if (isIgnored(this, e))
-    return
-
-  if (this.paused) {
-    this._emitQueue.push([index, e])
-    return
-  }
-
-  var abs = isAbsolute(e) ? e : this._makeAbs(e)
-
-  if (this.mark)
-    e = this._mark(e)
-
-  if (this.absolute)
-    e = abs
-
-  if (this.matches[index][e])
-    return
-
-  if (this.nodir) {
-    var c = this.cache[abs]
-    if (c === 'DIR' || Array.isArray(c))
-      return
-  }
-
-  this.matches[index][e] = true
-
-  var st = this.statCache[abs]
-  if (st)
-    this.emit('stat', e, st)
-
-  this.emit('match', e)
-}
-
-Glob.prototype._readdirInGlobStar = function (abs, cb) {
-  if (this.aborted)
-    return
-
-  // follow all symlinked directories forever
-  // just proceed as if this is a non-globstar situation
-  if (this.follow)
-    return this._readdir(abs, false, cb)
-
-  var lstatkey = 'lstat\0' + abs
-  var self = this
-  var lstatcb = inflight(lstatkey, lstatcb_)
-
-  if (lstatcb)
-    self.fs.lstat(abs, lstatcb)
-
-  function lstatcb_ (er, lstat) {
-    if (er && er.code === 'ENOENT')
-      return cb()
-
-    var isSym = lstat && lstat.isSymbolicLink()
-    self.symlinks[abs] = isSym
-
-    // If it's not a symlink or a dir, then it's definitely a regular file.
-    // don't bother doing a readdir in that case.
-    if (!isSym && lstat && !lstat.isDirectory()) {
-      self.cache[abs] = 'FILE'
-      cb()
-    } else
-      self._readdir(abs, false, cb)
-  }
-}
-
-Glob.prototype._readdir = function (abs, inGlobStar, cb) {
-  if (this.aborted)
-    return
-
-  cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
-  if (!cb)
-    return
-
-  //console.error('RD %j %j', +inGlobStar, abs)
-  if (inGlobStar && !ownProp(this.symlinks, abs))
-    return this._readdirInGlobStar(abs, cb)
-
-  if (ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-    if (!c || c === 'FILE')
-      return cb()
-
-    if (Array.isArray(c))
-      return cb(null, c)
-  }
-
-  var self = this
-  self.fs.readdir(abs, readdirCb(this, abs, cb))
-}
-
-function readdirCb (self, abs, cb) {
-  return function (er, entries) {
-    if (er)
-      self._readdirError(abs, er, cb)
-    else
-      self._readdirEntries(abs, entries, cb)
-  }
-}
-
-Glob.prototype._readdirEntries = function (abs, entries, cb) {
-  if (this.aborted)
-    return
-
-  // if we haven't asked to stat everything, then just
-  // assume that everything in there exists, so we can avoid
-  // having to stat it a second time.
-  if (!this.mark && !this.stat) {
-    for (var i = 0; i < entries.length; i ++) {
-      var e = entries[i]
-      if (abs === '/')
-        e = abs + e
-      else
-        e = abs + '/' + e
-      this.cache[e] = true
-    }
-  }
-
-  this.cache[abs] = entries
-  return cb(null, entries)
-}
-
-Glob.prototype._readdirError = function (f, er, cb) {
-  if (this.aborted)
-    return
-
-  // handle errors, and cache the information
-  switch (er.code) {
-    case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
-    case 'ENOTDIR': // totally normal. means it *does* exist.
-      var abs = this._makeAbs(f)
-      this.cache[abs] = 'FILE'
-      if (abs === this.cwdAbs) {
-        var error = new Error(er.code + ' invalid cwd ' + this.cwd)
-        error.path = this.cwd
-        error.code = er.code
-        this.emit('error', error)
-        this.abort()
-      }
-      break
-
-    case 'ENOENT': // not terribly unusual
-    case 'ELOOP':
-    case 'ENAMETOOLONG':
-    case 'UNKNOWN':
-      this.cache[this._makeAbs(f)] = false
-      break
-
-    default: // some unusual error.  Treat as failure.
-      this.cache[this._makeAbs(f)] = false
-      if (this.strict) {
-        this.emit('error', er)
-        // If the error is handled, then we abort
-        // if not, we threw out of here
-        this.abort()
-      }
-      if (!this.silent)
-        console.error('glob error', er)
-      break
-  }
-
-  return cb()
-}
-
-Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
-  var self = this
-  this._readdir(abs, inGlobStar, function (er, entries) {
-    self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
-  })
-}
-
-
-Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
-  //console.error('pgs2', prefix, remain[0], entries)
-
-  // no entries means not a dir, so it can never have matches
-  // foo.txt/** doesn't match foo.txt
-  if (!entries)
-    return cb()
-
-  // test without the globstar, and with every child both below
-  // and replacing the globstar.
-  var remainWithoutGlobStar = remain.slice(1)
-  var gspref = prefix ? [ prefix ] : []
-  var noGlobStar = gspref.concat(remainWithoutGlobStar)
-
-  // the noGlobStar pattern exits the inGlobStar state
-  this._process(noGlobStar, index, false, cb)
-
-  var isSym = this.symlinks[abs]
-  var len = entries.length
-
-  // If it's a symlink, and we're in a globstar, then stop
-  if (isSym && inGlobStar)
-    return cb()
-
-  for (var i = 0; i < len; i++) {
-    var e = entries[i]
-    if (e.charAt(0) === '.' && !this.dot)
-      continue
-
-    // these two cases enter the inGlobStar state
-    var instead = gspref.concat(entries[i], remainWithoutGlobStar)
-    this._process(instead, index, true, cb)
-
-    var below = gspref.concat(entries[i], remain)
-    this._process(below, index, true, cb)
-  }
-
-  cb()
-}
-
-Glob.prototype._processSimple = function (prefix, index, cb) {
-  // XXX review this.  Shouldn't it be doing the mounting etc
-  // before doing stat?  kinda weird?
-  var self = this
-  this._stat(prefix, function (er, exists) {
-    self._processSimple2(prefix, index, er, exists, cb)
-  })
-}
-Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
-
-  //console.error('ps2', prefix, exists)
-
-  if (!this.matches[index])
-    this.matches[index] = Object.create(null)
-
-  // If it doesn't exist, then just mark the lack of results
-  if (!exists)
-    return cb()
-
-  if (prefix && isAbsolute(prefix) && !this.nomount) {
-    var trail = /[\/\\]$/.test(prefix)
-    if (prefix.charAt(0) === '/') {
-      prefix = path.join(this.root, prefix)
-    } else {
-      prefix = path.resolve(this.root, prefix)
-      if (trail)
-        prefix += '/'
-    }
-  }
-
-  if (process.platform === 'win32')
-    prefix = prefix.replace(/\\/g, '/')
-
-  // Mark this as a match
-  this._emitMatch(index, prefix)
-  cb()
-}
-
-// Returns either 'DIR', 'FILE', or false
-Glob.prototype._stat = function (f, cb) {
-  var abs = this._makeAbs(f)
-  var needDir = f.slice(-1) === '/'
-
-  if (f.length > this.maxLength)
-    return cb()
-
-  if (!this.stat && ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-
-    if (Array.isArray(c))
-      c = 'DIR'
-
-    // It exists, but maybe not how we need it
-    if (!needDir || c === 'DIR')
-      return cb(null, c)
-
-    if (needDir && c === 'FILE')
-      return cb()
-
-    // otherwise we have to stat, because maybe c=true
-    // if we know it exists, but not what it is.
-  }
-
-  var exists
-  var stat = this.statCache[abs]
-  if (stat !== undefined) {
-    if (stat === false)
-      return cb(null, stat)
-    else {
-      var type = stat.isDirectory() ? 'DIR' : 'FILE'
-      if (needDir && type === 'FILE')
-        return cb()
-      else
-        return cb(null, type, stat)
-    }
-  }
-
-  var self = this
-  var statcb = inflight('stat\0' + abs, lstatcb_)
-  if (statcb)
-    self.fs.lstat(abs, statcb)
-
-  function lstatcb_ (er, lstat) {
-    if (lstat && lstat.isSymbolicLink()) {
-      // If it's a symlink, then treat it as the target, unless
-      // the target does not exist, then treat it as a file.
-      return self.fs.stat(abs, function (er, stat) {
-        if (er)
-          self._stat2(f, abs, null, lstat, cb)
-        else
-          self._stat2(f, abs, er, stat, cb)
-      })
-    } else {
-      self._stat2(f, abs, er, lstat, cb)
-    }
-  }
-}
-
-Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
-  if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
-    this.statCache[abs] = false
-    return cb()
-  }
-
-  var needDir = f.slice(-1) === '/'
-  this.statCache[abs] = stat
-
-  if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
-    return cb(null, false, stat)
-
-  var c = true
-  if (stat)
-    c = stat.isDirectory() ? 'DIR' : 'FILE'
-  this.cache[abs] = this.cache[abs] || c
-
-  if (needDir && c === 'FILE')
-    return cb()
-
-  return cb(null, c, stat)
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/glob/package.json b/node_modules/@npmcli/run-script/node_modules/glob/package.json
deleted file mode 100644
index 5940b649b7e65..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/glob/package.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
-  "author": "Isaac Z. Schlueter  (http://blog.izs.me/)",
-  "name": "glob",
-  "description": "a little globber",
-  "version": "7.2.3",
-  "publishConfig": {
-    "tag": "v7-legacy"
-  },
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/node-glob.git"
-  },
-  "main": "glob.js",
-  "files": [
-    "glob.js",
-    "sync.js",
-    "common.js"
-  ],
-  "engines": {
-    "node": "*"
-  },
-  "dependencies": {
-    "fs.realpath": "^1.0.0",
-    "inflight": "^1.0.4",
-    "inherits": "2",
-    "minimatch": "^3.1.1",
-    "once": "^1.3.0",
-    "path-is-absolute": "^1.0.0"
-  },
-  "devDependencies": {
-    "memfs": "^3.2.0",
-    "mkdirp": "0",
-    "rimraf": "^2.2.8",
-    "tap": "^15.0.6",
-    "tick": "0.0.6"
-  },
-  "tap": {
-    "before": "test/00-setup.js",
-    "after": "test/zz-cleanup.js",
-    "jobs": 1
-  },
-  "scripts": {
-    "prepublish": "npm run benchclean",
-    "profclean": "rm -f v8.log profile.txt",
-    "test": "tap",
-    "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js",
-    "bench": "bash benchmark.sh",
-    "prof": "bash prof.sh && cat profile.txt",
-    "benchclean": "node benchclean.js"
-  },
-  "license": "ISC",
-  "funding": {
-    "url": "https://github.com/sponsors/isaacs"
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/glob/sync.js b/node_modules/@npmcli/run-script/node_modules/glob/sync.js
deleted file mode 100644
index 2c4f480192d28..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/glob/sync.js
+++ /dev/null
@@ -1,486 +0,0 @@
-module.exports = globSync
-globSync.GlobSync = GlobSync
-
-var rp = require('fs.realpath')
-var minimatch = require('minimatch')
-var Minimatch = minimatch.Minimatch
-var Glob = require('./glob.js').Glob
-var util = require('util')
-var path = require('path')
-var assert = require('assert')
-var isAbsolute = require('path-is-absolute')
-var common = require('./common.js')
-var setopts = common.setopts
-var ownProp = common.ownProp
-var childrenIgnored = common.childrenIgnored
-var isIgnored = common.isIgnored
-
-function globSync (pattern, options) {
-  if (typeof options === 'function' || arguments.length === 3)
-    throw new TypeError('callback provided to sync glob\n'+
-                        'See: https://github.com/isaacs/node-glob/issues/167')
-
-  return new GlobSync(pattern, options).found
-}
-
-function GlobSync (pattern, options) {
-  if (!pattern)
-    throw new Error('must provide pattern')
-
-  if (typeof options === 'function' || arguments.length === 3)
-    throw new TypeError('callback provided to sync glob\n'+
-                        'See: https://github.com/isaacs/node-glob/issues/167')
-
-  if (!(this instanceof GlobSync))
-    return new GlobSync(pattern, options)
-
-  setopts(this, pattern, options)
-
-  if (this.noprocess)
-    return this
-
-  var n = this.minimatch.set.length
-  this.matches = new Array(n)
-  for (var i = 0; i < n; i ++) {
-    this._process(this.minimatch.set[i], i, false)
-  }
-  this._finish()
-}
-
-GlobSync.prototype._finish = function () {
-  assert.ok(this instanceof GlobSync)
-  if (this.realpath) {
-    var self = this
-    this.matches.forEach(function (matchset, index) {
-      var set = self.matches[index] = Object.create(null)
-      for (var p in matchset) {
-        try {
-          p = self._makeAbs(p)
-          var real = rp.realpathSync(p, self.realpathCache)
-          set[real] = true
-        } catch (er) {
-          if (er.syscall === 'stat')
-            set[self._makeAbs(p)] = true
-          else
-            throw er
-        }
-      }
-    })
-  }
-  common.finish(this)
-}
-
-
-GlobSync.prototype._process = function (pattern, index, inGlobStar) {
-  assert.ok(this instanceof GlobSync)
-
-  // Get the first [n] parts of pattern that are all strings.
-  var n = 0
-  while (typeof pattern[n] === 'string') {
-    n ++
-  }
-  // now n is the index of the first one that is *not* a string.
-
-  // See if there's anything else
-  var prefix
-  switch (n) {
-    // if not, then this is rather simple
-    case pattern.length:
-      this._processSimple(pattern.join('/'), index)
-      return
-
-    case 0:
-      // pattern *starts* with some non-trivial item.
-      // going to readdir(cwd), but not include the prefix in matches.
-      prefix = null
-      break
-
-    default:
-      // pattern has some string bits in the front.
-      // whatever it starts with, whether that's 'absolute' like /foo/bar,
-      // or 'relative' like '../baz'
-      prefix = pattern.slice(0, n).join('/')
-      break
-  }
-
-  var remain = pattern.slice(n)
-
-  // get the list of entries.
-  var read
-  if (prefix === null)
-    read = '.'
-  else if (isAbsolute(prefix) ||
-      isAbsolute(pattern.map(function (p) {
-        return typeof p === 'string' ? p : '[*]'
-      }).join('/'))) {
-    if (!prefix || !isAbsolute(prefix))
-      prefix = '/' + prefix
-    read = prefix
-  } else
-    read = prefix
-
-  var abs = this._makeAbs(read)
-
-  //if ignored, skip processing
-  if (childrenIgnored(this, read))
-    return
-
-  var isGlobStar = remain[0] === minimatch.GLOBSTAR
-  if (isGlobStar)
-    this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
-  else
-    this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
-}
-
-
-GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
-  var entries = this._readdir(abs, inGlobStar)
-
-  // if the abs isn't a dir, then nothing can match!
-  if (!entries)
-    return
-
-  // It will only match dot entries if it starts with a dot, or if
-  // dot is set.  Stuff like @(.foo|.bar) isn't allowed.
-  var pn = remain[0]
-  var negate = !!this.minimatch.negate
-  var rawGlob = pn._glob
-  var dotOk = this.dot || rawGlob.charAt(0) === '.'
-
-  var matchedEntries = []
-  for (var i = 0; i < entries.length; i++) {
-    var e = entries[i]
-    if (e.charAt(0) !== '.' || dotOk) {
-      var m
-      if (negate && !prefix) {
-        m = !e.match(pn)
-      } else {
-        m = e.match(pn)
-      }
-      if (m)
-        matchedEntries.push(e)
-    }
-  }
-
-  var len = matchedEntries.length
-  // If there are no matched entries, then nothing matches.
-  if (len === 0)
-    return
-
-  // if this is the last remaining pattern bit, then no need for
-  // an additional stat *unless* the user has specified mark or
-  // stat explicitly.  We know they exist, since readdir returned
-  // them.
-
-  if (remain.length === 1 && !this.mark && !this.stat) {
-    if (!this.matches[index])
-      this.matches[index] = Object.create(null)
-
-    for (var i = 0; i < len; i ++) {
-      var e = matchedEntries[i]
-      if (prefix) {
-        if (prefix.slice(-1) !== '/')
-          e = prefix + '/' + e
-        else
-          e = prefix + e
-      }
-
-      if (e.charAt(0) === '/' && !this.nomount) {
-        e = path.join(this.root, e)
-      }
-      this._emitMatch(index, e)
-    }
-    // This was the last one, and no stats were needed
-    return
-  }
-
-  // now test all matched entries as stand-ins for that part
-  // of the pattern.
-  remain.shift()
-  for (var i = 0; i < len; i ++) {
-    var e = matchedEntries[i]
-    var newPattern
-    if (prefix)
-      newPattern = [prefix, e]
-    else
-      newPattern = [e]
-    this._process(newPattern.concat(remain), index, inGlobStar)
-  }
-}
-
-
-GlobSync.prototype._emitMatch = function (index, e) {
-  if (isIgnored(this, e))
-    return
-
-  var abs = this._makeAbs(e)
-
-  if (this.mark)
-    e = this._mark(e)
-
-  if (this.absolute) {
-    e = abs
-  }
-
-  if (this.matches[index][e])
-    return
-
-  if (this.nodir) {
-    var c = this.cache[abs]
-    if (c === 'DIR' || Array.isArray(c))
-      return
-  }
-
-  this.matches[index][e] = true
-
-  if (this.stat)
-    this._stat(e)
-}
-
-
-GlobSync.prototype._readdirInGlobStar = function (abs) {
-  // follow all symlinked directories forever
-  // just proceed as if this is a non-globstar situation
-  if (this.follow)
-    return this._readdir(abs, false)
-
-  var entries
-  var lstat
-  var stat
-  try {
-    lstat = this.fs.lstatSync(abs)
-  } catch (er) {
-    if (er.code === 'ENOENT') {
-      // lstat failed, doesn't exist
-      return null
-    }
-  }
-
-  var isSym = lstat && lstat.isSymbolicLink()
-  this.symlinks[abs] = isSym
-
-  // If it's not a symlink or a dir, then it's definitely a regular file.
-  // don't bother doing a readdir in that case.
-  if (!isSym && lstat && !lstat.isDirectory())
-    this.cache[abs] = 'FILE'
-  else
-    entries = this._readdir(abs, false)
-
-  return entries
-}
-
-GlobSync.prototype._readdir = function (abs, inGlobStar) {
-  var entries
-
-  if (inGlobStar && !ownProp(this.symlinks, abs))
-    return this._readdirInGlobStar(abs)
-
-  if (ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-    if (!c || c === 'FILE')
-      return null
-
-    if (Array.isArray(c))
-      return c
-  }
-
-  try {
-    return this._readdirEntries(abs, this.fs.readdirSync(abs))
-  } catch (er) {
-    this._readdirError(abs, er)
-    return null
-  }
-}
-
-GlobSync.prototype._readdirEntries = function (abs, entries) {
-  // if we haven't asked to stat everything, then just
-  // assume that everything in there exists, so we can avoid
-  // having to stat it a second time.
-  if (!this.mark && !this.stat) {
-    for (var i = 0; i < entries.length; i ++) {
-      var e = entries[i]
-      if (abs === '/')
-        e = abs + e
-      else
-        e = abs + '/' + e
-      this.cache[e] = true
-    }
-  }
-
-  this.cache[abs] = entries
-
-  // mark and cache dir-ness
-  return entries
-}
-
-GlobSync.prototype._readdirError = function (f, er) {
-  // handle errors, and cache the information
-  switch (er.code) {
-    case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
-    case 'ENOTDIR': // totally normal. means it *does* exist.
-      var abs = this._makeAbs(f)
-      this.cache[abs] = 'FILE'
-      if (abs === this.cwdAbs) {
-        var error = new Error(er.code + ' invalid cwd ' + this.cwd)
-        error.path = this.cwd
-        error.code = er.code
-        throw error
-      }
-      break
-
-    case 'ENOENT': // not terribly unusual
-    case 'ELOOP':
-    case 'ENAMETOOLONG':
-    case 'UNKNOWN':
-      this.cache[this._makeAbs(f)] = false
-      break
-
-    default: // some unusual error.  Treat as failure.
-      this.cache[this._makeAbs(f)] = false
-      if (this.strict)
-        throw er
-      if (!this.silent)
-        console.error('glob error', er)
-      break
-  }
-}
-
-GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
-
-  var entries = this._readdir(abs, inGlobStar)
-
-  // no entries means not a dir, so it can never have matches
-  // foo.txt/** doesn't match foo.txt
-  if (!entries)
-    return
-
-  // test without the globstar, and with every child both below
-  // and replacing the globstar.
-  var remainWithoutGlobStar = remain.slice(1)
-  var gspref = prefix ? [ prefix ] : []
-  var noGlobStar = gspref.concat(remainWithoutGlobStar)
-
-  // the noGlobStar pattern exits the inGlobStar state
-  this._process(noGlobStar, index, false)
-
-  var len = entries.length
-  var isSym = this.symlinks[abs]
-
-  // If it's a symlink, and we're in a globstar, then stop
-  if (isSym && inGlobStar)
-    return
-
-  for (var i = 0; i < len; i++) {
-    var e = entries[i]
-    if (e.charAt(0) === '.' && !this.dot)
-      continue
-
-    // these two cases enter the inGlobStar state
-    var instead = gspref.concat(entries[i], remainWithoutGlobStar)
-    this._process(instead, index, true)
-
-    var below = gspref.concat(entries[i], remain)
-    this._process(below, index, true)
-  }
-}
-
-GlobSync.prototype._processSimple = function (prefix, index) {
-  // XXX review this.  Shouldn't it be doing the mounting etc
-  // before doing stat?  kinda weird?
-  var exists = this._stat(prefix)
-
-  if (!this.matches[index])
-    this.matches[index] = Object.create(null)
-
-  // If it doesn't exist, then just mark the lack of results
-  if (!exists)
-    return
-
-  if (prefix && isAbsolute(prefix) && !this.nomount) {
-    var trail = /[\/\\]$/.test(prefix)
-    if (prefix.charAt(0) === '/') {
-      prefix = path.join(this.root, prefix)
-    } else {
-      prefix = path.resolve(this.root, prefix)
-      if (trail)
-        prefix += '/'
-    }
-  }
-
-  if (process.platform === 'win32')
-    prefix = prefix.replace(/\\/g, '/')
-
-  // Mark this as a match
-  this._emitMatch(index, prefix)
-}
-
-// Returns either 'DIR', 'FILE', or false
-GlobSync.prototype._stat = function (f) {
-  var abs = this._makeAbs(f)
-  var needDir = f.slice(-1) === '/'
-
-  if (f.length > this.maxLength)
-    return false
-
-  if (!this.stat && ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-
-    if (Array.isArray(c))
-      c = 'DIR'
-
-    // It exists, but maybe not how we need it
-    if (!needDir || c === 'DIR')
-      return c
-
-    if (needDir && c === 'FILE')
-      return false
-
-    // otherwise we have to stat, because maybe c=true
-    // if we know it exists, but not what it is.
-  }
-
-  var exists
-  var stat = this.statCache[abs]
-  if (!stat) {
-    var lstat
-    try {
-      lstat = this.fs.lstatSync(abs)
-    } catch (er) {
-      if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
-        this.statCache[abs] = false
-        return false
-      }
-    }
-
-    if (lstat && lstat.isSymbolicLink()) {
-      try {
-        stat = this.fs.statSync(abs)
-      } catch (er) {
-        stat = lstat
-      }
-    } else {
-      stat = lstat
-    }
-  }
-
-  this.statCache[abs] = stat
-
-  var c = true
-  if (stat)
-    c = stat.isDirectory() ? 'DIR' : 'FILE'
-
-  this.cache[abs] = this.cache[abs] || c
-
-  if (needDir && c === 'FILE')
-    return false
-
-  return c
-}
-
-GlobSync.prototype._mark = function (p) {
-  return common.mark(this, p)
-}
-
-GlobSync.prototype._makeAbs = function (f) {
-  return common.makeAbs(this, f)
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/lru-cache/LICENSE b/node_modules/@npmcli/run-script/node_modules/lru-cache/LICENSE
deleted file mode 100644
index f785757cd63f8..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/lru-cache/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) 2010-2023 Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/lru-cache/index.js b/node_modules/@npmcli/run-script/node_modules/lru-cache/index.js
deleted file mode 100644
index 48e99fe5e5a70..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/lru-cache/index.js
+++ /dev/null
@@ -1,1227 +0,0 @@
-const perf =
-  typeof performance === 'object' &&
-  performance &&
-  typeof performance.now === 'function'
-    ? performance
-    : Date
-
-const hasAbortController = typeof AbortController === 'function'
-
-// minimal backwards-compatibility polyfill
-// this doesn't have nearly all the checks and whatnot that
-// actual AbortController/Signal has, but it's enough for
-// our purposes, and if used properly, behaves the same.
-const AC = hasAbortController
-  ? AbortController
-  : class AbortController {
-      constructor() {
-        this.signal = new AS()
-      }
-      abort(reason = new Error('This operation was aborted')) {
-        this.signal.reason = this.signal.reason || reason
-        this.signal.aborted = true
-        this.signal.dispatchEvent({
-          type: 'abort',
-          target: this.signal,
-        })
-      }
-    }
-
-const hasAbortSignal = typeof AbortSignal === 'function'
-// Some polyfills put this on the AC class, not global
-const hasACAbortSignal = typeof AC.AbortSignal === 'function'
-const AS = hasAbortSignal
-  ? AbortSignal
-  : hasACAbortSignal
-  ? AC.AbortController
-  : class AbortSignal {
-      constructor() {
-        this.reason = undefined
-        this.aborted = false
-        this._listeners = []
-      }
-      dispatchEvent(e) {
-        if (e.type === 'abort') {
-          this.aborted = true
-          this.onabort(e)
-          this._listeners.forEach(f => f(e), this)
-        }
-      }
-      onabort() {}
-      addEventListener(ev, fn) {
-        if (ev === 'abort') {
-          this._listeners.push(fn)
-        }
-      }
-      removeEventListener(ev, fn) {
-        if (ev === 'abort') {
-          this._listeners = this._listeners.filter(f => f !== fn)
-        }
-      }
-    }
-
-const warned = new Set()
-const deprecatedOption = (opt, instead) => {
-  const code = `LRU_CACHE_OPTION_${opt}`
-  if (shouldWarn(code)) {
-    warn(code, `${opt} option`, `options.${instead}`, LRUCache)
-  }
-}
-const deprecatedMethod = (method, instead) => {
-  const code = `LRU_CACHE_METHOD_${method}`
-  if (shouldWarn(code)) {
-    const { prototype } = LRUCache
-    const { get } = Object.getOwnPropertyDescriptor(prototype, method)
-    warn(code, `${method} method`, `cache.${instead}()`, get)
-  }
-}
-const deprecatedProperty = (field, instead) => {
-  const code = `LRU_CACHE_PROPERTY_${field}`
-  if (shouldWarn(code)) {
-    const { prototype } = LRUCache
-    const { get } = Object.getOwnPropertyDescriptor(prototype, field)
-    warn(code, `${field} property`, `cache.${instead}`, get)
-  }
-}
-
-const emitWarning = (...a) => {
-  typeof process === 'object' &&
-  process &&
-  typeof process.emitWarning === 'function'
-    ? process.emitWarning(...a)
-    : console.error(...a)
-}
-
-const shouldWarn = code => !warned.has(code)
-
-const warn = (code, what, instead, fn) => {
-  warned.add(code)
-  const msg = `The ${what} is deprecated. Please use ${instead} instead.`
-  emitWarning(msg, 'DeprecationWarning', code, fn)
-}
-
-const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n)
-
-/* istanbul ignore next - This is a little bit ridiculous, tbh.
- * The maximum array length is 2^32-1 or thereabouts on most JS impls.
- * And well before that point, you're caching the entire world, I mean,
- * that's ~32GB of just integers for the next/prev links, plus whatever
- * else to hold that many keys and values.  Just filling the memory with
- * zeroes at init time is brutal when you get that big.
- * But why not be complete?
- * Maybe in the future, these limits will have expanded. */
-const getUintArray = max =>
-  !isPosInt(max)
-    ? null
-    : max <= Math.pow(2, 8)
-    ? Uint8Array
-    : max <= Math.pow(2, 16)
-    ? Uint16Array
-    : max <= Math.pow(2, 32)
-    ? Uint32Array
-    : max <= Number.MAX_SAFE_INTEGER
-    ? ZeroArray
-    : null
-
-class ZeroArray extends Array {
-  constructor(size) {
-    super(size)
-    this.fill(0)
-  }
-}
-
-class Stack {
-  constructor(max) {
-    if (max === 0) {
-      return []
-    }
-    const UintArray = getUintArray(max)
-    this.heap = new UintArray(max)
-    this.length = 0
-  }
-  push(n) {
-    this.heap[this.length++] = n
-  }
-  pop() {
-    return this.heap[--this.length]
-  }
-}
-
-class LRUCache {
-  constructor(options = {}) {
-    const {
-      max = 0,
-      ttl,
-      ttlResolution = 1,
-      ttlAutopurge,
-      updateAgeOnGet,
-      updateAgeOnHas,
-      allowStale,
-      dispose,
-      disposeAfter,
-      noDisposeOnSet,
-      noUpdateTTL,
-      maxSize = 0,
-      maxEntrySize = 0,
-      sizeCalculation,
-      fetchMethod,
-      fetchContext,
-      noDeleteOnFetchRejection,
-      noDeleteOnStaleGet,
-      allowStaleOnFetchRejection,
-      allowStaleOnFetchAbort,
-      ignoreFetchAbort,
-    } = options
-
-    // deprecated options, don't trigger a warning for getting them if
-    // the thing being passed in is another LRUCache we're copying.
-    const { length, maxAge, stale } =
-      options instanceof LRUCache ? {} : options
-
-    if (max !== 0 && !isPosInt(max)) {
-      throw new TypeError('max option must be a nonnegative integer')
-    }
-
-    const UintArray = max ? getUintArray(max) : Array
-    if (!UintArray) {
-      throw new Error('invalid max value: ' + max)
-    }
-
-    this.max = max
-    this.maxSize = maxSize
-    this.maxEntrySize = maxEntrySize || this.maxSize
-    this.sizeCalculation = sizeCalculation || length
-    if (this.sizeCalculation) {
-      if (!this.maxSize && !this.maxEntrySize) {
-        throw new TypeError(
-          'cannot set sizeCalculation without setting maxSize or maxEntrySize'
-        )
-      }
-      if (typeof this.sizeCalculation !== 'function') {
-        throw new TypeError('sizeCalculation set to non-function')
-      }
-    }
-
-    this.fetchMethod = fetchMethod || null
-    if (this.fetchMethod && typeof this.fetchMethod !== 'function') {
-      throw new TypeError(
-        'fetchMethod must be a function if specified'
-      )
-    }
-
-    this.fetchContext = fetchContext
-    if (!this.fetchMethod && fetchContext !== undefined) {
-      throw new TypeError(
-        'cannot set fetchContext without fetchMethod'
-      )
-    }
-
-    this.keyMap = new Map()
-    this.keyList = new Array(max).fill(null)
-    this.valList = new Array(max).fill(null)
-    this.next = new UintArray(max)
-    this.prev = new UintArray(max)
-    this.head = 0
-    this.tail = 0
-    this.free = new Stack(max)
-    this.initialFill = 1
-    this.size = 0
-
-    if (typeof dispose === 'function') {
-      this.dispose = dispose
-    }
-    if (typeof disposeAfter === 'function') {
-      this.disposeAfter = disposeAfter
-      this.disposed = []
-    } else {
-      this.disposeAfter = null
-      this.disposed = null
-    }
-    this.noDisposeOnSet = !!noDisposeOnSet
-    this.noUpdateTTL = !!noUpdateTTL
-    this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection
-    this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection
-    this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort
-    this.ignoreFetchAbort = !!ignoreFetchAbort
-
-    // NB: maxEntrySize is set to maxSize if it's set
-    if (this.maxEntrySize !== 0) {
-      if (this.maxSize !== 0) {
-        if (!isPosInt(this.maxSize)) {
-          throw new TypeError(
-            'maxSize must be a positive integer if specified'
-          )
-        }
-      }
-      if (!isPosInt(this.maxEntrySize)) {
-        throw new TypeError(
-          'maxEntrySize must be a positive integer if specified'
-        )
-      }
-      this.initializeSizeTracking()
-    }
-
-    this.allowStale = !!allowStale || !!stale
-    this.noDeleteOnStaleGet = !!noDeleteOnStaleGet
-    this.updateAgeOnGet = !!updateAgeOnGet
-    this.updateAgeOnHas = !!updateAgeOnHas
-    this.ttlResolution =
-      isPosInt(ttlResolution) || ttlResolution === 0
-        ? ttlResolution
-        : 1
-    this.ttlAutopurge = !!ttlAutopurge
-    this.ttl = ttl || maxAge || 0
-    if (this.ttl) {
-      if (!isPosInt(this.ttl)) {
-        throw new TypeError(
-          'ttl must be a positive integer if specified'
-        )
-      }
-      this.initializeTTLTracking()
-    }
-
-    // do not allow completely unbounded caches
-    if (this.max === 0 && this.ttl === 0 && this.maxSize === 0) {
-      throw new TypeError(
-        'At least one of max, maxSize, or ttl is required'
-      )
-    }
-    if (!this.ttlAutopurge && !this.max && !this.maxSize) {
-      const code = 'LRU_CACHE_UNBOUNDED'
-      if (shouldWarn(code)) {
-        warned.add(code)
-        const msg =
-          'TTL caching without ttlAutopurge, max, or maxSize can ' +
-          'result in unbounded memory consumption.'
-        emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache)
-      }
-    }
-
-    if (stale) {
-      deprecatedOption('stale', 'allowStale')
-    }
-    if (maxAge) {
-      deprecatedOption('maxAge', 'ttl')
-    }
-    if (length) {
-      deprecatedOption('length', 'sizeCalculation')
-    }
-  }
-
-  getRemainingTTL(key) {
-    return this.has(key, { updateAgeOnHas: false }) ? Infinity : 0
-  }
-
-  initializeTTLTracking() {
-    this.ttls = new ZeroArray(this.max)
-    this.starts = new ZeroArray(this.max)
-
-    this.setItemTTL = (index, ttl, start = perf.now()) => {
-      this.starts[index] = ttl !== 0 ? start : 0
-      this.ttls[index] = ttl
-      if (ttl !== 0 && this.ttlAutopurge) {
-        const t = setTimeout(() => {
-          if (this.isStale(index)) {
-            this.delete(this.keyList[index])
-          }
-        }, ttl + 1)
-        /* istanbul ignore else - unref() not supported on all platforms */
-        if (t.unref) {
-          t.unref()
-        }
-      }
-    }
-
-    this.updateItemAge = index => {
-      this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0
-    }
-
-    this.statusTTL = (status, index) => {
-      if (status) {
-        status.ttl = this.ttls[index]
-        status.start = this.starts[index]
-        status.now = cachedNow || getNow()
-        status.remainingTTL = status.now + status.ttl - status.start
-      }
-    }
-
-    // debounce calls to perf.now() to 1s so we're not hitting
-    // that costly call repeatedly.
-    let cachedNow = 0
-    const getNow = () => {
-      const n = perf.now()
-      if (this.ttlResolution > 0) {
-        cachedNow = n
-        const t = setTimeout(
-          () => (cachedNow = 0),
-          this.ttlResolution
-        )
-        /* istanbul ignore else - not available on all platforms */
-        if (t.unref) {
-          t.unref()
-        }
-      }
-      return n
-    }
-
-    this.getRemainingTTL = key => {
-      const index = this.keyMap.get(key)
-      if (index === undefined) {
-        return 0
-      }
-      return this.ttls[index] === 0 || this.starts[index] === 0
-        ? Infinity
-        : this.starts[index] +
-            this.ttls[index] -
-            (cachedNow || getNow())
-    }
-
-    this.isStale = index => {
-      return (
-        this.ttls[index] !== 0 &&
-        this.starts[index] !== 0 &&
-        (cachedNow || getNow()) - this.starts[index] >
-          this.ttls[index]
-      )
-    }
-  }
-  updateItemAge(_index) {}
-  statusTTL(_status, _index) {}
-  setItemTTL(_index, _ttl, _start) {}
-  isStale(_index) {
-    return false
-  }
-
-  initializeSizeTracking() {
-    this.calculatedSize = 0
-    this.sizes = new ZeroArray(this.max)
-    this.removeItemSize = index => {
-      this.calculatedSize -= this.sizes[index]
-      this.sizes[index] = 0
-    }
-    this.requireSize = (k, v, size, sizeCalculation) => {
-      // provisionally accept background fetches.
-      // actual value size will be checked when they return.
-      if (this.isBackgroundFetch(v)) {
-        return 0
-      }
-      if (!isPosInt(size)) {
-        if (sizeCalculation) {
-          if (typeof sizeCalculation !== 'function') {
-            throw new TypeError('sizeCalculation must be a function')
-          }
-          size = sizeCalculation(v, k)
-          if (!isPosInt(size)) {
-            throw new TypeError(
-              'sizeCalculation return invalid (expect positive integer)'
-            )
-          }
-        } else {
-          throw new TypeError(
-            'invalid size value (must be positive integer). ' +
-              'When maxSize or maxEntrySize is used, sizeCalculation or size ' +
-              'must be set.'
-          )
-        }
-      }
-      return size
-    }
-    this.addItemSize = (index, size, status) => {
-      this.sizes[index] = size
-      if (this.maxSize) {
-        const maxSize = this.maxSize - this.sizes[index]
-        while (this.calculatedSize > maxSize) {
-          this.evict(true)
-        }
-      }
-      this.calculatedSize += this.sizes[index]
-      if (status) {
-        status.entrySize = size
-        status.totalCalculatedSize = this.calculatedSize
-      }
-    }
-  }
-  removeItemSize(_index) {}
-  addItemSize(_index, _size) {}
-  requireSize(_k, _v, size, sizeCalculation) {
-    if (size || sizeCalculation) {
-      throw new TypeError(
-        'cannot set size without setting maxSize or maxEntrySize on cache'
-      )
-    }
-  }
-
-  *indexes({ allowStale = this.allowStale } = {}) {
-    if (this.size) {
-      for (let i = this.tail; true; ) {
-        if (!this.isValidIndex(i)) {
-          break
-        }
-        if (allowStale || !this.isStale(i)) {
-          yield i
-        }
-        if (i === this.head) {
-          break
-        } else {
-          i = this.prev[i]
-        }
-      }
-    }
-  }
-
-  *rindexes({ allowStale = this.allowStale } = {}) {
-    if (this.size) {
-      for (let i = this.head; true; ) {
-        if (!this.isValidIndex(i)) {
-          break
-        }
-        if (allowStale || !this.isStale(i)) {
-          yield i
-        }
-        if (i === this.tail) {
-          break
-        } else {
-          i = this.next[i]
-        }
-      }
-    }
-  }
-
-  isValidIndex(index) {
-    return (
-      index !== undefined &&
-      this.keyMap.get(this.keyList[index]) === index
-    )
-  }
-
-  *entries() {
-    for (const i of this.indexes()) {
-      if (
-        this.valList[i] !== undefined &&
-        this.keyList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield [this.keyList[i], this.valList[i]]
-      }
-    }
-  }
-  *rentries() {
-    for (const i of this.rindexes()) {
-      if (
-        this.valList[i] !== undefined &&
-        this.keyList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield [this.keyList[i], this.valList[i]]
-      }
-    }
-  }
-
-  *keys() {
-    for (const i of this.indexes()) {
-      if (
-        this.keyList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield this.keyList[i]
-      }
-    }
-  }
-  *rkeys() {
-    for (const i of this.rindexes()) {
-      if (
-        this.keyList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield this.keyList[i]
-      }
-    }
-  }
-
-  *values() {
-    for (const i of this.indexes()) {
-      if (
-        this.valList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield this.valList[i]
-      }
-    }
-  }
-  *rvalues() {
-    for (const i of this.rindexes()) {
-      if (
-        this.valList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield this.valList[i]
-      }
-    }
-  }
-
-  [Symbol.iterator]() {
-    return this.entries()
-  }
-
-  find(fn, getOptions) {
-    for (const i of this.indexes()) {
-      const v = this.valList[i]
-      const value = this.isBackgroundFetch(v)
-        ? v.__staleWhileFetching
-        : v
-      if (value === undefined) continue
-      if (fn(value, this.keyList[i], this)) {
-        return this.get(this.keyList[i], getOptions)
-      }
-    }
-  }
-
-  forEach(fn, thisp = this) {
-    for (const i of this.indexes()) {
-      const v = this.valList[i]
-      const value = this.isBackgroundFetch(v)
-        ? v.__staleWhileFetching
-        : v
-      if (value === undefined) continue
-      fn.call(thisp, value, this.keyList[i], this)
-    }
-  }
-
-  rforEach(fn, thisp = this) {
-    for (const i of this.rindexes()) {
-      const v = this.valList[i]
-      const value = this.isBackgroundFetch(v)
-        ? v.__staleWhileFetching
-        : v
-      if (value === undefined) continue
-      fn.call(thisp, value, this.keyList[i], this)
-    }
-  }
-
-  get prune() {
-    deprecatedMethod('prune', 'purgeStale')
-    return this.purgeStale
-  }
-
-  purgeStale() {
-    let deleted = false
-    for (const i of this.rindexes({ allowStale: true })) {
-      if (this.isStale(i)) {
-        this.delete(this.keyList[i])
-        deleted = true
-      }
-    }
-    return deleted
-  }
-
-  dump() {
-    const arr = []
-    for (const i of this.indexes({ allowStale: true })) {
-      const key = this.keyList[i]
-      const v = this.valList[i]
-      const value = this.isBackgroundFetch(v)
-        ? v.__staleWhileFetching
-        : v
-      if (value === undefined) continue
-      const entry = { value }
-      if (this.ttls) {
-        entry.ttl = this.ttls[i]
-        // always dump the start relative to a portable timestamp
-        // it's ok for this to be a bit slow, it's a rare operation.
-        const age = perf.now() - this.starts[i]
-        entry.start = Math.floor(Date.now() - age)
-      }
-      if (this.sizes) {
-        entry.size = this.sizes[i]
-      }
-      arr.unshift([key, entry])
-    }
-    return arr
-  }
-
-  load(arr) {
-    this.clear()
-    for (const [key, entry] of arr) {
-      if (entry.start) {
-        // entry.start is a portable timestamp, but we may be using
-        // node's performance.now(), so calculate the offset.
-        // it's ok for this to be a bit slow, it's a rare operation.
-        const age = Date.now() - entry.start
-        entry.start = perf.now() - age
-      }
-      this.set(key, entry.value, entry)
-    }
-  }
-
-  dispose(_v, _k, _reason) {}
-
-  set(
-    k,
-    v,
-    {
-      ttl = this.ttl,
-      start,
-      noDisposeOnSet = this.noDisposeOnSet,
-      size = 0,
-      sizeCalculation = this.sizeCalculation,
-      noUpdateTTL = this.noUpdateTTL,
-      status,
-    } = {}
-  ) {
-    size = this.requireSize(k, v, size, sizeCalculation)
-    // if the item doesn't fit, don't do anything
-    // NB: maxEntrySize set to maxSize by default
-    if (this.maxEntrySize && size > this.maxEntrySize) {
-      if (status) {
-        status.set = 'miss'
-        status.maxEntrySizeExceeded = true
-      }
-      // have to delete, in case a background fetch is there already.
-      // in non-async cases, this is a no-op
-      this.delete(k)
-      return this
-    }
-    let index = this.size === 0 ? undefined : this.keyMap.get(k)
-    if (index === undefined) {
-      // addition
-      index = this.newIndex()
-      this.keyList[index] = k
-      this.valList[index] = v
-      this.keyMap.set(k, index)
-      this.next[this.tail] = index
-      this.prev[index] = this.tail
-      this.tail = index
-      this.size++
-      this.addItemSize(index, size, status)
-      if (status) {
-        status.set = 'add'
-      }
-      noUpdateTTL = false
-    } else {
-      // update
-      this.moveToTail(index)
-      const oldVal = this.valList[index]
-      if (v !== oldVal) {
-        if (this.isBackgroundFetch(oldVal)) {
-          oldVal.__abortController.abort(new Error('replaced'))
-        } else {
-          if (!noDisposeOnSet) {
-            this.dispose(oldVal, k, 'set')
-            if (this.disposeAfter) {
-              this.disposed.push([oldVal, k, 'set'])
-            }
-          }
-        }
-        this.removeItemSize(index)
-        this.valList[index] = v
-        this.addItemSize(index, size, status)
-        if (status) {
-          status.set = 'replace'
-          const oldValue =
-            oldVal && this.isBackgroundFetch(oldVal)
-              ? oldVal.__staleWhileFetching
-              : oldVal
-          if (oldValue !== undefined) status.oldValue = oldValue
-        }
-      } else if (status) {
-        status.set = 'update'
-      }
-    }
-    if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
-      this.initializeTTLTracking()
-    }
-    if (!noUpdateTTL) {
-      this.setItemTTL(index, ttl, start)
-    }
-    this.statusTTL(status, index)
-    if (this.disposeAfter) {
-      while (this.disposed.length) {
-        this.disposeAfter(...this.disposed.shift())
-      }
-    }
-    return this
-  }
-
-  newIndex() {
-    if (this.size === 0) {
-      return this.tail
-    }
-    if (this.size === this.max && this.max !== 0) {
-      return this.evict(false)
-    }
-    if (this.free.length !== 0) {
-      return this.free.pop()
-    }
-    // initial fill, just keep writing down the list
-    return this.initialFill++
-  }
-
-  pop() {
-    if (this.size) {
-      const val = this.valList[this.head]
-      this.evict(true)
-      return val
-    }
-  }
-
-  evict(free) {
-    const head = this.head
-    const k = this.keyList[head]
-    const v = this.valList[head]
-    if (this.isBackgroundFetch(v)) {
-      v.__abortController.abort(new Error('evicted'))
-    } else {
-      this.dispose(v, k, 'evict')
-      if (this.disposeAfter) {
-        this.disposed.push([v, k, 'evict'])
-      }
-    }
-    this.removeItemSize(head)
-    // if we aren't about to use the index, then null these out
-    if (free) {
-      this.keyList[head] = null
-      this.valList[head] = null
-      this.free.push(head)
-    }
-    this.head = this.next[head]
-    this.keyMap.delete(k)
-    this.size--
-    return head
-  }
-
-  has(k, { updateAgeOnHas = this.updateAgeOnHas, status } = {}) {
-    const index = this.keyMap.get(k)
-    if (index !== undefined) {
-      if (!this.isStale(index)) {
-        if (updateAgeOnHas) {
-          this.updateItemAge(index)
-        }
-        if (status) status.has = 'hit'
-        this.statusTTL(status, index)
-        return true
-      } else if (status) {
-        status.has = 'stale'
-        this.statusTTL(status, index)
-      }
-    } else if (status) {
-      status.has = 'miss'
-    }
-    return false
-  }
-
-  // like get(), but without any LRU updating or TTL expiration
-  peek(k, { allowStale = this.allowStale } = {}) {
-    const index = this.keyMap.get(k)
-    if (index !== undefined && (allowStale || !this.isStale(index))) {
-      const v = this.valList[index]
-      // either stale and allowed, or forcing a refresh of non-stale value
-      return this.isBackgroundFetch(v) ? v.__staleWhileFetching : v
-    }
-  }
-
-  backgroundFetch(k, index, options, context) {
-    const v = index === undefined ? undefined : this.valList[index]
-    if (this.isBackgroundFetch(v)) {
-      return v
-    }
-    const ac = new AC()
-    if (options.signal) {
-      options.signal.addEventListener('abort', () =>
-        ac.abort(options.signal.reason)
-      )
-    }
-    const fetchOpts = {
-      signal: ac.signal,
-      options,
-      context,
-    }
-    const cb = (v, updateCache = false) => {
-      const { aborted } = ac.signal
-      const ignoreAbort = options.ignoreFetchAbort && v !== undefined
-      if (options.status) {
-        if (aborted && !updateCache) {
-          options.status.fetchAborted = true
-          options.status.fetchError = ac.signal.reason
-          if (ignoreAbort) options.status.fetchAbortIgnored = true
-        } else {
-          options.status.fetchResolved = true
-        }
-      }
-      if (aborted && !ignoreAbort && !updateCache) {
-        return fetchFail(ac.signal.reason)
-      }
-      // either we didn't abort, and are still here, or we did, and ignored
-      if (this.valList[index] === p) {
-        if (v === undefined) {
-          if (p.__staleWhileFetching) {
-            this.valList[index] = p.__staleWhileFetching
-          } else {
-            this.delete(k)
-          }
-        } else {
-          if (options.status) options.status.fetchUpdated = true
-          this.set(k, v, fetchOpts.options)
-        }
-      }
-      return v
-    }
-    const eb = er => {
-      if (options.status) {
-        options.status.fetchRejected = true
-        options.status.fetchError = er
-      }
-      return fetchFail(er)
-    }
-    const fetchFail = er => {
-      const { aborted } = ac.signal
-      const allowStaleAborted =
-        aborted && options.allowStaleOnFetchAbort
-      const allowStale =
-        allowStaleAborted || options.allowStaleOnFetchRejection
-      const noDelete = allowStale || options.noDeleteOnFetchRejection
-      if (this.valList[index] === p) {
-        // if we allow stale on fetch rejections, then we need to ensure that
-        // the stale value is not removed from the cache when the fetch fails.
-        const del = !noDelete || p.__staleWhileFetching === undefined
-        if (del) {
-          this.delete(k)
-        } else if (!allowStaleAborted) {
-          // still replace the *promise* with the stale value,
-          // since we are done with the promise at this point.
-          // leave it untouched if we're still waiting for an
-          // aborted background fetch that hasn't yet returned.
-          this.valList[index] = p.__staleWhileFetching
-        }
-      }
-      if (allowStale) {
-        if (options.status && p.__staleWhileFetching !== undefined) {
-          options.status.returnedStale = true
-        }
-        return p.__staleWhileFetching
-      } else if (p.__returned === p) {
-        throw er
-      }
-    }
-    const pcall = (res, rej) => {
-      this.fetchMethod(k, v, fetchOpts).then(v => res(v), rej)
-      // ignored, we go until we finish, regardless.
-      // defer check until we are actually aborting,
-      // so fetchMethod can override.
-      ac.signal.addEventListener('abort', () => {
-        if (
-          !options.ignoreFetchAbort ||
-          options.allowStaleOnFetchAbort
-        ) {
-          res()
-          // when it eventually resolves, update the cache.
-          if (options.allowStaleOnFetchAbort) {
-            res = v => cb(v, true)
-          }
-        }
-      })
-    }
-    if (options.status) options.status.fetchDispatched = true
-    const p = new Promise(pcall).then(cb, eb)
-    p.__abortController = ac
-    p.__staleWhileFetching = v
-    p.__returned = null
-    if (index === undefined) {
-      // internal, don't expose status.
-      this.set(k, p, { ...fetchOpts.options, status: undefined })
-      index = this.keyMap.get(k)
-    } else {
-      this.valList[index] = p
-    }
-    return p
-  }
-
-  isBackgroundFetch(p) {
-    return (
-      p &&
-      typeof p === 'object' &&
-      typeof p.then === 'function' &&
-      Object.prototype.hasOwnProperty.call(
-        p,
-        '__staleWhileFetching'
-      ) &&
-      Object.prototype.hasOwnProperty.call(p, '__returned') &&
-      (p.__returned === p || p.__returned === null)
-    )
-  }
-
-  // this takes the union of get() and set() opts, because it does both
-  async fetch(
-    k,
-    {
-      // get options
-      allowStale = this.allowStale,
-      updateAgeOnGet = this.updateAgeOnGet,
-      noDeleteOnStaleGet = this.noDeleteOnStaleGet,
-      // set options
-      ttl = this.ttl,
-      noDisposeOnSet = this.noDisposeOnSet,
-      size = 0,
-      sizeCalculation = this.sizeCalculation,
-      noUpdateTTL = this.noUpdateTTL,
-      // fetch exclusive options
-      noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
-      allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
-      ignoreFetchAbort = this.ignoreFetchAbort,
-      allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
-      fetchContext = this.fetchContext,
-      forceRefresh = false,
-      status,
-      signal,
-    } = {}
-  ) {
-    if (!this.fetchMethod) {
-      if (status) status.fetch = 'get'
-      return this.get(k, {
-        allowStale,
-        updateAgeOnGet,
-        noDeleteOnStaleGet,
-        status,
-      })
-    }
-
-    const options = {
-      allowStale,
-      updateAgeOnGet,
-      noDeleteOnStaleGet,
-      ttl,
-      noDisposeOnSet,
-      size,
-      sizeCalculation,
-      noUpdateTTL,
-      noDeleteOnFetchRejection,
-      allowStaleOnFetchRejection,
-      allowStaleOnFetchAbort,
-      ignoreFetchAbort,
-      status,
-      signal,
-    }
-
-    let index = this.keyMap.get(k)
-    if (index === undefined) {
-      if (status) status.fetch = 'miss'
-      const p = this.backgroundFetch(k, index, options, fetchContext)
-      return (p.__returned = p)
-    } else {
-      // in cache, maybe already fetching
-      const v = this.valList[index]
-      if (this.isBackgroundFetch(v)) {
-        const stale =
-          allowStale && v.__staleWhileFetching !== undefined
-        if (status) {
-          status.fetch = 'inflight'
-          if (stale) status.returnedStale = true
-        }
-        return stale ? v.__staleWhileFetching : (v.__returned = v)
-      }
-
-      // if we force a refresh, that means do NOT serve the cached value,
-      // unless we are already in the process of refreshing the cache.
-      const isStale = this.isStale(index)
-      if (!forceRefresh && !isStale) {
-        if (status) status.fetch = 'hit'
-        this.moveToTail(index)
-        if (updateAgeOnGet) {
-          this.updateItemAge(index)
-        }
-        this.statusTTL(status, index)
-        return v
-      }
-
-      // ok, it is stale or a forced refresh, and not already fetching.
-      // refresh the cache.
-      const p = this.backgroundFetch(k, index, options, fetchContext)
-      const hasStale = p.__staleWhileFetching !== undefined
-      const staleVal = hasStale && allowStale
-      if (status) {
-        status.fetch = hasStale && isStale ? 'stale' : 'refresh'
-        if (staleVal && isStale) status.returnedStale = true
-      }
-      return staleVal ? p.__staleWhileFetching : (p.__returned = p)
-    }
-  }
-
-  get(
-    k,
-    {
-      allowStale = this.allowStale,
-      updateAgeOnGet = this.updateAgeOnGet,
-      noDeleteOnStaleGet = this.noDeleteOnStaleGet,
-      status,
-    } = {}
-  ) {
-    const index = this.keyMap.get(k)
-    if (index !== undefined) {
-      const value = this.valList[index]
-      const fetching = this.isBackgroundFetch(value)
-      this.statusTTL(status, index)
-      if (this.isStale(index)) {
-        if (status) status.get = 'stale'
-        // delete only if not an in-flight background fetch
-        if (!fetching) {
-          if (!noDeleteOnStaleGet) {
-            this.delete(k)
-          }
-          if (status) status.returnedStale = allowStale
-          return allowStale ? value : undefined
-        } else {
-          if (status) {
-            status.returnedStale =
-              allowStale && value.__staleWhileFetching !== undefined
-          }
-          return allowStale ? value.__staleWhileFetching : undefined
-        }
-      } else {
-        if (status) status.get = 'hit'
-        // if we're currently fetching it, we don't actually have it yet
-        // it's not stale, which means this isn't a staleWhileRefetching.
-        // If it's not stale, and fetching, AND has a __staleWhileFetching
-        // value, then that means the user fetched with {forceRefresh:true},
-        // so it's safe to return that value.
-        if (fetching) {
-          return value.__staleWhileFetching
-        }
-        this.moveToTail(index)
-        if (updateAgeOnGet) {
-          this.updateItemAge(index)
-        }
-        return value
-      }
-    } else if (status) {
-      status.get = 'miss'
-    }
-  }
-
-  connect(p, n) {
-    this.prev[n] = p
-    this.next[p] = n
-  }
-
-  moveToTail(index) {
-    // if tail already, nothing to do
-    // if head, move head to next[index]
-    // else
-    //   move next[prev[index]] to next[index] (head has no prev)
-    //   move prev[next[index]] to prev[index]
-    // prev[index] = tail
-    // next[tail] = index
-    // tail = index
-    if (index !== this.tail) {
-      if (index === this.head) {
-        this.head = this.next[index]
-      } else {
-        this.connect(this.prev[index], this.next[index])
-      }
-      this.connect(this.tail, index)
-      this.tail = index
-    }
-  }
-
-  get del() {
-    deprecatedMethod('del', 'delete')
-    return this.delete
-  }
-
-  delete(k) {
-    let deleted = false
-    if (this.size !== 0) {
-      const index = this.keyMap.get(k)
-      if (index !== undefined) {
-        deleted = true
-        if (this.size === 1) {
-          this.clear()
-        } else {
-          this.removeItemSize(index)
-          const v = this.valList[index]
-          if (this.isBackgroundFetch(v)) {
-            v.__abortController.abort(new Error('deleted'))
-          } else {
-            this.dispose(v, k, 'delete')
-            if (this.disposeAfter) {
-              this.disposed.push([v, k, 'delete'])
-            }
-          }
-          this.keyMap.delete(k)
-          this.keyList[index] = null
-          this.valList[index] = null
-          if (index === this.tail) {
-            this.tail = this.prev[index]
-          } else if (index === this.head) {
-            this.head = this.next[index]
-          } else {
-            this.next[this.prev[index]] = this.next[index]
-            this.prev[this.next[index]] = this.prev[index]
-          }
-          this.size--
-          this.free.push(index)
-        }
-      }
-    }
-    if (this.disposed) {
-      while (this.disposed.length) {
-        this.disposeAfter(...this.disposed.shift())
-      }
-    }
-    return deleted
-  }
-
-  clear() {
-    for (const index of this.rindexes({ allowStale: true })) {
-      const v = this.valList[index]
-      if (this.isBackgroundFetch(v)) {
-        v.__abortController.abort(new Error('deleted'))
-      } else {
-        const k = this.keyList[index]
-        this.dispose(v, k, 'delete')
-        if (this.disposeAfter) {
-          this.disposed.push([v, k, 'delete'])
-        }
-      }
-    }
-
-    this.keyMap.clear()
-    this.valList.fill(null)
-    this.keyList.fill(null)
-    if (this.ttls) {
-      this.ttls.fill(0)
-      this.starts.fill(0)
-    }
-    if (this.sizes) {
-      this.sizes.fill(0)
-    }
-    this.head = 0
-    this.tail = 0
-    this.initialFill = 1
-    this.free.length = 0
-    this.calculatedSize = 0
-    this.size = 0
-    if (this.disposed) {
-      while (this.disposed.length) {
-        this.disposeAfter(...this.disposed.shift())
-      }
-    }
-  }
-
-  get reset() {
-    deprecatedMethod('reset', 'clear')
-    return this.clear
-  }
-
-  get length() {
-    deprecatedProperty('length', 'size')
-    return this.size
-  }
-
-  static get AbortController() {
-    return AC
-  }
-  static get AbortSignal() {
-    return AS
-  }
-}
-
-module.exports = LRUCache
diff --git a/node_modules/@npmcli/run-script/node_modules/lru-cache/index.mjs b/node_modules/@npmcli/run-script/node_modules/lru-cache/index.mjs
deleted file mode 100644
index 4a0b4813ec515..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/lru-cache/index.mjs
+++ /dev/null
@@ -1,1227 +0,0 @@
-const perf =
-  typeof performance === 'object' &&
-  performance &&
-  typeof performance.now === 'function'
-    ? performance
-    : Date
-
-const hasAbortController = typeof AbortController === 'function'
-
-// minimal backwards-compatibility polyfill
-// this doesn't have nearly all the checks and whatnot that
-// actual AbortController/Signal has, but it's enough for
-// our purposes, and if used properly, behaves the same.
-const AC = hasAbortController
-  ? AbortController
-  : class AbortController {
-      constructor() {
-        this.signal = new AS()
-      }
-      abort(reason = new Error('This operation was aborted')) {
-        this.signal.reason = this.signal.reason || reason
-        this.signal.aborted = true
-        this.signal.dispatchEvent({
-          type: 'abort',
-          target: this.signal,
-        })
-      }
-    }
-
-const hasAbortSignal = typeof AbortSignal === 'function'
-// Some polyfills put this on the AC class, not global
-const hasACAbortSignal = typeof AC.AbortSignal === 'function'
-const AS = hasAbortSignal
-  ? AbortSignal
-  : hasACAbortSignal
-  ? AC.AbortController
-  : class AbortSignal {
-      constructor() {
-        this.reason = undefined
-        this.aborted = false
-        this._listeners = []
-      }
-      dispatchEvent(e) {
-        if (e.type === 'abort') {
-          this.aborted = true
-          this.onabort(e)
-          this._listeners.forEach(f => f(e), this)
-        }
-      }
-      onabort() {}
-      addEventListener(ev, fn) {
-        if (ev === 'abort') {
-          this._listeners.push(fn)
-        }
-      }
-      removeEventListener(ev, fn) {
-        if (ev === 'abort') {
-          this._listeners = this._listeners.filter(f => f !== fn)
-        }
-      }
-    }
-
-const warned = new Set()
-const deprecatedOption = (opt, instead) => {
-  const code = `LRU_CACHE_OPTION_${opt}`
-  if (shouldWarn(code)) {
-    warn(code, `${opt} option`, `options.${instead}`, LRUCache)
-  }
-}
-const deprecatedMethod = (method, instead) => {
-  const code = `LRU_CACHE_METHOD_${method}`
-  if (shouldWarn(code)) {
-    const { prototype } = LRUCache
-    const { get } = Object.getOwnPropertyDescriptor(prototype, method)
-    warn(code, `${method} method`, `cache.${instead}()`, get)
-  }
-}
-const deprecatedProperty = (field, instead) => {
-  const code = `LRU_CACHE_PROPERTY_${field}`
-  if (shouldWarn(code)) {
-    const { prototype } = LRUCache
-    const { get } = Object.getOwnPropertyDescriptor(prototype, field)
-    warn(code, `${field} property`, `cache.${instead}`, get)
-  }
-}
-
-const emitWarning = (...a) => {
-  typeof process === 'object' &&
-  process &&
-  typeof process.emitWarning === 'function'
-    ? process.emitWarning(...a)
-    : console.error(...a)
-}
-
-const shouldWarn = code => !warned.has(code)
-
-const warn = (code, what, instead, fn) => {
-  warned.add(code)
-  const msg = `The ${what} is deprecated. Please use ${instead} instead.`
-  emitWarning(msg, 'DeprecationWarning', code, fn)
-}
-
-const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n)
-
-/* istanbul ignore next - This is a little bit ridiculous, tbh.
- * The maximum array length is 2^32-1 or thereabouts on most JS impls.
- * And well before that point, you're caching the entire world, I mean,
- * that's ~32GB of just integers for the next/prev links, plus whatever
- * else to hold that many keys and values.  Just filling the memory with
- * zeroes at init time is brutal when you get that big.
- * But why not be complete?
- * Maybe in the future, these limits will have expanded. */
-const getUintArray = max =>
-  !isPosInt(max)
-    ? null
-    : max <= Math.pow(2, 8)
-    ? Uint8Array
-    : max <= Math.pow(2, 16)
-    ? Uint16Array
-    : max <= Math.pow(2, 32)
-    ? Uint32Array
-    : max <= Number.MAX_SAFE_INTEGER
-    ? ZeroArray
-    : null
-
-class ZeroArray extends Array {
-  constructor(size) {
-    super(size)
-    this.fill(0)
-  }
-}
-
-class Stack {
-  constructor(max) {
-    if (max === 0) {
-      return []
-    }
-    const UintArray = getUintArray(max)
-    this.heap = new UintArray(max)
-    this.length = 0
-  }
-  push(n) {
-    this.heap[this.length++] = n
-  }
-  pop() {
-    return this.heap[--this.length]
-  }
-}
-
-class LRUCache {
-  constructor(options = {}) {
-    const {
-      max = 0,
-      ttl,
-      ttlResolution = 1,
-      ttlAutopurge,
-      updateAgeOnGet,
-      updateAgeOnHas,
-      allowStale,
-      dispose,
-      disposeAfter,
-      noDisposeOnSet,
-      noUpdateTTL,
-      maxSize = 0,
-      maxEntrySize = 0,
-      sizeCalculation,
-      fetchMethod,
-      fetchContext,
-      noDeleteOnFetchRejection,
-      noDeleteOnStaleGet,
-      allowStaleOnFetchRejection,
-      allowStaleOnFetchAbort,
-      ignoreFetchAbort,
-    } = options
-
-    // deprecated options, don't trigger a warning for getting them if
-    // the thing being passed in is another LRUCache we're copying.
-    const { length, maxAge, stale } =
-      options instanceof LRUCache ? {} : options
-
-    if (max !== 0 && !isPosInt(max)) {
-      throw new TypeError('max option must be a nonnegative integer')
-    }
-
-    const UintArray = max ? getUintArray(max) : Array
-    if (!UintArray) {
-      throw new Error('invalid max value: ' + max)
-    }
-
-    this.max = max
-    this.maxSize = maxSize
-    this.maxEntrySize = maxEntrySize || this.maxSize
-    this.sizeCalculation = sizeCalculation || length
-    if (this.sizeCalculation) {
-      if (!this.maxSize && !this.maxEntrySize) {
-        throw new TypeError(
-          'cannot set sizeCalculation without setting maxSize or maxEntrySize'
-        )
-      }
-      if (typeof this.sizeCalculation !== 'function') {
-        throw new TypeError('sizeCalculation set to non-function')
-      }
-    }
-
-    this.fetchMethod = fetchMethod || null
-    if (this.fetchMethod && typeof this.fetchMethod !== 'function') {
-      throw new TypeError(
-        'fetchMethod must be a function if specified'
-      )
-    }
-
-    this.fetchContext = fetchContext
-    if (!this.fetchMethod && fetchContext !== undefined) {
-      throw new TypeError(
-        'cannot set fetchContext without fetchMethod'
-      )
-    }
-
-    this.keyMap = new Map()
-    this.keyList = new Array(max).fill(null)
-    this.valList = new Array(max).fill(null)
-    this.next = new UintArray(max)
-    this.prev = new UintArray(max)
-    this.head = 0
-    this.tail = 0
-    this.free = new Stack(max)
-    this.initialFill = 1
-    this.size = 0
-
-    if (typeof dispose === 'function') {
-      this.dispose = dispose
-    }
-    if (typeof disposeAfter === 'function') {
-      this.disposeAfter = disposeAfter
-      this.disposed = []
-    } else {
-      this.disposeAfter = null
-      this.disposed = null
-    }
-    this.noDisposeOnSet = !!noDisposeOnSet
-    this.noUpdateTTL = !!noUpdateTTL
-    this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection
-    this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection
-    this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort
-    this.ignoreFetchAbort = !!ignoreFetchAbort
-
-    // NB: maxEntrySize is set to maxSize if it's set
-    if (this.maxEntrySize !== 0) {
-      if (this.maxSize !== 0) {
-        if (!isPosInt(this.maxSize)) {
-          throw new TypeError(
-            'maxSize must be a positive integer if specified'
-          )
-        }
-      }
-      if (!isPosInt(this.maxEntrySize)) {
-        throw new TypeError(
-          'maxEntrySize must be a positive integer if specified'
-        )
-      }
-      this.initializeSizeTracking()
-    }
-
-    this.allowStale = !!allowStale || !!stale
-    this.noDeleteOnStaleGet = !!noDeleteOnStaleGet
-    this.updateAgeOnGet = !!updateAgeOnGet
-    this.updateAgeOnHas = !!updateAgeOnHas
-    this.ttlResolution =
-      isPosInt(ttlResolution) || ttlResolution === 0
-        ? ttlResolution
-        : 1
-    this.ttlAutopurge = !!ttlAutopurge
-    this.ttl = ttl || maxAge || 0
-    if (this.ttl) {
-      if (!isPosInt(this.ttl)) {
-        throw new TypeError(
-          'ttl must be a positive integer if specified'
-        )
-      }
-      this.initializeTTLTracking()
-    }
-
-    // do not allow completely unbounded caches
-    if (this.max === 0 && this.ttl === 0 && this.maxSize === 0) {
-      throw new TypeError(
-        'At least one of max, maxSize, or ttl is required'
-      )
-    }
-    if (!this.ttlAutopurge && !this.max && !this.maxSize) {
-      const code = 'LRU_CACHE_UNBOUNDED'
-      if (shouldWarn(code)) {
-        warned.add(code)
-        const msg =
-          'TTL caching without ttlAutopurge, max, or maxSize can ' +
-          'result in unbounded memory consumption.'
-        emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache)
-      }
-    }
-
-    if (stale) {
-      deprecatedOption('stale', 'allowStale')
-    }
-    if (maxAge) {
-      deprecatedOption('maxAge', 'ttl')
-    }
-    if (length) {
-      deprecatedOption('length', 'sizeCalculation')
-    }
-  }
-
-  getRemainingTTL(key) {
-    return this.has(key, { updateAgeOnHas: false }) ? Infinity : 0
-  }
-
-  initializeTTLTracking() {
-    this.ttls = new ZeroArray(this.max)
-    this.starts = new ZeroArray(this.max)
-
-    this.setItemTTL = (index, ttl, start = perf.now()) => {
-      this.starts[index] = ttl !== 0 ? start : 0
-      this.ttls[index] = ttl
-      if (ttl !== 0 && this.ttlAutopurge) {
-        const t = setTimeout(() => {
-          if (this.isStale(index)) {
-            this.delete(this.keyList[index])
-          }
-        }, ttl + 1)
-        /* istanbul ignore else - unref() not supported on all platforms */
-        if (t.unref) {
-          t.unref()
-        }
-      }
-    }
-
-    this.updateItemAge = index => {
-      this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0
-    }
-
-    this.statusTTL = (status, index) => {
-      if (status) {
-        status.ttl = this.ttls[index]
-        status.start = this.starts[index]
-        status.now = cachedNow || getNow()
-        status.remainingTTL = status.now + status.ttl - status.start
-      }
-    }
-
-    // debounce calls to perf.now() to 1s so we're not hitting
-    // that costly call repeatedly.
-    let cachedNow = 0
-    const getNow = () => {
-      const n = perf.now()
-      if (this.ttlResolution > 0) {
-        cachedNow = n
-        const t = setTimeout(
-          () => (cachedNow = 0),
-          this.ttlResolution
-        )
-        /* istanbul ignore else - not available on all platforms */
-        if (t.unref) {
-          t.unref()
-        }
-      }
-      return n
-    }
-
-    this.getRemainingTTL = key => {
-      const index = this.keyMap.get(key)
-      if (index === undefined) {
-        return 0
-      }
-      return this.ttls[index] === 0 || this.starts[index] === 0
-        ? Infinity
-        : this.starts[index] +
-            this.ttls[index] -
-            (cachedNow || getNow())
-    }
-
-    this.isStale = index => {
-      return (
-        this.ttls[index] !== 0 &&
-        this.starts[index] !== 0 &&
-        (cachedNow || getNow()) - this.starts[index] >
-          this.ttls[index]
-      )
-    }
-  }
-  updateItemAge(_index) {}
-  statusTTL(_status, _index) {}
-  setItemTTL(_index, _ttl, _start) {}
-  isStale(_index) {
-    return false
-  }
-
-  initializeSizeTracking() {
-    this.calculatedSize = 0
-    this.sizes = new ZeroArray(this.max)
-    this.removeItemSize = index => {
-      this.calculatedSize -= this.sizes[index]
-      this.sizes[index] = 0
-    }
-    this.requireSize = (k, v, size, sizeCalculation) => {
-      // provisionally accept background fetches.
-      // actual value size will be checked when they return.
-      if (this.isBackgroundFetch(v)) {
-        return 0
-      }
-      if (!isPosInt(size)) {
-        if (sizeCalculation) {
-          if (typeof sizeCalculation !== 'function') {
-            throw new TypeError('sizeCalculation must be a function')
-          }
-          size = sizeCalculation(v, k)
-          if (!isPosInt(size)) {
-            throw new TypeError(
-              'sizeCalculation return invalid (expect positive integer)'
-            )
-          }
-        } else {
-          throw new TypeError(
-            'invalid size value (must be positive integer). ' +
-              'When maxSize or maxEntrySize is used, sizeCalculation or size ' +
-              'must be set.'
-          )
-        }
-      }
-      return size
-    }
-    this.addItemSize = (index, size, status) => {
-      this.sizes[index] = size
-      if (this.maxSize) {
-        const maxSize = this.maxSize - this.sizes[index]
-        while (this.calculatedSize > maxSize) {
-          this.evict(true)
-        }
-      }
-      this.calculatedSize += this.sizes[index]
-      if (status) {
-        status.entrySize = size
-        status.totalCalculatedSize = this.calculatedSize
-      }
-    }
-  }
-  removeItemSize(_index) {}
-  addItemSize(_index, _size) {}
-  requireSize(_k, _v, size, sizeCalculation) {
-    if (size || sizeCalculation) {
-      throw new TypeError(
-        'cannot set size without setting maxSize or maxEntrySize on cache'
-      )
-    }
-  }
-
-  *indexes({ allowStale = this.allowStale } = {}) {
-    if (this.size) {
-      for (let i = this.tail; true; ) {
-        if (!this.isValidIndex(i)) {
-          break
-        }
-        if (allowStale || !this.isStale(i)) {
-          yield i
-        }
-        if (i === this.head) {
-          break
-        } else {
-          i = this.prev[i]
-        }
-      }
-    }
-  }
-
-  *rindexes({ allowStale = this.allowStale } = {}) {
-    if (this.size) {
-      for (let i = this.head; true; ) {
-        if (!this.isValidIndex(i)) {
-          break
-        }
-        if (allowStale || !this.isStale(i)) {
-          yield i
-        }
-        if (i === this.tail) {
-          break
-        } else {
-          i = this.next[i]
-        }
-      }
-    }
-  }
-
-  isValidIndex(index) {
-    return (
-      index !== undefined &&
-      this.keyMap.get(this.keyList[index]) === index
-    )
-  }
-
-  *entries() {
-    for (const i of this.indexes()) {
-      if (
-        this.valList[i] !== undefined &&
-        this.keyList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield [this.keyList[i], this.valList[i]]
-      }
-    }
-  }
-  *rentries() {
-    for (const i of this.rindexes()) {
-      if (
-        this.valList[i] !== undefined &&
-        this.keyList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield [this.keyList[i], this.valList[i]]
-      }
-    }
-  }
-
-  *keys() {
-    for (const i of this.indexes()) {
-      if (
-        this.keyList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield this.keyList[i]
-      }
-    }
-  }
-  *rkeys() {
-    for (const i of this.rindexes()) {
-      if (
-        this.keyList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield this.keyList[i]
-      }
-    }
-  }
-
-  *values() {
-    for (const i of this.indexes()) {
-      if (
-        this.valList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield this.valList[i]
-      }
-    }
-  }
-  *rvalues() {
-    for (const i of this.rindexes()) {
-      if (
-        this.valList[i] !== undefined &&
-        !this.isBackgroundFetch(this.valList[i])
-      ) {
-        yield this.valList[i]
-      }
-    }
-  }
-
-  [Symbol.iterator]() {
-    return this.entries()
-  }
-
-  find(fn, getOptions) {
-    for (const i of this.indexes()) {
-      const v = this.valList[i]
-      const value = this.isBackgroundFetch(v)
-        ? v.__staleWhileFetching
-        : v
-      if (value === undefined) continue
-      if (fn(value, this.keyList[i], this)) {
-        return this.get(this.keyList[i], getOptions)
-      }
-    }
-  }
-
-  forEach(fn, thisp = this) {
-    for (const i of this.indexes()) {
-      const v = this.valList[i]
-      const value = this.isBackgroundFetch(v)
-        ? v.__staleWhileFetching
-        : v
-      if (value === undefined) continue
-      fn.call(thisp, value, this.keyList[i], this)
-    }
-  }
-
-  rforEach(fn, thisp = this) {
-    for (const i of this.rindexes()) {
-      const v = this.valList[i]
-      const value = this.isBackgroundFetch(v)
-        ? v.__staleWhileFetching
-        : v
-      if (value === undefined) continue
-      fn.call(thisp, value, this.keyList[i], this)
-    }
-  }
-
-  get prune() {
-    deprecatedMethod('prune', 'purgeStale')
-    return this.purgeStale
-  }
-
-  purgeStale() {
-    let deleted = false
-    for (const i of this.rindexes({ allowStale: true })) {
-      if (this.isStale(i)) {
-        this.delete(this.keyList[i])
-        deleted = true
-      }
-    }
-    return deleted
-  }
-
-  dump() {
-    const arr = []
-    for (const i of this.indexes({ allowStale: true })) {
-      const key = this.keyList[i]
-      const v = this.valList[i]
-      const value = this.isBackgroundFetch(v)
-        ? v.__staleWhileFetching
-        : v
-      if (value === undefined) continue
-      const entry = { value }
-      if (this.ttls) {
-        entry.ttl = this.ttls[i]
-        // always dump the start relative to a portable timestamp
-        // it's ok for this to be a bit slow, it's a rare operation.
-        const age = perf.now() - this.starts[i]
-        entry.start = Math.floor(Date.now() - age)
-      }
-      if (this.sizes) {
-        entry.size = this.sizes[i]
-      }
-      arr.unshift([key, entry])
-    }
-    return arr
-  }
-
-  load(arr) {
-    this.clear()
-    for (const [key, entry] of arr) {
-      if (entry.start) {
-        // entry.start is a portable timestamp, but we may be using
-        // node's performance.now(), so calculate the offset.
-        // it's ok for this to be a bit slow, it's a rare operation.
-        const age = Date.now() - entry.start
-        entry.start = perf.now() - age
-      }
-      this.set(key, entry.value, entry)
-    }
-  }
-
-  dispose(_v, _k, _reason) {}
-
-  set(
-    k,
-    v,
-    {
-      ttl = this.ttl,
-      start,
-      noDisposeOnSet = this.noDisposeOnSet,
-      size = 0,
-      sizeCalculation = this.sizeCalculation,
-      noUpdateTTL = this.noUpdateTTL,
-      status,
-    } = {}
-  ) {
-    size = this.requireSize(k, v, size, sizeCalculation)
-    // if the item doesn't fit, don't do anything
-    // NB: maxEntrySize set to maxSize by default
-    if (this.maxEntrySize && size > this.maxEntrySize) {
-      if (status) {
-        status.set = 'miss'
-        status.maxEntrySizeExceeded = true
-      }
-      // have to delete, in case a background fetch is there already.
-      // in non-async cases, this is a no-op
-      this.delete(k)
-      return this
-    }
-    let index = this.size === 0 ? undefined : this.keyMap.get(k)
-    if (index === undefined) {
-      // addition
-      index = this.newIndex()
-      this.keyList[index] = k
-      this.valList[index] = v
-      this.keyMap.set(k, index)
-      this.next[this.tail] = index
-      this.prev[index] = this.tail
-      this.tail = index
-      this.size++
-      this.addItemSize(index, size, status)
-      if (status) {
-        status.set = 'add'
-      }
-      noUpdateTTL = false
-    } else {
-      // update
-      this.moveToTail(index)
-      const oldVal = this.valList[index]
-      if (v !== oldVal) {
-        if (this.isBackgroundFetch(oldVal)) {
-          oldVal.__abortController.abort(new Error('replaced'))
-        } else {
-          if (!noDisposeOnSet) {
-            this.dispose(oldVal, k, 'set')
-            if (this.disposeAfter) {
-              this.disposed.push([oldVal, k, 'set'])
-            }
-          }
-        }
-        this.removeItemSize(index)
-        this.valList[index] = v
-        this.addItemSize(index, size, status)
-        if (status) {
-          status.set = 'replace'
-          const oldValue =
-            oldVal && this.isBackgroundFetch(oldVal)
-              ? oldVal.__staleWhileFetching
-              : oldVal
-          if (oldValue !== undefined) status.oldValue = oldValue
-        }
-      } else if (status) {
-        status.set = 'update'
-      }
-    }
-    if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
-      this.initializeTTLTracking()
-    }
-    if (!noUpdateTTL) {
-      this.setItemTTL(index, ttl, start)
-    }
-    this.statusTTL(status, index)
-    if (this.disposeAfter) {
-      while (this.disposed.length) {
-        this.disposeAfter(...this.disposed.shift())
-      }
-    }
-    return this
-  }
-
-  newIndex() {
-    if (this.size === 0) {
-      return this.tail
-    }
-    if (this.size === this.max && this.max !== 0) {
-      return this.evict(false)
-    }
-    if (this.free.length !== 0) {
-      return this.free.pop()
-    }
-    // initial fill, just keep writing down the list
-    return this.initialFill++
-  }
-
-  pop() {
-    if (this.size) {
-      const val = this.valList[this.head]
-      this.evict(true)
-      return val
-    }
-  }
-
-  evict(free) {
-    const head = this.head
-    const k = this.keyList[head]
-    const v = this.valList[head]
-    if (this.isBackgroundFetch(v)) {
-      v.__abortController.abort(new Error('evicted'))
-    } else {
-      this.dispose(v, k, 'evict')
-      if (this.disposeAfter) {
-        this.disposed.push([v, k, 'evict'])
-      }
-    }
-    this.removeItemSize(head)
-    // if we aren't about to use the index, then null these out
-    if (free) {
-      this.keyList[head] = null
-      this.valList[head] = null
-      this.free.push(head)
-    }
-    this.head = this.next[head]
-    this.keyMap.delete(k)
-    this.size--
-    return head
-  }
-
-  has(k, { updateAgeOnHas = this.updateAgeOnHas, status } = {}) {
-    const index = this.keyMap.get(k)
-    if (index !== undefined) {
-      if (!this.isStale(index)) {
-        if (updateAgeOnHas) {
-          this.updateItemAge(index)
-        }
-        if (status) status.has = 'hit'
-        this.statusTTL(status, index)
-        return true
-      } else if (status) {
-        status.has = 'stale'
-        this.statusTTL(status, index)
-      }
-    } else if (status) {
-      status.has = 'miss'
-    }
-    return false
-  }
-
-  // like get(), but without any LRU updating or TTL expiration
-  peek(k, { allowStale = this.allowStale } = {}) {
-    const index = this.keyMap.get(k)
-    if (index !== undefined && (allowStale || !this.isStale(index))) {
-      const v = this.valList[index]
-      // either stale and allowed, or forcing a refresh of non-stale value
-      return this.isBackgroundFetch(v) ? v.__staleWhileFetching : v
-    }
-  }
-
-  backgroundFetch(k, index, options, context) {
-    const v = index === undefined ? undefined : this.valList[index]
-    if (this.isBackgroundFetch(v)) {
-      return v
-    }
-    const ac = new AC()
-    if (options.signal) {
-      options.signal.addEventListener('abort', () =>
-        ac.abort(options.signal.reason)
-      )
-    }
-    const fetchOpts = {
-      signal: ac.signal,
-      options,
-      context,
-    }
-    const cb = (v, updateCache = false) => {
-      const { aborted } = ac.signal
-      const ignoreAbort = options.ignoreFetchAbort && v !== undefined
-      if (options.status) {
-        if (aborted && !updateCache) {
-          options.status.fetchAborted = true
-          options.status.fetchError = ac.signal.reason
-          if (ignoreAbort) options.status.fetchAbortIgnored = true
-        } else {
-          options.status.fetchResolved = true
-        }
-      }
-      if (aborted && !ignoreAbort && !updateCache) {
-        return fetchFail(ac.signal.reason)
-      }
-      // either we didn't abort, and are still here, or we did, and ignored
-      if (this.valList[index] === p) {
-        if (v === undefined) {
-          if (p.__staleWhileFetching) {
-            this.valList[index] = p.__staleWhileFetching
-          } else {
-            this.delete(k)
-          }
-        } else {
-          if (options.status) options.status.fetchUpdated = true
-          this.set(k, v, fetchOpts.options)
-        }
-      }
-      return v
-    }
-    const eb = er => {
-      if (options.status) {
-        options.status.fetchRejected = true
-        options.status.fetchError = er
-      }
-      return fetchFail(er)
-    }
-    const fetchFail = er => {
-      const { aborted } = ac.signal
-      const allowStaleAborted =
-        aborted && options.allowStaleOnFetchAbort
-      const allowStale =
-        allowStaleAborted || options.allowStaleOnFetchRejection
-      const noDelete = allowStale || options.noDeleteOnFetchRejection
-      if (this.valList[index] === p) {
-        // if we allow stale on fetch rejections, then we need to ensure that
-        // the stale value is not removed from the cache when the fetch fails.
-        const del = !noDelete || p.__staleWhileFetching === undefined
-        if (del) {
-          this.delete(k)
-        } else if (!allowStaleAborted) {
-          // still replace the *promise* with the stale value,
-          // since we are done with the promise at this point.
-          // leave it untouched if we're still waiting for an
-          // aborted background fetch that hasn't yet returned.
-          this.valList[index] = p.__staleWhileFetching
-        }
-      }
-      if (allowStale) {
-        if (options.status && p.__staleWhileFetching !== undefined) {
-          options.status.returnedStale = true
-        }
-        return p.__staleWhileFetching
-      } else if (p.__returned === p) {
-        throw er
-      }
-    }
-    const pcall = (res, rej) => {
-      this.fetchMethod(k, v, fetchOpts).then(v => res(v), rej)
-      // ignored, we go until we finish, regardless.
-      // defer check until we are actually aborting,
-      // so fetchMethod can override.
-      ac.signal.addEventListener('abort', () => {
-        if (
-          !options.ignoreFetchAbort ||
-          options.allowStaleOnFetchAbort
-        ) {
-          res()
-          // when it eventually resolves, update the cache.
-          if (options.allowStaleOnFetchAbort) {
-            res = v => cb(v, true)
-          }
-        }
-      })
-    }
-    if (options.status) options.status.fetchDispatched = true
-    const p = new Promise(pcall).then(cb, eb)
-    p.__abortController = ac
-    p.__staleWhileFetching = v
-    p.__returned = null
-    if (index === undefined) {
-      // internal, don't expose status.
-      this.set(k, p, { ...fetchOpts.options, status: undefined })
-      index = this.keyMap.get(k)
-    } else {
-      this.valList[index] = p
-    }
-    return p
-  }
-
-  isBackgroundFetch(p) {
-    return (
-      p &&
-      typeof p === 'object' &&
-      typeof p.then === 'function' &&
-      Object.prototype.hasOwnProperty.call(
-        p,
-        '__staleWhileFetching'
-      ) &&
-      Object.prototype.hasOwnProperty.call(p, '__returned') &&
-      (p.__returned === p || p.__returned === null)
-    )
-  }
-
-  // this takes the union of get() and set() opts, because it does both
-  async fetch(
-    k,
-    {
-      // get options
-      allowStale = this.allowStale,
-      updateAgeOnGet = this.updateAgeOnGet,
-      noDeleteOnStaleGet = this.noDeleteOnStaleGet,
-      // set options
-      ttl = this.ttl,
-      noDisposeOnSet = this.noDisposeOnSet,
-      size = 0,
-      sizeCalculation = this.sizeCalculation,
-      noUpdateTTL = this.noUpdateTTL,
-      // fetch exclusive options
-      noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
-      allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
-      ignoreFetchAbort = this.ignoreFetchAbort,
-      allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
-      fetchContext = this.fetchContext,
-      forceRefresh = false,
-      status,
-      signal,
-    } = {}
-  ) {
-    if (!this.fetchMethod) {
-      if (status) status.fetch = 'get'
-      return this.get(k, {
-        allowStale,
-        updateAgeOnGet,
-        noDeleteOnStaleGet,
-        status,
-      })
-    }
-
-    const options = {
-      allowStale,
-      updateAgeOnGet,
-      noDeleteOnStaleGet,
-      ttl,
-      noDisposeOnSet,
-      size,
-      sizeCalculation,
-      noUpdateTTL,
-      noDeleteOnFetchRejection,
-      allowStaleOnFetchRejection,
-      allowStaleOnFetchAbort,
-      ignoreFetchAbort,
-      status,
-      signal,
-    }
-
-    let index = this.keyMap.get(k)
-    if (index === undefined) {
-      if (status) status.fetch = 'miss'
-      const p = this.backgroundFetch(k, index, options, fetchContext)
-      return (p.__returned = p)
-    } else {
-      // in cache, maybe already fetching
-      const v = this.valList[index]
-      if (this.isBackgroundFetch(v)) {
-        const stale =
-          allowStale && v.__staleWhileFetching !== undefined
-        if (status) {
-          status.fetch = 'inflight'
-          if (stale) status.returnedStale = true
-        }
-        return stale ? v.__staleWhileFetching : (v.__returned = v)
-      }
-
-      // if we force a refresh, that means do NOT serve the cached value,
-      // unless we are already in the process of refreshing the cache.
-      const isStale = this.isStale(index)
-      if (!forceRefresh && !isStale) {
-        if (status) status.fetch = 'hit'
-        this.moveToTail(index)
-        if (updateAgeOnGet) {
-          this.updateItemAge(index)
-        }
-        this.statusTTL(status, index)
-        return v
-      }
-
-      // ok, it is stale or a forced refresh, and not already fetching.
-      // refresh the cache.
-      const p = this.backgroundFetch(k, index, options, fetchContext)
-      const hasStale = p.__staleWhileFetching !== undefined
-      const staleVal = hasStale && allowStale
-      if (status) {
-        status.fetch = hasStale && isStale ? 'stale' : 'refresh'
-        if (staleVal && isStale) status.returnedStale = true
-      }
-      return staleVal ? p.__staleWhileFetching : (p.__returned = p)
-    }
-  }
-
-  get(
-    k,
-    {
-      allowStale = this.allowStale,
-      updateAgeOnGet = this.updateAgeOnGet,
-      noDeleteOnStaleGet = this.noDeleteOnStaleGet,
-      status,
-    } = {}
-  ) {
-    const index = this.keyMap.get(k)
-    if (index !== undefined) {
-      const value = this.valList[index]
-      const fetching = this.isBackgroundFetch(value)
-      this.statusTTL(status, index)
-      if (this.isStale(index)) {
-        if (status) status.get = 'stale'
-        // delete only if not an in-flight background fetch
-        if (!fetching) {
-          if (!noDeleteOnStaleGet) {
-            this.delete(k)
-          }
-          if (status) status.returnedStale = allowStale
-          return allowStale ? value : undefined
-        } else {
-          if (status) {
-            status.returnedStale =
-              allowStale && value.__staleWhileFetching !== undefined
-          }
-          return allowStale ? value.__staleWhileFetching : undefined
-        }
-      } else {
-        if (status) status.get = 'hit'
-        // if we're currently fetching it, we don't actually have it yet
-        // it's not stale, which means this isn't a staleWhileRefetching.
-        // If it's not stale, and fetching, AND has a __staleWhileFetching
-        // value, then that means the user fetched with {forceRefresh:true},
-        // so it's safe to return that value.
-        if (fetching) {
-          return value.__staleWhileFetching
-        }
-        this.moveToTail(index)
-        if (updateAgeOnGet) {
-          this.updateItemAge(index)
-        }
-        return value
-      }
-    } else if (status) {
-      status.get = 'miss'
-    }
-  }
-
-  connect(p, n) {
-    this.prev[n] = p
-    this.next[p] = n
-  }
-
-  moveToTail(index) {
-    // if tail already, nothing to do
-    // if head, move head to next[index]
-    // else
-    //   move next[prev[index]] to next[index] (head has no prev)
-    //   move prev[next[index]] to prev[index]
-    // prev[index] = tail
-    // next[tail] = index
-    // tail = index
-    if (index !== this.tail) {
-      if (index === this.head) {
-        this.head = this.next[index]
-      } else {
-        this.connect(this.prev[index], this.next[index])
-      }
-      this.connect(this.tail, index)
-      this.tail = index
-    }
-  }
-
-  get del() {
-    deprecatedMethod('del', 'delete')
-    return this.delete
-  }
-
-  delete(k) {
-    let deleted = false
-    if (this.size !== 0) {
-      const index = this.keyMap.get(k)
-      if (index !== undefined) {
-        deleted = true
-        if (this.size === 1) {
-          this.clear()
-        } else {
-          this.removeItemSize(index)
-          const v = this.valList[index]
-          if (this.isBackgroundFetch(v)) {
-            v.__abortController.abort(new Error('deleted'))
-          } else {
-            this.dispose(v, k, 'delete')
-            if (this.disposeAfter) {
-              this.disposed.push([v, k, 'delete'])
-            }
-          }
-          this.keyMap.delete(k)
-          this.keyList[index] = null
-          this.valList[index] = null
-          if (index === this.tail) {
-            this.tail = this.prev[index]
-          } else if (index === this.head) {
-            this.head = this.next[index]
-          } else {
-            this.next[this.prev[index]] = this.next[index]
-            this.prev[this.next[index]] = this.prev[index]
-          }
-          this.size--
-          this.free.push(index)
-        }
-      }
-    }
-    if (this.disposed) {
-      while (this.disposed.length) {
-        this.disposeAfter(...this.disposed.shift())
-      }
-    }
-    return deleted
-  }
-
-  clear() {
-    for (const index of this.rindexes({ allowStale: true })) {
-      const v = this.valList[index]
-      if (this.isBackgroundFetch(v)) {
-        v.__abortController.abort(new Error('deleted'))
-      } else {
-        const k = this.keyList[index]
-        this.dispose(v, k, 'delete')
-        if (this.disposeAfter) {
-          this.disposed.push([v, k, 'delete'])
-        }
-      }
-    }
-
-    this.keyMap.clear()
-    this.valList.fill(null)
-    this.keyList.fill(null)
-    if (this.ttls) {
-      this.ttls.fill(0)
-      this.starts.fill(0)
-    }
-    if (this.sizes) {
-      this.sizes.fill(0)
-    }
-    this.head = 0
-    this.tail = 0
-    this.initialFill = 1
-    this.free.length = 0
-    this.calculatedSize = 0
-    this.size = 0
-    if (this.disposed) {
-      while (this.disposed.length) {
-        this.disposeAfter(...this.disposed.shift())
-      }
-    }
-  }
-
-  get reset() {
-    deprecatedMethod('reset', 'clear')
-    return this.clear
-  }
-
-  get length() {
-    deprecatedProperty('length', 'size')
-    return this.size
-  }
-
-  static get AbortController() {
-    return AC
-  }
-  static get AbortSignal() {
-    return AS
-  }
-}
-
-export default LRUCache
diff --git a/node_modules/@npmcli/run-script/node_modules/lru-cache/package.json b/node_modules/@npmcli/run-script/node_modules/lru-cache/package.json
deleted file mode 100644
index 9684991727e7a..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/lru-cache/package.json
+++ /dev/null
@@ -1,96 +0,0 @@
-{
-  "name": "lru-cache",
-  "description": "A cache object that deletes the least-recently-used items.",
-  "version": "7.18.3",
-  "author": "Isaac Z. Schlueter ",
-  "keywords": [
-    "mru",
-    "lru",
-    "cache"
-  ],
-  "sideEffects": false,
-  "scripts": {
-    "build": "npm run prepare",
-    "pretest": "npm run prepare",
-    "presnap": "npm run prepare",
-    "prepare": "node ./scripts/transpile-to-esm.js",
-    "size": "size-limit",
-    "test": "tap",
-    "snap": "tap",
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "prepublishOnly": "git push origin --follow-tags",
-    "format": "prettier --write .",
-    "typedoc": "typedoc ./index.d.ts"
-  },
-  "type": "commonjs",
-  "main": "./index.js",
-  "module": "./index.mjs",
-  "types": "./index.d.ts",
-  "exports": {
-    ".": {
-      "import": {
-        "types": "./index.d.ts",
-        "default": "./index.mjs"
-      },
-      "require": {
-        "types": "./index.d.ts",
-        "default": "./index.js"
-      }
-    },
-    "./package.json": "./package.json"
-  },
-  "repository": "git://github.com/isaacs/node-lru-cache.git",
-  "devDependencies": {
-    "@size-limit/preset-small-lib": "^7.0.8",
-    "@types/node": "^17.0.31",
-    "@types/tap": "^15.0.6",
-    "benchmark": "^2.1.4",
-    "c8": "^7.11.2",
-    "clock-mock": "^1.0.6",
-    "eslint-config-prettier": "^8.5.0",
-    "prettier": "^2.6.2",
-    "size-limit": "^7.0.8",
-    "tap": "^16.3.4",
-    "ts-node": "^10.7.0",
-    "tslib": "^2.4.0",
-    "typedoc": "^0.23.24",
-    "typescript": "^4.6.4"
-  },
-  "license": "ISC",
-  "files": [
-    "index.js",
-    "index.mjs",
-    "index.d.ts"
-  ],
-  "engines": {
-    "node": ">=12"
-  },
-  "prettier": {
-    "semi": false,
-    "printWidth": 70,
-    "tabWidth": 2,
-    "useTabs": false,
-    "singleQuote": true,
-    "jsxSingleQuote": false,
-    "bracketSameLine": true,
-    "arrowParens": "avoid",
-    "endOfLine": "lf"
-  },
-  "tap": {
-    "nyc-arg": [
-      "--include=index.js"
-    ],
-    "node-arg": [
-      "--expose-gc",
-      "--require",
-      "ts-node/register"
-    ],
-    "ts": false
-  },
-  "size-limit": [
-    {
-      "path": "./index.js"
-    }
-  ]
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/LICENSE b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/LICENSE
deleted file mode 100644
index 1808eb2844231..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/LICENSE
+++ /dev/null
@@ -1,16 +0,0 @@
-ISC License
-
-Copyright 2017-2022 (c) npm, Inc.
-
-Permission to use, copy, modify, and/or distribute this software for
-any purpose with or without fee is hereby granted, provided that the
-above copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER DISCLAIMS
-ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
-OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
-USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/agent.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/agent.js
deleted file mode 100644
index dd68492ed7ea7..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/agent.js
+++ /dev/null
@@ -1,214 +0,0 @@
-'use strict'
-const LRU = require('lru-cache')
-const url = require('url')
-const isLambda = require('is-lambda')
-const dns = require('./dns.js')
-
-const AGENT_CACHE = new LRU({ max: 50 })
-const HttpAgent = require('agentkeepalive')
-const HttpsAgent = HttpAgent.HttpsAgent
-
-module.exports = getAgent
-
-const getAgentTimeout = timeout =>
-  typeof timeout !== 'number' || !timeout ? 0 : timeout + 1
-
-const getMaxSockets = maxSockets => maxSockets || 15
-
-function getAgent (uri, opts) {
-  const parsedUri = new url.URL(typeof uri === 'string' ? uri : uri.url)
-  const isHttps = parsedUri.protocol === 'https:'
-  const pxuri = getProxyUri(parsedUri.href, opts)
-
-  // If opts.timeout is zero, set the agentTimeout to zero as well. A timeout
-  // of zero disables the timeout behavior (OS limits still apply). Else, if
-  // opts.timeout is a non-zero value, set it to timeout + 1, to ensure that
-  // the node-fetch-npm timeout will always fire first, giving us more
-  // consistent errors.
-  const agentTimeout = getAgentTimeout(opts.timeout)
-  const agentMaxSockets = getMaxSockets(opts.maxSockets)
-
-  const key = [
-    `https:${isHttps}`,
-    pxuri
-      ? `proxy:${pxuri.protocol}//${pxuri.host}:${pxuri.port}`
-      : '>no-proxy<',
-    `local-address:${opts.localAddress || '>no-local-address<'}`,
-    `strict-ssl:${isHttps ? opts.rejectUnauthorized : '>no-strict-ssl<'}`,
-    `ca:${(isHttps && opts.ca) || '>no-ca<'}`,
-    `cert:${(isHttps && opts.cert) || '>no-cert<'}`,
-    `key:${(isHttps && opts.key) || '>no-key<'}`,
-    `timeout:${agentTimeout}`,
-    `maxSockets:${agentMaxSockets}`,
-  ].join(':')
-
-  if (opts.agent != null) { // `agent: false` has special behavior!
-    return opts.agent
-  }
-
-  // keep alive in AWS lambda makes no sense
-  const lambdaAgent = !isLambda ? null
-    : isHttps ? require('https').globalAgent
-    : require('http').globalAgent
-
-  if (isLambda && !pxuri) {
-    return lambdaAgent
-  }
-
-  if (AGENT_CACHE.peek(key)) {
-    return AGENT_CACHE.get(key)
-  }
-
-  if (pxuri) {
-    const pxopts = isLambda ? {
-      ...opts,
-      agent: lambdaAgent,
-    } : opts
-    const proxy = getProxy(pxuri, pxopts, isHttps)
-    AGENT_CACHE.set(key, proxy)
-    return proxy
-  }
-
-  const agent = isHttps ? new HttpsAgent({
-    maxSockets: agentMaxSockets,
-    ca: opts.ca,
-    cert: opts.cert,
-    key: opts.key,
-    localAddress: opts.localAddress,
-    rejectUnauthorized: opts.rejectUnauthorized,
-    timeout: agentTimeout,
-    freeSocketTimeout: 15000,
-    lookup: dns.getLookup(opts.dns),
-  }) : new HttpAgent({
-    maxSockets: agentMaxSockets,
-    localAddress: opts.localAddress,
-    timeout: agentTimeout,
-    freeSocketTimeout: 15000,
-    lookup: dns.getLookup(opts.dns),
-  })
-  AGENT_CACHE.set(key, agent)
-  return agent
-}
-
-function checkNoProxy (uri, opts) {
-  const host = new url.URL(uri).hostname.split('.').reverse()
-  let noproxy = (opts.noProxy || getProcessEnv('no_proxy'))
-  if (typeof noproxy === 'string') {
-    noproxy = noproxy.split(',').map(n => n.trim())
-  }
-
-  return noproxy && noproxy.some(no => {
-    const noParts = no.split('.').filter(x => x).reverse()
-    if (!noParts.length) {
-      return false
-    }
-    for (let i = 0; i < noParts.length; i++) {
-      if (host[i] !== noParts[i]) {
-        return false
-      }
-    }
-    return true
-  })
-}
-
-module.exports.getProcessEnv = getProcessEnv
-
-function getProcessEnv (env) {
-  if (!env) {
-    return
-  }
-
-  let value
-
-  if (Array.isArray(env)) {
-    for (const e of env) {
-      value = process.env[e] ||
-        process.env[e.toUpperCase()] ||
-        process.env[e.toLowerCase()]
-      if (typeof value !== 'undefined') {
-        break
-      }
-    }
-  }
-
-  if (typeof env === 'string') {
-    value = process.env[env] ||
-      process.env[env.toUpperCase()] ||
-      process.env[env.toLowerCase()]
-  }
-
-  return value
-}
-
-module.exports.getProxyUri = getProxyUri
-function getProxyUri (uri, opts) {
-  const protocol = new url.URL(uri).protocol
-
-  const proxy = opts.proxy ||
-    (
-      protocol === 'https:' &&
-      getProcessEnv('https_proxy')
-    ) ||
-    (
-      protocol === 'http:' &&
-      getProcessEnv(['https_proxy', 'http_proxy', 'proxy'])
-    )
-  if (!proxy) {
-    return null
-  }
-
-  const parsedProxy = (typeof proxy === 'string') ? new url.URL(proxy) : proxy
-
-  return !checkNoProxy(uri, opts) && parsedProxy
-}
-
-const getAuth = u =>
-  u.username && u.password ? decodeURIComponent(`${u.username}:${u.password}`)
-  : u.username ? decodeURIComponent(u.username)
-  : null
-
-const getPath = u => u.pathname + u.search + u.hash
-
-const HttpProxyAgent = require('http-proxy-agent')
-const HttpsProxyAgent = require('https-proxy-agent')
-const { SocksProxyAgent } = require('socks-proxy-agent')
-module.exports.getProxy = getProxy
-function getProxy (proxyUrl, opts, isHttps) {
-  // our current proxy agents do not support an overridden dns lookup method, so will not
-  // benefit from the dns cache
-  const popts = {
-    host: proxyUrl.hostname,
-    port: proxyUrl.port,
-    protocol: proxyUrl.protocol,
-    path: getPath(proxyUrl),
-    auth: getAuth(proxyUrl),
-    ca: opts.ca,
-    cert: opts.cert,
-    key: opts.key,
-    timeout: getAgentTimeout(opts.timeout),
-    localAddress: opts.localAddress,
-    maxSockets: getMaxSockets(opts.maxSockets),
-    rejectUnauthorized: opts.rejectUnauthorized,
-  }
-
-  if (proxyUrl.protocol === 'http:' || proxyUrl.protocol === 'https:') {
-    if (!isHttps) {
-      return new HttpProxyAgent(popts)
-    } else {
-      return new HttpsProxyAgent(popts)
-    }
-  } else if (proxyUrl.protocol.startsWith('socks')) {
-    // socks-proxy-agent uses hostname not host
-    popts.hostname = popts.host
-    delete popts.host
-    return new SocksProxyAgent(popts)
-  } else {
-    throw Object.assign(
-      new Error(`unsupported proxy protocol: '${proxyUrl.protocol}'`),
-      {
-        code: 'EUNSUPPORTEDPROXY',
-        url: proxyUrl.href,
-      }
-    )
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/entry.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/entry.js
deleted file mode 100644
index dba89d715d8a5..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/entry.js
+++ /dev/null
@@ -1,444 +0,0 @@
-const { Request, Response } = require('minipass-fetch')
-const Minipass = require('minipass')
-const MinipassFlush = require('minipass-flush')
-const cacache = require('cacache')
-const url = require('url')
-
-const CachingMinipassPipeline = require('../pipeline.js')
-const CachePolicy = require('./policy.js')
-const cacheKey = require('./key.js')
-const remote = require('../remote.js')
-
-const hasOwnProperty = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
-
-// allow list for request headers that will be written to the cache index
-// note: we will also store any request headers
-// that are named in a response's vary header
-const KEEP_REQUEST_HEADERS = [
-  'accept-charset',
-  'accept-encoding',
-  'accept-language',
-  'accept',
-  'cache-control',
-]
-
-// allow list for response headers that will be written to the cache index
-// note: we must not store the real response's age header, or when we load
-// a cache policy based on the metadata it will think the cached response
-// is always stale
-const KEEP_RESPONSE_HEADERS = [
-  'cache-control',
-  'content-encoding',
-  'content-language',
-  'content-type',
-  'date',
-  'etag',
-  'expires',
-  'last-modified',
-  'link',
-  'location',
-  'pragma',
-  'vary',
-]
-
-// return an object containing all metadata to be written to the index
-const getMetadata = (request, response, options) => {
-  const metadata = {
-    time: Date.now(),
-    url: request.url,
-    reqHeaders: {},
-    resHeaders: {},
-
-    // options on which we must match the request and vary the response
-    options: {
-      compress: options.compress != null ? options.compress : request.compress,
-    },
-  }
-
-  // only save the status if it's not a 200 or 304
-  if (response.status !== 200 && response.status !== 304) {
-    metadata.status = response.status
-  }
-
-  for (const name of KEEP_REQUEST_HEADERS) {
-    if (request.headers.has(name)) {
-      metadata.reqHeaders[name] = request.headers.get(name)
-    }
-  }
-
-  // if the request's host header differs from the host in the url
-  // we need to keep it, otherwise it's just noise and we ignore it
-  const host = request.headers.get('host')
-  const parsedUrl = new url.URL(request.url)
-  if (host && parsedUrl.host !== host) {
-    metadata.reqHeaders.host = host
-  }
-
-  // if the response has a vary header, make sure
-  // we store the relevant request headers too
-  if (response.headers.has('vary')) {
-    const vary = response.headers.get('vary')
-    // a vary of "*" means every header causes a different response.
-    // in that scenario, we do not include any additional headers
-    // as the freshness check will always fail anyway and we don't
-    // want to bloat the cache indexes
-    if (vary !== '*') {
-      // copy any other request headers that will vary the response
-      const varyHeaders = vary.trim().toLowerCase().split(/\s*,\s*/)
-      for (const name of varyHeaders) {
-        if (request.headers.has(name)) {
-          metadata.reqHeaders[name] = request.headers.get(name)
-        }
-      }
-    }
-  }
-
-  for (const name of KEEP_RESPONSE_HEADERS) {
-    if (response.headers.has(name)) {
-      metadata.resHeaders[name] = response.headers.get(name)
-    }
-  }
-
-  return metadata
-}
-
-// symbols used to hide objects that may be lazily evaluated in a getter
-const _request = Symbol('request')
-const _response = Symbol('response')
-const _policy = Symbol('policy')
-
-class CacheEntry {
-  constructor ({ entry, request, response, options }) {
-    if (entry) {
-      this.key = entry.key
-      this.entry = entry
-      // previous versions of this module didn't write an explicit timestamp in
-      // the metadata, so fall back to the entry's timestamp. we can't use the
-      // entry timestamp to determine staleness because cacache will update it
-      // when it verifies its data
-      this.entry.metadata.time = this.entry.metadata.time || this.entry.time
-    } else {
-      this.key = cacheKey(request)
-    }
-
-    this.options = options
-
-    // these properties are behind getters that lazily evaluate
-    this[_request] = request
-    this[_response] = response
-    this[_policy] = null
-  }
-
-  // returns a CacheEntry instance that satisfies the given request
-  // or undefined if no existing entry satisfies
-  static async find (request, options) {
-    try {
-      // compacts the index and returns an array of unique entries
-      var matches = await cacache.index.compact(options.cachePath, cacheKey(request), (A, B) => {
-        const entryA = new CacheEntry({ entry: A, options })
-        const entryB = new CacheEntry({ entry: B, options })
-        return entryA.policy.satisfies(entryB.request)
-      }, {
-        validateEntry: (entry) => {
-          // clean out entries with a buggy content-encoding value
-          if (entry.metadata &&
-              entry.metadata.resHeaders &&
-              entry.metadata.resHeaders['content-encoding'] === null) {
-            return false
-          }
-
-          // if an integrity is null, it needs to have a status specified
-          if (entry.integrity === null) {
-            return !!(entry.metadata && entry.metadata.status)
-          }
-
-          return true
-        },
-      })
-    } catch (err) {
-      // if the compact request fails, ignore the error and return
-      return
-    }
-
-    // a cache mode of 'reload' means to behave as though we have no cache
-    // on the way to the network. return undefined to allow cacheFetch to
-    // create a brand new request no matter what.
-    if (options.cache === 'reload') {
-      return
-    }
-
-    // find the specific entry that satisfies the request
-    let match
-    for (const entry of matches) {
-      const _entry = new CacheEntry({
-        entry,
-        options,
-      })
-
-      if (_entry.policy.satisfies(request)) {
-        match = _entry
-        break
-      }
-    }
-
-    return match
-  }
-
-  // if the user made a PUT/POST/PATCH then we invalidate our
-  // cache for the same url by deleting the index entirely
-  static async invalidate (request, options) {
-    const key = cacheKey(request)
-    try {
-      await cacache.rm.entry(options.cachePath, key, { removeFully: true })
-    } catch (err) {
-      // ignore errors
-    }
-  }
-
-  get request () {
-    if (!this[_request]) {
-      this[_request] = new Request(this.entry.metadata.url, {
-        method: 'GET',
-        headers: this.entry.metadata.reqHeaders,
-        ...this.entry.metadata.options,
-      })
-    }
-
-    return this[_request]
-  }
-
-  get response () {
-    if (!this[_response]) {
-      this[_response] = new Response(null, {
-        url: this.entry.metadata.url,
-        counter: this.options.counter,
-        status: this.entry.metadata.status || 200,
-        headers: {
-          ...this.entry.metadata.resHeaders,
-          'content-length': this.entry.size,
-        },
-      })
-    }
-
-    return this[_response]
-  }
-
-  get policy () {
-    if (!this[_policy]) {
-      this[_policy] = new CachePolicy({
-        entry: this.entry,
-        request: this.request,
-        response: this.response,
-        options: this.options,
-      })
-    }
-
-    return this[_policy]
-  }
-
-  // wraps the response in a pipeline that stores the data
-  // in the cache while the user consumes it
-  async store (status) {
-    // if we got a status other than 200, 301, or 308,
-    // or the CachePolicy forbid storage, append the
-    // cache status header and return it untouched
-    if (
-      this.request.method !== 'GET' ||
-      ![200, 301, 308].includes(this.response.status) ||
-      !this.policy.storable()
-    ) {
-      this.response.headers.set('x-local-cache-status', 'skip')
-      return this.response
-    }
-
-    const size = this.response.headers.get('content-length')
-    const cacheOpts = {
-      algorithms: this.options.algorithms,
-      metadata: getMetadata(this.request, this.response, this.options),
-      size,
-      integrity: this.options.integrity,
-      integrityEmitter: this.response.body.hasIntegrityEmitter && this.response.body,
-    }
-
-    let body = null
-    // we only set a body if the status is a 200, redirects are
-    // stored as metadata only
-    if (this.response.status === 200) {
-      let cacheWriteResolve, cacheWriteReject
-      const cacheWritePromise = new Promise((resolve, reject) => {
-        cacheWriteResolve = resolve
-        cacheWriteReject = reject
-      })
-
-      body = new CachingMinipassPipeline({ events: ['integrity', 'size'] }, new MinipassFlush({
-        flush () {
-          return cacheWritePromise
-        },
-      }))
-      // this is always true since if we aren't reusing the one from the remote fetch, we
-      // are using the one from cacache
-      body.hasIntegrityEmitter = true
-
-      const onResume = () => {
-        const tee = new Minipass()
-        const cacheStream = cacache.put.stream(this.options.cachePath, this.key, cacheOpts)
-        // re-emit the integrity and size events on our new response body so they can be reused
-        cacheStream.on('integrity', i => body.emit('integrity', i))
-        cacheStream.on('size', s => body.emit('size', s))
-        // stick a flag on here so downstream users will know if they can expect integrity events
-        tee.pipe(cacheStream)
-        // TODO if the cache write fails, log a warning but return the response anyway
-        // eslint-disable-next-line promise/catch-or-return
-        cacheStream.promise().then(cacheWriteResolve, cacheWriteReject)
-        body.unshift(tee)
-        body.unshift(this.response.body)
-      }
-
-      body.once('resume', onResume)
-      body.once('end', () => body.removeListener('resume', onResume))
-    } else {
-      await cacache.index.insert(this.options.cachePath, this.key, null, cacheOpts)
-    }
-
-    // note: we do not set the x-local-cache-hash header because we do not know
-    // the hash value until after the write to the cache completes, which doesn't
-    // happen until after the response has been sent and it's too late to write
-    // the header anyway
-    this.response.headers.set('x-local-cache', encodeURIComponent(this.options.cachePath))
-    this.response.headers.set('x-local-cache-key', encodeURIComponent(this.key))
-    this.response.headers.set('x-local-cache-mode', 'stream')
-    this.response.headers.set('x-local-cache-status', status)
-    this.response.headers.set('x-local-cache-time', new Date().toISOString())
-    const newResponse = new Response(body, {
-      url: this.response.url,
-      status: this.response.status,
-      headers: this.response.headers,
-      counter: this.options.counter,
-    })
-    return newResponse
-  }
-
-  // use the cached data to create a response and return it
-  async respond (method, options, status) {
-    let response
-    if (method === 'HEAD' || [301, 308].includes(this.response.status)) {
-      // if the request is a HEAD, or the response is a redirect,
-      // then the metadata in the entry already includes everything
-      // we need to build a response
-      response = this.response
-    } else {
-      // we're responding with a full cached response, so create a body
-      // that reads from cacache and attach it to a new Response
-      const body = new Minipass()
-      const headers = { ...this.policy.responseHeaders() }
-      const onResume = () => {
-        const cacheStream = cacache.get.stream.byDigest(
-          this.options.cachePath, this.entry.integrity, { memoize: this.options.memoize }
-        )
-        cacheStream.on('error', async (err) => {
-          cacheStream.pause()
-          if (err.code === 'EINTEGRITY') {
-            await cacache.rm.content(
-              this.options.cachePath, this.entry.integrity, { memoize: this.options.memoize }
-            )
-          }
-          if (err.code === 'ENOENT' || err.code === 'EINTEGRITY') {
-            await CacheEntry.invalidate(this.request, this.options)
-          }
-          body.emit('error', err)
-          cacheStream.resume()
-        })
-        // emit the integrity and size events based on our metadata so we're consistent
-        body.emit('integrity', this.entry.integrity)
-        body.emit('size', Number(headers['content-length']))
-        cacheStream.pipe(body)
-      }
-
-      body.once('resume', onResume)
-      body.once('end', () => body.removeListener('resume', onResume))
-      response = new Response(body, {
-        url: this.entry.metadata.url,
-        counter: options.counter,
-        status: 200,
-        headers,
-      })
-    }
-
-    response.headers.set('x-local-cache', encodeURIComponent(this.options.cachePath))
-    response.headers.set('x-local-cache-hash', encodeURIComponent(this.entry.integrity))
-    response.headers.set('x-local-cache-key', encodeURIComponent(this.key))
-    response.headers.set('x-local-cache-mode', 'stream')
-    response.headers.set('x-local-cache-status', status)
-    response.headers.set('x-local-cache-time', new Date(this.entry.metadata.time).toUTCString())
-    return response
-  }
-
-  // use the provided request along with this cache entry to
-  // revalidate the stored response. returns a response, either
-  // from the cache or from the update
-  async revalidate (request, options) {
-    const revalidateRequest = new Request(request, {
-      headers: this.policy.revalidationHeaders(request),
-    })
-
-    try {
-      // NOTE: be sure to remove the headers property from the
-      // user supplied options, since we have already defined
-      // them on the new request object. if they're still in the
-      // options then those will overwrite the ones from the policy
-      var response = await remote(revalidateRequest, {
-        ...options,
-        headers: undefined,
-      })
-    } catch (err) {
-      // if the network fetch fails, return the stale
-      // cached response unless it has a cache-control
-      // of 'must-revalidate'
-      if (!this.policy.mustRevalidate) {
-        return this.respond(request.method, options, 'stale')
-      }
-
-      throw err
-    }
-
-    if (this.policy.revalidated(revalidateRequest, response)) {
-      // we got a 304, write a new index to the cache and respond from cache
-      const metadata = getMetadata(request, response, options)
-      // 304 responses do not include headers that are specific to the response data
-      // since they do not include a body, so we copy values for headers that were
-      // in the old cache entry to the new one, if the new metadata does not already
-      // include that header
-      for (const name of KEEP_RESPONSE_HEADERS) {
-        if (
-          !hasOwnProperty(metadata.resHeaders, name) &&
-          hasOwnProperty(this.entry.metadata.resHeaders, name)
-        ) {
-          metadata.resHeaders[name] = this.entry.metadata.resHeaders[name]
-        }
-      }
-
-      try {
-        await cacache.index.insert(options.cachePath, this.key, this.entry.integrity, {
-          size: this.entry.size,
-          metadata,
-        })
-      } catch (err) {
-        // if updating the cache index fails, we ignore it and
-        // respond anyway
-      }
-      return this.respond(request.method, options, 'revalidated')
-    }
-
-    // if we got a modified response, create a new entry based on it
-    const newEntry = new CacheEntry({
-      request,
-      response,
-      options,
-    })
-
-    // respond with the new entry while writing it to the cache
-    return newEntry.store('updated')
-  }
-}
-
-module.exports = CacheEntry
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/errors.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/errors.js
deleted file mode 100644
index 67a66573bebe6..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/errors.js
+++ /dev/null
@@ -1,11 +0,0 @@
-class NotCachedError extends Error {
-  constructor (url) {
-    /* eslint-disable-next-line max-len */
-    super(`request to ${url} failed: cache mode is 'only-if-cached' but no cached response is available.`)
-    this.code = 'ENOTCACHED'
-  }
-}
-
-module.exports = {
-  NotCachedError,
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/index.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/index.js
deleted file mode 100644
index 0de49d23fb933..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/index.js
+++ /dev/null
@@ -1,49 +0,0 @@
-const { NotCachedError } = require('./errors.js')
-const CacheEntry = require('./entry.js')
-const remote = require('../remote.js')
-
-// do whatever is necessary to get a Response and return it
-const cacheFetch = async (request, options) => {
-  // try to find a cached entry that satisfies this request
-  const entry = await CacheEntry.find(request, options)
-  if (!entry) {
-    // no cached result, if the cache mode is 'only-if-cached' that's a failure
-    if (options.cache === 'only-if-cached') {
-      throw new NotCachedError(request.url)
-    }
-
-    // otherwise, we make a request, store it and return it
-    const response = await remote(request, options)
-    const newEntry = new CacheEntry({ request, response, options })
-    return newEntry.store('miss')
-  }
-
-  // we have a cached response that satisfies this request, however if the cache
-  // mode is 'no-cache' then we send the revalidation request no matter what
-  if (options.cache === 'no-cache') {
-    return entry.revalidate(request, options)
-  }
-
-  // if the cached entry is not stale, or if the cache mode is 'force-cache' or
-  // 'only-if-cached' we can respond with the cached entry. set the status
-  // based on the result of needsRevalidation and respond
-  const _needsRevalidation = entry.policy.needsRevalidation(request)
-  if (options.cache === 'force-cache' ||
-      options.cache === 'only-if-cached' ||
-      !_needsRevalidation) {
-    return entry.respond(request.method, options, _needsRevalidation ? 'stale' : 'hit')
-  }
-
-  // if we got here, the cache entry is stale so revalidate it
-  return entry.revalidate(request, options)
-}
-
-cacheFetch.invalidate = async (request, options) => {
-  if (!options.cachePath) {
-    return
-  }
-
-  return CacheEntry.invalidate(request, options)
-}
-
-module.exports = cacheFetch
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/key.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/key.js
deleted file mode 100644
index f7684d562b7fa..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/key.js
+++ /dev/null
@@ -1,17 +0,0 @@
-const { URL, format } = require('url')
-
-// options passed to url.format() when generating a key
-const formatOptions = {
-  auth: false,
-  fragment: false,
-  search: true,
-  unicode: false,
-}
-
-// returns a string to be used as the cache key for the Request
-const cacheKey = (request) => {
-  const parsed = new URL(request.url)
-  return `make-fetch-happen:request-cache:${format(parsed, formatOptions)}`
-}
-
-module.exports = cacheKey
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/policy.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/policy.js
deleted file mode 100644
index ada3c8600dae9..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/cache/policy.js
+++ /dev/null
@@ -1,161 +0,0 @@
-const CacheSemantics = require('http-cache-semantics')
-const Negotiator = require('negotiator')
-const ssri = require('ssri')
-
-// options passed to http-cache-semantics constructor
-const policyOptions = {
-  shared: false,
-  ignoreCargoCult: true,
-}
-
-// a fake empty response, used when only testing the
-// request for storability
-const emptyResponse = { status: 200, headers: {} }
-
-// returns a plain object representation of the Request
-const requestObject = (request) => {
-  const _obj = {
-    method: request.method,
-    url: request.url,
-    headers: {},
-    compress: request.compress,
-  }
-
-  request.headers.forEach((value, key) => {
-    _obj.headers[key] = value
-  })
-
-  return _obj
-}
-
-// returns a plain object representation of the Response
-const responseObject = (response) => {
-  const _obj = {
-    status: response.status,
-    headers: {},
-  }
-
-  response.headers.forEach((value, key) => {
-    _obj.headers[key] = value
-  })
-
-  return _obj
-}
-
-class CachePolicy {
-  constructor ({ entry, request, response, options }) {
-    this.entry = entry
-    this.request = requestObject(request)
-    this.response = responseObject(response)
-    this.options = options
-    this.policy = new CacheSemantics(this.request, this.response, policyOptions)
-
-    if (this.entry) {
-      // if we have an entry, copy the timestamp to the _responseTime
-      // this is necessary because the CacheSemantics constructor forces
-      // the value to Date.now() which means a policy created from a
-      // cache entry is likely to always identify itself as stale
-      this.policy._responseTime = this.entry.metadata.time
-    }
-  }
-
-  // static method to quickly determine if a request alone is storable
-  static storable (request, options) {
-    // no cachePath means no caching
-    if (!options.cachePath) {
-      return false
-    }
-
-    // user explicitly asked not to cache
-    if (options.cache === 'no-store') {
-      return false
-    }
-
-    // we only cache GET and HEAD requests
-    if (!['GET', 'HEAD'].includes(request.method)) {
-      return false
-    }
-
-    // otherwise, let http-cache-semantics make the decision
-    // based on the request's headers
-    const policy = new CacheSemantics(requestObject(request), emptyResponse, policyOptions)
-    return policy.storable()
-  }
-
-  // returns true if the policy satisfies the request
-  satisfies (request) {
-    const _req = requestObject(request)
-    if (this.request.headers.host !== _req.headers.host) {
-      return false
-    }
-
-    if (this.request.compress !== _req.compress) {
-      return false
-    }
-
-    const negotiatorA = new Negotiator(this.request)
-    const negotiatorB = new Negotiator(_req)
-
-    if (JSON.stringify(negotiatorA.mediaTypes()) !== JSON.stringify(negotiatorB.mediaTypes())) {
-      return false
-    }
-
-    if (JSON.stringify(negotiatorA.languages()) !== JSON.stringify(negotiatorB.languages())) {
-      return false
-    }
-
-    if (JSON.stringify(negotiatorA.encodings()) !== JSON.stringify(negotiatorB.encodings())) {
-      return false
-    }
-
-    if (this.options.integrity) {
-      return ssri.parse(this.options.integrity).match(this.entry.integrity)
-    }
-
-    return true
-  }
-
-  // returns true if the request and response allow caching
-  storable () {
-    return this.policy.storable()
-  }
-
-  // NOTE: this is a hack to avoid parsing the cache-control
-  // header ourselves, it returns true if the response's
-  // cache-control contains must-revalidate
-  get mustRevalidate () {
-    return !!this.policy._rescc['must-revalidate']
-  }
-
-  // returns true if the cached response requires revalidation
-  // for the given request
-  needsRevalidation (request) {
-    const _req = requestObject(request)
-    // force method to GET because we only cache GETs
-    // but can serve a HEAD from a cached GET
-    _req.method = 'GET'
-    return !this.policy.satisfiesWithoutRevalidation(_req)
-  }
-
-  responseHeaders () {
-    return this.policy.responseHeaders()
-  }
-
-  // returns a new object containing the appropriate headers
-  // to send a revalidation request
-  revalidationHeaders (request) {
-    const _req = requestObject(request)
-    return this.policy.revalidationHeaders(_req)
-  }
-
-  // returns true if the request/response was revalidated
-  // successfully. returns false if a new response was received
-  revalidated (request, response) {
-    const _req = requestObject(request)
-    const _res = responseObject(response)
-    const policy = this.policy.revalidatedPolicy(_req, _res)
-    return !policy.modified
-  }
-}
-
-module.exports = CachePolicy
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/dns.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/dns.js
deleted file mode 100644
index 13102b57c4aa0..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/dns.js
+++ /dev/null
@@ -1,49 +0,0 @@
-const LRUCache = require('lru-cache')
-const dns = require('dns')
-
-const defaultOptions = exports.defaultOptions = {
-  family: undefined,
-  hints: dns.ADDRCONFIG,
-  all: false,
-  verbatim: undefined,
-}
-
-const lookupCache = exports.lookupCache = new LRUCache({ max: 50 })
-
-// this is a factory so that each request can have its own opts (i.e. ttl)
-// while still sharing the cache across all requests
-exports.getLookup = (dnsOptions) => {
-  return (hostname, options, callback) => {
-    if (typeof options === 'function') {
-      callback = options
-      options = null
-    } else if (typeof options === 'number') {
-      options = { family: options }
-    }
-
-    options = { ...defaultOptions, ...options }
-
-    const key = JSON.stringify({
-      hostname,
-      family: options.family,
-      hints: options.hints,
-      all: options.all,
-      verbatim: options.verbatim,
-    })
-
-    if (lookupCache.has(key)) {
-      const [address, family] = lookupCache.get(key)
-      process.nextTick(callback, null, address, family)
-      return
-    }
-
-    dnsOptions.lookup(hostname, options, (err, address, family) => {
-      if (err) {
-        return callback(err)
-      }
-
-      lookupCache.set(key, [address, family], { ttl: dnsOptions.ttl })
-      return callback(null, address, family)
-    })
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/fetch.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/fetch.js
deleted file mode 100644
index 233ba67e16550..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/fetch.js
+++ /dev/null
@@ -1,118 +0,0 @@
-'use strict'
-
-const { FetchError, Request, isRedirect } = require('minipass-fetch')
-const url = require('url')
-
-const CachePolicy = require('./cache/policy.js')
-const cache = require('./cache/index.js')
-const remote = require('./remote.js')
-
-// given a Request, a Response and user options
-// return true if the response is a redirect that
-// can be followed. we throw errors that will result
-// in the fetch being rejected if the redirect is
-// possible but invalid for some reason
-const canFollowRedirect = (request, response, options) => {
-  if (!isRedirect(response.status)) {
-    return false
-  }
-
-  if (options.redirect === 'manual') {
-    return false
-  }
-
-  if (options.redirect === 'error') {
-    throw new FetchError(`redirect mode is set to error: ${request.url}`,
-      'no-redirect', { code: 'ENOREDIRECT' })
-  }
-
-  if (!response.headers.has('location')) {
-    throw new FetchError(`redirect location header missing for: ${request.url}`,
-      'no-location', { code: 'EINVALIDREDIRECT' })
-  }
-
-  if (request.counter >= request.follow) {
-    throw new FetchError(`maximum redirect reached at: ${request.url}`,
-      'max-redirect', { code: 'EMAXREDIRECT' })
-  }
-
-  return true
-}
-
-// given a Request, a Response, and the user's options return an object
-// with a new Request and a new options object that will be used for
-// following the redirect
-const getRedirect = (request, response, options) => {
-  const _opts = { ...options }
-  const location = response.headers.get('location')
-  const redirectUrl = new url.URL(location, /^https?:/.test(location) ? undefined : request.url)
-  // Comment below is used under the following license:
-  /**
-   * @license
-   * Copyright (c) 2010-2012 Mikeal Rogers
-   * Licensed under the Apache License, Version 2.0 (the "License");
-   * you may not use this file except in compliance with the License.
-   * You may obtain a copy of the License at
-   * http://www.apache.org/licenses/LICENSE-2.0
-   * Unless required by applicable law or agreed to in writing,
-   * software distributed under the License is distributed on an "AS
-   * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
-   * express or implied. See the License for the specific language
-   * governing permissions and limitations under the License.
-   */
-
-  // Remove authorization if changing hostnames (but not if just
-  // changing ports or protocols).  This matches the behavior of request:
-  // https://github.com/request/request/blob/b12a6245/lib/redirect.js#L134-L138
-  if (new url.URL(request.url).hostname !== redirectUrl.hostname) {
-    request.headers.delete('authorization')
-    request.headers.delete('cookie')
-  }
-
-  // for POST request with 301/302 response, or any request with 303 response,
-  // use GET when following redirect
-  if (
-    response.status === 303 ||
-    (request.method === 'POST' && [301, 302].includes(response.status))
-  ) {
-    _opts.method = 'GET'
-    _opts.body = null
-    request.headers.delete('content-length')
-  }
-
-  _opts.headers = {}
-  request.headers.forEach((value, key) => {
-    _opts.headers[key] = value
-  })
-
-  _opts.counter = ++request.counter
-  const redirectReq = new Request(url.format(redirectUrl), _opts)
-  return {
-    request: redirectReq,
-    options: _opts,
-  }
-}
-
-const fetch = async (request, options) => {
-  const response = CachePolicy.storable(request, options)
-    ? await cache(request, options)
-    : await remote(request, options)
-
-  // if the request wasn't a GET or HEAD, and the response
-  // status is between 200 and 399 inclusive, invalidate the
-  // request url
-  if (!['GET', 'HEAD'].includes(request.method) &&
-      response.status >= 200 &&
-      response.status <= 399) {
-    await cache.invalidate(request, options)
-  }
-
-  if (!canFollowRedirect(request, response, options)) {
-    return response
-  }
-
-  const redirect = getRedirect(request, response, options)
-  return fetch(redirect.request, redirect.options)
-}
-
-module.exports = fetch
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/index.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/index.js
deleted file mode 100644
index 2f12e8e1b6113..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/index.js
+++ /dev/null
@@ -1,41 +0,0 @@
-const { FetchError, Headers, Request, Response } = require('minipass-fetch')
-
-const configureOptions = require('./options.js')
-const fetch = require('./fetch.js')
-
-const makeFetchHappen = (url, opts) => {
-  const options = configureOptions(opts)
-
-  const request = new Request(url, options)
-  return fetch(request, options)
-}
-
-makeFetchHappen.defaults = (defaultUrl, defaultOptions = {}, wrappedFetch = makeFetchHappen) => {
-  if (typeof defaultUrl === 'object') {
-    defaultOptions = defaultUrl
-    defaultUrl = null
-  }
-
-  const defaultedFetch = (url, options = {}) => {
-    const finalUrl = url || defaultUrl
-    const finalOptions = {
-      ...defaultOptions,
-      ...options,
-      headers: {
-        ...defaultOptions.headers,
-        ...options.headers,
-      },
-    }
-    return wrappedFetch(finalUrl, finalOptions)
-  }
-
-  defaultedFetch.defaults = (defaultUrl1, defaultOptions1 = {}) =>
-    makeFetchHappen.defaults(defaultUrl1, defaultOptions1, defaultedFetch)
-  return defaultedFetch
-}
-
-module.exports = makeFetchHappen
-module.exports.FetchError = FetchError
-module.exports.Headers = Headers
-module.exports.Request = Request
-module.exports.Response = Response
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/options.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/options.js
deleted file mode 100644
index daa9ecd9d5d5f..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/options.js
+++ /dev/null
@@ -1,52 +0,0 @@
-const dns = require('dns')
-
-const conditionalHeaders = [
-  'if-modified-since',
-  'if-none-match',
-  'if-unmodified-since',
-  'if-match',
-  'if-range',
-]
-
-const configureOptions = (opts) => {
-  const { strictSSL, ...options } = { ...opts }
-  options.method = options.method ? options.method.toUpperCase() : 'GET'
-  options.rejectUnauthorized = strictSSL !== false
-
-  if (!options.retry) {
-    options.retry = { retries: 0 }
-  } else if (typeof options.retry === 'string') {
-    const retries = parseInt(options.retry, 10)
-    if (isFinite(retries)) {
-      options.retry = { retries }
-    } else {
-      options.retry = { retries: 0 }
-    }
-  } else if (typeof options.retry === 'number') {
-    options.retry = { retries: options.retry }
-  } else {
-    options.retry = { retries: 0, ...options.retry }
-  }
-
-  options.dns = { ttl: 5 * 60 * 1000, lookup: dns.lookup, ...options.dns }
-
-  options.cache = options.cache || 'default'
-  if (options.cache === 'default') {
-    const hasConditionalHeader = Object.keys(options.headers || {}).some((name) => {
-      return conditionalHeaders.includes(name.toLowerCase())
-    })
-    if (hasConditionalHeader) {
-      options.cache = 'no-store'
-    }
-  }
-
-  // cacheManager is deprecated, but if it's set and
-  // cachePath is not we should copy it to the new field
-  if (options.cacheManager && !options.cachePath) {
-    options.cachePath = options.cacheManager
-  }
-
-  return options
-}
-
-module.exports = configureOptions
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/pipeline.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/pipeline.js
deleted file mode 100644
index b1d221b2d0ce3..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/pipeline.js
+++ /dev/null
@@ -1,41 +0,0 @@
-'use strict'
-
-const MinipassPipeline = require('minipass-pipeline')
-
-class CachingMinipassPipeline extends MinipassPipeline {
-  #events = []
-  #data = new Map()
-
-  constructor (opts, ...streams) {
-    // CRITICAL: do NOT pass the streams to the call to super(), this will start
-    // the flow of data and potentially cause the events we need to catch to emit
-    // before we've finished our own setup. instead we call super() with no args,
-    // finish our setup, and then push the streams into ourselves to start the
-    // data flow
-    super()
-    this.#events = opts.events
-
-    /* istanbul ignore next - coverage disabled because this is pointless to test here */
-    if (streams.length) {
-      this.push(...streams)
-    }
-  }
-
-  on (event, handler) {
-    if (this.#events.includes(event) && this.#data.has(event)) {
-      return handler(...this.#data.get(event))
-    }
-
-    return super.on(event, handler)
-  }
-
-  emit (event, ...data) {
-    if (this.#events.includes(event)) {
-      this.#data.set(event, data)
-    }
-
-    return super.emit(event, ...data)
-  }
-}
-
-module.exports = CachingMinipassPipeline
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/remote.js b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/remote.js
deleted file mode 100644
index 068c73a8a7a7e..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/lib/remote.js
+++ /dev/null
@@ -1,121 +0,0 @@
-const Minipass = require('minipass')
-const fetch = require('minipass-fetch')
-const promiseRetry = require('promise-retry')
-const ssri = require('ssri')
-
-const CachingMinipassPipeline = require('./pipeline.js')
-const getAgent = require('./agent.js')
-const pkg = require('../package.json')
-
-const USER_AGENT = `${pkg.name}/${pkg.version} (+https://npm.im/${pkg.name})`
-
-const RETRY_ERRORS = [
-  'ECONNRESET', // remote socket closed on us
-  'ECONNREFUSED', // remote host refused to open connection
-  'EADDRINUSE', // failed to bind to a local port (proxy?)
-  'ETIMEDOUT', // someone in the transaction is WAY TOO SLOW
-  'ERR_SOCKET_TIMEOUT', // same as above, but this one comes from agentkeepalive
-  // Known codes we do NOT retry on:
-  // ENOTFOUND (getaddrinfo failure. Either bad hostname, or offline)
-]
-
-const RETRY_TYPES = [
-  'request-timeout',
-]
-
-// make a request directly to the remote source,
-// retrying certain classes of errors as well as
-// following redirects (through the cache if necessary)
-// and verifying response integrity
-const remoteFetch = (request, options) => {
-  const agent = getAgent(request.url, options)
-  if (!request.headers.has('connection')) {
-    request.headers.set('connection', agent ? 'keep-alive' : 'close')
-  }
-
-  if (!request.headers.has('user-agent')) {
-    request.headers.set('user-agent', USER_AGENT)
-  }
-
-  // keep our own options since we're overriding the agent
-  // and the redirect mode
-  const _opts = {
-    ...options,
-    agent,
-    redirect: 'manual',
-  }
-
-  return promiseRetry(async (retryHandler, attemptNum) => {
-    const req = new fetch.Request(request, _opts)
-    try {
-      let res = await fetch(req, _opts)
-      if (_opts.integrity && res.status === 200) {
-        // we got a 200 response and the user has specified an expected
-        // integrity value, so wrap the response in an ssri stream to verify it
-        const integrityStream = ssri.integrityStream({
-          algorithms: _opts.algorithms,
-          integrity: _opts.integrity,
-          size: _opts.size,
-        })
-        const pipeline = new CachingMinipassPipeline({
-          events: ['integrity', 'size'],
-        }, res.body, integrityStream)
-        // we also propagate the integrity and size events out to the pipeline so we can use
-        // this new response body as an integrityEmitter for cacache
-        integrityStream.on('integrity', i => pipeline.emit('integrity', i))
-        integrityStream.on('size', s => pipeline.emit('size', s))
-        res = new fetch.Response(pipeline, res)
-        // set an explicit flag so we know if our response body will emit integrity and size
-        res.body.hasIntegrityEmitter = true
-      }
-
-      res.headers.set('x-fetch-attempts', attemptNum)
-
-      // do not retry POST requests, or requests with a streaming body
-      // do retry requests with a 408, 420, 429 or 500+ status in the response
-      const isStream = Minipass.isStream(req.body)
-      const isRetriable = req.method !== 'POST' &&
-          !isStream &&
-          ([408, 420, 429].includes(res.status) || res.status >= 500)
-
-      if (isRetriable) {
-        if (typeof options.onRetry === 'function') {
-          options.onRetry(res)
-        }
-
-        return retryHandler(res)
-      }
-
-      return res
-    } catch (err) {
-      const code = (err.code === 'EPROMISERETRY')
-        ? err.retried.code
-        : err.code
-
-      // err.retried will be the thing that was thrown from above
-      // if it's a response, we just got a bad status code and we
-      // can re-throw to allow the retry
-      const isRetryError = err.retried instanceof fetch.Response ||
-        (RETRY_ERRORS.includes(code) && RETRY_TYPES.includes(err.type))
-
-      if (req.method === 'POST' || isRetryError) {
-        throw err
-      }
-
-      if (typeof options.onRetry === 'function') {
-        options.onRetry(err)
-      }
-
-      return retryHandler(err)
-    }
-  }, options.retry).catch((err) => {
-    // don't reject for http errors, just return them
-    if (err.status >= 400 && err.type !== 'system') {
-      return err
-    }
-
-    throw err
-  })
-}
-
-module.exports = remoteFetch
diff --git a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/package.json b/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/package.json
deleted file mode 100644
index fc491d1152e15..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/make-fetch-happen/package.json
+++ /dev/null
@@ -1,79 +0,0 @@
-{
-  "name": "make-fetch-happen",
-  "version": "10.2.1",
-  "description": "Opinionated, caching, retrying fetch client",
-  "main": "lib/index.js",
-  "files": [
-    "bin/",
-    "lib/"
-  ],
-  "scripts": {
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "prepublishOnly": "git push origin --follow-tags",
-    "test": "tap",
-    "posttest": "npm run lint",
-    "eslint": "eslint",
-    "lint": "eslint \"**/*.js\"",
-    "lintfix": "npm run lint -- --fix",
-    "postlint": "template-oss-check",
-    "snap": "tap",
-    "template-oss-apply": "template-oss-apply --force"
-  },
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/npm/make-fetch-happen.git"
-  },
-  "keywords": [
-    "http",
-    "request",
-    "fetch",
-    "mean girls",
-    "caching",
-    "cache",
-    "subresource integrity"
-  ],
-  "author": "GitHub Inc.",
-  "license": "ISC",
-  "dependencies": {
-    "agentkeepalive": "^4.2.1",
-    "cacache": "^16.1.0",
-    "http-cache-semantics": "^4.1.0",
-    "http-proxy-agent": "^5.0.0",
-    "https-proxy-agent": "^5.0.0",
-    "is-lambda": "^1.0.1",
-    "lru-cache": "^7.7.1",
-    "minipass": "^3.1.6",
-    "minipass-collect": "^1.0.2",
-    "minipass-fetch": "^2.0.3",
-    "minipass-flush": "^1.0.5",
-    "minipass-pipeline": "^1.2.4",
-    "negotiator": "^0.6.3",
-    "promise-retry": "^2.0.1",
-    "socks-proxy-agent": "^7.0.0",
-    "ssri": "^9.0.0"
-  },
-  "devDependencies": {
-    "@npmcli/eslint-config": "^3.0.1",
-    "@npmcli/template-oss": "3.5.0",
-    "mkdirp": "^1.0.4",
-    "nock": "^13.2.4",
-    "rimraf": "^3.0.2",
-    "safe-buffer": "^5.2.1",
-    "standard-version": "^9.3.2",
-    "tap": "^16.0.0"
-  },
-  "engines": {
-    "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
-  },
-  "tap": {
-    "color": 1,
-    "files": "test/*.js",
-    "check-coverage": true,
-    "timeout": 60
-  },
-  "templateOSS": {
-    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
-    "version": "3.5.0"
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/minimatch/LICENSE b/node_modules/@npmcli/run-script/node_modules/minimatch/LICENSE
deleted file mode 100644
index 19129e315fe59..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minimatch/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/minimatch/minimatch.js b/node_modules/@npmcli/run-script/node_modules/minimatch/minimatch.js
deleted file mode 100644
index fda45ade7cfc3..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minimatch/minimatch.js
+++ /dev/null
@@ -1,947 +0,0 @@
-module.exports = minimatch
-minimatch.Minimatch = Minimatch
-
-var path = (function () { try { return require('path') } catch (e) {}}()) || {
-  sep: '/'
-}
-minimatch.sep = path.sep
-
-var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
-var expand = require('brace-expansion')
-
-var plTypes = {
-  '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
-  '?': { open: '(?:', close: ')?' },
-  '+': { open: '(?:', close: ')+' },
-  '*': { open: '(?:', close: ')*' },
-  '@': { open: '(?:', close: ')' }
-}
-
-// any single thing other than /
-// don't need to escape / when using new RegExp()
-var qmark = '[^/]'
-
-// * => any number of characters
-var star = qmark + '*?'
-
-// ** when dots are allowed.  Anything goes, except .. and .
-// not (^ or / followed by one or two dots followed by $ or /),
-// followed by anything, any number of times.
-var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
-
-// not a ^ or / followed by a dot,
-// followed by anything, any number of times.
-var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
-
-// characters that need to be escaped in RegExp.
-var reSpecials = charSet('().*{}+?[]^$\\!')
-
-// "abc" -> { a:true, b:true, c:true }
-function charSet (s) {
-  return s.split('').reduce(function (set, c) {
-    set[c] = true
-    return set
-  }, {})
-}
-
-// normalizes slashes.
-var slashSplit = /\/+/
-
-minimatch.filter = filter
-function filter (pattern, options) {
-  options = options || {}
-  return function (p, i, list) {
-    return minimatch(p, pattern, options)
-  }
-}
-
-function ext (a, b) {
-  b = b || {}
-  var t = {}
-  Object.keys(a).forEach(function (k) {
-    t[k] = a[k]
-  })
-  Object.keys(b).forEach(function (k) {
-    t[k] = b[k]
-  })
-  return t
-}
-
-minimatch.defaults = function (def) {
-  if (!def || typeof def !== 'object' || !Object.keys(def).length) {
-    return minimatch
-  }
-
-  var orig = minimatch
-
-  var m = function minimatch (p, pattern, options) {
-    return orig(p, pattern, ext(def, options))
-  }
-
-  m.Minimatch = function Minimatch (pattern, options) {
-    return new orig.Minimatch(pattern, ext(def, options))
-  }
-  m.Minimatch.defaults = function defaults (options) {
-    return orig.defaults(ext(def, options)).Minimatch
-  }
-
-  m.filter = function filter (pattern, options) {
-    return orig.filter(pattern, ext(def, options))
-  }
-
-  m.defaults = function defaults (options) {
-    return orig.defaults(ext(def, options))
-  }
-
-  m.makeRe = function makeRe (pattern, options) {
-    return orig.makeRe(pattern, ext(def, options))
-  }
-
-  m.braceExpand = function braceExpand (pattern, options) {
-    return orig.braceExpand(pattern, ext(def, options))
-  }
-
-  m.match = function (list, pattern, options) {
-    return orig.match(list, pattern, ext(def, options))
-  }
-
-  return m
-}
-
-Minimatch.defaults = function (def) {
-  return minimatch.defaults(def).Minimatch
-}
-
-function minimatch (p, pattern, options) {
-  assertValidPattern(pattern)
-
-  if (!options) options = {}
-
-  // shortcut: comments match nothing.
-  if (!options.nocomment && pattern.charAt(0) === '#') {
-    return false
-  }
-
-  return new Minimatch(pattern, options).match(p)
-}
-
-function Minimatch (pattern, options) {
-  if (!(this instanceof Minimatch)) {
-    return new Minimatch(pattern, options)
-  }
-
-  assertValidPattern(pattern)
-
-  if (!options) options = {}
-
-  pattern = pattern.trim()
-
-  // windows support: need to use /, not \
-  if (!options.allowWindowsEscape && path.sep !== '/') {
-    pattern = pattern.split(path.sep).join('/')
-  }
-
-  this.options = options
-  this.set = []
-  this.pattern = pattern
-  this.regexp = null
-  this.negate = false
-  this.comment = false
-  this.empty = false
-  this.partial = !!options.partial
-
-  // make the set of regexps etc.
-  this.make()
-}
-
-Minimatch.prototype.debug = function () {}
-
-Minimatch.prototype.make = make
-function make () {
-  var pattern = this.pattern
-  var options = this.options
-
-  // empty patterns and comments match nothing.
-  if (!options.nocomment && pattern.charAt(0) === '#') {
-    this.comment = true
-    return
-  }
-  if (!pattern) {
-    this.empty = true
-    return
-  }
-
-  // step 1: figure out negation, etc.
-  this.parseNegate()
-
-  // step 2: expand braces
-  var set = this.globSet = this.braceExpand()
-
-  if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) }
-
-  this.debug(this.pattern, set)
-
-  // step 3: now we have a set, so turn each one into a series of path-portion
-  // matching patterns.
-  // These will be regexps, except in the case of "**", which is
-  // set to the GLOBSTAR object for globstar behavior,
-  // and will not contain any / characters
-  set = this.globParts = set.map(function (s) {
-    return s.split(slashSplit)
-  })
-
-  this.debug(this.pattern, set)
-
-  // glob --> regexps
-  set = set.map(function (s, si, set) {
-    return s.map(this.parse, this)
-  }, this)
-
-  this.debug(this.pattern, set)
-
-  // filter out everything that didn't compile properly.
-  set = set.filter(function (s) {
-    return s.indexOf(false) === -1
-  })
-
-  this.debug(this.pattern, set)
-
-  this.set = set
-}
-
-Minimatch.prototype.parseNegate = parseNegate
-function parseNegate () {
-  var pattern = this.pattern
-  var negate = false
-  var options = this.options
-  var negateOffset = 0
-
-  if (options.nonegate) return
-
-  for (var i = 0, l = pattern.length
-    ; i < l && pattern.charAt(i) === '!'
-    ; i++) {
-    negate = !negate
-    negateOffset++
-  }
-
-  if (negateOffset) this.pattern = pattern.substr(negateOffset)
-  this.negate = negate
-}
-
-// Brace expansion:
-// a{b,c}d -> abd acd
-// a{b,}c -> abc ac
-// a{0..3}d -> a0d a1d a2d a3d
-// a{b,c{d,e}f}g -> abg acdfg acefg
-// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
-//
-// Invalid sets are not expanded.
-// a{2..}b -> a{2..}b
-// a{b}c -> a{b}c
-minimatch.braceExpand = function (pattern, options) {
-  return braceExpand(pattern, options)
-}
-
-Minimatch.prototype.braceExpand = braceExpand
-
-function braceExpand (pattern, options) {
-  if (!options) {
-    if (this instanceof Minimatch) {
-      options = this.options
-    } else {
-      options = {}
-    }
-  }
-
-  pattern = typeof pattern === 'undefined'
-    ? this.pattern : pattern
-
-  assertValidPattern(pattern)
-
-  // Thanks to Yeting Li  for
-  // improving this regexp to avoid a ReDOS vulnerability.
-  if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
-    // shortcut. no need to expand.
-    return [pattern]
-  }
-
-  return expand(pattern)
-}
-
-var MAX_PATTERN_LENGTH = 1024 * 64
-var assertValidPattern = function (pattern) {
-  if (typeof pattern !== 'string') {
-    throw new TypeError('invalid pattern')
-  }
-
-  if (pattern.length > MAX_PATTERN_LENGTH) {
-    throw new TypeError('pattern is too long')
-  }
-}
-
-// parse a component of the expanded set.
-// At this point, no pattern may contain "/" in it
-// so we're going to return a 2d array, where each entry is the full
-// pattern, split on '/', and then turned into a regular expression.
-// A regexp is made at the end which joins each array with an
-// escaped /, and another full one which joins each regexp with |.
-//
-// Following the lead of Bash 4.1, note that "**" only has special meaning
-// when it is the *only* thing in a path portion.  Otherwise, any series
-// of * is equivalent to a single *.  Globstar behavior is enabled by
-// default, and can be disabled by setting options.noglobstar.
-Minimatch.prototype.parse = parse
-var SUBPARSE = {}
-function parse (pattern, isSub) {
-  assertValidPattern(pattern)
-
-  var options = this.options
-
-  // shortcuts
-  if (pattern === '**') {
-    if (!options.noglobstar)
-      return GLOBSTAR
-    else
-      pattern = '*'
-  }
-  if (pattern === '') return ''
-
-  var re = ''
-  var hasMagic = !!options.nocase
-  var escaping = false
-  // ? => one single character
-  var patternListStack = []
-  var negativeLists = []
-  var stateChar
-  var inClass = false
-  var reClassStart = -1
-  var classStart = -1
-  // . and .. never match anything that doesn't start with .,
-  // even when options.dot is set.
-  var patternStart = pattern.charAt(0) === '.' ? '' // anything
-  // not (start or / followed by . or .. followed by / or end)
-  : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
-  : '(?!\\.)'
-  var self = this
-
-  function clearStateChar () {
-    if (stateChar) {
-      // we had some state-tracking character
-      // that wasn't consumed by this pass.
-      switch (stateChar) {
-        case '*':
-          re += star
-          hasMagic = true
-        break
-        case '?':
-          re += qmark
-          hasMagic = true
-        break
-        default:
-          re += '\\' + stateChar
-        break
-      }
-      self.debug('clearStateChar %j %j', stateChar, re)
-      stateChar = false
-    }
-  }
-
-  for (var i = 0, len = pattern.length, c
-    ; (i < len) && (c = pattern.charAt(i))
-    ; i++) {
-    this.debug('%s\t%s %s %j', pattern, i, re, c)
-
-    // skip over any that are escaped.
-    if (escaping && reSpecials[c]) {
-      re += '\\' + c
-      escaping = false
-      continue
-    }
-
-    switch (c) {
-      /* istanbul ignore next */
-      case '/': {
-        // completely not allowed, even escaped.
-        // Should already be path-split by now.
-        return false
-      }
-
-      case '\\':
-        clearStateChar()
-        escaping = true
-      continue
-
-      // the various stateChar values
-      // for the "extglob" stuff.
-      case '?':
-      case '*':
-      case '+':
-      case '@':
-      case '!':
-        this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
-
-        // all of those are literals inside a class, except that
-        // the glob [!a] means [^a] in regexp
-        if (inClass) {
-          this.debug('  in class')
-          if (c === '!' && i === classStart + 1) c = '^'
-          re += c
-          continue
-        }
-
-        // if we already have a stateChar, then it means
-        // that there was something like ** or +? in there.
-        // Handle the stateChar, then proceed with this one.
-        self.debug('call clearStateChar %j', stateChar)
-        clearStateChar()
-        stateChar = c
-        // if extglob is disabled, then +(asdf|foo) isn't a thing.
-        // just clear the statechar *now*, rather than even diving into
-        // the patternList stuff.
-        if (options.noext) clearStateChar()
-      continue
-
-      case '(':
-        if (inClass) {
-          re += '('
-          continue
-        }
-
-        if (!stateChar) {
-          re += '\\('
-          continue
-        }
-
-        patternListStack.push({
-          type: stateChar,
-          start: i - 1,
-          reStart: re.length,
-          open: plTypes[stateChar].open,
-          close: plTypes[stateChar].close
-        })
-        // negation is (?:(?!js)[^/]*)
-        re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
-        this.debug('plType %j %j', stateChar, re)
-        stateChar = false
-      continue
-
-      case ')':
-        if (inClass || !patternListStack.length) {
-          re += '\\)'
-          continue
-        }
-
-        clearStateChar()
-        hasMagic = true
-        var pl = patternListStack.pop()
-        // negation is (?:(?!js)[^/]*)
-        // The others are (?:)
-        re += pl.close
-        if (pl.type === '!') {
-          negativeLists.push(pl)
-        }
-        pl.reEnd = re.length
-      continue
-
-      case '|':
-        if (inClass || !patternListStack.length || escaping) {
-          re += '\\|'
-          escaping = false
-          continue
-        }
-
-        clearStateChar()
-        re += '|'
-      continue
-
-      // these are mostly the same in regexp and glob
-      case '[':
-        // swallow any state-tracking char before the [
-        clearStateChar()
-
-        if (inClass) {
-          re += '\\' + c
-          continue
-        }
-
-        inClass = true
-        classStart = i
-        reClassStart = re.length
-        re += c
-      continue
-
-      case ']':
-        //  a right bracket shall lose its special
-        //  meaning and represent itself in
-        //  a bracket expression if it occurs
-        //  first in the list.  -- POSIX.2 2.8.3.2
-        if (i === classStart + 1 || !inClass) {
-          re += '\\' + c
-          escaping = false
-          continue
-        }
-
-        // handle the case where we left a class open.
-        // "[z-a]" is valid, equivalent to "\[z-a\]"
-        // split where the last [ was, make sure we don't have
-        // an invalid re. if so, re-walk the contents of the
-        // would-be class to re-translate any characters that
-        // were passed through as-is
-        // TODO: It would probably be faster to determine this
-        // without a try/catch and a new RegExp, but it's tricky
-        // to do safely.  For now, this is safe and works.
-        var cs = pattern.substring(classStart + 1, i)
-        try {
-          RegExp('[' + cs + ']')
-        } catch (er) {
-          // not a valid class!
-          var sp = this.parse(cs, SUBPARSE)
-          re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
-          hasMagic = hasMagic || sp[1]
-          inClass = false
-          continue
-        }
-
-        // finish up the class.
-        hasMagic = true
-        inClass = false
-        re += c
-      continue
-
-      default:
-        // swallow any state char that wasn't consumed
-        clearStateChar()
-
-        if (escaping) {
-          // no need
-          escaping = false
-        } else if (reSpecials[c]
-          && !(c === '^' && inClass)) {
-          re += '\\'
-        }
-
-        re += c
-
-    } // switch
-  } // for
-
-  // handle the case where we left a class open.
-  // "[abc" is valid, equivalent to "\[abc"
-  if (inClass) {
-    // split where the last [ was, and escape it
-    // this is a huge pita.  We now have to re-walk
-    // the contents of the would-be class to re-translate
-    // any characters that were passed through as-is
-    cs = pattern.substr(classStart + 1)
-    sp = this.parse(cs, SUBPARSE)
-    re = re.substr(0, reClassStart) + '\\[' + sp[0]
-    hasMagic = hasMagic || sp[1]
-  }
-
-  // handle the case where we had a +( thing at the *end*
-  // of the pattern.
-  // each pattern list stack adds 3 chars, and we need to go through
-  // and escape any | chars that were passed through as-is for the regexp.
-  // Go through and escape them, taking care not to double-escape any
-  // | chars that were already escaped.
-  for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
-    var tail = re.slice(pl.reStart + pl.open.length)
-    this.debug('setting tail', re, pl)
-    // maybe some even number of \, then maybe 1 \, followed by a |
-    tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
-      if (!$2) {
-        // the | isn't already escaped, so escape it.
-        $2 = '\\'
-      }
-
-      // need to escape all those slashes *again*, without escaping the
-      // one that we need for escaping the | character.  As it works out,
-      // escaping an even number of slashes can be done by simply repeating
-      // it exactly after itself.  That's why this trick works.
-      //
-      // I am sorry that you have to see this.
-      return $1 + $1 + $2 + '|'
-    })
-
-    this.debug('tail=%j\n   %s', tail, tail, pl, re)
-    var t = pl.type === '*' ? star
-      : pl.type === '?' ? qmark
-      : '\\' + pl.type
-
-    hasMagic = true
-    re = re.slice(0, pl.reStart) + t + '\\(' + tail
-  }
-
-  // handle trailing things that only matter at the very end.
-  clearStateChar()
-  if (escaping) {
-    // trailing \\
-    re += '\\\\'
-  }
-
-  // only need to apply the nodot start if the re starts with
-  // something that could conceivably capture a dot
-  var addPatternStart = false
-  switch (re.charAt(0)) {
-    case '[': case '.': case '(': addPatternStart = true
-  }
-
-  // Hack to work around lack of negative lookbehind in JS
-  // A pattern like: *.!(x).!(y|z) needs to ensure that a name
-  // like 'a.xyz.yz' doesn't match.  So, the first negative
-  // lookahead, has to look ALL the way ahead, to the end of
-  // the pattern.
-  for (var n = negativeLists.length - 1; n > -1; n--) {
-    var nl = negativeLists[n]
-
-    var nlBefore = re.slice(0, nl.reStart)
-    var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
-    var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
-    var nlAfter = re.slice(nl.reEnd)
-
-    nlLast += nlAfter
-
-    // Handle nested stuff like *(*.js|!(*.json)), where open parens
-    // mean that we should *not* include the ) in the bit that is considered
-    // "after" the negated section.
-    var openParensBefore = nlBefore.split('(').length - 1
-    var cleanAfter = nlAfter
-    for (i = 0; i < openParensBefore; i++) {
-      cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
-    }
-    nlAfter = cleanAfter
-
-    var dollar = ''
-    if (nlAfter === '' && isSub !== SUBPARSE) {
-      dollar = '$'
-    }
-    var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
-    re = newRe
-  }
-
-  // if the re is not "" at this point, then we need to make sure
-  // it doesn't match against an empty path part.
-  // Otherwise a/* will match a/, which it should not.
-  if (re !== '' && hasMagic) {
-    re = '(?=.)' + re
-  }
-
-  if (addPatternStart) {
-    re = patternStart + re
-  }
-
-  // parsing just a piece of a larger pattern.
-  if (isSub === SUBPARSE) {
-    return [re, hasMagic]
-  }
-
-  // skip the regexp for non-magical patterns
-  // unescape anything in it, though, so that it'll be
-  // an exact match against a file etc.
-  if (!hasMagic) {
-    return globUnescape(pattern)
-  }
-
-  var flags = options.nocase ? 'i' : ''
-  try {
-    var regExp = new RegExp('^' + re + '$', flags)
-  } catch (er) /* istanbul ignore next - should be impossible */ {
-    // If it was an invalid regular expression, then it can't match
-    // anything.  This trick looks for a character after the end of
-    // the string, which is of course impossible, except in multi-line
-    // mode, but it's not a /m regex.
-    return new RegExp('$.')
-  }
-
-  regExp._glob = pattern
-  regExp._src = re
-
-  return regExp
-}
-
-minimatch.makeRe = function (pattern, options) {
-  return new Minimatch(pattern, options || {}).makeRe()
-}
-
-Minimatch.prototype.makeRe = makeRe
-function makeRe () {
-  if (this.regexp || this.regexp === false) return this.regexp
-
-  // at this point, this.set is a 2d array of partial
-  // pattern strings, or "**".
-  //
-  // It's better to use .match().  This function shouldn't
-  // be used, really, but it's pretty convenient sometimes,
-  // when you just want to work with a regex.
-  var set = this.set
-
-  if (!set.length) {
-    this.regexp = false
-    return this.regexp
-  }
-  var options = this.options
-
-  var twoStar = options.noglobstar ? star
-    : options.dot ? twoStarDot
-    : twoStarNoDot
-  var flags = options.nocase ? 'i' : ''
-
-  var re = set.map(function (pattern) {
-    return pattern.map(function (p) {
-      return (p === GLOBSTAR) ? twoStar
-      : (typeof p === 'string') ? regExpEscape(p)
-      : p._src
-    }).join('\\\/')
-  }).join('|')
-
-  // must match entire pattern
-  // ending in a * or ** will make it less strict.
-  re = '^(?:' + re + ')$'
-
-  // can match anything, as long as it's not this.
-  if (this.negate) re = '^(?!' + re + ').*$'
-
-  try {
-    this.regexp = new RegExp(re, flags)
-  } catch (ex) /* istanbul ignore next - should be impossible */ {
-    this.regexp = false
-  }
-  return this.regexp
-}
-
-minimatch.match = function (list, pattern, options) {
-  options = options || {}
-  var mm = new Minimatch(pattern, options)
-  list = list.filter(function (f) {
-    return mm.match(f)
-  })
-  if (mm.options.nonull && !list.length) {
-    list.push(pattern)
-  }
-  return list
-}
-
-Minimatch.prototype.match = function match (f, partial) {
-  if (typeof partial === 'undefined') partial = this.partial
-  this.debug('match', f, this.pattern)
-  // short-circuit in the case of busted things.
-  // comments, etc.
-  if (this.comment) return false
-  if (this.empty) return f === ''
-
-  if (f === '/' && partial) return true
-
-  var options = this.options
-
-  // windows: need to use /, not \
-  if (path.sep !== '/') {
-    f = f.split(path.sep).join('/')
-  }
-
-  // treat the test path as a set of pathparts.
-  f = f.split(slashSplit)
-  this.debug(this.pattern, 'split', f)
-
-  // just ONE of the pattern sets in this.set needs to match
-  // in order for it to be valid.  If negating, then just one
-  // match means that we have failed.
-  // Either way, return on the first hit.
-
-  var set = this.set
-  this.debug(this.pattern, 'set', set)
-
-  // Find the basename of the path by looking for the last non-empty segment
-  var filename
-  var i
-  for (i = f.length - 1; i >= 0; i--) {
-    filename = f[i]
-    if (filename) break
-  }
-
-  for (i = 0; i < set.length; i++) {
-    var pattern = set[i]
-    var file = f
-    if (options.matchBase && pattern.length === 1) {
-      file = [filename]
-    }
-    var hit = this.matchOne(file, pattern, partial)
-    if (hit) {
-      if (options.flipNegate) return true
-      return !this.negate
-    }
-  }
-
-  // didn't get any hits.  this is success if it's a negative
-  // pattern, failure otherwise.
-  if (options.flipNegate) return false
-  return this.negate
-}
-
-// set partial to true to test if, for example,
-// "/a/b" matches the start of "/*/b/*/d"
-// Partial means, if you run out of file before you run
-// out of pattern, then that's fine, as long as all
-// the parts match.
-Minimatch.prototype.matchOne = function (file, pattern, partial) {
-  var options = this.options
-
-  this.debug('matchOne',
-    { 'this': this, file: file, pattern: pattern })
-
-  this.debug('matchOne', file.length, pattern.length)
-
-  for (var fi = 0,
-      pi = 0,
-      fl = file.length,
-      pl = pattern.length
-      ; (fi < fl) && (pi < pl)
-      ; fi++, pi++) {
-    this.debug('matchOne loop')
-    var p = pattern[pi]
-    var f = file[fi]
-
-    this.debug(pattern, p, f)
-
-    // should be impossible.
-    // some invalid regexp stuff in the set.
-    /* istanbul ignore if */
-    if (p === false) return false
-
-    if (p === GLOBSTAR) {
-      this.debug('GLOBSTAR', [pattern, p, f])
-
-      // "**"
-      // a/**/b/**/c would match the following:
-      // a/b/x/y/z/c
-      // a/x/y/z/b/c
-      // a/b/x/b/x/c
-      // a/b/c
-      // To do this, take the rest of the pattern after
-      // the **, and see if it would match the file remainder.
-      // If so, return success.
-      // If not, the ** "swallows" a segment, and try again.
-      // This is recursively awful.
-      //
-      // a/**/b/**/c matching a/b/x/y/z/c
-      // - a matches a
-      // - doublestar
-      //   - matchOne(b/x/y/z/c, b/**/c)
-      //     - b matches b
-      //     - doublestar
-      //       - matchOne(x/y/z/c, c) -> no
-      //       - matchOne(y/z/c, c) -> no
-      //       - matchOne(z/c, c) -> no
-      //       - matchOne(c, c) yes, hit
-      var fr = fi
-      var pr = pi + 1
-      if (pr === pl) {
-        this.debug('** at the end')
-        // a ** at the end will just swallow the rest.
-        // We have found a match.
-        // however, it will not swallow /.x, unless
-        // options.dot is set.
-        // . and .. are *never* matched by **, for explosively
-        // exponential reasons.
-        for (; fi < fl; fi++) {
-          if (file[fi] === '.' || file[fi] === '..' ||
-            (!options.dot && file[fi].charAt(0) === '.')) return false
-        }
-        return true
-      }
-
-      // ok, let's see if we can swallow whatever we can.
-      while (fr < fl) {
-        var swallowee = file[fr]
-
-        this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
-
-        // XXX remove this slice.  Just pass the start index.
-        if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
-          this.debug('globstar found match!', fr, fl, swallowee)
-          // found a match.
-          return true
-        } else {
-          // can't swallow "." or ".." ever.
-          // can only swallow ".foo" when explicitly asked.
-          if (swallowee === '.' || swallowee === '..' ||
-            (!options.dot && swallowee.charAt(0) === '.')) {
-            this.debug('dot detected!', file, fr, pattern, pr)
-            break
-          }
-
-          // ** swallows a segment, and continue.
-          this.debug('globstar swallow a segment, and continue')
-          fr++
-        }
-      }
-
-      // no match was found.
-      // However, in partial mode, we can't say this is necessarily over.
-      // If there's more *pattern* left, then
-      /* istanbul ignore if */
-      if (partial) {
-        // ran out of file
-        this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
-        if (fr === fl) return true
-      }
-      return false
-    }
-
-    // something other than **
-    // non-magic patterns just have to match exactly
-    // patterns with magic have been turned into regexps.
-    var hit
-    if (typeof p === 'string') {
-      hit = f === p
-      this.debug('string match', p, f, hit)
-    } else {
-      hit = f.match(p)
-      this.debug('pattern match', p, f, hit)
-    }
-
-    if (!hit) return false
-  }
-
-  // Note: ending in / means that we'll get a final ""
-  // at the end of the pattern.  This can only match a
-  // corresponding "" at the end of the file.
-  // If the file ends in /, then it can only match a
-  // a pattern that ends in /, unless the pattern just
-  // doesn't have any more for it. But, a/b/ should *not*
-  // match "a/b/*", even though "" matches against the
-  // [^/]*? pattern, except in partial mode, where it might
-  // simply not be reached yet.
-  // However, a/b/ should still satisfy a/*
-
-  // now either we fell off the end of the pattern, or we're done.
-  if (fi === fl && pi === pl) {
-    // ran out of pattern and filename at the same time.
-    // an exact hit!
-    return true
-  } else if (fi === fl) {
-    // ran out of file, but still had pattern left.
-    // this is ok if we're doing the match as part of
-    // a glob fs traversal.
-    return partial
-  } else /* istanbul ignore else */ if (pi === pl) {
-    // ran out of pattern, still have file left.
-    // this is only acceptable if we're on the very last
-    // empty segment of a file with a trailing slash.
-    // a/* should match a/b/
-    return (fi === fl - 1) && (file[fi] === '')
-  }
-
-  // should be unreachable.
-  /* istanbul ignore next */
-  throw new Error('wtf?')
-}
-
-// replace stuff like \* with *
-function globUnescape (s) {
-  return s.replace(/\\(.)/g, '$1')
-}
-
-function regExpEscape (s) {
-  return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/minimatch/package.json b/node_modules/@npmcli/run-script/node_modules/minimatch/package.json
deleted file mode 100644
index 566efdfe45cb8..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minimatch/package.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
-  "author": "Isaac Z. Schlueter  (http://blog.izs.me)",
-  "name": "minimatch",
-  "description": "a glob matcher in javascript",
-  "version": "3.1.2",
-  "publishConfig": {
-    "tag": "v3-legacy"
-  },
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/minimatch.git"
-  },
-  "main": "minimatch.js",
-  "scripts": {
-    "test": "tap",
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "postpublish": "git push origin --all; git push origin --tags"
-  },
-  "engines": {
-    "node": "*"
-  },
-  "dependencies": {
-    "brace-expansion": "^1.1.7"
-  },
-  "devDependencies": {
-    "tap": "^15.1.6"
-  },
-  "license": "ISC",
-  "files": [
-    "minimatch.js"
-  ]
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/LICENSE b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/LICENSE
deleted file mode 100644
index 3c3410cdc12ee..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-Copyright (c) 2016 David Frank
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
----
-
-Note: This is a derivative work based on "node-fetch" by David Frank,
-modified and distributed under the terms of the MIT license above.
-https://github.com/bitinn/node-fetch
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/abort-error.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/abort-error.js
deleted file mode 100644
index b18f643269e37..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/abort-error.js
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict'
-class AbortError extends Error {
-  constructor (message) {
-    super(message)
-    this.code = 'FETCH_ABORTED'
-    this.type = 'aborted'
-    Error.captureStackTrace(this, this.constructor)
-  }
-
-  get name () {
-    return 'AbortError'
-  }
-
-  // don't allow name to be overridden, but don't throw either
-  set name (s) {}
-}
-module.exports = AbortError
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/blob.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/blob.js
deleted file mode 100644
index efe69a34458af..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/blob.js
+++ /dev/null
@@ -1,97 +0,0 @@
-'use strict'
-const Minipass = require('minipass')
-const TYPE = Symbol('type')
-const BUFFER = Symbol('buffer')
-
-class Blob {
-  constructor (blobParts, options) {
-    this[TYPE] = ''
-
-    const buffers = []
-    let size = 0
-
-    if (blobParts) {
-      const a = blobParts
-      const length = Number(a.length)
-      for (let i = 0; i < length; i++) {
-        const element = a[i]
-        const buffer = element instanceof Buffer ? element
-          : ArrayBuffer.isView(element)
-            ? Buffer.from(element.buffer, element.byteOffset, element.byteLength)
-            : element instanceof ArrayBuffer ? Buffer.from(element)
-            : element instanceof Blob ? element[BUFFER]
-            : typeof element === 'string' ? Buffer.from(element)
-            : Buffer.from(String(element))
-        size += buffer.length
-        buffers.push(buffer)
-      }
-    }
-
-    this[BUFFER] = Buffer.concat(buffers, size)
-
-    const type = options && options.type !== undefined
-      && String(options.type).toLowerCase()
-    if (type && !/[^\u0020-\u007E]/.test(type)) {
-      this[TYPE] = type
-    }
-  }
-
-  get size () {
-    return this[BUFFER].length
-  }
-
-  get type () {
-    return this[TYPE]
-  }
-
-  text () {
-    return Promise.resolve(this[BUFFER].toString())
-  }
-
-  arrayBuffer () {
-    const buf = this[BUFFER]
-    const off = buf.byteOffset
-    const len = buf.byteLength
-    const ab = buf.buffer.slice(off, off + len)
-    return Promise.resolve(ab)
-  }
-
-  stream () {
-    return new Minipass().end(this[BUFFER])
-  }
-
-  slice (start, end, type) {
-    const size = this.size
-    const relativeStart = start === undefined ? 0
-      : start < 0 ? Math.max(size + start, 0)
-      : Math.min(start, size)
-    const relativeEnd = end === undefined ? size
-      : end < 0 ? Math.max(size + end, 0)
-      : Math.min(end, size)
-    const span = Math.max(relativeEnd - relativeStart, 0)
-
-    const buffer = this[BUFFER]
-    const slicedBuffer = buffer.slice(
-      relativeStart,
-      relativeStart + span
-    )
-    const blob = new Blob([], { type })
-    blob[BUFFER] = slicedBuffer
-    return blob
-  }
-
-  get [Symbol.toStringTag] () {
-    return 'Blob'
-  }
-
-  static get BUFFER () {
-    return BUFFER
-  }
-}
-
-Object.defineProperties(Blob.prototype, {
-  size: { enumerable: true },
-  type: { enumerable: true },
-})
-
-module.exports = Blob
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/body.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/body.js
deleted file mode 100644
index 9d1b45de30ce9..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/body.js
+++ /dev/null
@@ -1,350 +0,0 @@
-'use strict'
-const Minipass = require('minipass')
-const MinipassSized = require('minipass-sized')
-
-const Blob = require('./blob.js')
-const { BUFFER } = Blob
-const FetchError = require('./fetch-error.js')
-
-// optional dependency on 'encoding'
-let convert
-try {
-  convert = require('encoding').convert
-} catch (e) {
-  // defer error until textConverted is called
-}
-
-const INTERNALS = Symbol('Body internals')
-const CONSUME_BODY = Symbol('consumeBody')
-
-class Body {
-  constructor (bodyArg, options = {}) {
-    const { size = 0, timeout = 0 } = options
-    const body = bodyArg === undefined || bodyArg === null ? null
-      : isURLSearchParams(bodyArg) ? Buffer.from(bodyArg.toString())
-      : isBlob(bodyArg) ? bodyArg
-      : Buffer.isBuffer(bodyArg) ? bodyArg
-      : Object.prototype.toString.call(bodyArg) === '[object ArrayBuffer]'
-        ? Buffer.from(bodyArg)
-        : ArrayBuffer.isView(bodyArg)
-          ? Buffer.from(bodyArg.buffer, bodyArg.byteOffset, bodyArg.byteLength)
-          : Minipass.isStream(bodyArg) ? bodyArg
-          : Buffer.from(String(bodyArg))
-
-    this[INTERNALS] = {
-      body,
-      disturbed: false,
-      error: null,
-    }
-
-    this.size = size
-    this.timeout = timeout
-
-    if (Minipass.isStream(body)) {
-      body.on('error', er => {
-        const error = er.name === 'AbortError' ? er
-          : new FetchError(`Invalid response while trying to fetch ${
-            this.url}: ${er.message}`, 'system', er)
-        this[INTERNALS].error = error
-      })
-    }
-  }
-
-  get body () {
-    return this[INTERNALS].body
-  }
-
-  get bodyUsed () {
-    return this[INTERNALS].disturbed
-  }
-
-  arrayBuffer () {
-    return this[CONSUME_BODY]().then(buf =>
-      buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength))
-  }
-
-  blob () {
-    const ct = this.headers && this.headers.get('content-type') || ''
-    return this[CONSUME_BODY]().then(buf => Object.assign(
-      new Blob([], { type: ct.toLowerCase() }),
-      { [BUFFER]: buf }
-    ))
-  }
-
-  async json () {
-    const buf = await this[CONSUME_BODY]()
-    try {
-      return JSON.parse(buf.toString())
-    } catch (er) {
-      throw new FetchError(
-        `invalid json response body at ${this.url} reason: ${er.message}`,
-        'invalid-json'
-      )
-    }
-  }
-
-  text () {
-    return this[CONSUME_BODY]().then(buf => buf.toString())
-  }
-
-  buffer () {
-    return this[CONSUME_BODY]()
-  }
-
-  textConverted () {
-    return this[CONSUME_BODY]().then(buf => convertBody(buf, this.headers))
-  }
-
-  [CONSUME_BODY] () {
-    if (this[INTERNALS].disturbed) {
-      return Promise.reject(new TypeError(`body used already for: ${
-        this.url}`))
-    }
-
-    this[INTERNALS].disturbed = true
-
-    if (this[INTERNALS].error) {
-      return Promise.reject(this[INTERNALS].error)
-    }
-
-    // body is null
-    if (this.body === null) {
-      return Promise.resolve(Buffer.alloc(0))
-    }
-
-    if (Buffer.isBuffer(this.body)) {
-      return Promise.resolve(this.body)
-    }
-
-    const upstream = isBlob(this.body) ? this.body.stream() : this.body
-
-    /* istanbul ignore if: should never happen */
-    if (!Minipass.isStream(upstream)) {
-      return Promise.resolve(Buffer.alloc(0))
-    }
-
-    const stream = this.size && upstream instanceof MinipassSized ? upstream
-      : !this.size && upstream instanceof Minipass &&
-        !(upstream instanceof MinipassSized) ? upstream
-      : this.size ? new MinipassSized({ size: this.size })
-      : new Minipass()
-
-    // allow timeout on slow response body, but only if the stream is still writable. this
-    // makes the timeout center on the socket stream from lib/index.js rather than the
-    // intermediary minipass stream we create to receive the data
-    const resTimeout = this.timeout && stream.writable ? setTimeout(() => {
-      stream.emit('error', new FetchError(
-        `Response timeout while trying to fetch ${
-          this.url} (over ${this.timeout}ms)`, 'body-timeout'))
-    }, this.timeout) : null
-
-    // do not keep the process open just for this timeout, even
-    // though we expect it'll get cleared eventually.
-    if (resTimeout && resTimeout.unref) {
-      resTimeout.unref()
-    }
-
-    // do the pipe in the promise, because the pipe() can send too much
-    // data through right away and upset the MP Sized object
-    return new Promise((resolve, reject) => {
-      // if the stream is some other kind of stream, then pipe through a MP
-      // so we can collect it more easily.
-      if (stream !== upstream) {
-        upstream.on('error', er => stream.emit('error', er))
-        upstream.pipe(stream)
-      }
-      resolve()
-    }).then(() => stream.concat()).then(buf => {
-      clearTimeout(resTimeout)
-      return buf
-    }).catch(er => {
-      clearTimeout(resTimeout)
-      // request was aborted, reject with this Error
-      if (er.name === 'AbortError' || er.name === 'FetchError') {
-        throw er
-      } else if (er.name === 'RangeError') {
-        throw new FetchError(`Could not create Buffer from response body for ${
-          this.url}: ${er.message}`, 'system', er)
-      } else {
-        // other errors, such as incorrect content-encoding or content-length
-        throw new FetchError(`Invalid response body while trying to fetch ${
-          this.url}: ${er.message}`, 'system', er)
-      }
-    })
-  }
-
-  static clone (instance) {
-    if (instance.bodyUsed) {
-      throw new Error('cannot clone body after it is used')
-    }
-
-    const body = instance.body
-
-    // check that body is a stream and not form-data object
-    // NB: can't clone the form-data object without having it as a dependency
-    if (Minipass.isStream(body) && typeof body.getBoundary !== 'function') {
-      // create a dedicated tee stream so that we don't lose data
-      // potentially sitting in the body stream's buffer by writing it
-      // immediately to p1 and not having it for p2.
-      const tee = new Minipass()
-      const p1 = new Minipass()
-      const p2 = new Minipass()
-      tee.on('error', er => {
-        p1.emit('error', er)
-        p2.emit('error', er)
-      })
-      body.on('error', er => tee.emit('error', er))
-      tee.pipe(p1)
-      tee.pipe(p2)
-      body.pipe(tee)
-      // set instance body to one fork, return the other
-      instance[INTERNALS].body = p1
-      return p2
-    } else {
-      return instance.body
-    }
-  }
-
-  static extractContentType (body) {
-    return body === null || body === undefined ? null
-      : typeof body === 'string' ? 'text/plain;charset=UTF-8'
-      : isURLSearchParams(body)
-        ? 'application/x-www-form-urlencoded;charset=UTF-8'
-        : isBlob(body) ? body.type || null
-        : Buffer.isBuffer(body) ? null
-        : Object.prototype.toString.call(body) === '[object ArrayBuffer]' ? null
-        : ArrayBuffer.isView(body) ? null
-        : typeof body.getBoundary === 'function'
-          ? `multipart/form-data;boundary=${body.getBoundary()}`
-          : Minipass.isStream(body) ? null
-          : 'text/plain;charset=UTF-8'
-  }
-
-  static getTotalBytes (instance) {
-    const { body } = instance
-    return (body === null || body === undefined) ? 0
-      : isBlob(body) ? body.size
-      : Buffer.isBuffer(body) ? body.length
-      : body && typeof body.getLengthSync === 'function' && (
-        // detect form data input from form-data module
-        body._lengthRetrievers &&
-        /* istanbul ignore next */ body._lengthRetrievers.length === 0 || // 1.x
-        body.hasKnownLength && body.hasKnownLength()) // 2.x
-        ? body.getLengthSync()
-        : null
-  }
-
-  static writeToStream (dest, instance) {
-    const { body } = instance
-
-    if (body === null || body === undefined) {
-      dest.end()
-    } else if (Buffer.isBuffer(body) || typeof body === 'string') {
-      dest.end(body)
-    } else {
-      // body is stream or blob
-      const stream = isBlob(body) ? body.stream() : body
-      stream.on('error', er => dest.emit('error', er)).pipe(dest)
-    }
-
-    return dest
-  }
-}
-
-Object.defineProperties(Body.prototype, {
-  body: { enumerable: true },
-  bodyUsed: { enumerable: true },
-  arrayBuffer: { enumerable: true },
-  blob: { enumerable: true },
-  json: { enumerable: true },
-  text: { enumerable: true },
-})
-
-const isURLSearchParams = obj =>
-  // Duck-typing as a necessary condition.
-  (typeof obj !== 'object' ||
-    typeof obj.append !== 'function' ||
-    typeof obj.delete !== 'function' ||
-    typeof obj.get !== 'function' ||
-    typeof obj.getAll !== 'function' ||
-    typeof obj.has !== 'function' ||
-    typeof obj.set !== 'function') ? false
-  // Brand-checking and more duck-typing as optional condition.
-  : obj.constructor.name === 'URLSearchParams' ||
-    Object.prototype.toString.call(obj) === '[object URLSearchParams]' ||
-    typeof obj.sort === 'function'
-
-const isBlob = obj =>
-  typeof obj === 'object' &&
-  typeof obj.arrayBuffer === 'function' &&
-  typeof obj.type === 'string' &&
-  typeof obj.stream === 'function' &&
-  typeof obj.constructor === 'function' &&
-  typeof obj.constructor.name === 'string' &&
-  /^(Blob|File)$/.test(obj.constructor.name) &&
-  /^(Blob|File)$/.test(obj[Symbol.toStringTag])
-
-const convertBody = (buffer, headers) => {
-  /* istanbul ignore if */
-  if (typeof convert !== 'function') {
-    throw new Error('The package `encoding` must be installed to use the textConverted() function')
-  }
-
-  const ct = headers && headers.get('content-type')
-  let charset = 'utf-8'
-  let res
-
-  // header
-  if (ct) {
-    res = /charset=([^;]*)/i.exec(ct)
-  }
-
-  // no charset in content type, peek at response body for at most 1024 bytes
-  const str = buffer.slice(0, 1024).toString()
-
-  // html5
-  if (!res && str) {
-    res = / this.expect
-      ? 'max-size' : type
-    this.message = message
-    Error.captureStackTrace(this, this.constructor)
-  }
-
-  get name () {
-    return 'FetchError'
-  }
-
-  // don't allow name to be overwritten
-  set name (n) {}
-
-  get [Symbol.toStringTag] () {
-    return 'FetchError'
-  }
-}
-module.exports = FetchError
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/headers.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/headers.js
deleted file mode 100644
index dd6e854d5ba39..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/headers.js
+++ /dev/null
@@ -1,267 +0,0 @@
-'use strict'
-const invalidTokenRegex = /[^^_`a-zA-Z\-0-9!#$%&'*+.|~]/
-const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/
-
-const validateName = name => {
-  name = `${name}`
-  if (invalidTokenRegex.test(name) || name === '') {
-    throw new TypeError(`${name} is not a legal HTTP header name`)
-  }
-}
-
-const validateValue = value => {
-  value = `${value}`
-  if (invalidHeaderCharRegex.test(value)) {
-    throw new TypeError(`${value} is not a legal HTTP header value`)
-  }
-}
-
-const find = (map, name) => {
-  name = name.toLowerCase()
-  for (const key in map) {
-    if (key.toLowerCase() === name) {
-      return key
-    }
-  }
-  return undefined
-}
-
-const MAP = Symbol('map')
-class Headers {
-  constructor (init = undefined) {
-    this[MAP] = Object.create(null)
-    if (init instanceof Headers) {
-      const rawHeaders = init.raw()
-      const headerNames = Object.keys(rawHeaders)
-      for (const headerName of headerNames) {
-        for (const value of rawHeaders[headerName]) {
-          this.append(headerName, value)
-        }
-      }
-      return
-    }
-
-    // no-op
-    if (init === undefined || init === null) {
-      return
-    }
-
-    if (typeof init === 'object') {
-      const method = init[Symbol.iterator]
-      if (method !== null && method !== undefined) {
-        if (typeof method !== 'function') {
-          throw new TypeError('Header pairs must be iterable')
-        }
-
-        // sequence>
-        // Note: per spec we have to first exhaust the lists then process them
-        const pairs = []
-        for (const pair of init) {
-          if (typeof pair !== 'object' ||
-              typeof pair[Symbol.iterator] !== 'function') {
-            throw new TypeError('Each header pair must be iterable')
-          }
-          const arrPair = Array.from(pair)
-          if (arrPair.length !== 2) {
-            throw new TypeError('Each header pair must be a name/value tuple')
-          }
-          pairs.push(arrPair)
-        }
-
-        for (const pair of pairs) {
-          this.append(pair[0], pair[1])
-        }
-      } else {
-        // record
-        for (const key of Object.keys(init)) {
-          this.append(key, init[key])
-        }
-      }
-    } else {
-      throw new TypeError('Provided initializer must be an object')
-    }
-  }
-
-  get (name) {
-    name = `${name}`
-    validateName(name)
-    const key = find(this[MAP], name)
-    if (key === undefined) {
-      return null
-    }
-
-    return this[MAP][key].join(', ')
-  }
-
-  forEach (callback, thisArg = undefined) {
-    let pairs = getHeaders(this)
-    for (let i = 0; i < pairs.length; i++) {
-      const [name, value] = pairs[i]
-      callback.call(thisArg, value, name, this)
-      // refresh in case the callback added more headers
-      pairs = getHeaders(this)
-    }
-  }
-
-  set (name, value) {
-    name = `${name}`
-    value = `${value}`
-    validateName(name)
-    validateValue(value)
-    const key = find(this[MAP], name)
-    this[MAP][key !== undefined ? key : name] = [value]
-  }
-
-  append (name, value) {
-    name = `${name}`
-    value = `${value}`
-    validateName(name)
-    validateValue(value)
-    const key = find(this[MAP], name)
-    if (key !== undefined) {
-      this[MAP][key].push(value)
-    } else {
-      this[MAP][name] = [value]
-    }
-  }
-
-  has (name) {
-    name = `${name}`
-    validateName(name)
-    return find(this[MAP], name) !== undefined
-  }
-
-  delete (name) {
-    name = `${name}`
-    validateName(name)
-    const key = find(this[MAP], name)
-    if (key !== undefined) {
-      delete this[MAP][key]
-    }
-  }
-
-  raw () {
-    return this[MAP]
-  }
-
-  keys () {
-    return new HeadersIterator(this, 'key')
-  }
-
-  values () {
-    return new HeadersIterator(this, 'value')
-  }
-
-  [Symbol.iterator] () {
-    return new HeadersIterator(this, 'key+value')
-  }
-
-  entries () {
-    return new HeadersIterator(this, 'key+value')
-  }
-
-  get [Symbol.toStringTag] () {
-    return 'Headers'
-  }
-
-  static exportNodeCompatibleHeaders (headers) {
-    const obj = Object.assign(Object.create(null), headers[MAP])
-
-    // http.request() only supports string as Host header. This hack makes
-    // specifying custom Host header possible.
-    const hostHeaderKey = find(headers[MAP], 'Host')
-    if (hostHeaderKey !== undefined) {
-      obj[hostHeaderKey] = obj[hostHeaderKey][0]
-    }
-
-    return obj
-  }
-
-  static createHeadersLenient (obj) {
-    const headers = new Headers()
-    for (const name of Object.keys(obj)) {
-      if (invalidTokenRegex.test(name)) {
-        continue
-      }
-
-      if (Array.isArray(obj[name])) {
-        for (const val of obj[name]) {
-          if (invalidHeaderCharRegex.test(val)) {
-            continue
-          }
-
-          if (headers[MAP][name] === undefined) {
-            headers[MAP][name] = [val]
-          } else {
-            headers[MAP][name].push(val)
-          }
-        }
-      } else if (!invalidHeaderCharRegex.test(obj[name])) {
-        headers[MAP][name] = [obj[name]]
-      }
-    }
-    return headers
-  }
-}
-
-Object.defineProperties(Headers.prototype, {
-  get: { enumerable: true },
-  forEach: { enumerable: true },
-  set: { enumerable: true },
-  append: { enumerable: true },
-  has: { enumerable: true },
-  delete: { enumerable: true },
-  keys: { enumerable: true },
-  values: { enumerable: true },
-  entries: { enumerable: true },
-})
-
-const getHeaders = (headers, kind = 'key+value') =>
-  Object.keys(headers[MAP]).sort().map(
-    kind === 'key' ? k => k.toLowerCase()
-    : kind === 'value' ? k => headers[MAP][k].join(', ')
-    : k => [k.toLowerCase(), headers[MAP][k].join(', ')]
-  )
-
-const INTERNAL = Symbol('internal')
-
-class HeadersIterator {
-  constructor (target, kind) {
-    this[INTERNAL] = {
-      target,
-      kind,
-      index: 0,
-    }
-  }
-
-  get [Symbol.toStringTag] () {
-    return 'HeadersIterator'
-  }
-
-  next () {
-    /* istanbul ignore if: should be impossible */
-    if (!this || Object.getPrototypeOf(this) !== HeadersIterator.prototype) {
-      throw new TypeError('Value of `this` is not a HeadersIterator')
-    }
-
-    const { target, kind, index } = this[INTERNAL]
-    const values = getHeaders(target, kind)
-    const len = values.length
-    if (index >= len) {
-      return {
-        value: undefined,
-        done: true,
-      }
-    }
-
-    this[INTERNAL].index++
-
-    return { value: values[index], done: false }
-  }
-}
-
-// manually extend because 'extends' requires a ctor
-Object.setPrototypeOf(HeadersIterator.prototype,
-  Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())))
-
-module.exports = Headers
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/index.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/index.js
deleted file mode 100644
index b1878ac0c06b5..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/index.js
+++ /dev/null
@@ -1,365 +0,0 @@
-'use strict'
-const { URL } = require('url')
-const http = require('http')
-const https = require('https')
-const zlib = require('minizlib')
-const Minipass = require('minipass')
-
-const Body = require('./body.js')
-const { writeToStream, getTotalBytes } = Body
-const Response = require('./response.js')
-const Headers = require('./headers.js')
-const { createHeadersLenient } = Headers
-const Request = require('./request.js')
-const { getNodeRequestOptions } = Request
-const FetchError = require('./fetch-error.js')
-const AbortError = require('./abort-error.js')
-
-// XXX this should really be split up and unit-ized for easier testing
-// and better DRY implementation of data/http request aborting
-const fetch = async (url, opts) => {
-  if (/^data:/.test(url)) {
-    const request = new Request(url, opts)
-    // delay 1 promise tick so that the consumer can abort right away
-    return Promise.resolve().then(() => new Promise((resolve, reject) => {
-      let type, data
-      try {
-        const { pathname, search } = new URL(url)
-        const split = pathname.split(',')
-        if (split.length < 2) {
-          throw new Error('invalid data: URI')
-        }
-        const mime = split.shift()
-        const base64 = /;base64$/.test(mime)
-        type = base64 ? mime.slice(0, -1 * ';base64'.length) : mime
-        const rawData = decodeURIComponent(split.join(',') + search)
-        data = base64 ? Buffer.from(rawData, 'base64') : Buffer.from(rawData)
-      } catch (er) {
-        return reject(new FetchError(`[${request.method}] ${
-          request.url} invalid URL, ${er.message}`, 'system', er))
-      }
-
-      const { signal } = request
-      if (signal && signal.aborted) {
-        return reject(new AbortError('The user aborted a request.'))
-      }
-
-      const headers = { 'Content-Length': data.length }
-      if (type) {
-        headers['Content-Type'] = type
-      }
-      return resolve(new Response(data, { headers }))
-    }))
-  }
-
-  return new Promise((resolve, reject) => {
-    // build request object
-    const request = new Request(url, opts)
-    let options
-    try {
-      options = getNodeRequestOptions(request)
-    } catch (er) {
-      return reject(er)
-    }
-
-    const send = (options.protocol === 'https:' ? https : http).request
-    const { signal } = request
-    let response = null
-    const abort = () => {
-      const error = new AbortError('The user aborted a request.')
-      reject(error)
-      if (Minipass.isStream(request.body) &&
-          typeof request.body.destroy === 'function') {
-        request.body.destroy(error)
-      }
-      if (response && response.body) {
-        response.body.emit('error', error)
-      }
-    }
-
-    if (signal && signal.aborted) {
-      return abort()
-    }
-
-    const abortAndFinalize = () => {
-      abort()
-      finalize()
-    }
-
-    const finalize = () => {
-      req.abort()
-      if (signal) {
-        signal.removeEventListener('abort', abortAndFinalize)
-      }
-      clearTimeout(reqTimeout)
-    }
-
-    // send request
-    const req = send(options)
-
-    if (signal) {
-      signal.addEventListener('abort', abortAndFinalize)
-    }
-
-    let reqTimeout = null
-    if (request.timeout) {
-      req.once('socket', socket => {
-        reqTimeout = setTimeout(() => {
-          reject(new FetchError(`network timeout at: ${
-            request.url}`, 'request-timeout'))
-          finalize()
-        }, request.timeout)
-      })
-    }
-
-    req.on('error', er => {
-      // if a 'response' event is emitted before the 'error' event, then by the
-      // time this handler is run it's too late to reject the Promise for the
-      // response. instead, we forward the error event to the response stream
-      // so that the error will surface to the user when they try to consume
-      // the body. this is done as a side effect of aborting the request except
-      // for in windows, where we must forward the event manually, otherwise
-      // there is no longer a ref'd socket attached to the request and the
-      // stream never ends so the event loop runs out of work and the process
-      // exits without warning.
-      // coverage skipped here due to the difficulty in testing
-      // istanbul ignore next
-      if (req.res) {
-        req.res.emit('error', er)
-      }
-      reject(new FetchError(`request to ${request.url} failed, reason: ${
-        er.message}`, 'system', er))
-      finalize()
-    })
-
-    req.on('response', res => {
-      clearTimeout(reqTimeout)
-
-      const headers = createHeadersLenient(res.headers)
-
-      // HTTP fetch step 5
-      if (fetch.isRedirect(res.statusCode)) {
-        // HTTP fetch step 5.2
-        const location = headers.get('Location')
-
-        // HTTP fetch step 5.3
-        const locationURL = location === null ? null
-          : (new URL(location, request.url)).toString()
-
-        // HTTP fetch step 5.5
-        if (request.redirect === 'error') {
-          reject(new FetchError('uri requested responds with a redirect, ' +
-            `redirect mode is set to error: ${request.url}`, 'no-redirect'))
-          finalize()
-          return
-        } else if (request.redirect === 'manual') {
-          // node-fetch-specific step: make manual redirect a bit easier to
-          // use by setting the Location header value to the resolved URL.
-          if (locationURL !== null) {
-            // handle corrupted header
-            try {
-              headers.set('Location', locationURL)
-            } catch (err) {
-              /* istanbul ignore next: nodejs server prevent invalid
-                 response headers, we can't test this through normal
-                 request */
-              reject(err)
-            }
-          }
-        } else if (request.redirect === 'follow' && locationURL !== null) {
-          // HTTP-redirect fetch step 5
-          if (request.counter >= request.follow) {
-            reject(new FetchError(`maximum redirect reached at: ${
-              request.url}`, 'max-redirect'))
-            finalize()
-            return
-          }
-
-          // HTTP-redirect fetch step 9
-          if (res.statusCode !== 303 &&
-              request.body &&
-              getTotalBytes(request) === null) {
-            reject(new FetchError(
-              'Cannot follow redirect with body being a readable stream',
-              'unsupported-redirect'
-            ))
-            finalize()
-            return
-          }
-
-          // Update host due to redirection
-          request.headers.set('host', (new URL(locationURL)).host)
-
-          // HTTP-redirect fetch step 6 (counter increment)
-          // Create a new Request object.
-          const requestOpts = {
-            headers: new Headers(request.headers),
-            follow: request.follow,
-            counter: request.counter + 1,
-            agent: request.agent,
-            compress: request.compress,
-            method: request.method,
-            body: request.body,
-            signal: request.signal,
-            timeout: request.timeout,
-          }
-
-          // if the redirect is to a new hostname, strip the authorization and cookie headers
-          const parsedOriginal = new URL(request.url)
-          const parsedRedirect = new URL(locationURL)
-          if (parsedOriginal.hostname !== parsedRedirect.hostname) {
-            requestOpts.headers.delete('authorization')
-            requestOpts.headers.delete('cookie')
-          }
-
-          // HTTP-redirect fetch step 11
-          if (res.statusCode === 303 || (
-            (res.statusCode === 301 || res.statusCode === 302) &&
-              request.method === 'POST'
-          )) {
-            requestOpts.method = 'GET'
-            requestOpts.body = undefined
-            requestOpts.headers.delete('content-length')
-          }
-
-          // HTTP-redirect fetch step 15
-          resolve(fetch(new Request(locationURL, requestOpts)))
-          finalize()
-          return
-        }
-      } // end if(isRedirect)
-
-      // prepare response
-      res.once('end', () =>
-        signal && signal.removeEventListener('abort', abortAndFinalize))
-
-      const body = new Minipass()
-      // if an error occurs, either on the response stream itself, on one of the
-      // decoder streams, or a response length timeout from the Body class, we
-      // forward the error through to our internal body stream. If we see an
-      // error event on that, we call finalize to abort the request and ensure
-      // we don't leave a socket believing a request is in flight.
-      // this is difficult to test, so lacks specific coverage.
-      body.on('error', finalize)
-      // exceedingly rare that the stream would have an error,
-      // but just in case we proxy it to the stream in use.
-      res.on('error', /* istanbul ignore next */ er => body.emit('error', er))
-      res.on('data', (chunk) => body.write(chunk))
-      res.on('end', () => body.end())
-
-      const responseOptions = {
-        url: request.url,
-        status: res.statusCode,
-        statusText: res.statusMessage,
-        headers: headers,
-        size: request.size,
-        timeout: request.timeout,
-        counter: request.counter,
-        trailer: new Promise(resolveTrailer =>
-          res.on('end', () => resolveTrailer(createHeadersLenient(res.trailers)))),
-      }
-
-      // HTTP-network fetch step 12.1.1.3
-      const codings = headers.get('Content-Encoding')
-
-      // HTTP-network fetch step 12.1.1.4: handle content codings
-
-      // in following scenarios we ignore compression support
-      // 1. compression support is disabled
-      // 2. HEAD request
-      // 3. no Content-Encoding header
-      // 4. no content response (204)
-      // 5. content not modified response (304)
-      if (!request.compress ||
-          request.method === 'HEAD' ||
-          codings === null ||
-          res.statusCode === 204 ||
-          res.statusCode === 304) {
-        response = new Response(body, responseOptions)
-        resolve(response)
-        return
-      }
-
-      // Be less strict when decoding compressed responses, since sometimes
-      // servers send slightly invalid responses that are still accepted
-      // by common browsers.
-      // Always using Z_SYNC_FLUSH is what cURL does.
-      const zlibOptions = {
-        flush: zlib.constants.Z_SYNC_FLUSH,
-        finishFlush: zlib.constants.Z_SYNC_FLUSH,
-      }
-
-      // for gzip
-      if (codings === 'gzip' || codings === 'x-gzip') {
-        const unzip = new zlib.Gunzip(zlibOptions)
-        response = new Response(
-          // exceedingly rare that the stream would have an error,
-          // but just in case we proxy it to the stream in use.
-          body.on('error', /* istanbul ignore next */ er => unzip.emit('error', er)).pipe(unzip),
-          responseOptions
-        )
-        resolve(response)
-        return
-      }
-
-      // for deflate
-      if (codings === 'deflate' || codings === 'x-deflate') {
-        // handle the infamous raw deflate response from old servers
-        // a hack for old IIS and Apache servers
-        const raw = res.pipe(new Minipass())
-        raw.once('data', chunk => {
-          // see http://stackoverflow.com/questions/37519828
-          const decoder = (chunk[0] & 0x0F) === 0x08
-            ? new zlib.Inflate()
-            : new zlib.InflateRaw()
-          // exceedingly rare that the stream would have an error,
-          // but just in case we proxy it to the stream in use.
-          body.on('error', /* istanbul ignore next */ er => decoder.emit('error', er)).pipe(decoder)
-          response = new Response(decoder, responseOptions)
-          resolve(response)
-        })
-        return
-      }
-
-      // for br
-      if (codings === 'br') {
-        // ignoring coverage so tests don't have to fake support (or lack of) for brotli
-        // istanbul ignore next
-        try {
-          var decoder = new zlib.BrotliDecompress()
-        } catch (err) {
-          reject(err)
-          finalize()
-          return
-        }
-        // exceedingly rare that the stream would have an error,
-        // but just in case we proxy it to the stream in use.
-        body.on('error', /* istanbul ignore next */ er => decoder.emit('error', er)).pipe(decoder)
-        response = new Response(decoder, responseOptions)
-        resolve(response)
-        return
-      }
-
-      // otherwise, use response as-is
-      response = new Response(body, responseOptions)
-      resolve(response)
-    })
-
-    writeToStream(req, request)
-  })
-}
-
-module.exports = fetch
-
-fetch.isRedirect = code =>
-  code === 301 ||
-  code === 302 ||
-  code === 303 ||
-  code === 307 ||
-  code === 308
-
-fetch.Headers = Headers
-fetch.Request = Request
-fetch.Response = Response
-fetch.FetchError = FetchError
-fetch.AbortError = AbortError
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/request.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/request.js
deleted file mode 100644
index e620df6de2c01..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/request.js
+++ /dev/null
@@ -1,281 +0,0 @@
-'use strict'
-const { URL } = require('url')
-const Minipass = require('minipass')
-const Headers = require('./headers.js')
-const { exportNodeCompatibleHeaders } = Headers
-const Body = require('./body.js')
-const { clone, extractContentType, getTotalBytes } = Body
-
-const version = require('../package.json').version
-const defaultUserAgent =
-  `minipass-fetch/${version} (+https://github.com/isaacs/minipass-fetch)`
-
-const INTERNALS = Symbol('Request internals')
-
-const isRequest = input =>
-  typeof input === 'object' && typeof input[INTERNALS] === 'object'
-
-const isAbortSignal = signal => {
-  const proto = (
-    signal
-    && typeof signal === 'object'
-    && Object.getPrototypeOf(signal)
-  )
-  return !!(proto && proto.constructor.name === 'AbortSignal')
-}
-
-class Request extends Body {
-  constructor (input, init = {}) {
-    const parsedURL = isRequest(input) ? new URL(input.url)
-      : input && input.href ? new URL(input.href)
-      : new URL(`${input}`)
-
-    if (isRequest(input)) {
-      init = { ...input[INTERNALS], ...init }
-    } else if (!input || typeof input === 'string') {
-      input = {}
-    }
-
-    const method = (init.method || input.method || 'GET').toUpperCase()
-    const isGETHEAD = method === 'GET' || method === 'HEAD'
-
-    if ((init.body !== null && init.body !== undefined ||
-        isRequest(input) && input.body !== null) && isGETHEAD) {
-      throw new TypeError('Request with GET/HEAD method cannot have body')
-    }
-
-    const inputBody = init.body !== null && init.body !== undefined ? init.body
-      : isRequest(input) && input.body !== null ? clone(input)
-      : null
-
-    super(inputBody, {
-      timeout: init.timeout || input.timeout || 0,
-      size: init.size || input.size || 0,
-    })
-
-    const headers = new Headers(init.headers || input.headers || {})
-
-    if (inputBody !== null && inputBody !== undefined &&
-        !headers.has('Content-Type')) {
-      const contentType = extractContentType(inputBody)
-      if (contentType) {
-        headers.append('Content-Type', contentType)
-      }
-    }
-
-    const signal = 'signal' in init ? init.signal
-      : null
-
-    if (signal !== null && signal !== undefined && !isAbortSignal(signal)) {
-      throw new TypeError('Expected signal must be an instanceof AbortSignal')
-    }
-
-    // TLS specific options that are handled by node
-    const {
-      ca,
-      cert,
-      ciphers,
-      clientCertEngine,
-      crl,
-      dhparam,
-      ecdhCurve,
-      family,
-      honorCipherOrder,
-      key,
-      passphrase,
-      pfx,
-      rejectUnauthorized = process.env.NODE_TLS_REJECT_UNAUTHORIZED !== '0',
-      secureOptions,
-      secureProtocol,
-      servername,
-      sessionIdContext,
-    } = init
-
-    this[INTERNALS] = {
-      method,
-      redirect: init.redirect || input.redirect || 'follow',
-      headers,
-      parsedURL,
-      signal,
-      ca,
-      cert,
-      ciphers,
-      clientCertEngine,
-      crl,
-      dhparam,
-      ecdhCurve,
-      family,
-      honorCipherOrder,
-      key,
-      passphrase,
-      pfx,
-      rejectUnauthorized,
-      secureOptions,
-      secureProtocol,
-      servername,
-      sessionIdContext,
-    }
-
-    // node-fetch-only options
-    this.follow = init.follow !== undefined ? init.follow
-      : input.follow !== undefined ? input.follow
-      : 20
-    this.compress = init.compress !== undefined ? init.compress
-      : input.compress !== undefined ? input.compress
-      : true
-    this.counter = init.counter || input.counter || 0
-    this.agent = init.agent || input.agent
-  }
-
-  get method () {
-    return this[INTERNALS].method
-  }
-
-  get url () {
-    return this[INTERNALS].parsedURL.toString()
-  }
-
-  get headers () {
-    return this[INTERNALS].headers
-  }
-
-  get redirect () {
-    return this[INTERNALS].redirect
-  }
-
-  get signal () {
-    return this[INTERNALS].signal
-  }
-
-  clone () {
-    return new Request(this)
-  }
-
-  get [Symbol.toStringTag] () {
-    return 'Request'
-  }
-
-  static getNodeRequestOptions (request) {
-    const parsedURL = request[INTERNALS].parsedURL
-    const headers = new Headers(request[INTERNALS].headers)
-
-    // fetch step 1.3
-    if (!headers.has('Accept')) {
-      headers.set('Accept', '*/*')
-    }
-
-    // Basic fetch
-    if (!/^https?:$/.test(parsedURL.protocol)) {
-      throw new TypeError('Only HTTP(S) protocols are supported')
-    }
-
-    if (request.signal &&
-        Minipass.isStream(request.body) &&
-        typeof request.body.destroy !== 'function') {
-      throw new Error(
-        'Cancellation of streamed requests with AbortSignal is not supported')
-    }
-
-    // HTTP-network-or-cache fetch steps 2.4-2.7
-    const contentLengthValue =
-      (request.body === null || request.body === undefined) &&
-        /^(POST|PUT)$/i.test(request.method) ? '0'
-      : request.body !== null && request.body !== undefined
-        ? getTotalBytes(request)
-        : null
-
-    if (contentLengthValue) {
-      headers.set('Content-Length', contentLengthValue + '')
-    }
-
-    // HTTP-network-or-cache fetch step 2.11
-    if (!headers.has('User-Agent')) {
-      headers.set('User-Agent', defaultUserAgent)
-    }
-
-    // HTTP-network-or-cache fetch step 2.15
-    if (request.compress && !headers.has('Accept-Encoding')) {
-      headers.set('Accept-Encoding', 'gzip,deflate')
-    }
-
-    const agent = typeof request.agent === 'function'
-      ? request.agent(parsedURL)
-      : request.agent
-
-    if (!headers.has('Connection') && !agent) {
-      headers.set('Connection', 'close')
-    }
-
-    // TLS specific options that are handled by node
-    const {
-      ca,
-      cert,
-      ciphers,
-      clientCertEngine,
-      crl,
-      dhparam,
-      ecdhCurve,
-      family,
-      honorCipherOrder,
-      key,
-      passphrase,
-      pfx,
-      rejectUnauthorized,
-      secureOptions,
-      secureProtocol,
-      servername,
-      sessionIdContext,
-    } = request[INTERNALS]
-
-    // HTTP-network fetch step 4.2
-    // chunked encoding is handled by Node.js
-
-    // we cannot spread parsedURL directly, so we have to read each property one-by-one
-    // and map them to the equivalent https?.request() method options
-    const urlProps = {
-      auth: parsedURL.username || parsedURL.password
-        ? `${parsedURL.username}:${parsedURL.password}`
-        : '',
-      host: parsedURL.host,
-      hostname: parsedURL.hostname,
-      path: `${parsedURL.pathname}${parsedURL.search}`,
-      port: parsedURL.port,
-      protocol: parsedURL.protocol,
-    }
-
-    return {
-      ...urlProps,
-      method: request.method,
-      headers: exportNodeCompatibleHeaders(headers),
-      agent,
-      ca,
-      cert,
-      ciphers,
-      clientCertEngine,
-      crl,
-      dhparam,
-      ecdhCurve,
-      family,
-      honorCipherOrder,
-      key,
-      passphrase,
-      pfx,
-      rejectUnauthorized,
-      secureOptions,
-      secureProtocol,
-      servername,
-      sessionIdContext,
-    }
-  }
-}
-
-module.exports = Request
-
-Object.defineProperties(Request.prototype, {
-  method: { enumerable: true },
-  url: { enumerable: true },
-  headers: { enumerable: true },
-  redirect: { enumerable: true },
-  clone: { enumerable: true },
-  signal: { enumerable: true },
-})
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/response.js b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/response.js
deleted file mode 100644
index 54cb52db3594a..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/lib/response.js
+++ /dev/null
@@ -1,90 +0,0 @@
-'use strict'
-const http = require('http')
-const { STATUS_CODES } = http
-
-const Headers = require('./headers.js')
-const Body = require('./body.js')
-const { clone, extractContentType } = Body
-
-const INTERNALS = Symbol('Response internals')
-
-class Response extends Body {
-  constructor (body = null, opts = {}) {
-    super(body, opts)
-
-    const status = opts.status || 200
-    const headers = new Headers(opts.headers)
-
-    if (body !== null && body !== undefined && !headers.has('Content-Type')) {
-      const contentType = extractContentType(body)
-      if (contentType) {
-        headers.append('Content-Type', contentType)
-      }
-    }
-
-    this[INTERNALS] = {
-      url: opts.url,
-      status,
-      statusText: opts.statusText || STATUS_CODES[status],
-      headers,
-      counter: opts.counter,
-      trailer: Promise.resolve(opts.trailer || new Headers()),
-    }
-  }
-
-  get trailer () {
-    return this[INTERNALS].trailer
-  }
-
-  get url () {
-    return this[INTERNALS].url || ''
-  }
-
-  get status () {
-    return this[INTERNALS].status
-  }
-
-  get ok () {
-    return this[INTERNALS].status >= 200 && this[INTERNALS].status < 300
-  }
-
-  get redirected () {
-    return this[INTERNALS].counter > 0
-  }
-
-  get statusText () {
-    return this[INTERNALS].statusText
-  }
-
-  get headers () {
-    return this[INTERNALS].headers
-  }
-
-  clone () {
-    return new Response(clone(this), {
-      url: this.url,
-      status: this.status,
-      statusText: this.statusText,
-      headers: this.headers,
-      ok: this.ok,
-      redirected: this.redirected,
-      trailer: this.trailer,
-    })
-  }
-
-  get [Symbol.toStringTag] () {
-    return 'Response'
-  }
-}
-
-module.exports = Response
-
-Object.defineProperties(Response.prototype, {
-  url: { enumerable: true },
-  status: { enumerable: true },
-  ok: { enumerable: true },
-  redirected: { enumerable: true },
-  statusText: { enumerable: true },
-  headers: { enumerable: true },
-  clone: { enumerable: true },
-})
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/package.json b/node_modules/@npmcli/run-script/node_modules/minipass-fetch/package.json
deleted file mode 100644
index ada5aed6d7cf6..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass-fetch/package.json
+++ /dev/null
@@ -1,67 +0,0 @@
-{
-  "name": "minipass-fetch",
-  "version": "2.1.2",
-  "description": "An implementation of window.fetch in Node.js using Minipass streams",
-  "license": "MIT",
-  "main": "lib/index.js",
-  "scripts": {
-    "test": "tap",
-    "snap": "tap",
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "postpublish": "git push origin --follow-tags",
-    "lint": "eslint \"**/*.js\"",
-    "postlint": "template-oss-check",
-    "lintfix": "npm run lint -- --fix",
-    "prepublishOnly": "git push origin --follow-tags",
-    "posttest": "npm run lint",
-    "template-oss-apply": "template-oss-apply --force"
-  },
-  "tap": {
-    "coverage-map": "map.js",
-    "check-coverage": true
-  },
-  "devDependencies": {
-    "@npmcli/eslint-config": "^3.0.1",
-    "@npmcli/template-oss": "3.5.0",
-    "@ungap/url-search-params": "^0.2.2",
-    "abort-controller": "^3.0.0",
-    "abortcontroller-polyfill": "~1.7.3",
-    "encoding": "^0.1.13",
-    "form-data": "^4.0.0",
-    "nock": "^13.2.4",
-    "parted": "^0.1.1",
-    "string-to-arraybuffer": "^1.0.2",
-    "tap": "^16.0.0"
-  },
-  "dependencies": {
-    "minipass": "^3.1.6",
-    "minipass-sized": "^1.0.3",
-    "minizlib": "^2.1.2"
-  },
-  "optionalDependencies": {
-    "encoding": "^0.1.13"
-  },
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/npm/minipass-fetch.git"
-  },
-  "keywords": [
-    "fetch",
-    "minipass",
-    "node-fetch",
-    "window.fetch"
-  ],
-  "files": [
-    "bin/",
-    "lib/"
-  ],
-  "engines": {
-    "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
-  },
-  "author": "GitHub Inc.",
-  "templateOSS": {
-    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
-    "version": "3.5.0"
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass/LICENSE b/node_modules/@npmcli/run-script/node_modules/minipass/LICENSE
deleted file mode 100644
index bf1dece2e1f12..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) 2017-2022 npm, Inc., Isaac Z. Schlueter, and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass/index.js b/node_modules/@npmcli/run-script/node_modules/minipass/index.js
deleted file mode 100644
index e8797aab6cc27..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass/index.js
+++ /dev/null
@@ -1,649 +0,0 @@
-'use strict'
-const proc = typeof process === 'object' && process ? process : {
-  stdout: null,
-  stderr: null,
-}
-const EE = require('events')
-const Stream = require('stream')
-const SD = require('string_decoder').StringDecoder
-
-const EOF = Symbol('EOF')
-const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
-const EMITTED_END = Symbol('emittedEnd')
-const EMITTING_END = Symbol('emittingEnd')
-const EMITTED_ERROR = Symbol('emittedError')
-const CLOSED = Symbol('closed')
-const READ = Symbol('read')
-const FLUSH = Symbol('flush')
-const FLUSHCHUNK = Symbol('flushChunk')
-const ENCODING = Symbol('encoding')
-const DECODER = Symbol('decoder')
-const FLOWING = Symbol('flowing')
-const PAUSED = Symbol('paused')
-const RESUME = Symbol('resume')
-const BUFFERLENGTH = Symbol('bufferLength')
-const BUFFERPUSH = Symbol('bufferPush')
-const BUFFERSHIFT = Symbol('bufferShift')
-const OBJECTMODE = Symbol('objectMode')
-const DESTROYED = Symbol('destroyed')
-const EMITDATA = Symbol('emitData')
-const EMITEND = Symbol('emitEnd')
-const EMITEND2 = Symbol('emitEnd2')
-const ASYNC = Symbol('async')
-
-const defer = fn => Promise.resolve().then(fn)
-
-// TODO remove when Node v8 support drops
-const doIter = global._MP_NO_ITERATOR_SYMBOLS_  !== '1'
-const ASYNCITERATOR = doIter && Symbol.asyncIterator
-  || Symbol('asyncIterator not implemented')
-const ITERATOR = doIter && Symbol.iterator
-  || Symbol('iterator not implemented')
-
-// events that mean 'the stream is over'
-// these are treated specially, and re-emitted
-// if they are listened for after emitting.
-const isEndish = ev =>
-  ev === 'end' ||
-  ev === 'finish' ||
-  ev === 'prefinish'
-
-const isArrayBuffer = b => b instanceof ArrayBuffer ||
-  typeof b === 'object' &&
-  b.constructor &&
-  b.constructor.name === 'ArrayBuffer' &&
-  b.byteLength >= 0
-
-const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b)
-
-class Pipe {
-  constructor (src, dest, opts) {
-    this.src = src
-    this.dest = dest
-    this.opts = opts
-    this.ondrain = () => src[RESUME]()
-    dest.on('drain', this.ondrain)
-  }
-  unpipe () {
-    this.dest.removeListener('drain', this.ondrain)
-  }
-  // istanbul ignore next - only here for the prototype
-  proxyErrors () {}
-  end () {
-    this.unpipe()
-    if (this.opts.end)
-      this.dest.end()
-  }
-}
-
-class PipeProxyErrors extends Pipe {
-  unpipe () {
-    this.src.removeListener('error', this.proxyErrors)
-    super.unpipe()
-  }
-  constructor (src, dest, opts) {
-    super(src, dest, opts)
-    this.proxyErrors = er => dest.emit('error', er)
-    src.on('error', this.proxyErrors)
-  }
-}
-
-module.exports = class Minipass extends Stream {
-  constructor (options) {
-    super()
-    this[FLOWING] = false
-    // whether we're explicitly paused
-    this[PAUSED] = false
-    this.pipes = []
-    this.buffer = []
-    this[OBJECTMODE] = options && options.objectMode || false
-    if (this[OBJECTMODE])
-      this[ENCODING] = null
-    else
-      this[ENCODING] = options && options.encoding || null
-    if (this[ENCODING] === 'buffer')
-      this[ENCODING] = null
-    this[ASYNC] = options && !!options.async || false
-    this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
-    this[EOF] = false
-    this[EMITTED_END] = false
-    this[EMITTING_END] = false
-    this[CLOSED] = false
-    this[EMITTED_ERROR] = null
-    this.writable = true
-    this.readable = true
-    this[BUFFERLENGTH] = 0
-    this[DESTROYED] = false
-  }
-
-  get bufferLength () { return this[BUFFERLENGTH] }
-
-  get encoding () { return this[ENCODING] }
-  set encoding (enc) {
-    if (this[OBJECTMODE])
-      throw new Error('cannot set encoding in objectMode')
-
-    if (this[ENCODING] && enc !== this[ENCODING] &&
-        (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH]))
-      throw new Error('cannot change encoding')
-
-    if (this[ENCODING] !== enc) {
-      this[DECODER] = enc ? new SD(enc) : null
-      if (this.buffer.length)
-        this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk))
-    }
-
-    this[ENCODING] = enc
-  }
-
-  setEncoding (enc) {
-    this.encoding = enc
-  }
-
-  get objectMode () { return this[OBJECTMODE] }
-  set objectMode (om) { this[OBJECTMODE] = this[OBJECTMODE] || !!om }
-
-  get ['async'] () { return this[ASYNC] }
-  set ['async'] (a) { this[ASYNC] = this[ASYNC] || !!a }
-
-  write (chunk, encoding, cb) {
-    if (this[EOF])
-      throw new Error('write after end')
-
-    if (this[DESTROYED]) {
-      this.emit('error', Object.assign(
-        new Error('Cannot call write after a stream was destroyed'),
-        { code: 'ERR_STREAM_DESTROYED' }
-      ))
-      return true
-    }
-
-    if (typeof encoding === 'function')
-      cb = encoding, encoding = 'utf8'
-
-    if (!encoding)
-      encoding = 'utf8'
-
-    const fn = this[ASYNC] ? defer : f => f()
-
-    // convert array buffers and typed array views into buffers
-    // at some point in the future, we may want to do the opposite!
-    // leave strings and buffers as-is
-    // anything else switches us into object mode
-    if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
-      if (isArrayBufferView(chunk))
-        chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)
-      else if (isArrayBuffer(chunk))
-        chunk = Buffer.from(chunk)
-      else if (typeof chunk !== 'string')
-        // use the setter so we throw if we have encoding set
-        this.objectMode = true
-    }
-
-    // handle object mode up front, since it's simpler
-    // this yields better performance, fewer checks later.
-    if (this[OBJECTMODE]) {
-      /* istanbul ignore if - maybe impossible? */
-      if (this.flowing && this[BUFFERLENGTH] !== 0)
-        this[FLUSH](true)
-
-      if (this.flowing)
-        this.emit('data', chunk)
-      else
-        this[BUFFERPUSH](chunk)
-
-      if (this[BUFFERLENGTH] !== 0)
-        this.emit('readable')
-
-      if (cb)
-        fn(cb)
-
-      return this.flowing
-    }
-
-    // at this point the chunk is a buffer or string
-    // don't buffer it up or send it to the decoder
-    if (!chunk.length) {
-      if (this[BUFFERLENGTH] !== 0)
-        this.emit('readable')
-      if (cb)
-        fn(cb)
-      return this.flowing
-    }
-
-    // fast-path writing strings of same encoding to a stream with
-    // an empty buffer, skipping the buffer/decoder dance
-    if (typeof chunk === 'string' &&
-        // unless it is a string already ready for us to use
-        !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) {
-      chunk = Buffer.from(chunk, encoding)
-    }
-
-    if (Buffer.isBuffer(chunk) && this[ENCODING])
-      chunk = this[DECODER].write(chunk)
-
-    // Note: flushing CAN potentially switch us into not-flowing mode
-    if (this.flowing && this[BUFFERLENGTH] !== 0)
-      this[FLUSH](true)
-
-    if (this.flowing)
-      this.emit('data', chunk)
-    else
-      this[BUFFERPUSH](chunk)
-
-    if (this[BUFFERLENGTH] !== 0)
-      this.emit('readable')
-
-    if (cb)
-      fn(cb)
-
-    return this.flowing
-  }
-
-  read (n) {
-    if (this[DESTROYED])
-      return null
-
-    if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) {
-      this[MAYBE_EMIT_END]()
-      return null
-    }
-
-    if (this[OBJECTMODE])
-      n = null
-
-    if (this.buffer.length > 1 && !this[OBJECTMODE]) {
-      if (this.encoding)
-        this.buffer = [this.buffer.join('')]
-      else
-        this.buffer = [Buffer.concat(this.buffer, this[BUFFERLENGTH])]
-    }
-
-    const ret = this[READ](n || null, this.buffer[0])
-    this[MAYBE_EMIT_END]()
-    return ret
-  }
-
-  [READ] (n, chunk) {
-    if (n === chunk.length || n === null)
-      this[BUFFERSHIFT]()
-    else {
-      this.buffer[0] = chunk.slice(n)
-      chunk = chunk.slice(0, n)
-      this[BUFFERLENGTH] -= n
-    }
-
-    this.emit('data', chunk)
-
-    if (!this.buffer.length && !this[EOF])
-      this.emit('drain')
-
-    return chunk
-  }
-
-  end (chunk, encoding, cb) {
-    if (typeof chunk === 'function')
-      cb = chunk, chunk = null
-    if (typeof encoding === 'function')
-      cb = encoding, encoding = 'utf8'
-    if (chunk)
-      this.write(chunk, encoding)
-    if (cb)
-      this.once('end', cb)
-    this[EOF] = true
-    this.writable = false
-
-    // if we haven't written anything, then go ahead and emit,
-    // even if we're not reading.
-    // we'll re-emit if a new 'end' listener is added anyway.
-    // This makes MP more suitable to write-only use cases.
-    if (this.flowing || !this[PAUSED])
-      this[MAYBE_EMIT_END]()
-    return this
-  }
-
-  // don't let the internal resume be overwritten
-  [RESUME] () {
-    if (this[DESTROYED])
-      return
-
-    this[PAUSED] = false
-    this[FLOWING] = true
-    this.emit('resume')
-    if (this.buffer.length)
-      this[FLUSH]()
-    else if (this[EOF])
-      this[MAYBE_EMIT_END]()
-    else
-      this.emit('drain')
-  }
-
-  resume () {
-    return this[RESUME]()
-  }
-
-  pause () {
-    this[FLOWING] = false
-    this[PAUSED] = true
-  }
-
-  get destroyed () {
-    return this[DESTROYED]
-  }
-
-  get flowing () {
-    return this[FLOWING]
-  }
-
-  get paused () {
-    return this[PAUSED]
-  }
-
-  [BUFFERPUSH] (chunk) {
-    if (this[OBJECTMODE])
-      this[BUFFERLENGTH] += 1
-    else
-      this[BUFFERLENGTH] += chunk.length
-    this.buffer.push(chunk)
-  }
-
-  [BUFFERSHIFT] () {
-    if (this.buffer.length) {
-      if (this[OBJECTMODE])
-        this[BUFFERLENGTH] -= 1
-      else
-        this[BUFFERLENGTH] -= this.buffer[0].length
-    }
-    return this.buffer.shift()
-  }
-
-  [FLUSH] (noDrain) {
-    do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()))
-
-    if (!noDrain && !this.buffer.length && !this[EOF])
-      this.emit('drain')
-  }
-
-  [FLUSHCHUNK] (chunk) {
-    return chunk ? (this.emit('data', chunk), this.flowing) : false
-  }
-
-  pipe (dest, opts) {
-    if (this[DESTROYED])
-      return
-
-    const ended = this[EMITTED_END]
-    opts = opts || {}
-    if (dest === proc.stdout || dest === proc.stderr)
-      opts.end = false
-    else
-      opts.end = opts.end !== false
-    opts.proxyErrors = !!opts.proxyErrors
-
-    // piping an ended stream ends immediately
-    if (ended) {
-      if (opts.end)
-        dest.end()
-    } else {
-      this.pipes.push(!opts.proxyErrors ? new Pipe(this, dest, opts)
-        : new PipeProxyErrors(this, dest, opts))
-      if (this[ASYNC])
-        defer(() => this[RESUME]())
-      else
-        this[RESUME]()
-    }
-
-    return dest
-  }
-
-  unpipe (dest) {
-    const p = this.pipes.find(p => p.dest === dest)
-    if (p) {
-      this.pipes.splice(this.pipes.indexOf(p), 1)
-      p.unpipe()
-    }
-  }
-
-  addListener (ev, fn) {
-    return this.on(ev, fn)
-  }
-
-  on (ev, fn) {
-    const ret = super.on(ev, fn)
-    if (ev === 'data' && !this.pipes.length && !this.flowing)
-      this[RESUME]()
-    else if (ev === 'readable' && this[BUFFERLENGTH] !== 0)
-      super.emit('readable')
-    else if (isEndish(ev) && this[EMITTED_END]) {
-      super.emit(ev)
-      this.removeAllListeners(ev)
-    } else if (ev === 'error' && this[EMITTED_ERROR]) {
-      if (this[ASYNC])
-        defer(() => fn.call(this, this[EMITTED_ERROR]))
-      else
-        fn.call(this, this[EMITTED_ERROR])
-    }
-    return ret
-  }
-
-  get emittedEnd () {
-    return this[EMITTED_END]
-  }
-
-  [MAYBE_EMIT_END] () {
-    if (!this[EMITTING_END] &&
-        !this[EMITTED_END] &&
-        !this[DESTROYED] &&
-        this.buffer.length === 0 &&
-        this[EOF]) {
-      this[EMITTING_END] = true
-      this.emit('end')
-      this.emit('prefinish')
-      this.emit('finish')
-      if (this[CLOSED])
-        this.emit('close')
-      this[EMITTING_END] = false
-    }
-  }
-
-  emit (ev, data, ...extra) {
-    // error and close are only events allowed after calling destroy()
-    if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])
-      return
-    else if (ev === 'data') {
-      return !data ? false
-        : this[ASYNC] ? defer(() => this[EMITDATA](data))
-        : this[EMITDATA](data)
-    } else if (ev === 'end') {
-      return this[EMITEND]()
-    } else if (ev === 'close') {
-      this[CLOSED] = true
-      // don't emit close before 'end' and 'finish'
-      if (!this[EMITTED_END] && !this[DESTROYED])
-        return
-      const ret = super.emit('close')
-      this.removeAllListeners('close')
-      return ret
-    } else if (ev === 'error') {
-      this[EMITTED_ERROR] = data
-      const ret = super.emit('error', data)
-      this[MAYBE_EMIT_END]()
-      return ret
-    } else if (ev === 'resume') {
-      const ret = super.emit('resume')
-      this[MAYBE_EMIT_END]()
-      return ret
-    } else if (ev === 'finish' || ev === 'prefinish') {
-      const ret = super.emit(ev)
-      this.removeAllListeners(ev)
-      return ret
-    }
-
-    // Some other unknown event
-    const ret = super.emit(ev, data, ...extra)
-    this[MAYBE_EMIT_END]()
-    return ret
-  }
-
-  [EMITDATA] (data) {
-    for (const p of this.pipes) {
-      if (p.dest.write(data) === false)
-        this.pause()
-    }
-    const ret = super.emit('data', data)
-    this[MAYBE_EMIT_END]()
-    return ret
-  }
-
-  [EMITEND] () {
-    if (this[EMITTED_END])
-      return
-
-    this[EMITTED_END] = true
-    this.readable = false
-    if (this[ASYNC])
-      defer(() => this[EMITEND2]())
-    else
-      this[EMITEND2]()
-  }
-
-  [EMITEND2] () {
-    if (this[DECODER]) {
-      const data = this[DECODER].end()
-      if (data) {
-        for (const p of this.pipes) {
-          p.dest.write(data)
-        }
-        super.emit('data', data)
-      }
-    }
-
-    for (const p of this.pipes) {
-      p.end()
-    }
-    const ret = super.emit('end')
-    this.removeAllListeners('end')
-    return ret
-  }
-
-  // const all = await stream.collect()
-  collect () {
-    const buf = []
-    if (!this[OBJECTMODE])
-      buf.dataLength = 0
-    // set the promise first, in case an error is raised
-    // by triggering the flow here.
-    const p = this.promise()
-    this.on('data', c => {
-      buf.push(c)
-      if (!this[OBJECTMODE])
-        buf.dataLength += c.length
-    })
-    return p.then(() => buf)
-  }
-
-  // const data = await stream.concat()
-  concat () {
-    return this[OBJECTMODE]
-      ? Promise.reject(new Error('cannot concat in objectMode'))
-      : this.collect().then(buf =>
-          this[OBJECTMODE]
-            ? Promise.reject(new Error('cannot concat in objectMode'))
-            : this[ENCODING] ? buf.join('') : Buffer.concat(buf, buf.dataLength))
-  }
-
-  // stream.promise().then(() => done, er => emitted error)
-  promise () {
-    return new Promise((resolve, reject) => {
-      this.on(DESTROYED, () => reject(new Error('stream destroyed')))
-      this.on('error', er => reject(er))
-      this.on('end', () => resolve())
-    })
-  }
-
-  // for await (let chunk of stream)
-  [ASYNCITERATOR] () {
-    const next = () => {
-      const res = this.read()
-      if (res !== null)
-        return Promise.resolve({ done: false, value: res })
-
-      if (this[EOF])
-        return Promise.resolve({ done: true })
-
-      let resolve = null
-      let reject = null
-      const onerr = er => {
-        this.removeListener('data', ondata)
-        this.removeListener('end', onend)
-        reject(er)
-      }
-      const ondata = value => {
-        this.removeListener('error', onerr)
-        this.removeListener('end', onend)
-        this.pause()
-        resolve({ value: value, done: !!this[EOF] })
-      }
-      const onend = () => {
-        this.removeListener('error', onerr)
-        this.removeListener('data', ondata)
-        resolve({ done: true })
-      }
-      const ondestroy = () => onerr(new Error('stream destroyed'))
-      return new Promise((res, rej) => {
-        reject = rej
-        resolve = res
-        this.once(DESTROYED, ondestroy)
-        this.once('error', onerr)
-        this.once('end', onend)
-        this.once('data', ondata)
-      })
-    }
-
-    return { next }
-  }
-
-  // for (let chunk of stream)
-  [ITERATOR] () {
-    const next = () => {
-      const value = this.read()
-      const done = value === null
-      return { value, done }
-    }
-    return { next }
-  }
-
-  destroy (er) {
-    if (this[DESTROYED]) {
-      if (er)
-        this.emit('error', er)
-      else
-        this.emit(DESTROYED)
-      return this
-    }
-
-    this[DESTROYED] = true
-
-    // throw away all buffered data, it's never coming out
-    this.buffer.length = 0
-    this[BUFFERLENGTH] = 0
-
-    if (typeof this.close === 'function' && !this[CLOSED])
-      this.close()
-
-    if (er)
-      this.emit('error', er)
-    else // if no error to emit, still reject pending promises
-      this.emit(DESTROYED)
-
-    return this
-  }
-
-  static isStream (s) {
-    return !!s && (s instanceof Minipass || s instanceof Stream ||
-      s instanceof EE && (
-        typeof s.pipe === 'function' || // readable
-        (typeof s.write === 'function' && typeof s.end === 'function') // writable
-      ))
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/minipass/package.json b/node_modules/@npmcli/run-script/node_modules/minipass/package.json
deleted file mode 100644
index 548d03fa6d5d4..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/minipass/package.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
-  "name": "minipass",
-  "version": "3.3.6",
-  "description": "minimal implementation of a PassThrough stream",
-  "main": "index.js",
-  "types": "index.d.ts",
-  "dependencies": {
-    "yallist": "^4.0.0"
-  },
-  "devDependencies": {
-    "@types/node": "^17.0.41",
-    "end-of-stream": "^1.4.0",
-    "prettier": "^2.6.2",
-    "tap": "^16.2.0",
-    "through2": "^2.0.3",
-    "ts-node": "^10.8.1",
-    "typescript": "^4.7.3"
-  },
-  "scripts": {
-    "test": "tap",
-    "preversion": "npm test",
-    "postversion": "npm publish",
-    "postpublish": "git push origin --follow-tags"
-  },
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/isaacs/minipass.git"
-  },
-  "keywords": [
-    "passthrough",
-    "stream"
-  ],
-  "author": "Isaac Z. Schlueter  (http://blog.izs.me/)",
-  "license": "ISC",
-  "files": [
-    "index.d.ts",
-    "index.js"
-  ],
-  "tap": {
-    "check-coverage": true
-  },
-  "engines": {
-    "node": ">=8"
-  },
-  "prettier": {
-    "semi": false,
-    "printWidth": 80,
-    "tabWidth": 2,
-    "useTabs": false,
-    "singleQuote": true,
-    "jsxSingleQuote": false,
-    "bracketSameLine": true,
-    "arrowParens": "avoid",
-    "endOfLine": "lf"
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/CONTRIBUTING.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/CONTRIBUTING.md
deleted file mode 100644
index c1c50eab4e58b..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/CONTRIBUTING.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# Contributing to node-gyp
-
-## Code of Conduct
-
-Please read the
-[Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md)
-which explains the minimum behavior expectations for node-gyp contributors.
-
-
-## Developer's Certificate of Origin 1.1
-
-By making a contribution to this project, I certify that:
-
-* (a) The contribution was created in whole or in part by me and I
-  have the right to submit it under the open source license
-  indicated in the file; or
-
-* (b) The contribution is based upon previous work that, to the best
-  of my knowledge, is covered under an appropriate open source
-  license and I have the right under that license to submit that
-  work with modifications, whether created in whole or in part
-  by me, under the same open source license (unless I am
-  permitted to submit under a different license), as indicated
-  in the file; or
-
-* (c) The contribution was provided directly to me by some other
-  person who certified (a), (b) or (c) and I have not modified
-  it.
-
-* (d) I understand and agree that this project and the contribution
-  are public and that a record of the contribution (including all
-  personal information I submit with it, including my sign-off) is
-  maintained indefinitely and may be redistributed consistent with
-  this project or the open source license(s) involved.
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/LICENSE b/node_modules/@npmcli/run-script/node_modules/node-gyp/LICENSE
deleted file mode 100644
index 2ea4dc5efb872..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2012 Nathan Rajlich 
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/SECURITY.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/SECURITY.md
deleted file mode 100644
index 1e168d76e3b1b..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/SECURITY.md
+++ /dev/null
@@ -1,2 +0,0 @@
-If you believe you have found a security issue in the software in this
-repository, please consult https://github.com/nodejs/node/blob/HEAD/SECURITY.md.
\ No newline at end of file
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi b/node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi
deleted file mode 100644
index b4ac369acb4f1..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi
+++ /dev/null
@@ -1,204 +0,0 @@
-{
-  'variables' : {
-    'node_engine_include_dir%': 'deps/v8/include',
-    'node_host_binary%': 'node',
-    'node_with_ltcg%': 'true',
-  },
-  'target_defaults': {
-    'type': 'loadable_module',
-    'win_delay_load_hook': 'true',
-    'product_prefix': '',
-
-    'conditions': [
-      [ 'node_engine=="chakracore"', {
-        'variables': {
-          'node_engine_include_dir%': 'deps/chakrashim/include'
-        },
-      }]
-    ],
-
-    'include_dirs': [
-      '<(node_root_dir)/include/node',
-      '<(node_root_dir)/src',
-      '<(node_root_dir)/deps/openssl/config',
-      '<(node_root_dir)/deps/openssl/openssl/include',
-      '<(node_root_dir)/deps/uv/include',
-      '<(node_root_dir)/deps/zlib',
-      '<(node_root_dir)/<(node_engine_include_dir)'
-    ],
-    'defines!': [
-      'BUILDING_UV_SHARED=1',  # Inherited from common.gypi.
-      'BUILDING_V8_SHARED=1',  # Inherited from common.gypi.
-    ],
-    'defines': [
-      'NODE_GYP_MODULE_NAME=>(_target_name)',
-      'USING_UV_SHARED=1',
-      'USING_V8_SHARED=1',
-      # Warn when using deprecated V8 APIs.
-      'V8_DEPRECATION_WARNINGS=1'
-    ],
-
-    'target_conditions': [
-      ['_type=="loadable_module"', {
-        'product_extension': 'node',
-        'defines': [
-          'BUILDING_NODE_EXTENSION'
-        ],
-        'xcode_settings': {
-          'OTHER_LDFLAGS': [
-            '-undefined dynamic_lookup'
-          ],
-        },
-      }],
-
-      ['_type=="static_library"', {
-        # set to `1` to *disable* the -T thin archive 'ld' flag.
-        # older linkers don't support this flag.
-        'standalone_static_library': '<(standalone_static_library)'
-      }],
-
-      ['_type!="executable"', {
-        'conditions': [
-          [ 'OS=="android"', {
-            'cflags!': [ '-fPIE' ],
-          }]
-        ]
-      }],
-
-      ['_win_delay_load_hook=="true"', {
-        # If the addon specifies `'win_delay_load_hook': 'true'` in its
-        # binding.gyp, link a delay-load hook into the DLL. This hook ensures
-        # that the addon will work regardless of whether the node/iojs binary
-        # is named node.exe, iojs.exe, or something else.
-        'conditions': [
-          [ 'OS=="win"', {
-            'defines': [ 'HOST_BINARY=\"<(node_host_binary)<(EXECUTABLE_SUFFIX)\"', ],
-            'sources': [
-              '<(node_gyp_dir)/src/win_delay_load_hook.cc',
-            ],
-            'msvs_settings': {
-              'VCLinkerTool': {
-                'DelayLoadDLLs': [ '<(node_host_binary)<(EXECUTABLE_SUFFIX)' ],
-                # Don't print a linker warning when no imports from either .exe
-                # are used.
-                'AdditionalOptions': [ '/ignore:4199' ],
-              },
-            },
-          }],
-        ],
-      }],
-    ],
-
-    'conditions': [
-      [ 'OS=="mac"', {
-        'defines': [
-          '_DARWIN_USE_64_BIT_INODE=1'
-        ],
-        'xcode_settings': {
-          'DYLIB_INSTALL_NAME_BASE': '@rpath'
-        },
-      }],
-      [ 'OS=="aix"', {
-        'ldflags': [
-          '-Wl,-bimport:<(node_exp_file)'
-        ],
-      }],
-      [ 'OS=="os400"', {
-        'ldflags': [
-          '-Wl,-bimport:<(node_exp_file)'
-        ],
-      }],
-      [ 'OS=="zos"', {
-        'conditions': [
-          [ '"'
-          # needs to have dll-interface to be used by
-          # clients of class 'node::ObjectWrap'
-          4251
-        ],
-      }, {
-        # OS!="win"
-        'defines': [
-          '_LARGEFILE_SOURCE',
-          '_FILE_OFFSET_BITS=64'
-        ],
-      }],
-      [ 'OS in "freebsd openbsd netbsd solaris android" or \
-         (OS=="linux" and target_arch!="ia32")', {
-        'cflags': [ '-fPIC' ],
-      }],
-    ]
-  }
-}
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/bin/node-gyp.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/bin/node-gyp.js
deleted file mode 100755
index 8652ea21eceeb..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/bin/node-gyp.js
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/usr/bin/env node
-
-'use strict'
-
-process.title = 'node-gyp'
-
-const envPaths = require('env-paths')
-const gyp = require('../')
-const log = require('npmlog')
-const os = require('os')
-
-/**
- * Process and execute the selected commands.
- */
-
-const prog = gyp()
-var completed = false
-prog.parseArgv(process.argv)
-prog.devDir = prog.opts.devdir
-
-var homeDir = os.homedir()
-if (prog.devDir) {
-  prog.devDir = prog.devDir.replace(/^~/, homeDir)
-} else if (homeDir) {
-  prog.devDir = envPaths('node-gyp', { suffix: '' }).cache
-} else {
-  throw new Error(
-    "node-gyp requires that the user's home directory is specified " +
-    'in either of the environmental variables HOME or USERPROFILE. ' +
-    'Overide with: --devdir /path/to/.node-gyp')
-}
-
-if (prog.todo.length === 0) {
-  if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) {
-    console.log('v%s', prog.version)
-  } else {
-    console.log('%s', prog.usage())
-  }
-  process.exit(0)
-}
-
-log.info('it worked if it ends with', 'ok')
-log.verbose('cli', process.argv)
-log.info('using', 'node-gyp@%s', prog.version)
-log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch)
-
-/**
- * Change dir if -C/--directory was passed.
- */
-
-var dir = prog.opts.directory
-if (dir) {
-  var fs = require('fs')
-  try {
-    var stat = fs.statSync(dir)
-    if (stat.isDirectory()) {
-      log.info('chdir', dir)
-      process.chdir(dir)
-    } else {
-      log.warn('chdir', dir + ' is not a directory')
-    }
-  } catch (e) {
-    if (e.code === 'ENOENT') {
-      log.warn('chdir', dir + ' is not a directory')
-    } else {
-      log.warn('chdir', 'error during chdir() "%s"', e.message)
-    }
-  }
-}
-
-function run () {
-  var command = prog.todo.shift()
-  if (!command) {
-    // done!
-    completed = true
-    log.info('ok')
-    return
-  }
-
-  prog.commands[command.name](command.args, function (err) {
-    if (err) {
-      log.error(command.name + ' error')
-      log.error('stack', err.stack)
-      errorMessage()
-      log.error('not ok')
-      return process.exit(1)
-    }
-    if (command.name === 'list') {
-      var versions = arguments[1]
-      if (versions.length > 0) {
-        versions.forEach(function (version) {
-          console.log(version)
-        })
-      } else {
-        console.log('No node development files installed. Use `node-gyp install` to install a version.')
-      }
-    } else if (arguments.length >= 2) {
-      console.log.apply(console, [].slice.call(arguments, 1))
-    }
-
-    // now run the next command in the queue
-    process.nextTick(run)
-  })
-}
-
-process.on('exit', function (code) {
-  if (!completed && !code) {
-    log.error('Completion callback never invoked!')
-    issueMessage()
-    process.exit(6)
-  }
-})
-
-process.on('uncaughtException', function (err) {
-  log.error('UNCAUGHT EXCEPTION')
-  log.error('stack', err.stack)
-  issueMessage()
-  process.exit(7)
-})
-
-function errorMessage () {
-  // copied from npm's lib/utils/error-handler.js
-  var os = require('os')
-  log.error('System', os.type() + ' ' + os.release())
-  log.error('command', process.argv
-    .map(JSON.stringify).join(' '))
-  log.error('cwd', process.cwd())
-  log.error('node -v', process.version)
-  log.error('node-gyp -v', 'v' + prog.package.version)
-}
-
-function issueMessage () {
-  errorMessage()
-  log.error('', ['Node-gyp failed to build your package.',
-    'Try to update npm and/or node-gyp and if it does not help file an issue with the package author.'
-  ].join('\n'))
-}
-
-// start running the given commands!
-run()
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Error-pre-versions-of-node-cannot-be-installed.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Error-pre-versions-of-node-cannot-be-installed.md
deleted file mode 100644
index c1e1158d70190..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Error-pre-versions-of-node-cannot-be-installed.md
+++ /dev/null
@@ -1,94 +0,0 @@
-When using `node-gyp` you might see an error like this when attempting to compile/install a node.js native addon:
-
-```
-$ npm install bcrypt
-npm http GET https://registry.npmjs.org/bcrypt/0.7.5
-npm http 304 https://registry.npmjs.org/bcrypt/0.7.5
-npm http GET https://registry.npmjs.org/bindings/1.0.0
-npm http 304 https://registry.npmjs.org/bindings/1.0.0
-
-> bcrypt@0.7.5 install /home/ubuntu/public/song-swap/node_modules/bcrypt
-> node-gyp rebuild
-
-gyp ERR! configure error
-gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
-gyp ERR! stack     at install (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:69:16)
-gyp ERR! stack     at Object.self.commands.(anonymous function) [as install] (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:56:37)
-gyp ERR! stack     at getNodeDir (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:219:20)
-gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:105:9
-gyp ERR! stack     at ChildProcess.exithandler (child_process.js:630:7)
-gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:99:17)
-gyp ERR! stack     at maybeClose (child_process.js:730:16)
-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:5)
-gyp ERR! System Linux 3.5.0-21-generic
-gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
-gyp ERR! cwd /home/ubuntu/public/song-swap/node_modules/bcrypt
-gyp ERR! node -v v0.11.2-pre
-gyp ERR! node-gyp -v v0.9.5
-gyp ERR! not ok
-npm ERR! bcrypt@0.7.5 install: `node-gyp rebuild`
-npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
-npm ERR!
-npm ERR! Failed at the bcrypt@0.7.5 install script.
-npm ERR! This is most likely a problem with the bcrypt package,
-npm ERR! not with npm itself.
-npm ERR! Tell the author that this fails on your system:
-npm ERR!     node-gyp rebuild
-npm ERR! You can get their info via:
-npm ERR!     npm owner ls bcrypt
-npm ERR! There is likely additional logging output above.
-
-npm ERR! System Linux 3.5.0-21-generic
-npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "bcrypt"
-npm ERR! cwd /home/ubuntu/public/song-swap
-npm ERR! node -v v0.11.2-pre
-npm ERR! npm -v 1.2.18
-npm ERR! code ELIFECYCLE
-npm ERR!
-npm ERR! Additional logging details can be found in:
-npm ERR!     /home/ubuntu/public/song-swap/npm-debug.log
-npm ERR! not ok code 0
-```
-
-The main error here is:
-
-```
-Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
-```
-
-This error is caused when you attempt to compile a native addon using a version of node.js with `-pre` at the end of the version number:
-
-``` bash
-$ node -v
-v0.10.4-pre
-```
-
-## How to avoid (the short answer)
-
-To avoid this error completely just use a stable release of node.js. i.e. `v0.10.4`, and __not__ `v0.10.4-pre`.
-
-## How to fix (the long answer)
-
-This error happens because `node-gyp` does not know what header files were used to compile your "pre" version of node, and therefore it needs you to specify the node source code directory path using the `--nodedir` flag.
-
-For example, if I compiled my development ("pre") version of node.js using the source code in `/Users/nrajlich/node`, then I could invoke `node-gyp` like:
-
-``` bash
-$ node-gyp rebuild --nodedir=/Users/nrajlich/node
-```
-
-Or install an native addon through `npm` like:
-
-``` bash
-$ npm install bcrypt --nodedir=/Users/nrajlich/node
-```
-
-### Always use `--nodedir`
-
-__Note:__ This is for advanced users who use `-pre` versions of node more often than tagged releases.
-
-If you're invoking `node-gyp` through `npm`, then you can leverage `npm`'s configuration system and not have to specify the `--nodedir` flag all the time:
-
-``` bash
-$ npm config set nodedir /Users/nrajlich/node
-```
\ No newline at end of file
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Force-npm-to-use-global-node-gyp.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Force-npm-to-use-global-node-gyp.md
deleted file mode 100644
index c6304e490a75d..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Force-npm-to-use-global-node-gyp.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# Force npm to use global installed node-gyp
-
-**Note: These instructions only work with npm 6 or older. For a solution that works with npm 8 (or older), see [Updating-npm-bundled-node-gyp.md](Updating-npm-bundled-node-gyp.md).**
-
-[Many issues](https://github.com/nodejs/node-gyp/labels/ERR%21%20node-gyp%20-v%20%3C%3D%20v5.1.0) are opened by users who are
-not running a [current version of node-gyp](https://github.com/nodejs/node-gyp/releases).
-
-npm bundles its own, internal, copy of node-gyp located at `npm/node_modules`, within npm's private dependencies which are separate from *globally* accessible packages. Therefore this internal copy of node-gyp is independent from any globally installed copy of node-gyp that
-may have been installed via `npm install -g node-gyp`.
-
-So npm's internal copy of node-gyp **isn't** stored inside *global* `node_modules` and thus isn't available for use as a standalone package. npm uses it's *internal* copy of `node-gyp` to automatically build native addons.
-
-When you install a _new_ version of node-gyp outside of npm, it'll go into your *global* `node_modules`, but not under the `npm/node_modules` (where internal copy of node-gyp is stored). So it will get into your `$PATH` and you will be able to use this globally installed version (**but not internal node-gyp of npm**) as any other globally installed package.
-
-The catch is that npm **won't** use global version unless you tell it to, it'll keep on using the **internal one**. You need to instruct it to by setting the `node_gyp` config variable (which goes into your `~/.npmrc`). You do this by running the `npm config set` command as below. Then npm will use the command in the path you supply whenever it needs to build a native addon.
-
-**Important**: You also need to remember to unset this when you upgrade npm with a newer version of node-gyp, or you have to manually keep your globally installed node-gyp to date. See "Undo" below.
-
-## Linux and macOS
-```
-npm install --global node-gyp@latest
-npm config set node_gyp $(npm prefix -g)/lib/node_modules/node-gyp/bin/node-gyp.js
-```
-
-`sudo` may be required for the first command if you get a permission error.
-
-## Windows
-
-### Windows Command Prompt
-```
-npm install --global node-gyp@latest
-for /f "delims=" %P in ('npm prefix -g') do npm config set node_gyp "%P\node_modules\node-gyp\bin\node-gyp.js"
-```
-
-### Powershell
-```
-npm install --global node-gyp@latest
-npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
-```
-
-## Undo
-**Beware** if you don't unset the `node_gyp` config option, npm will continue to use the globally installed version of node-gyp rather than the one it ships with, which may end up being newer.
-
-```
-npm config delete node_gyp
-npm uninstall --global node-gyp
-```
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Home.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Home.md
deleted file mode 100644
index fe099868b2822..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Home.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Welcome to the node-gyp wiki!
-
- * [["binding.gyp" files out in the wild]]
- * [[Linking to OpenSSL]]
- * [[Common Issues]]
- * [[Updating npm's bundled node-gyp]]
- * [[Error: "pre" versions of node cannot be installed]]
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Linking-to-OpenSSL.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Linking-to-OpenSSL.md
deleted file mode 100644
index ec809299958ca..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Linking-to-OpenSSL.md
+++ /dev/null
@@ -1,86 +0,0 @@
-A handful of native addons require linking to OpenSSL in one way or another. This introduces a small challenge since node will sometimes bundle OpenSSL statically (the default for node >= v0.8.x), or sometimes dynamically link to the system OpenSSL (default for node <= v0.6.x).
-
-Good native addons should account for both scenarios. It's recommended that you use the `binding.gyp` file provided below as a starting-point for any addon that needs to use OpenSSL:
-
-``` python
-{
-  'variables': {
-    # node v0.6.x doesn't give us its build variables,
-    # but on Unix it was only possible to use the system OpenSSL library,
-    # so default the variable to "true", v0.8.x node and up will overwrite it.
-    'node_shared_openssl%': 'true'
-  },
-  'targets': [
-    {
-      'target_name': 'binding',
-      'sources': [
-        'src/binding.cc'
-      ],
-      'conditions': [
-        ['node_shared_openssl=="false"', {
-          # so when "node_shared_openssl" is "false", then OpenSSL has been
-          # bundled into the node executable. So we need to include the same
-          # header files that were used when building node.
-          'include_dirs': [
-            '<(node_root_dir)/deps/openssl/openssl/include'
-          ],
-          "conditions" : [
-            ["target_arch=='ia32'", {
-              "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ]
-            }],
-            ["target_arch=='x64'", {
-              "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ]
-            }],
-            ["target_arch=='arm'", {
-              "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ]
-            }]
-          ]
-        }]
-      ]
-    }
-  ]
-}
-```
-
-This ensures that when OpenSSL is statically linked into `node` then, the bundled OpenSSL headers are included, but when the system OpenSSL is in use, then only those headers will be used.
-
-## Windows?
-
-As you can see this baseline `binding.gyp` file only accounts for the Unix scenario. Currently on Windows the situation is a little less ideal. On Windows, OpenSSL is _always_ statically compiled into the `node` executable, so ideally it would be possible to use that copy of OpenSSL when building native addons.
-
-Unfortunately it doesn't seem like that is possible at the moment, as there would need to be tweaks made to the generated `node.lib` file to include the openssl glue functions, or a new `openssl.lib` file would need to be created during the node build. I'm not sure which is the easiest/most feasible.
-
-In the meantime, one possible solution is using another copy of OpenSSL, which is what [`node-bcrypt`](https://github.com/ncb000gt/node.bcrypt.js) currently does. Adding something like this to your `binding.gyp` file's `"conditions"` block would enable this:
-
-``` python
-    [ 'OS=="win"', {
-      'conditions': [
-        # "openssl_root" is the directory on Windows of the OpenSSL files.
-        # Check the "target_arch" variable to set good default values for
-        # both 64-bit and 32-bit builds of the module.
-        ['target_arch=="x64"', {
-          'variables': {
-            'openssl_root%': 'C:/OpenSSL-Win64'
-          },
-        }, {
-          'variables': {
-            'openssl_root%': 'C:/OpenSSL-Win32'
-          },
-        }],
-      ],
-      'libraries': [ 
-        '-l<(openssl_root)/lib/libeay32.lib',
-      ],
-      'include_dirs': [
-        '<(openssl_root)/include',
-      ],
-    }]
-```
-
-Now you can direct your users to install OpenSSL on Windows from here (be sure to tell them to install the 64-bit version if they're compiling against a 64-bit version of node): http://slproweb.com/products/Win32OpenSSL.html
-
-Also note that both `node-gyp` and `npm` allow you to overwrite that default `openssl_root` variable on the command line:
-
-``` bash
-$ node-gyp rebuild --openssl-root="C:\Users\Nathan\Desktop\openssl"
-```
\ No newline at end of file
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Updating-npm-bundled-node-gyp.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Updating-npm-bundled-node-gyp.md
deleted file mode 100644
index 5759add3fee57..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/Updating-npm-bundled-node-gyp.md
+++ /dev/null
@@ -1,72 +0,0 @@
-# Updating the npm-bundled version of node-gyp
-
-**Note: These instructions are (only) tested and known to work with npm 8 and older.**
-
-**Note: These instructions will be undone if you reinstall or upgrade npm or node! For a more permanent (and simpler) solution, see [Force-npm-to-use-global-node-gyp.md](Force-npm-to-use-global-node-gyp.md). (npm 6 or older only!)**
-
-[Many issues](https://github.com/nodejs/node-gyp/issues?q=label%3A"ERR!+node-gyp+-v+<%3D+v9.x.x") are opened by users who are
-not running a [current version of node-gyp](https://github.com/nodejs/node-gyp/releases).
-
-`npm` bundles its own, internal, copy of `node-gyp`. This internal copy is independent of any globally installed copy of node-gyp that
-may have been installed via `npm install -g node-gyp`.
-
-This means that while `node-gyp` doesn't get installed into your `$PATH` by default, npm still keeps its own copy to invoke when you
-attempt to `npm install` a native add-on.
-
-Sometimes, you may need to update npm's internal node-gyp to a newer version than what is installed. A simple `npm install -g node-gyp`
-_won't_ do the trick since npm will still continue to use its internal copy over the global one.
-
-So instead:
-
-## Version of npm
-
-We need to start by knowing your version of `npm`:
-```bash
-npm --version
-```
-
-## Linux, macOS, Solaris, etc.
-
-Unix is easy. Just run the following command.
-
-If your npm is version ___7 or 8___, do:
-```bash
-$ npm explore npm/node_modules/@npmcli/run-script -g -- npm_config_global=false npm install node-gyp@latest
-```
-
-Else if your npm is version ___less than 7___, do:
-```bash
-$ npm explore npm/node_modules/npm-lifecycle -g -- npm install node-gyp@latest
-```
-
-If the command fails with a permissions error, please try `sudo` and then the command.
-
-## Windows
-
-Windows is a bit trickier, since `npm` might be installed to the "Program Files" directory, which needs admin privileges in order to
-modify on current Windows. Therefore, run the following commands __inside a `cmd.exe` started with "Run as Administrator"__:
-
-First we need to find the location of `node`. If you don't already know the location that `node.exe` got installed to, then run:
-```bash
-$ where node
-```
-
-Now `cd` to the directory that `node.exe` is contained in e.g.:
-```bash
-$ cd "C:\Program Files\nodejs"
-```
-
-If your npm version is ___7 or 8___, do:
-```bash
-cd node_modules\npm\node_modules\@npmcli\run-script
-```
-
-Else if your npm version is ___less than 7___, do:
-```bash
-cd node_modules\npm\node_modules\npm-lifecycle
-```
-
-Finish by running:
-```bash
-$ npm install node-gyp@latest
-```
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/binding.gyp-files-in-the-wild.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/binding.gyp-files-in-the-wild.md
deleted file mode 100644
index 795d2fd2ec618..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/docs/binding.gyp-files-in-the-wild.md
+++ /dev/null
@@ -1,49 +0,0 @@
-This page contains links to some examples of existing `binding.gyp` files that other node modules are using. Take a look at them for inspiration.
-
-To add to this page, just add the link to the project's `binding.gyp` file below:
-
- * [ons](https://github.com/XadillaX/aliyun-ons/blob/master/binding.gyp)
- * [thmclrx](https://github.com/XadillaX/thmclrx/blob/master/binding.gyp)
- * [libxmljs](https://github.com/polotek/libxmljs/blob/master/binding.gyp)
- * [node-buffertools](https://github.com/bnoordhuis/node-buffertools/blob/master/binding.gyp)
- * [node-canvas](https://github.com/LearnBoost/node-canvas/blob/master/binding.gyp)
- * [node-ffi](https://github.com/rbranson/node-ffi/blob/master/binding.gyp) + [libffi](https://github.com/rbranson/node-ffi/blob/master/deps/libffi/libffi.gyp)
- * [node-time](https://github.com/TooTallNate/node-time/blob/master/binding.gyp)
- * [node-sass](https://github.com/sass/node-sass/blob/master/binding.gyp) + [libsass](https://github.com/sass/node-sass/blob/master/src/libsass.gyp)
- * [node-serialport](https://github.com/voodootikigod/node-serialport/blob/master/binding.gyp)
- * [node-weak](https://github.com/TooTallNate/node-weak/blob/master/binding.gyp)
- * [pty.js](https://github.com/chjj/pty.js/blob/master/binding.gyp)
- * [ref](https://github.com/TooTallNate/ref/blob/master/binding.gyp)
- * [appjs](https://github.com/milani/appjs/blob/master/binding.gyp)
- * [nwm](https://github.com/mixu/nwm/blob/master/binding.gyp)
- * [bcrypt](https://github.com/ncb000gt/node.bcrypt.js/blob/master/binding.gyp)
- * [nk-mysql](https://github.com/mmod/nodamysql/blob/master/binding.gyp)
- * [nk-xrm-installer](https://github.com/mmod/nk-xrm-installer/blob/master/binding.gyp) + [includable.gypi](https://github.com/mmod/nk-xrm-installer/blob/master/includable.gypi) + [unpack.py](https://github.com/mmod/nk-xrm-installer/blob/master/unpack.py) + [disburse.py](https://github.com/mmod/nk-xrm-installer/blob/master/disburse.py)   
-   .py files above provide complete reference for examples of fetching source via http, extracting, and moving files.
- * [node-memwatch](https://github.com/lloyd/node-memwatch/blob/master/binding.gyp)
- * [node-ip2location](https://github.com/bolgovr/node-ip2location/blob/master/binding.gyp)
- * [node-midi](https://github.com/justinlatimer/node-midi/blob/master/binding.gyp)
- * [node-sqlite3](https://github.com/developmentseed/node-sqlite3/blob/master/binding.gyp) + [libsqlite3](https://github.com/developmentseed/node-sqlite3/blob/master/deps/sqlite3.gyp)
- * [node-zipfile](https://github.com/mapbox/node-zipfile/blob/master/binding.gyp)
- * [node-mapnik](https://github.com/mapnik/node-mapnik/blob/master/binding.gyp)
- * [node-inotify](https://github.com/c4milo/node-inotify/blob/master/binding.gyp)
- * [v8-profiler](https://github.com/c4milo/v8-profiler/blob/master/binding.gyp)
- * [airtunes](https://github.com/radioline/node_airtunes/blob/master/binding.gyp)
- * [node-fann](https://github.com/c4milo/node-fann/blob/master/binding.gyp)
- * [node-talib](https://github.com/oransel/node-talib/blob/master/binding.gyp)
- * [node-leveldown](https://github.com/rvagg/node-leveldown/blob/master/binding.gyp) + [leveldb.gyp](https://github.com/rvagg/node-leveldown/blob/master/deps/leveldb/leveldb.gyp) + [snappy.gyp](https://github.com/rvagg/node-leveldown/blob/master/deps/snappy/snappy.gyp)
- * [node-expat](https://github.com/astro/node-expat/blob/master/binding.gyp) + [libexpat](https://github.com/astro/node-expat/blob/master/deps/libexpat/libexpat.gyp)
- * [node-openvg-canvas](https://github.com/luismreis/node-openvg-canvas/blob/master/binding.gyp) + [node-openvg](https://github.com/luismreis/node-openvg/blob/master/binding.gyp)
- * [node-cryptopp](https://github.com/BatikhSouri/node-cryptopp/blob/master/binding.gyp)
- * [topcube](https://github.com/creationix/topcube/blob/master/binding.gyp)
- * [node-osmium](https://github.com/osmcode/node-osmium/blob/master/binding.gyp)
- * [node-osrm](https://github.com/DennisOSRM/node-osrm)
- * [node-oracle](https://github.com/joeferner/node-oracle/blob/master/binding.gyp)
- * [node-process-list](https://github.com/ReklatsMasters/node-process-list/blob/master/binding.gyp)
- * [node-nanomsg](https://github.com/nickdesaulniers/node-nanomsg/blob/master/binding.gyp)
- * [Ghostscript4JS](https://github.com/NickNaso/ghostscript4js/blob/master/binding.gyp)
- * [nodecv](https://github.com/xudafeng/nodecv/blob/master/binding.gyp)
- * [magick-cli](https://github.com/NickNaso/magick-cli/blob/master/binding.gyp)
- * [sharp](https://github.com/lovell/sharp/blob/master/binding.gyp)
- * [krb5](https://github.com/adaltas/node-krb5/blob/master/binding.gyp)
- * [node-heapdump](https://github.com/bnoordhuis/node-heapdump/blob/master/binding.gyp)
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/.flake8 b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/.flake8
deleted file mode 100644
index ea0c7680ef87b..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/.flake8
+++ /dev/null
@@ -1,4 +0,0 @@
-[flake8]
-max-complexity = 101
-max-line-length = 88
-extend-ignore = E203  # whitespace before ':' to agree with psf/black
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/AUTHORS b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/AUTHORS
deleted file mode 100644
index f49a357b9ed10..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/AUTHORS
+++ /dev/null
@@ -1,16 +0,0 @@
-# Names should be added to this file like so:
-# Name or Organization 
-
-Google Inc. <*@google.com>
-Bloomberg Finance L.P. <*@bloomberg.net>
-IBM Inc. <*@*.ibm.com>
-Yandex LLC <*@yandex-team.ru>
-
-Steven Knight 
-Ryan Norton 
-David J. Sankel 
-Eric N. Vander Weele 
-Tom Freudenberg 
-Julien Brianceau 
-Refael Ackermann 
-Ujjwal Sharma 
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CODE_OF_CONDUCT.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CODE_OF_CONDUCT.md
deleted file mode 100644
index d724027fd9aad..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Code of Conduct
-
-* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md)
-* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/HEAD/Moderation-Policy.md)
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CONTRIBUTING.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CONTRIBUTING.md
deleted file mode 100644
index 1a0bcde2b48d8..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/CONTRIBUTING.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Contributing to gyp-next
-
-## Code of Conduct
-
-This project is bound to the [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md).
-
-
-## Developer's Certificate of Origin 1.1
-
-By making a contribution to this project, I certify that:
-
-* (a) The contribution was created in whole or in part by me and I
-  have the right to submit it under the open source license
-  indicated in the file; or
-
-* (b) The contribution is based upon previous work that, to the best
-  of my knowledge, is covered under an appropriate open source
-  license and I have the right under that license to submit that
-  work with modifications, whether created in whole or in part
-  by me, under the same open source license (unless I am
-  permitted to submit under a different license), as indicated
-  in the file; or
-
-* (c) The contribution was provided directly to me by some other
-  person who certified (a), (b) or (c) and I have not modified
-  it.
-
-* (d) I understand and agree that this project and the contribution
-  are public and that a record of the contribution (including all
-  personal information I submit with it, including my sign-off) is
-  maintained indefinitely and may be redistributed consistent with
-  this project or the open source license(s) involved.
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/LICENSE b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/LICENSE
deleted file mode 100644
index c6944c5e4ed48..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2020 Node.js contributors. All rights reserved.
-Copyright (c) 2009 Google Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-   * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-   * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-   * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc
deleted file mode 100644
index 8bca510815e0a..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) 2013 Google Inc. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file is used to generate an empty .pdb -- with a 4KB pagesize -- that is
-// then used during the final link for modules that have large PDBs. Otherwise,
-// the linker will generate a pdb with a page size of 1KB, which imposes a limit
-// of 1GB on the .pdb. By generating an initial empty .pdb with the compiler
-// (rather than the linker), this limit is avoided. With this in place PDBs may
-// grow to 2GB.
-//
-// This file is referenced by the msvs_large_pdb mechanism in MSVSUtil.py.
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp
deleted file mode 100755
index 1b8b9bdfb05f5..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-set -e
-base=$(dirname "$0")
-exec python "${base}/gyp_main.py" "$@"
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp.bat b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp.bat
deleted file mode 100755
index c0b4ca24e5df0..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-@rem Copyright (c) 2009 Google Inc. All rights reserved.
-@rem Use of this source code is governed by a BSD-style license that can be
-@rem found in the LICENSE file.
-
-@python "%~dp0gyp_main.py" %*
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py
deleted file mode 100755
index f23dcdf882d1b..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright (c) 2009 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-import subprocess
-
-
-def IsCygwin():
-    # Function copied from pylib/gyp/common.py
-    try:
-        out = subprocess.Popen(
-            "uname", stdout=subprocess.PIPE, stderr=subprocess.STDOUT
-        )
-        stdout, _ = out.communicate()
-        return "CYGWIN" in stdout.decode("utf-8")
-    except Exception:
-        return False
-
-
-def UnixifyPath(path):
-    try:
-        if not IsCygwin():
-            return path
-        out = subprocess.Popen(
-            ["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
-        )
-        stdout, _ = out.communicate()
-        return stdout.decode("utf-8")
-    except Exception:
-        return path
-
-
-# Make sure we're using the version of pylib in this repo, not one installed
-# elsewhere on the system. Also convert to Unix style path on Cygwin systems,
-# else the 'gyp' library will not be found
-path = UnixifyPath(sys.argv[0])
-sys.path.insert(0, os.path.join(os.path.dirname(path), "pylib"))
-import gyp  # noqa: E402
-
-if __name__ == "__main__":
-    sys.exit(gyp.script_main())
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py
deleted file mode 100644
index d6b189760cef9..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py
+++ /dev/null
@@ -1,367 +0,0 @@
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""New implementation of Visual Studio project generation."""
-
-import hashlib
-import os
-import random
-from operator import attrgetter
-
-import gyp.common
-
-
-def cmp(x, y):
-    return (x > y) - (x < y)
-
-
-# Initialize random number generator
-random.seed()
-
-# GUIDs for project types
-ENTRY_TYPE_GUIDS = {
-    "project": "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}",
-    "folder": "{2150E333-8FDC-42A3-9474-1A3956D46DE8}",
-}
-
-# ------------------------------------------------------------------------------
-# Helper functions
-
-
-def MakeGuid(name, seed="msvs_new"):
-    """Returns a GUID for the specified target name.
-
-  Args:
-    name: Target name.
-    seed: Seed for MD5 hash.
-  Returns:
-    A GUID-line string calculated from the name and seed.
-
-  This generates something which looks like a GUID, but depends only on the
-  name and seed.  This means the same name/seed will always generate the same
-  GUID, so that projects and solutions which refer to each other can explicitly
-  determine the GUID to refer to explicitly.  It also means that the GUID will
-  not change when the project for a target is rebuilt.
-  """
-    # Calculate a MD5 signature for the seed and name.
-    d = hashlib.md5((str(seed) + str(name)).encode("utf-8")).hexdigest().upper()
-    # Convert most of the signature to GUID form (discard the rest)
-    guid = (
-        "{"
-        + d[:8]
-        + "-"
-        + d[8:12]
-        + "-"
-        + d[12:16]
-        + "-"
-        + d[16:20]
-        + "-"
-        + d[20:32]
-        + "}"
-    )
-    return guid
-
-
-# ------------------------------------------------------------------------------
-
-
-class MSVSSolutionEntry:
-    def __cmp__(self, other):
-        # Sort by name then guid (so things are in order on vs2008).
-        return cmp((self.name, self.get_guid()), (other.name, other.get_guid()))
-
-
-class MSVSFolder(MSVSSolutionEntry):
-    """Folder in a Visual Studio project or solution."""
-
-    def __init__(self, path, name=None, entries=None, guid=None, items=None):
-        """Initializes the folder.
-
-    Args:
-      path: Full path to the folder.
-      name: Name of the folder.
-      entries: List of folder entries to nest inside this folder.  May contain
-          Folder or Project objects.  May be None, if the folder is empty.
-      guid: GUID to use for folder, if not None.
-      items: List of solution items to include in the folder project.  May be
-          None, if the folder does not directly contain items.
-    """
-        if name:
-            self.name = name
-        else:
-            # Use last layer.
-            self.name = os.path.basename(path)
-
-        self.path = path
-        self.guid = guid
-
-        # Copy passed lists (or set to empty lists)
-        self.entries = sorted(entries or [], key=attrgetter("path"))
-        self.items = list(items or [])
-
-        self.entry_type_guid = ENTRY_TYPE_GUIDS["folder"]
-
-    def get_guid(self):
-        if self.guid is None:
-            # Use consistent guids for folders (so things don't regenerate).
-            self.guid = MakeGuid(self.path, seed="msvs_folder")
-        return self.guid
-
-
-# ------------------------------------------------------------------------------
-
-
-class MSVSProject(MSVSSolutionEntry):
-    """Visual Studio project."""
-
-    def __init__(
-        self,
-        path,
-        name=None,
-        dependencies=None,
-        guid=None,
-        spec=None,
-        build_file=None,
-        config_platform_overrides=None,
-        fixpath_prefix=None,
-    ):
-        """Initializes the project.
-
-    Args:
-      path: Absolute path to the project file.
-      name: Name of project.  If None, the name will be the same as the base
-          name of the project file.
-      dependencies: List of other Project objects this project is dependent
-          upon, if not None.
-      guid: GUID to use for project, if not None.
-      spec: Dictionary specifying how to build this project.
-      build_file: Filename of the .gyp file that the vcproj file comes from.
-      config_platform_overrides: optional dict of configuration platforms to
-          used in place of the default for this target.
-      fixpath_prefix: the path used to adjust the behavior of _fixpath
-    """
-        self.path = path
-        self.guid = guid
-        self.spec = spec
-        self.build_file = build_file
-        # Use project filename if name not specified
-        self.name = name or os.path.splitext(os.path.basename(path))[0]
-
-        # Copy passed lists (or set to empty lists)
-        self.dependencies = list(dependencies or [])
-
-        self.entry_type_guid = ENTRY_TYPE_GUIDS["project"]
-
-        if config_platform_overrides:
-            self.config_platform_overrides = config_platform_overrides
-        else:
-            self.config_platform_overrides = {}
-        self.fixpath_prefix = fixpath_prefix
-        self.msbuild_toolset = None
-
-    def set_dependencies(self, dependencies):
-        self.dependencies = list(dependencies or [])
-
-    def get_guid(self):
-        if self.guid is None:
-            # Set GUID from path
-            # TODO(rspangler): This is fragile.
-            # 1. We can't just use the project filename sans path, since there could
-            #    be multiple projects with the same base name (for example,
-            #    foo/unittest.vcproj and bar/unittest.vcproj).
-            # 2. The path needs to be relative to $SOURCE_ROOT, so that the project
-            #    GUID is the same whether it's included from base/base.sln or
-            #    foo/bar/baz/baz.sln.
-            # 3. The GUID needs to be the same each time this builder is invoked, so
-            #    that we don't need to rebuild the solution when the project changes.
-            # 4. We should be able to handle pre-built project files by reading the
-            #    GUID from the files.
-            self.guid = MakeGuid(self.name)
-        return self.guid
-
-    def set_msbuild_toolset(self, msbuild_toolset):
-        self.msbuild_toolset = msbuild_toolset
-
-
-# ------------------------------------------------------------------------------
-
-
-class MSVSSolution:
-    """Visual Studio solution."""
-
-    def __init__(
-        self, path, version, entries=None, variants=None, websiteProperties=True
-    ):
-        """Initializes the solution.
-
-    Args:
-      path: Path to solution file.
-      version: Format version to emit.
-      entries: List of entries in solution.  May contain Folder or Project
-          objects.  May be None, if the folder is empty.
-      variants: List of build variant strings.  If none, a default list will
-          be used.
-      websiteProperties: Flag to decide if the website properties section
-          is generated.
-    """
-        self.path = path
-        self.websiteProperties = websiteProperties
-        self.version = version
-
-        # Copy passed lists (or set to empty lists)
-        self.entries = list(entries or [])
-
-        if variants:
-            # Copy passed list
-            self.variants = variants[:]
-        else:
-            # Use default
-            self.variants = ["Debug|Win32", "Release|Win32"]
-        # TODO(rspangler): Need to be able to handle a mapping of solution config
-        # to project config.  Should we be able to handle variants being a dict,
-        # or add a separate variant_map variable?  If it's a dict, we can't
-        # guarantee the order of variants since dict keys aren't ordered.
-
-        # TODO(rspangler): Automatically write to disk for now; should delay until
-        # node-evaluation time.
-        self.Write()
-
-    def Write(self, writer=gyp.common.WriteOnDiff):
-        """Writes the solution file to disk.
-
-    Raises:
-      IndexError: An entry appears multiple times.
-    """
-        # Walk the entry tree and collect all the folders and projects.
-        all_entries = set()
-        entries_to_check = self.entries[:]
-        while entries_to_check:
-            e = entries_to_check.pop(0)
-
-            # If this entry has been visited, nothing to do.
-            if e in all_entries:
-                continue
-
-            all_entries.add(e)
-
-            # If this is a folder, check its entries too.
-            if isinstance(e, MSVSFolder):
-                entries_to_check += e.entries
-
-        all_entries = sorted(all_entries, key=attrgetter("path"))
-
-        # Open file and print header
-        f = writer(self.path)
-        f.write(
-            "Microsoft Visual Studio Solution File, "
-            "Format Version %s\r\n" % self.version.SolutionVersion()
-        )
-        f.write("# %s\r\n" % self.version.Description())
-
-        # Project entries
-        sln_root = os.path.split(self.path)[0]
-        for e in all_entries:
-            relative_path = gyp.common.RelativePath(e.path, sln_root)
-            # msbuild does not accept an empty folder_name.
-            # use '.' in case relative_path is empty.
-            folder_name = relative_path.replace("/", "\\") or "."
-            f.write(
-                'Project("%s") = "%s", "%s", "%s"\r\n'
-                % (
-                    e.entry_type_guid,  # Entry type GUID
-                    e.name,  # Folder name
-                    folder_name,  # Folder name (again)
-                    e.get_guid(),  # Entry GUID
-                )
-            )
-
-            # TODO(rspangler): Need a way to configure this stuff
-            if self.websiteProperties:
-                f.write(
-                    "\tProjectSection(WebsiteProperties) = preProject\r\n"
-                    '\t\tDebug.AspNetCompiler.Debug = "True"\r\n'
-                    '\t\tRelease.AspNetCompiler.Debug = "False"\r\n'
-                    "\tEndProjectSection\r\n"
-                )
-
-            if isinstance(e, MSVSFolder):
-                if e.items:
-                    f.write("\tProjectSection(SolutionItems) = preProject\r\n")
-                    for i in e.items:
-                        f.write(f"\t\t{i} = {i}\r\n")
-                    f.write("\tEndProjectSection\r\n")
-
-            if isinstance(e, MSVSProject):
-                if e.dependencies:
-                    f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
-                    for d in e.dependencies:
-                        f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n")
-                    f.write("\tEndProjectSection\r\n")
-
-            f.write("EndProject\r\n")
-
-        # Global section
-        f.write("Global\r\n")
-
-        # Configurations (variants)
-        f.write("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n")
-        for v in self.variants:
-            f.write(f"\t\t{v} = {v}\r\n")
-        f.write("\tEndGlobalSection\r\n")
-
-        # Sort config guids for easier diffing of solution changes.
-        config_guids = []
-        config_guids_overrides = {}
-        for e in all_entries:
-            if isinstance(e, MSVSProject):
-                config_guids.append(e.get_guid())
-                config_guids_overrides[e.get_guid()] = e.config_platform_overrides
-        config_guids.sort()
-
-        f.write("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n")
-        for g in config_guids:
-            for v in self.variants:
-                nv = config_guids_overrides[g].get(v, v)
-                # Pick which project configuration to build for this solution
-                # configuration.
-                f.write(
-                    "\t\t%s.%s.ActiveCfg = %s\r\n"
-                    % (
-                        g,  # Project GUID
-                        v,  # Solution build configuration
-                        nv,  # Project build config for that solution config
-                    )
-                )
-
-                # Enable project in this solution configuration.
-                f.write(
-                    "\t\t%s.%s.Build.0 = %s\r\n"
-                    % (
-                        g,  # Project GUID
-                        v,  # Solution build configuration
-                        nv,  # Project build config for that solution config
-                    )
-                )
-        f.write("\tEndGlobalSection\r\n")
-
-        # TODO(rspangler): Should be able to configure this stuff too (though I've
-        # never seen this be any different)
-        f.write("\tGlobalSection(SolutionProperties) = preSolution\r\n")
-        f.write("\t\tHideSolutionNode = FALSE\r\n")
-        f.write("\tEndGlobalSection\r\n")
-
-        # Folder mappings
-        # Omit this section if there are no folders
-        if any([e.entries for e in all_entries if isinstance(e, MSVSFolder)]):
-            f.write("\tGlobalSection(NestedProjects) = preSolution\r\n")
-            for e in all_entries:
-                if not isinstance(e, MSVSFolder):
-                    continue  # Does not apply to projects, only folders
-                for subentry in e.entries:
-                    f.write(f"\t\t{subentry.get_guid()} = {e.get_guid()}\r\n")
-            f.write("\tEndGlobalSection\r\n")
-
-        f.write("EndGlobal\r\n")
-
-        f.close()
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py
deleted file mode 100644
index f0cfabe834909..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py
+++ /dev/null
@@ -1,206 +0,0 @@
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Visual Studio project reader/writer."""
-
-import gyp.easy_xml as easy_xml
-
-# ------------------------------------------------------------------------------
-
-
-class Tool:
-    """Visual Studio tool."""
-
-    def __init__(self, name, attrs=None):
-        """Initializes the tool.
-
-    Args:
-      name: Tool name.
-      attrs: Dict of tool attributes; may be None.
-    """
-        self._attrs = attrs or {}
-        self._attrs["Name"] = name
-
-    def _GetSpecification(self):
-        """Creates an element for the tool.
-
-    Returns:
-      A new xml.dom.Element for the tool.
-    """
-        return ["Tool", self._attrs]
-
-
-class Filter:
-    """Visual Studio filter - that is, a virtual folder."""
-
-    def __init__(self, name, contents=None):
-        """Initializes the folder.
-
-    Args:
-      name: Filter (folder) name.
-      contents: List of filenames and/or Filter objects contained.
-    """
-        self.name = name
-        self.contents = list(contents or [])
-
-
-# ------------------------------------------------------------------------------
-
-
-class Writer:
-    """Visual Studio XML project writer."""
-
-    def __init__(self, project_path, version, name, guid=None, platforms=None):
-        """Initializes the project.
-
-    Args:
-      project_path: Path to the project file.
-      version: Format version to emit.
-      name: Name of the project.
-      guid: GUID to use for project, if not None.
-      platforms: Array of string, the supported platforms.  If null, ['Win32']
-    """
-        self.project_path = project_path
-        self.version = version
-        self.name = name
-        self.guid = guid
-
-        # Default to Win32 for platforms.
-        if not platforms:
-            platforms = ["Win32"]
-
-        # Initialize the specifications of the various sections.
-        self.platform_section = ["Platforms"]
-        for platform in platforms:
-            self.platform_section.append(["Platform", {"Name": platform}])
-        self.tool_files_section = ["ToolFiles"]
-        self.configurations_section = ["Configurations"]
-        self.files_section = ["Files"]
-
-        # Keep a dict keyed on filename to speed up access.
-        self.files_dict = dict()
-
-    def AddToolFile(self, path):
-        """Adds a tool file to the project.
-
-    Args:
-      path: Relative path from project to tool file.
-    """
-        self.tool_files_section.append(["ToolFile", {"RelativePath": path}])
-
-    def _GetSpecForConfiguration(self, config_type, config_name, attrs, tools):
-        """Returns the specification for a configuration.
-
-    Args:
-      config_type: Type of configuration node.
-      config_name: Configuration name.
-      attrs: Dict of configuration attributes; may be None.
-      tools: List of tools (strings or Tool objects); may be None.
-    Returns:
-    """
-        # Handle defaults
-        if not attrs:
-            attrs = {}
-        if not tools:
-            tools = []
-
-        # Add configuration node and its attributes
-        node_attrs = attrs.copy()
-        node_attrs["Name"] = config_name
-        specification = [config_type, node_attrs]
-
-        # Add tool nodes and their attributes
-        if tools:
-            for t in tools:
-                if isinstance(t, Tool):
-                    specification.append(t._GetSpecification())
-                else:
-                    specification.append(Tool(t)._GetSpecification())
-        return specification
-
-    def AddConfig(self, name, attrs=None, tools=None):
-        """Adds a configuration to the project.
-
-    Args:
-      name: Configuration name.
-      attrs: Dict of configuration attributes; may be None.
-      tools: List of tools (strings or Tool objects); may be None.
-    """
-        spec = self._GetSpecForConfiguration("Configuration", name, attrs, tools)
-        self.configurations_section.append(spec)
-
-    def _AddFilesToNode(self, parent, files):
-        """Adds files and/or filters to the parent node.
-
-    Args:
-      parent: Destination node
-      files: A list of Filter objects and/or relative paths to files.
-
-    Will call itself recursively, if the files list contains Filter objects.
-    """
-        for f in files:
-            if isinstance(f, Filter):
-                node = ["Filter", {"Name": f.name}]
-                self._AddFilesToNode(node, f.contents)
-            else:
-                node = ["File", {"RelativePath": f}]
-                self.files_dict[f] = node
-            parent.append(node)
-
-    def AddFiles(self, files):
-        """Adds files to the project.
-
-    Args:
-      files: A list of Filter objects and/or relative paths to files.
-
-    This makes a copy of the file/filter tree at the time of this call.  If you
-    later add files to a Filter object which was passed into a previous call
-    to AddFiles(), it will not be reflected in this project.
-    """
-        self._AddFilesToNode(self.files_section, files)
-        # TODO(rspangler) This also doesn't handle adding files to an existing
-        # filter.  That is, it doesn't merge the trees.
-
-    def AddFileConfig(self, path, config, attrs=None, tools=None):
-        """Adds a configuration to a file.
-
-    Args:
-      path: Relative path to the file.
-      config: Name of configuration to add.
-      attrs: Dict of configuration attributes; may be None.
-      tools: List of tools (strings or Tool objects); may be None.
-
-    Raises:
-      ValueError: Relative path does not match any file added via AddFiles().
-    """
-        # Find the file node with the right relative path
-        parent = self.files_dict.get(path)
-        if not parent:
-            raise ValueError('AddFileConfig: file "%s" not in project.' % path)
-
-        # Add the config to the file node
-        spec = self._GetSpecForConfiguration("FileConfiguration", config, attrs, tools)
-        parent.append(spec)
-
-    def WriteIfChanged(self):
-        """Writes the project file."""
-        # First create XML content definition
-        content = [
-            "VisualStudioProject",
-            {
-                "ProjectType": "Visual C++",
-                "Version": self.version.ProjectVersion(),
-                "Name": self.name,
-                "ProjectGUID": self.guid,
-                "RootNamespace": self.name,
-                "Keyword": "Win32Proj",
-            },
-            self.platform_section,
-            self.tool_files_section,
-            self.configurations_section,
-            ["References"],  # empty section
-            self.files_section,
-            ["Globals"],  # empty section
-        ]
-        easy_xml.WriteXmlIfChanged(content, self.project_path, encoding="Windows-1252")
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py
deleted file mode 100644
index e89a971a3bb4f..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py
+++ /dev/null
@@ -1,1270 +0,0 @@
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-r"""Code to validate and convert settings of the Microsoft build tools.
-
-This file contains code to validate and convert settings of the Microsoft
-build tools.  The function ConvertToMSBuildSettings(), ValidateMSVSSettings(),
-and ValidateMSBuildSettings() are the entry points.
-
-This file was created by comparing the projects created by Visual Studio 2008
-and Visual Studio 2010 for all available settings through the user interface.
-The MSBuild schemas were also considered.  They are typically found in the
-MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild
-"""
-
-import re
-import sys
-
-# Dictionaries of settings validators. The key is the tool name, the value is
-# a dictionary mapping setting names to validation functions.
-_msvs_validators = {}
-_msbuild_validators = {}
-
-
-# A dictionary of settings converters. The key is the tool name, the value is
-# a dictionary mapping setting names to conversion functions.
-_msvs_to_msbuild_converters = {}
-
-
-# Tool name mapping from MSVS to MSBuild.
-_msbuild_name_of_tool = {}
-
-
-class _Tool:
-    """Represents a tool used by MSVS or MSBuild.
-
-  Attributes:
-      msvs_name: The name of the tool in MSVS.
-      msbuild_name: The name of the tool in MSBuild.
-  """
-
-    def __init__(self, msvs_name, msbuild_name):
-        self.msvs_name = msvs_name
-        self.msbuild_name = msbuild_name
-
-
-def _AddTool(tool):
-    """Adds a tool to the four dictionaries used to process settings.
-
-  This only defines the tool.  Each setting also needs to be added.
-
-  Args:
-    tool: The _Tool object to be added.
-  """
-    _msvs_validators[tool.msvs_name] = {}
-    _msbuild_validators[tool.msbuild_name] = {}
-    _msvs_to_msbuild_converters[tool.msvs_name] = {}
-    _msbuild_name_of_tool[tool.msvs_name] = tool.msbuild_name
-
-
-def _GetMSBuildToolSettings(msbuild_settings, tool):
-    """Returns an MSBuild tool dictionary.  Creates it if needed."""
-    return msbuild_settings.setdefault(tool.msbuild_name, {})
-
-
-class _Type:
-    """Type of settings (Base class)."""
-
-    def ValidateMSVS(self, value):
-        """Verifies that the value is legal for MSVS.
-
-    Args:
-      value: the value to check for this type.
-
-    Raises:
-      ValueError if value is not valid for MSVS.
-    """
-
-    def ValidateMSBuild(self, value):
-        """Verifies that the value is legal for MSBuild.
-
-    Args:
-      value: the value to check for this type.
-
-    Raises:
-      ValueError if value is not valid for MSBuild.
-    """
-
-    def ConvertToMSBuild(self, value):
-        """Returns the MSBuild equivalent of the MSVS value given.
-
-    Args:
-      value: the MSVS value to convert.
-
-    Returns:
-      the MSBuild equivalent.
-
-    Raises:
-      ValueError if value is not valid.
-    """
-        return value
-
-
-class _String(_Type):
-    """A setting that's just a string."""
-
-    def ValidateMSVS(self, value):
-        if not isinstance(value, str):
-            raise ValueError("expected string; got %r" % value)
-
-    def ValidateMSBuild(self, value):
-        if not isinstance(value, str):
-            raise ValueError("expected string; got %r" % value)
-
-    def ConvertToMSBuild(self, value):
-        # Convert the macros
-        return ConvertVCMacrosToMSBuild(value)
-
-
-class _StringList(_Type):
-    """A settings that's a list of strings."""
-
-    def ValidateMSVS(self, value):
-        if not isinstance(value, (list, str)):
-            raise ValueError("expected string list; got %r" % value)
-
-    def ValidateMSBuild(self, value):
-        if not isinstance(value, (list, str)):
-            raise ValueError("expected string list; got %r" % value)
-
-    def ConvertToMSBuild(self, value):
-        # Convert the macros
-        if isinstance(value, list):
-            return [ConvertVCMacrosToMSBuild(i) for i in value]
-        else:
-            return ConvertVCMacrosToMSBuild(value)
-
-
-class _Boolean(_Type):
-    """Boolean settings, can have the values 'false' or 'true'."""
-
-    def _Validate(self, value):
-        if value != "true" and value != "false":
-            raise ValueError("expected bool; got %r" % value)
-
-    def ValidateMSVS(self, value):
-        self._Validate(value)
-
-    def ValidateMSBuild(self, value):
-        self._Validate(value)
-
-    def ConvertToMSBuild(self, value):
-        self._Validate(value)
-        return value
-
-
-class _Integer(_Type):
-    """Integer settings."""
-
-    def __init__(self, msbuild_base=10):
-        _Type.__init__(self)
-        self._msbuild_base = msbuild_base
-
-    def ValidateMSVS(self, value):
-        # Try to convert, this will raise ValueError if invalid.
-        self.ConvertToMSBuild(value)
-
-    def ValidateMSBuild(self, value):
-        # Try to convert, this will raise ValueError if invalid.
-        int(value, self._msbuild_base)
-
-    def ConvertToMSBuild(self, value):
-        msbuild_format = (self._msbuild_base == 10) and "%d" or "0x%04x"
-        return msbuild_format % int(value)
-
-
-class _Enumeration(_Type):
-    """Type of settings that is an enumeration.
-
-  In MSVS, the values are indexes like '0', '1', and '2'.
-  MSBuild uses text labels that are more representative, like 'Win32'.
-
-  Constructor args:
-    label_list: an array of MSBuild labels that correspond to the MSVS index.
-        In the rare cases where MSVS has skipped an index value, None is
-        used in the array to indicate the unused spot.
-    new: an array of labels that are new to MSBuild.
-  """
-
-    def __init__(self, label_list, new=None):
-        _Type.__init__(self)
-        self._label_list = label_list
-        self._msbuild_values = {value for value in label_list if value is not None}
-        if new is not None:
-            self._msbuild_values.update(new)
-
-    def ValidateMSVS(self, value):
-        # Try to convert.  It will raise an exception if not valid.
-        self.ConvertToMSBuild(value)
-
-    def ValidateMSBuild(self, value):
-        if value not in self._msbuild_values:
-            raise ValueError("unrecognized enumerated value %s" % value)
-
-    def ConvertToMSBuild(self, value):
-        index = int(value)
-        if index < 0 or index >= len(self._label_list):
-            raise ValueError(
-                "index value (%d) not in expected range [0, %d)"
-                % (index, len(self._label_list))
-            )
-        label = self._label_list[index]
-        if label is None:
-            raise ValueError("converted value for %s not specified." % value)
-        return label
-
-
-# Instantiate the various generic types.
-_boolean = _Boolean()
-_integer = _Integer()
-# For now, we don't do any special validation on these types:
-_string = _String()
-_file_name = _String()
-_folder_name = _String()
-_file_list = _StringList()
-_folder_list = _StringList()
-_string_list = _StringList()
-# Some boolean settings went from numerical values to boolean.  The
-# mapping is 0: default, 1: false, 2: true.
-_newly_boolean = _Enumeration(["", "false", "true"])
-
-
-def _Same(tool, name, setting_type):
-    """Defines a setting that has the same name in MSVS and MSBuild.
-
-  Args:
-    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
-    name: the name of the setting.
-    setting_type: the type of this setting.
-  """
-    _Renamed(tool, name, name, setting_type)
-
-
-def _Renamed(tool, msvs_name, msbuild_name, setting_type):
-    """Defines a setting for which the name has changed.
-
-  Args:
-    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
-    msvs_name: the name of the MSVS setting.
-    msbuild_name: the name of the MSBuild setting.
-    setting_type: the type of this setting.
-  """
-
-    def _Translate(value, msbuild_settings):
-        msbuild_tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
-        msbuild_tool_settings[msbuild_name] = setting_type.ConvertToMSBuild(value)
-
-    _msvs_validators[tool.msvs_name][msvs_name] = setting_type.ValidateMSVS
-    _msbuild_validators[tool.msbuild_name][msbuild_name] = setting_type.ValidateMSBuild
-    _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
-
-
-def _Moved(tool, settings_name, msbuild_tool_name, setting_type):
-    _MovedAndRenamed(
-        tool, settings_name, msbuild_tool_name, settings_name, setting_type
-    )
-
-
-def _MovedAndRenamed(
-    tool, msvs_settings_name, msbuild_tool_name, msbuild_settings_name, setting_type
-):
-    """Defines a setting that may have moved to a new section.
-
-  Args:
-    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
-    msvs_settings_name: the MSVS name of the setting.
-    msbuild_tool_name: the name of the MSBuild tool to place the setting under.
-    msbuild_settings_name: the MSBuild name of the setting.
-    setting_type: the type of this setting.
-  """
-
-    def _Translate(value, msbuild_settings):
-        tool_settings = msbuild_settings.setdefault(msbuild_tool_name, {})
-        tool_settings[msbuild_settings_name] = setting_type.ConvertToMSBuild(value)
-
-    _msvs_validators[tool.msvs_name][msvs_settings_name] = setting_type.ValidateMSVS
-    validator = setting_type.ValidateMSBuild
-    _msbuild_validators[msbuild_tool_name][msbuild_settings_name] = validator
-    _msvs_to_msbuild_converters[tool.msvs_name][msvs_settings_name] = _Translate
-
-
-def _MSVSOnly(tool, name, setting_type):
-    """Defines a setting that is only found in MSVS.
-
-  Args:
-    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
-    name: the name of the setting.
-    setting_type: the type of this setting.
-  """
-
-    def _Translate(unused_value, unused_msbuild_settings):
-        # Since this is for MSVS only settings, no translation will happen.
-        pass
-
-    _msvs_validators[tool.msvs_name][name] = setting_type.ValidateMSVS
-    _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate
-
-
-def _MSBuildOnly(tool, name, setting_type):
-    """Defines a setting that is only found in MSBuild.
-
-  Args:
-    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
-    name: the name of the setting.
-    setting_type: the type of this setting.
-  """
-
-    def _Translate(value, msbuild_settings):
-        # Let msbuild-only properties get translated as-is from msvs_settings.
-        tool_settings = msbuild_settings.setdefault(tool.msbuild_name, {})
-        tool_settings[name] = value
-
-    _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild
-    _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate
-
-
-def _ConvertedToAdditionalOption(tool, msvs_name, flag):
-    """Defines a setting that's handled via a command line option in MSBuild.
-
-  Args:
-    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
-    msvs_name: the name of the MSVS setting that if 'true' becomes a flag
-    flag: the flag to insert at the end of the AdditionalOptions
-  """
-
-    def _Translate(value, msbuild_settings):
-        if value == "true":
-            tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
-            if "AdditionalOptions" in tool_settings:
-                new_flags = "{} {}".format(tool_settings["AdditionalOptions"], flag)
-            else:
-                new_flags = flag
-            tool_settings["AdditionalOptions"] = new_flags
-
-    _msvs_validators[tool.msvs_name][msvs_name] = _boolean.ValidateMSVS
-    _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
-
-
-def _CustomGeneratePreprocessedFile(tool, msvs_name):
-    def _Translate(value, msbuild_settings):
-        tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
-        if value == "0":
-            tool_settings["PreprocessToFile"] = "false"
-            tool_settings["PreprocessSuppressLineNumbers"] = "false"
-        elif value == "1":  # /P
-            tool_settings["PreprocessToFile"] = "true"
-            tool_settings["PreprocessSuppressLineNumbers"] = "false"
-        elif value == "2":  # /EP /P
-            tool_settings["PreprocessToFile"] = "true"
-            tool_settings["PreprocessSuppressLineNumbers"] = "true"
-        else:
-            raise ValueError("value must be one of [0, 1, 2]; got %s" % value)
-
-    # Create a bogus validator that looks for '0', '1', or '2'
-    msvs_validator = _Enumeration(["a", "b", "c"]).ValidateMSVS
-    _msvs_validators[tool.msvs_name][msvs_name] = msvs_validator
-    msbuild_validator = _boolean.ValidateMSBuild
-    msbuild_tool_validators = _msbuild_validators[tool.msbuild_name]
-    msbuild_tool_validators["PreprocessToFile"] = msbuild_validator
-    msbuild_tool_validators["PreprocessSuppressLineNumbers"] = msbuild_validator
-    _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
-
-
-fix_vc_macro_slashes_regex_list = ("IntDir", "OutDir")
-fix_vc_macro_slashes_regex = re.compile(
-    r"(\$\((?:%s)\))(?:[\\/]+)" % "|".join(fix_vc_macro_slashes_regex_list)
-)
-
-# Regular expression to detect keys that were generated by exclusion lists
-_EXCLUDED_SUFFIX_RE = re.compile("^(.*)_excluded$")
-
-
-def _ValidateExclusionSetting(setting, settings, error_msg, stderr=sys.stderr):
-    """Verify that 'setting' is valid if it is generated from an exclusion list.
-
-  If the setting appears to be generated from an exclusion list, the root name
-  is checked.
-
-  Args:
-      setting:   A string that is the setting name to validate
-      settings:  A dictionary where the keys are valid settings
-      error_msg: The message to emit in the event of error
-      stderr:    The stream receiving the error messages.
-  """
-    # This may be unrecognized because it's an exclusion list. If the
-    # setting name has the _excluded suffix, then check the root name.
-    unrecognized = True
-    m = re.match(_EXCLUDED_SUFFIX_RE, setting)
-    if m:
-        root_setting = m.group(1)
-        unrecognized = root_setting not in settings
-
-    if unrecognized:
-        # We don't know this setting. Give a warning.
-        print(error_msg, file=stderr)
-
-
-def FixVCMacroSlashes(s):
-    """Replace macros which have excessive following slashes.
-
-  These macros are known to have a built-in trailing slash. Furthermore, many
-  scripts hiccup on processing paths with extra slashes in the middle.
-
-  This list is probably not exhaustive.  Add as needed.
-  """
-    if "$" in s:
-        s = fix_vc_macro_slashes_regex.sub(r"\1", s)
-    return s
-
-
-def ConvertVCMacrosToMSBuild(s):
-    """Convert the MSVS macros found in the string to the MSBuild equivalent.
-
-  This list is probably not exhaustive.  Add as needed.
-  """
-    if "$" in s:
-        replace_map = {
-            "$(ConfigurationName)": "$(Configuration)",
-            "$(InputDir)": "%(RelativeDir)",
-            "$(InputExt)": "%(Extension)",
-            "$(InputFileName)": "%(Filename)%(Extension)",
-            "$(InputName)": "%(Filename)",
-            "$(InputPath)": "%(Identity)",
-            "$(ParentName)": "$(ProjectFileName)",
-            "$(PlatformName)": "$(Platform)",
-            "$(SafeInputName)": "%(Filename)",
-        }
-        for old, new in replace_map.items():
-            s = s.replace(old, new)
-        s = FixVCMacroSlashes(s)
-    return s
-
-
-def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):
-    """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).
-
-  Args:
-      msvs_settings: A dictionary.  The key is the tool name.  The values are
-          themselves dictionaries of settings and their values.
-      stderr: The stream receiving the error messages.
-
-  Returns:
-      A dictionary of MSBuild settings.  The key is either the MSBuild tool name
-      or the empty string (for the global settings).  The values are themselves
-      dictionaries of settings and their values.
-  """
-    msbuild_settings = {}
-    for msvs_tool_name, msvs_tool_settings in msvs_settings.items():
-        if msvs_tool_name in _msvs_to_msbuild_converters:
-            msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name]
-            for msvs_setting, msvs_value in msvs_tool_settings.items():
-                if msvs_setting in msvs_tool:
-                    # Invoke the translation function.
-                    try:
-                        msvs_tool[msvs_setting](msvs_value, msbuild_settings)
-                    except ValueError as e:
-                        print(
-                            "Warning: while converting %s/%s to MSBuild, "
-                            "%s" % (msvs_tool_name, msvs_setting, e),
-                            file=stderr,
-                        )
-                else:
-                    _ValidateExclusionSetting(
-                        msvs_setting,
-                        msvs_tool,
-                        (
-                            "Warning: unrecognized setting %s/%s "
-                            "while converting to MSBuild."
-                            % (msvs_tool_name, msvs_setting)
-                        ),
-                        stderr,
-                    )
-        else:
-            print(
-                "Warning: unrecognized tool %s while converting to "
-                "MSBuild." % msvs_tool_name,
-                file=stderr,
-            )
-    return msbuild_settings
-
-
-def ValidateMSVSSettings(settings, stderr=sys.stderr):
-    """Validates that the names of the settings are valid for MSVS.
-
-  Args:
-      settings: A dictionary.  The key is the tool name.  The values are
-          themselves dictionaries of settings and their values.
-      stderr: The stream receiving the error messages.
-  """
-    _ValidateSettings(_msvs_validators, settings, stderr)
-
-
-def ValidateMSBuildSettings(settings, stderr=sys.stderr):
-    """Validates that the names of the settings are valid for MSBuild.
-
-  Args:
-      settings: A dictionary.  The key is the tool name.  The values are
-          themselves dictionaries of settings and their values.
-      stderr: The stream receiving the error messages.
-  """
-    _ValidateSettings(_msbuild_validators, settings, stderr)
-
-
-def _ValidateSettings(validators, settings, stderr):
-    """Validates that the settings are valid for MSBuild or MSVS.
-
-  We currently only validate the names of the settings, not their values.
-
-  Args:
-      validators: A dictionary of tools and their validators.
-      settings: A dictionary.  The key is the tool name.  The values are
-          themselves dictionaries of settings and their values.
-      stderr: The stream receiving the error messages.
-  """
-    for tool_name in settings:
-        if tool_name in validators:
-            tool_validators = validators[tool_name]
-            for setting, value in settings[tool_name].items():
-                if setting in tool_validators:
-                    try:
-                        tool_validators[setting](value)
-                    except ValueError as e:
-                        print(
-                            f"Warning: for {tool_name}/{setting}, {e}",
-                            file=stderr,
-                        )
-                else:
-                    _ValidateExclusionSetting(
-                        setting,
-                        tool_validators,
-                        (f"Warning: unrecognized setting {tool_name}/{setting}"),
-                        stderr,
-                    )
-
-        else:
-            print("Warning: unrecognized tool %s" % (tool_name), file=stderr)
-
-
-# MSVS and MBuild names of the tools.
-_compile = _Tool("VCCLCompilerTool", "ClCompile")
-_link = _Tool("VCLinkerTool", "Link")
-_midl = _Tool("VCMIDLTool", "Midl")
-_rc = _Tool("VCResourceCompilerTool", "ResourceCompile")
-_lib = _Tool("VCLibrarianTool", "Lib")
-_manifest = _Tool("VCManifestTool", "Manifest")
-_masm = _Tool("MASM", "MASM")
-_armasm = _Tool("ARMASM", "ARMASM")
-
-
-_AddTool(_compile)
-_AddTool(_link)
-_AddTool(_midl)
-_AddTool(_rc)
-_AddTool(_lib)
-_AddTool(_manifest)
-_AddTool(_masm)
-_AddTool(_armasm)
-# Add sections only found in the MSBuild settings.
-_msbuild_validators[""] = {}
-_msbuild_validators["ProjectReference"] = {}
-_msbuild_validators["ManifestResourceCompile"] = {}
-
-# Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and
-# ClCompile in MSBuild.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for
-# the schema of the MSBuild ClCompile settings.
-
-# Options that have the same name in MSVS and MSBuild
-_Same(_compile, "AdditionalIncludeDirectories", _folder_list)  # /I
-_Same(_compile, "AdditionalOptions", _string_list)
-_Same(_compile, "AdditionalUsingDirectories", _folder_list)  # /AI
-_Same(_compile, "AssemblerListingLocation", _file_name)  # /Fa
-_Same(_compile, "BrowseInformationFile", _file_name)
-_Same(_compile, "BufferSecurityCheck", _boolean)  # /GS
-_Same(_compile, "DisableLanguageExtensions", _boolean)  # /Za
-_Same(_compile, "DisableSpecificWarnings", _string_list)  # /wd
-_Same(_compile, "EnableFiberSafeOptimizations", _boolean)  # /GT
-_Same(_compile, "EnablePREfast", _boolean)  # /analyze Visible='false'
-_Same(_compile, "ExpandAttributedSource", _boolean)  # /Fx
-_Same(_compile, "FloatingPointExceptions", _boolean)  # /fp:except
-_Same(_compile, "ForceConformanceInForLoopScope", _boolean)  # /Zc:forScope
-_Same(_compile, "ForcedIncludeFiles", _file_list)  # /FI
-_Same(_compile, "ForcedUsingFiles", _file_list)  # /FU
-_Same(_compile, "GenerateXMLDocumentationFiles", _boolean)  # /doc
-_Same(_compile, "IgnoreStandardIncludePath", _boolean)  # /X
-_Same(_compile, "MinimalRebuild", _boolean)  # /Gm
-_Same(_compile, "OmitDefaultLibName", _boolean)  # /Zl
-_Same(_compile, "OmitFramePointers", _boolean)  # /Oy
-_Same(_compile, "PreprocessorDefinitions", _string_list)  # /D
-_Same(_compile, "ProgramDataBaseFileName", _file_name)  # /Fd
-_Same(_compile, "RuntimeTypeInfo", _boolean)  # /GR
-_Same(_compile, "ShowIncludes", _boolean)  # /showIncludes
-_Same(_compile, "SmallerTypeCheck", _boolean)  # /RTCc
-_Same(_compile, "StringPooling", _boolean)  # /GF
-_Same(_compile, "SuppressStartupBanner", _boolean)  # /nologo
-_Same(_compile, "TreatWChar_tAsBuiltInType", _boolean)  # /Zc:wchar_t
-_Same(_compile, "UndefineAllPreprocessorDefinitions", _boolean)  # /u
-_Same(_compile, "UndefinePreprocessorDefinitions", _string_list)  # /U
-_Same(_compile, "UseFullPaths", _boolean)  # /FC
-_Same(_compile, "WholeProgramOptimization", _boolean)  # /GL
-_Same(_compile, "XMLDocumentationFileName", _file_name)
-_Same(_compile, "CompileAsWinRT", _boolean)  # /ZW
-
-_Same(
-    _compile,
-    "AssemblerOutput",
-    _Enumeration(
-        [
-            "NoListing",
-            "AssemblyCode",  # /FA
-            "All",  # /FAcs
-            "AssemblyAndMachineCode",  # /FAc
-            "AssemblyAndSourceCode",
-        ]
-    ),
-)  # /FAs
-_Same(
-    _compile,
-    "BasicRuntimeChecks",
-    _Enumeration(
-        [
-            "Default",
-            "StackFrameRuntimeCheck",  # /RTCs
-            "UninitializedLocalUsageCheck",  # /RTCu
-            "EnableFastChecks",
-        ]
-    ),
-)  # /RTC1
-_Same(
-    _compile, "BrowseInformation", _Enumeration(["false", "true", "true"])  # /FR
-)  # /Fr
-_Same(
-    _compile,
-    "CallingConvention",
-    _Enumeration(["Cdecl", "FastCall", "StdCall", "VectorCall"]),  # /Gd  # /Gr  # /Gz
-)  # /Gv
-_Same(
-    _compile,
-    "CompileAs",
-    _Enumeration(["Default", "CompileAsC", "CompileAsCpp"]),  # /TC
-)  # /TP
-_Same(
-    _compile,
-    "DebugInformationFormat",
-    _Enumeration(
-        [
-            "",  # Disabled
-            "OldStyle",  # /Z7
-            None,
-            "ProgramDatabase",  # /Zi
-            "EditAndContinue",
-        ]
-    ),
-)  # /ZI
-_Same(
-    _compile,
-    "EnableEnhancedInstructionSet",
-    _Enumeration(
-        [
-            "NotSet",
-            "StreamingSIMDExtensions",  # /arch:SSE
-            "StreamingSIMDExtensions2",  # /arch:SSE2
-            "AdvancedVectorExtensions",  # /arch:AVX (vs2012+)
-            "NoExtensions",  # /arch:IA32 (vs2012+)
-            # This one only exists in the new msbuild format.
-            "AdvancedVectorExtensions2",  # /arch:AVX2 (vs2013r2+)
-        ]
-    ),
-)
-_Same(
-    _compile,
-    "ErrorReporting",
-    _Enumeration(
-        [
-            "None",  # /errorReport:none
-            "Prompt",  # /errorReport:prompt
-            "Queue",
-        ],  # /errorReport:queue
-        new=["Send"],
-    ),
-)  # /errorReport:send"
-_Same(
-    _compile,
-    "ExceptionHandling",
-    _Enumeration(["false", "Sync", "Async"], new=["SyncCThrow"]),  # /EHsc  # /EHa
-)  # /EHs
-_Same(
-    _compile, "FavorSizeOrSpeed", _Enumeration(["Neither", "Speed", "Size"])  # /Ot
-)  # /Os
-_Same(
-    _compile,
-    "FloatingPointModel",
-    _Enumeration(["Precise", "Strict", "Fast"]),  # /fp:precise  # /fp:strict
-)  # /fp:fast
-_Same(
-    _compile,
-    "InlineFunctionExpansion",
-    _Enumeration(
-        ["Default", "OnlyExplicitInline", "AnySuitable"],  # /Ob1  # /Ob2
-        new=["Disabled"],
-    ),
-)  # /Ob0
-_Same(
-    _compile,
-    "Optimization",
-    _Enumeration(["Disabled", "MinSpace", "MaxSpeed", "Full"]),  # /Od  # /O1  # /O2
-)  # /Ox
-_Same(
-    _compile,
-    "RuntimeLibrary",
-    _Enumeration(
-        [
-            "MultiThreaded",  # /MT
-            "MultiThreadedDebug",  # /MTd
-            "MultiThreadedDLL",  # /MD
-            "MultiThreadedDebugDLL",
-        ]
-    ),
-)  # /MDd
-_Same(
-    _compile,
-    "StructMemberAlignment",
-    _Enumeration(
-        [
-            "Default",
-            "1Byte",  # /Zp1
-            "2Bytes",  # /Zp2
-            "4Bytes",  # /Zp4
-            "8Bytes",  # /Zp8
-            "16Bytes",
-        ]
-    ),
-)  # /Zp16
-_Same(
-    _compile,
-    "WarningLevel",
-    _Enumeration(
-        [
-            "TurnOffAllWarnings",  # /W0
-            "Level1",  # /W1
-            "Level2",  # /W2
-            "Level3",  # /W3
-            "Level4",
-        ],  # /W4
-        new=["EnableAllWarnings"],
-    ),
-)  # /Wall
-
-# Options found in MSVS that have been renamed in MSBuild.
-_Renamed(
-    _compile, "EnableFunctionLevelLinking", "FunctionLevelLinking", _boolean
-)  # /Gy
-_Renamed(_compile, "EnableIntrinsicFunctions", "IntrinsicFunctions", _boolean)  # /Oi
-_Renamed(_compile, "KeepComments", "PreprocessKeepComments", _boolean)  # /C
-_Renamed(_compile, "ObjectFile", "ObjectFileName", _file_name)  # /Fo
-_Renamed(_compile, "OpenMP", "OpenMPSupport", _boolean)  # /openmp
-_Renamed(
-    _compile, "PrecompiledHeaderThrough", "PrecompiledHeaderFile", _file_name
-)  # Used with /Yc and /Yu
-_Renamed(
-    _compile, "PrecompiledHeaderFile", "PrecompiledHeaderOutputFile", _file_name
-)  # /Fp
-_Renamed(
-    _compile,
-    "UsePrecompiledHeader",
-    "PrecompiledHeader",
-    _Enumeration(
-        ["NotUsing", "Create", "Use"]  # VS recognized '' for this value too.  # /Yc
-    ),
-)  # /Yu
-_Renamed(_compile, "WarnAsError", "TreatWarningAsError", _boolean)  # /WX
-
-_ConvertedToAdditionalOption(_compile, "DefaultCharIsUnsigned", "/J")
-
-# MSVS options not found in MSBuild.
-_MSVSOnly(_compile, "Detect64BitPortabilityProblems", _boolean)
-_MSVSOnly(_compile, "UseUnicodeResponseFiles", _boolean)
-
-# MSBuild options not found in MSVS.
-_MSBuildOnly(_compile, "BuildingInIDE", _boolean)
-_MSBuildOnly(
-    _compile, "CompileAsManaged", _Enumeration([], new=["false", "true"])
-)  # /clr
-_MSBuildOnly(_compile, "CreateHotpatchableImage", _boolean)  # /hotpatch
-_MSBuildOnly(_compile, "MultiProcessorCompilation", _boolean)  # /MP
-_MSBuildOnly(_compile, "PreprocessOutputPath", _string)  # /Fi
-_MSBuildOnly(_compile, "ProcessorNumber", _integer)  # the number of processors
-_MSBuildOnly(_compile, "TrackerLogDirectory", _folder_name)
-_MSBuildOnly(_compile, "TreatSpecificWarningsAsErrors", _string_list)  # /we
-_MSBuildOnly(_compile, "UseUnicodeForAssemblerListing", _boolean)  # /FAu
-
-# Defines a setting that needs very customized processing
-_CustomGeneratePreprocessedFile(_compile, "GeneratePreprocessedFile")
-
-
-# Directives for converting MSVS VCLinkerTool to MSBuild Link.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\link.xml" for
-# the schema of the MSBuild Link settings.
-
-# Options that have the same name in MSVS and MSBuild
-_Same(_link, "AdditionalDependencies", _file_list)
-_Same(_link, "AdditionalLibraryDirectories", _folder_list)  # /LIBPATH
-#  /MANIFESTDEPENDENCY:
-_Same(_link, "AdditionalManifestDependencies", _file_list)
-_Same(_link, "AdditionalOptions", _string_list)
-_Same(_link, "AddModuleNamesToAssembly", _file_list)  # /ASSEMBLYMODULE
-_Same(_link, "AllowIsolation", _boolean)  # /ALLOWISOLATION
-_Same(_link, "AssemblyLinkResource", _file_list)  # /ASSEMBLYLINKRESOURCE
-_Same(_link, "BaseAddress", _string)  # /BASE
-_Same(_link, "CLRUnmanagedCodeCheck", _boolean)  # /CLRUNMANAGEDCODECHECK
-_Same(_link, "DelayLoadDLLs", _file_list)  # /DELAYLOAD
-_Same(_link, "DelaySign", _boolean)  # /DELAYSIGN
-_Same(_link, "EmbedManagedResourceFile", _file_list)  # /ASSEMBLYRESOURCE
-_Same(_link, "EnableUAC", _boolean)  # /MANIFESTUAC
-_Same(_link, "EntryPointSymbol", _string)  # /ENTRY
-_Same(_link, "ForceSymbolReferences", _file_list)  # /INCLUDE
-_Same(_link, "FunctionOrder", _file_name)  # /ORDER
-_Same(_link, "GenerateDebugInformation", _boolean)  # /DEBUG
-_Same(_link, "GenerateMapFile", _boolean)  # /MAP
-_Same(_link, "HeapCommitSize", _string)
-_Same(_link, "HeapReserveSize", _string)  # /HEAP
-_Same(_link, "IgnoreAllDefaultLibraries", _boolean)  # /NODEFAULTLIB
-_Same(_link, "IgnoreEmbeddedIDL", _boolean)  # /IGNOREIDL
-_Same(_link, "ImportLibrary", _file_name)  # /IMPLIB
-_Same(_link, "KeyContainer", _file_name)  # /KEYCONTAINER
-_Same(_link, "KeyFile", _file_name)  # /KEYFILE
-_Same(_link, "ManifestFile", _file_name)  # /ManifestFile
-_Same(_link, "MapExports", _boolean)  # /MAPINFO:EXPORTS
-_Same(_link, "MapFileName", _file_name)
-_Same(_link, "MergedIDLBaseFileName", _file_name)  # /IDLOUT
-_Same(_link, "MergeSections", _string)  # /MERGE
-_Same(_link, "MidlCommandFile", _file_name)  # /MIDL
-_Same(_link, "ModuleDefinitionFile", _file_name)  # /DEF
-_Same(_link, "OutputFile", _file_name)  # /OUT
-_Same(_link, "PerUserRedirection", _boolean)
-_Same(_link, "Profile", _boolean)  # /PROFILE
-_Same(_link, "ProfileGuidedDatabase", _file_name)  # /PGD
-_Same(_link, "ProgramDatabaseFile", _file_name)  # /PDB
-_Same(_link, "RegisterOutput", _boolean)
-_Same(_link, "SetChecksum", _boolean)  # /RELEASE
-_Same(_link, "StackCommitSize", _string)
-_Same(_link, "StackReserveSize", _string)  # /STACK
-_Same(_link, "StripPrivateSymbols", _file_name)  # /PDBSTRIPPED
-_Same(_link, "SupportUnloadOfDelayLoadedDLL", _boolean)  # /DELAY:UNLOAD
-_Same(_link, "SuppressStartupBanner", _boolean)  # /NOLOGO
-_Same(_link, "SwapRunFromCD", _boolean)  # /SWAPRUN:CD
-_Same(_link, "TurnOffAssemblyGeneration", _boolean)  # /NOASSEMBLY
-_Same(_link, "TypeLibraryFile", _file_name)  # /TLBOUT
-_Same(_link, "TypeLibraryResourceID", _integer)  # /TLBID
-_Same(_link, "UACUIAccess", _boolean)  # /uiAccess='true'
-_Same(_link, "Version", _string)  # /VERSION
-
-_Same(_link, "EnableCOMDATFolding", _newly_boolean)  # /OPT:ICF
-_Same(_link, "FixedBaseAddress", _newly_boolean)  # /FIXED
-_Same(_link, "LargeAddressAware", _newly_boolean)  # /LARGEADDRESSAWARE
-_Same(_link, "OptimizeReferences", _newly_boolean)  # /OPT:REF
-_Same(_link, "RandomizedBaseAddress", _newly_boolean)  # /DYNAMICBASE
-_Same(_link, "TerminalServerAware", _newly_boolean)  # /TSAWARE
-
-_subsystem_enumeration = _Enumeration(
-    [
-        "NotSet",
-        "Console",  # /SUBSYSTEM:CONSOLE
-        "Windows",  # /SUBSYSTEM:WINDOWS
-        "Native",  # /SUBSYSTEM:NATIVE
-        "EFI Application",  # /SUBSYSTEM:EFI_APPLICATION
-        "EFI Boot Service Driver",  # /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
-        "EFI ROM",  # /SUBSYSTEM:EFI_ROM
-        "EFI Runtime",  # /SUBSYSTEM:EFI_RUNTIME_DRIVER
-        "WindowsCE",
-    ],  # /SUBSYSTEM:WINDOWSCE
-    new=["POSIX"],
-)  # /SUBSYSTEM:POSIX
-
-_target_machine_enumeration = _Enumeration(
-    [
-        "NotSet",
-        "MachineX86",  # /MACHINE:X86
-        None,
-        "MachineARM",  # /MACHINE:ARM
-        "MachineEBC",  # /MACHINE:EBC
-        "MachineIA64",  # /MACHINE:IA64
-        None,
-        "MachineMIPS",  # /MACHINE:MIPS
-        "MachineMIPS16",  # /MACHINE:MIPS16
-        "MachineMIPSFPU",  # /MACHINE:MIPSFPU
-        "MachineMIPSFPU16",  # /MACHINE:MIPSFPU16
-        None,
-        None,
-        None,
-        "MachineSH4",  # /MACHINE:SH4
-        None,
-        "MachineTHUMB",  # /MACHINE:THUMB
-        "MachineX64",
-    ]
-)  # /MACHINE:X64
-
-_Same(
-    _link, "AssemblyDebug", _Enumeration(["", "true", "false"])  # /ASSEMBLYDEBUG
-)  # /ASSEMBLYDEBUG:DISABLE
-_Same(
-    _link,
-    "CLRImageType",
-    _Enumeration(
-        [
-            "Default",
-            "ForceIJWImage",  # /CLRIMAGETYPE:IJW
-            "ForcePureILImage",  # /Switch="CLRIMAGETYPE:PURE
-            "ForceSafeILImage",
-        ]
-    ),
-)  # /Switch="CLRIMAGETYPE:SAFE
-_Same(
-    _link,
-    "CLRThreadAttribute",
-    _Enumeration(
-        [
-            "DefaultThreadingAttribute",  # /CLRTHREADATTRIBUTE:NONE
-            "MTAThreadingAttribute",  # /CLRTHREADATTRIBUTE:MTA
-            "STAThreadingAttribute",
-        ]
-    ),
-)  # /CLRTHREADATTRIBUTE:STA
-_Same(
-    _link,
-    "DataExecutionPrevention",
-    _Enumeration(["", "false", "true"]),  # /NXCOMPAT:NO
-)  # /NXCOMPAT
-_Same(
-    _link,
-    "Driver",
-    _Enumeration(["NotSet", "Driver", "UpOnly", "WDM"]),  # /Driver  # /DRIVER:UPONLY
-)  # /DRIVER:WDM
-_Same(
-    _link,
-    "LinkTimeCodeGeneration",
-    _Enumeration(
-        [
-            "Default",
-            "UseLinkTimeCodeGeneration",  # /LTCG
-            "PGInstrument",  # /LTCG:PGInstrument
-            "PGOptimization",  # /LTCG:PGOptimize
-            "PGUpdate",
-        ]
-    ),
-)  # /LTCG:PGUpdate
-_Same(
-    _link,
-    "ShowProgress",
-    _Enumeration(
-        ["NotSet", "LinkVerbose", "LinkVerboseLib"],  # /VERBOSE  # /VERBOSE:Lib
-        new=[
-            "LinkVerboseICF",  # /VERBOSE:ICF
-            "LinkVerboseREF",  # /VERBOSE:REF
-            "LinkVerboseSAFESEH",  # /VERBOSE:SAFESEH
-            "LinkVerboseCLR",
-        ],
-    ),
-)  # /VERBOSE:CLR
-_Same(_link, "SubSystem", _subsystem_enumeration)
-_Same(_link, "TargetMachine", _target_machine_enumeration)
-_Same(
-    _link,
-    "UACExecutionLevel",
-    _Enumeration(
-        [
-            "AsInvoker",  # /level='asInvoker'
-            "HighestAvailable",  # /level='highestAvailable'
-            "RequireAdministrator",
-        ]
-    ),
-)  # /level='requireAdministrator'
-_Same(_link, "MinimumRequiredVersion", _string)
-_Same(_link, "TreatLinkerWarningAsErrors", _boolean)  # /WX
-
-
-# Options found in MSVS that have been renamed in MSBuild.
-_Renamed(
-    _link,
-    "ErrorReporting",
-    "LinkErrorReporting",
-    _Enumeration(
-        [
-            "NoErrorReport",  # /ERRORREPORT:NONE
-            "PromptImmediately",  # /ERRORREPORT:PROMPT
-            "QueueForNextLogin",
-        ],  # /ERRORREPORT:QUEUE
-        new=["SendErrorReport"],
-    ),
-)  # /ERRORREPORT:SEND
-_Renamed(
-    _link, "IgnoreDefaultLibraryNames", "IgnoreSpecificDefaultLibraries", _file_list
-)  # /NODEFAULTLIB
-_Renamed(_link, "ResourceOnlyDLL", "NoEntryPoint", _boolean)  # /NOENTRY
-_Renamed(_link, "SwapRunFromNet", "SwapRunFromNET", _boolean)  # /SWAPRUN:NET
-
-_Moved(_link, "GenerateManifest", "", _boolean)
-_Moved(_link, "IgnoreImportLibrary", "", _boolean)
-_Moved(_link, "LinkIncremental", "", _newly_boolean)
-_Moved(_link, "LinkLibraryDependencies", "ProjectReference", _boolean)
-_Moved(_link, "UseLibraryDependencyInputs", "ProjectReference", _boolean)
-
-# MSVS options not found in MSBuild.
-_MSVSOnly(_link, "OptimizeForWindows98", _newly_boolean)
-_MSVSOnly(_link, "UseUnicodeResponseFiles", _boolean)
-
-# MSBuild options not found in MSVS.
-_MSBuildOnly(_link, "BuildingInIDE", _boolean)
-_MSBuildOnly(_link, "ImageHasSafeExceptionHandlers", _boolean)  # /SAFESEH
-_MSBuildOnly(_link, "LinkDLL", _boolean)  # /DLL Visible='false'
-_MSBuildOnly(_link, "LinkStatus", _boolean)  # /LTCG:STATUS
-_MSBuildOnly(_link, "PreventDllBinding", _boolean)  # /ALLOWBIND
-_MSBuildOnly(_link, "SupportNobindOfDelayLoadedDLL", _boolean)  # /DELAY:NOBIND
-_MSBuildOnly(_link, "TrackerLogDirectory", _folder_name)
-_MSBuildOnly(_link, "MSDOSStubFileName", _file_name)  # /STUB Visible='false'
-_MSBuildOnly(_link, "SectionAlignment", _integer)  # /ALIGN
-_MSBuildOnly(_link, "SpecifySectionAttributes", _string)  # /SECTION
-_MSBuildOnly(
-    _link,
-    "ForceFileOutput",
-    _Enumeration(
-        [],
-        new=[
-            "Enabled",  # /FORCE
-            # /FORCE:MULTIPLE
-            "MultiplyDefinedSymbolOnly",
-            "UndefinedSymbolOnly",
-        ],
-    ),
-)  # /FORCE:UNRESOLVED
-_MSBuildOnly(
-    _link,
-    "CreateHotPatchableImage",
-    _Enumeration(
-        [],
-        new=[
-            "Enabled",  # /FUNCTIONPADMIN
-            "X86Image",  # /FUNCTIONPADMIN:5
-            "X64Image",  # /FUNCTIONPADMIN:6
-            "ItaniumImage",
-        ],
-    ),
-)  # /FUNCTIONPADMIN:16
-_MSBuildOnly(
-    _link,
-    "CLRSupportLastError",
-    _Enumeration(
-        [],
-        new=[
-            "Enabled",  # /CLRSupportLastError
-            "Disabled",  # /CLRSupportLastError:NO
-            # /CLRSupportLastError:SYSTEMDLL
-            "SystemDlls",
-        ],
-    ),
-)
-
-
-# Directives for converting VCResourceCompilerTool to ResourceCompile.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\rc.xml" for
-# the schema of the MSBuild ResourceCompile settings.
-
-_Same(_rc, "AdditionalOptions", _string_list)
-_Same(_rc, "AdditionalIncludeDirectories", _folder_list)  # /I
-_Same(_rc, "Culture", _Integer(msbuild_base=16))
-_Same(_rc, "IgnoreStandardIncludePath", _boolean)  # /X
-_Same(_rc, "PreprocessorDefinitions", _string_list)  # /D
-_Same(_rc, "ResourceOutputFileName", _string)  # /fo
-_Same(_rc, "ShowProgress", _boolean)  # /v
-# There is no UI in VisualStudio 2008 to set the following properties.
-# However they are found in CL and other tools.  Include them here for
-# completeness, as they are very likely to have the same usage pattern.
-_Same(_rc, "SuppressStartupBanner", _boolean)  # /nologo
-_Same(_rc, "UndefinePreprocessorDefinitions", _string_list)  # /u
-
-# MSBuild options not found in MSVS.
-_MSBuildOnly(_rc, "NullTerminateStrings", _boolean)  # /n
-_MSBuildOnly(_rc, "TrackerLogDirectory", _folder_name)
-
-
-# Directives for converting VCMIDLTool to Midl.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\midl.xml" for
-# the schema of the MSBuild Midl settings.
-
-_Same(_midl, "AdditionalIncludeDirectories", _folder_list)  # /I
-_Same(_midl, "AdditionalOptions", _string_list)
-_Same(_midl, "CPreprocessOptions", _string)  # /cpp_opt
-_Same(_midl, "ErrorCheckAllocations", _boolean)  # /error allocation
-_Same(_midl, "ErrorCheckBounds", _boolean)  # /error bounds_check
-_Same(_midl, "ErrorCheckEnumRange", _boolean)  # /error enum
-_Same(_midl, "ErrorCheckRefPointers", _boolean)  # /error ref
-_Same(_midl, "ErrorCheckStubData", _boolean)  # /error stub_data
-_Same(_midl, "GenerateStublessProxies", _boolean)  # /Oicf
-_Same(_midl, "GenerateTypeLibrary", _boolean)
-_Same(_midl, "HeaderFileName", _file_name)  # /h
-_Same(_midl, "IgnoreStandardIncludePath", _boolean)  # /no_def_idir
-_Same(_midl, "InterfaceIdentifierFileName", _file_name)  # /iid
-_Same(_midl, "MkTypLibCompatible", _boolean)  # /mktyplib203
-_Same(_midl, "OutputDirectory", _string)  # /out
-_Same(_midl, "PreprocessorDefinitions", _string_list)  # /D
-_Same(_midl, "ProxyFileName", _file_name)  # /proxy
-_Same(_midl, "RedirectOutputAndErrors", _file_name)  # /o
-_Same(_midl, "SuppressStartupBanner", _boolean)  # /nologo
-_Same(_midl, "TypeLibraryName", _file_name)  # /tlb
-_Same(_midl, "UndefinePreprocessorDefinitions", _string_list)  # /U
-_Same(_midl, "WarnAsError", _boolean)  # /WX
-
-_Same(
-    _midl,
-    "DefaultCharType",
-    _Enumeration(["Unsigned", "Signed", "Ascii"]),  # /char unsigned  # /char signed
-)  # /char ascii7
-_Same(
-    _midl,
-    "TargetEnvironment",
-    _Enumeration(
-        [
-            "NotSet",
-            "Win32",  # /env win32
-            "Itanium",  # /env ia64
-            "X64",  # /env x64
-            "ARM64",  # /env arm64
-        ]
-    ),
-)
-_Same(
-    _midl,
-    "EnableErrorChecks",
-    _Enumeration(["EnableCustom", "None", "All"]),  # /error none
-)  # /error all
-_Same(
-    _midl,
-    "StructMemberAlignment",
-    _Enumeration(["NotSet", "1", "2", "4", "8"]),  # Zp1  # Zp2  # Zp4
-)  # Zp8
-_Same(
-    _midl,
-    "WarningLevel",
-    _Enumeration(["0", "1", "2", "3", "4"]),  # /W0  # /W1  # /W2  # /W3
-)  # /W4
-
-_Renamed(_midl, "DLLDataFileName", "DllDataFileName", _file_name)  # /dlldata
-_Renamed(_midl, "ValidateParameters", "ValidateAllParameters", _boolean)  # /robust
-
-# MSBuild options not found in MSVS.
-_MSBuildOnly(_midl, "ApplicationConfigurationMode", _boolean)  # /app_config
-_MSBuildOnly(_midl, "ClientStubFile", _file_name)  # /cstub
-_MSBuildOnly(
-    _midl, "GenerateClientFiles", _Enumeration([], new=["Stub", "None"])  # /client stub
-)  # /client none
-_MSBuildOnly(
-    _midl, "GenerateServerFiles", _Enumeration([], new=["Stub", "None"])  # /client stub
-)  # /client none
-_MSBuildOnly(_midl, "LocaleID", _integer)  # /lcid DECIMAL
-_MSBuildOnly(_midl, "ServerStubFile", _file_name)  # /sstub
-_MSBuildOnly(_midl, "SuppressCompilerWarnings", _boolean)  # /no_warn
-_MSBuildOnly(_midl, "TrackerLogDirectory", _folder_name)
-_MSBuildOnly(
-    _midl, "TypeLibFormat", _Enumeration([], new=["NewFormat", "OldFormat"])  # /newtlb
-)  # /oldtlb
-
-
-# Directives for converting VCLibrarianTool to Lib.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\lib.xml" for
-# the schema of the MSBuild Lib settings.
-
-_Same(_lib, "AdditionalDependencies", _file_list)
-_Same(_lib, "AdditionalLibraryDirectories", _folder_list)  # /LIBPATH
-_Same(_lib, "AdditionalOptions", _string_list)
-_Same(_lib, "ExportNamedFunctions", _string_list)  # /EXPORT
-_Same(_lib, "ForceSymbolReferences", _string)  # /INCLUDE
-_Same(_lib, "IgnoreAllDefaultLibraries", _boolean)  # /NODEFAULTLIB
-_Same(_lib, "IgnoreSpecificDefaultLibraries", _file_list)  # /NODEFAULTLIB
-_Same(_lib, "ModuleDefinitionFile", _file_name)  # /DEF
-_Same(_lib, "OutputFile", _file_name)  # /OUT
-_Same(_lib, "SuppressStartupBanner", _boolean)  # /NOLOGO
-_Same(_lib, "UseUnicodeResponseFiles", _boolean)
-_Same(_lib, "LinkTimeCodeGeneration", _boolean)  # /LTCG
-_Same(_lib, "TargetMachine", _target_machine_enumeration)
-
-# TODO(jeanluc) _link defines the same value that gets moved to
-# ProjectReference.  We may want to validate that they are consistent.
-_Moved(_lib, "LinkLibraryDependencies", "ProjectReference", _boolean)
-
-_MSBuildOnly(_lib, "DisplayLibrary", _string)  # /LIST Visible='false'
-_MSBuildOnly(
-    _lib,
-    "ErrorReporting",
-    _Enumeration(
-        [],
-        new=[
-            "PromptImmediately",  # /ERRORREPORT:PROMPT
-            "QueueForNextLogin",  # /ERRORREPORT:QUEUE
-            "SendErrorReport",  # /ERRORREPORT:SEND
-            "NoErrorReport",
-        ],
-    ),
-)  # /ERRORREPORT:NONE
-_MSBuildOnly(_lib, "MinimumRequiredVersion", _string)
-_MSBuildOnly(_lib, "Name", _file_name)  # /NAME
-_MSBuildOnly(_lib, "RemoveObjects", _file_list)  # /REMOVE
-_MSBuildOnly(_lib, "SubSystem", _subsystem_enumeration)
-_MSBuildOnly(_lib, "TrackerLogDirectory", _folder_name)
-_MSBuildOnly(_lib, "TreatLibWarningAsErrors", _boolean)  # /WX
-_MSBuildOnly(_lib, "Verbose", _boolean)
-
-
-# Directives for converting VCManifestTool to Mt.
-# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\mt.xml" for
-# the schema of the MSBuild Lib settings.
-
-# Options that have the same name in MSVS and MSBuild
-_Same(_manifest, "AdditionalManifestFiles", _file_list)  # /manifest
-_Same(_manifest, "AdditionalOptions", _string_list)
-_Same(_manifest, "AssemblyIdentity", _string)  # /identity:
-_Same(_manifest, "ComponentFileName", _file_name)  # /dll
-_Same(_manifest, "GenerateCatalogFiles", _boolean)  # /makecdfs
-_Same(_manifest, "InputResourceManifests", _string)  # /inputresource
-_Same(_manifest, "OutputManifestFile", _file_name)  # /out
-_Same(_manifest, "RegistrarScriptFile", _file_name)  # /rgs
-_Same(_manifest, "ReplacementsFile", _file_name)  # /replacements
-_Same(_manifest, "SuppressStartupBanner", _boolean)  # /nologo
-_Same(_manifest, "TypeLibraryFile", _file_name)  # /tlb:
-_Same(_manifest, "UpdateFileHashes", _boolean)  # /hashupdate
-_Same(_manifest, "UpdateFileHashesSearchPath", _file_name)
-_Same(_manifest, "VerboseOutput", _boolean)  # /verbose
-
-# Options that have moved location.
-_MovedAndRenamed(
-    _manifest,
-    "ManifestResourceFile",
-    "ManifestResourceCompile",
-    "ResourceOutputFileName",
-    _file_name,
-)
-_Moved(_manifest, "EmbedManifest", "", _boolean)
-
-# MSVS options not found in MSBuild.
-_MSVSOnly(_manifest, "DependencyInformationFile", _file_name)
-_MSVSOnly(_manifest, "UseFAT32Workaround", _boolean)
-_MSVSOnly(_manifest, "UseUnicodeResponseFiles", _boolean)
-
-# MSBuild options not found in MSVS.
-_MSBuildOnly(_manifest, "EnableDPIAwareness", _boolean)
-_MSBuildOnly(_manifest, "GenerateCategoryTags", _boolean)  # /category
-_MSBuildOnly(
-    _manifest, "ManifestFromManagedAssembly", _file_name
-)  # /managedassemblyname
-_MSBuildOnly(_manifest, "OutputResourceManifests", _string)  # /outputresource
-_MSBuildOnly(_manifest, "SuppressDependencyElement", _boolean)  # /nodependency
-_MSBuildOnly(_manifest, "TrackerLogDirectory", _folder_name)
-
-
-# Directives for MASM.
-# See "$(VCTargetsPath)\BuildCustomizations\masm.xml" for the schema of the
-# MSBuild MASM settings.
-
-# Options that have the same name in MSVS and MSBuild.
-_Same(_masm, "UseSafeExceptionHandlers", _boolean)  # /safeseh
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py
deleted file mode 100755
index 6ca09687ad7f1..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py
+++ /dev/null
@@ -1,1547 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Unit tests for the MSVSSettings.py file."""
-
-import unittest
-import gyp.MSVSSettings as MSVSSettings
-
-from io import StringIO
-
-
-class TestSequenceFunctions(unittest.TestCase):
-    def setUp(self):
-        self.stderr = StringIO()
-
-    def _ExpectedWarnings(self, expected):
-        """Compares recorded lines to expected warnings."""
-        self.stderr.seek(0)
-        actual = self.stderr.read().split("\n")
-        actual = [line for line in actual if line]
-        self.assertEqual(sorted(expected), sorted(actual))
-
-    def testValidateMSVSSettings_tool_names(self):
-        """Tests that only MSVS tool names are allowed."""
-        MSVSSettings.ValidateMSVSSettings(
-            {
-                "VCCLCompilerTool": {},
-                "VCLinkerTool": {},
-                "VCMIDLTool": {},
-                "foo": {},
-                "VCResourceCompilerTool": {},
-                "VCLibrarianTool": {},
-                "VCManifestTool": {},
-                "ClCompile": {},
-            },
-            self.stderr,
-        )
-        self._ExpectedWarnings(
-            ["Warning: unrecognized tool foo", "Warning: unrecognized tool ClCompile"]
-        )
-
-    def testValidateMSVSSettings_settings(self):
-        """Tests that for invalid MSVS settings."""
-        MSVSSettings.ValidateMSVSSettings(
-            {
-                "VCCLCompilerTool": {
-                    "AdditionalIncludeDirectories": "folder1;folder2",
-                    "AdditionalOptions": ["string1", "string2"],
-                    "AdditionalUsingDirectories": "folder1;folder2",
-                    "AssemblerListingLocation": "a_file_name",
-                    "AssemblerOutput": "0",
-                    "BasicRuntimeChecks": "5",
-                    "BrowseInformation": "fdkslj",
-                    "BrowseInformationFile": "a_file_name",
-                    "BufferSecurityCheck": "true",
-                    "CallingConvention": "-1",
-                    "CompileAs": "1",
-                    "DebugInformationFormat": "2",
-                    "DefaultCharIsUnsigned": "true",
-                    "Detect64BitPortabilityProblems": "true",
-                    "DisableLanguageExtensions": "true",
-                    "DisableSpecificWarnings": "string1;string2",
-                    "EnableEnhancedInstructionSet": "1",
-                    "EnableFiberSafeOptimizations": "true",
-                    "EnableFunctionLevelLinking": "true",
-                    "EnableIntrinsicFunctions": "true",
-                    "EnablePREfast": "true",
-                    "Enableprefast": "bogus",
-                    "ErrorReporting": "1",
-                    "ExceptionHandling": "1",
-                    "ExpandAttributedSource": "true",
-                    "FavorSizeOrSpeed": "1",
-                    "FloatingPointExceptions": "true",
-                    "FloatingPointModel": "1",
-                    "ForceConformanceInForLoopScope": "true",
-                    "ForcedIncludeFiles": "file1;file2",
-                    "ForcedUsingFiles": "file1;file2",
-                    "GeneratePreprocessedFile": "1",
-                    "GenerateXMLDocumentationFiles": "true",
-                    "IgnoreStandardIncludePath": "true",
-                    "InlineFunctionExpansion": "1",
-                    "KeepComments": "true",
-                    "MinimalRebuild": "true",
-                    "ObjectFile": "a_file_name",
-                    "OmitDefaultLibName": "true",
-                    "OmitFramePointers": "true",
-                    "OpenMP": "true",
-                    "Optimization": "1",
-                    "PrecompiledHeaderFile": "a_file_name",
-                    "PrecompiledHeaderThrough": "a_file_name",
-                    "PreprocessorDefinitions": "string1;string2",
-                    "ProgramDataBaseFileName": "a_file_name",
-                    "RuntimeLibrary": "1",
-                    "RuntimeTypeInfo": "true",
-                    "ShowIncludes": "true",
-                    "SmallerTypeCheck": "true",
-                    "StringPooling": "true",
-                    "StructMemberAlignment": "1",
-                    "SuppressStartupBanner": "true",
-                    "TreatWChar_tAsBuiltInType": "true",
-                    "UndefineAllPreprocessorDefinitions": "true",
-                    "UndefinePreprocessorDefinitions": "string1;string2",
-                    "UseFullPaths": "true",
-                    "UsePrecompiledHeader": "1",
-                    "UseUnicodeResponseFiles": "true",
-                    "WarnAsError": "true",
-                    "WarningLevel": "1",
-                    "WholeProgramOptimization": "true",
-                    "XMLDocumentationFileName": "a_file_name",
-                    "ZZXYZ": "bogus",
-                },
-                "VCLinkerTool": {
-                    "AdditionalDependencies": "file1;file2",
-                    "AdditionalDependencies_excluded": "file3",
-                    "AdditionalLibraryDirectories": "folder1;folder2",
-                    "AdditionalManifestDependencies": "file1;file2",
-                    "AdditionalOptions": "a string1",
-                    "AddModuleNamesToAssembly": "file1;file2",
-                    "AllowIsolation": "true",
-                    "AssemblyDebug": "2",
-                    "AssemblyLinkResource": "file1;file2",
-                    "BaseAddress": "a string1",
-                    "CLRImageType": "2",
-                    "CLRThreadAttribute": "2",
-                    "CLRUnmanagedCodeCheck": "true",
-                    "DataExecutionPrevention": "2",
-                    "DelayLoadDLLs": "file1;file2",
-                    "DelaySign": "true",
-                    "Driver": "2",
-                    "EmbedManagedResourceFile": "file1;file2",
-                    "EnableCOMDATFolding": "2",
-                    "EnableUAC": "true",
-                    "EntryPointSymbol": "a string1",
-                    "ErrorReporting": "2",
-                    "FixedBaseAddress": "2",
-                    "ForceSymbolReferences": "file1;file2",
-                    "FunctionOrder": "a_file_name",
-                    "GenerateDebugInformation": "true",
-                    "GenerateManifest": "true",
-                    "GenerateMapFile": "true",
-                    "HeapCommitSize": "a string1",
-                    "HeapReserveSize": "a string1",
-                    "IgnoreAllDefaultLibraries": "true",
-                    "IgnoreDefaultLibraryNames": "file1;file2",
-                    "IgnoreEmbeddedIDL": "true",
-                    "IgnoreImportLibrary": "true",
-                    "ImportLibrary": "a_file_name",
-                    "KeyContainer": "a_file_name",
-                    "KeyFile": "a_file_name",
-                    "LargeAddressAware": "2",
-                    "LinkIncremental": "2",
-                    "LinkLibraryDependencies": "true",
-                    "LinkTimeCodeGeneration": "2",
-                    "ManifestFile": "a_file_name",
-                    "MapExports": "true",
-                    "MapFileName": "a_file_name",
-                    "MergedIDLBaseFileName": "a_file_name",
-                    "MergeSections": "a string1",
-                    "MidlCommandFile": "a_file_name",
-                    "ModuleDefinitionFile": "a_file_name",
-                    "OptimizeForWindows98": "1",
-                    "OptimizeReferences": "2",
-                    "OutputFile": "a_file_name",
-                    "PerUserRedirection": "true",
-                    "Profile": "true",
-                    "ProfileGuidedDatabase": "a_file_name",
-                    "ProgramDatabaseFile": "a_file_name",
-                    "RandomizedBaseAddress": "2",
-                    "RegisterOutput": "true",
-                    "ResourceOnlyDLL": "true",
-                    "SetChecksum": "true",
-                    "ShowProgress": "2",
-                    "StackCommitSize": "a string1",
-                    "StackReserveSize": "a string1",
-                    "StripPrivateSymbols": "a_file_name",
-                    "SubSystem": "2",
-                    "SupportUnloadOfDelayLoadedDLL": "true",
-                    "SuppressStartupBanner": "true",
-                    "SwapRunFromCD": "true",
-                    "SwapRunFromNet": "true",
-                    "TargetMachine": "2",
-                    "TerminalServerAware": "2",
-                    "TurnOffAssemblyGeneration": "true",
-                    "TypeLibraryFile": "a_file_name",
-                    "TypeLibraryResourceID": "33",
-                    "UACExecutionLevel": "2",
-                    "UACUIAccess": "true",
-                    "UseLibraryDependencyInputs": "true",
-                    "UseUnicodeResponseFiles": "true",
-                    "Version": "a string1",
-                },
-                "VCMIDLTool": {
-                    "AdditionalIncludeDirectories": "folder1;folder2",
-                    "AdditionalOptions": "a string1",
-                    "CPreprocessOptions": "a string1",
-                    "DefaultCharType": "1",
-                    "DLLDataFileName": "a_file_name",
-                    "EnableErrorChecks": "1",
-                    "ErrorCheckAllocations": "true",
-                    "ErrorCheckBounds": "true",
-                    "ErrorCheckEnumRange": "true",
-                    "ErrorCheckRefPointers": "true",
-                    "ErrorCheckStubData": "true",
-                    "GenerateStublessProxies": "true",
-                    "GenerateTypeLibrary": "true",
-                    "HeaderFileName": "a_file_name",
-                    "IgnoreStandardIncludePath": "true",
-                    "InterfaceIdentifierFileName": "a_file_name",
-                    "MkTypLibCompatible": "true",
-                    "notgood": "bogus",
-                    "OutputDirectory": "a string1",
-                    "PreprocessorDefinitions": "string1;string2",
-                    "ProxyFileName": "a_file_name",
-                    "RedirectOutputAndErrors": "a_file_name",
-                    "StructMemberAlignment": "1",
-                    "SuppressStartupBanner": "true",
-                    "TargetEnvironment": "1",
-                    "TypeLibraryName": "a_file_name",
-                    "UndefinePreprocessorDefinitions": "string1;string2",
-                    "ValidateParameters": "true",
-                    "WarnAsError": "true",
-                    "WarningLevel": "1",
-                },
-                "VCResourceCompilerTool": {
-                    "AdditionalOptions": "a string1",
-                    "AdditionalIncludeDirectories": "folder1;folder2",
-                    "Culture": "1003",
-                    "IgnoreStandardIncludePath": "true",
-                    "notgood2": "bogus",
-                    "PreprocessorDefinitions": "string1;string2",
-                    "ResourceOutputFileName": "a string1",
-                    "ShowProgress": "true",
-                    "SuppressStartupBanner": "true",
-                    "UndefinePreprocessorDefinitions": "string1;string2",
-                },
-                "VCLibrarianTool": {
-                    "AdditionalDependencies": "file1;file2",
-                    "AdditionalLibraryDirectories": "folder1;folder2",
-                    "AdditionalOptions": "a string1",
-                    "ExportNamedFunctions": "string1;string2",
-                    "ForceSymbolReferences": "a string1",
-                    "IgnoreAllDefaultLibraries": "true",
-                    "IgnoreSpecificDefaultLibraries": "file1;file2",
-                    "LinkLibraryDependencies": "true",
-                    "ModuleDefinitionFile": "a_file_name",
-                    "OutputFile": "a_file_name",
-                    "SuppressStartupBanner": "true",
-                    "UseUnicodeResponseFiles": "true",
-                },
-                "VCManifestTool": {
-                    "AdditionalManifestFiles": "file1;file2",
-                    "AdditionalOptions": "a string1",
-                    "AssemblyIdentity": "a string1",
-                    "ComponentFileName": "a_file_name",
-                    "DependencyInformationFile": "a_file_name",
-                    "GenerateCatalogFiles": "true",
-                    "InputResourceManifests": "a string1",
-                    "ManifestResourceFile": "a_file_name",
-                    "OutputManifestFile": "a_file_name",
-                    "RegistrarScriptFile": "a_file_name",
-                    "ReplacementsFile": "a_file_name",
-                    "SuppressStartupBanner": "true",
-                    "TypeLibraryFile": "a_file_name",
-                    "UpdateFileHashes": "truel",
-                    "UpdateFileHashesSearchPath": "a_file_name",
-                    "UseFAT32Workaround": "true",
-                    "UseUnicodeResponseFiles": "true",
-                    "VerboseOutput": "true",
-                },
-            },
-            self.stderr,
-        )
-        self._ExpectedWarnings(
-            [
-                "Warning: for VCCLCompilerTool/BasicRuntimeChecks, "
-                "index value (5) not in expected range [0, 4)",
-                "Warning: for VCCLCompilerTool/BrowseInformation, "
-                "invalid literal for int() with base 10: 'fdkslj'",
-                "Warning: for VCCLCompilerTool/CallingConvention, "
-                "index value (-1) not in expected range [0, 4)",
-                "Warning: for VCCLCompilerTool/DebugInformationFormat, "
-                "converted value for 2 not specified.",
-                "Warning: unrecognized setting VCCLCompilerTool/Enableprefast",
-                "Warning: unrecognized setting VCCLCompilerTool/ZZXYZ",
-                "Warning: for VCLinkerTool/TargetMachine, "
-                "converted value for 2 not specified.",
-                "Warning: unrecognized setting VCMIDLTool/notgood",
-                "Warning: unrecognized setting VCResourceCompilerTool/notgood2",
-                "Warning: for VCManifestTool/UpdateFileHashes, "
-                "expected bool; got 'truel'"
-                "",
-            ]
-        )
-
-    def testValidateMSBuildSettings_settings(self):
-        """Tests that for invalid MSBuild settings."""
-        MSVSSettings.ValidateMSBuildSettings(
-            {
-                "ClCompile": {
-                    "AdditionalIncludeDirectories": "folder1;folder2",
-                    "AdditionalOptions": ["string1", "string2"],
-                    "AdditionalUsingDirectories": "folder1;folder2",
-                    "AssemblerListingLocation": "a_file_name",
-                    "AssemblerOutput": "NoListing",
-                    "BasicRuntimeChecks": "StackFrameRuntimeCheck",
-                    "BrowseInformation": "false",
-                    "BrowseInformationFile": "a_file_name",
-                    "BufferSecurityCheck": "true",
-                    "BuildingInIDE": "true",
-                    "CallingConvention": "Cdecl",
-                    "CompileAs": "CompileAsC",
-                    "CompileAsManaged": "true",
-                    "CreateHotpatchableImage": "true",
-                    "DebugInformationFormat": "ProgramDatabase",
-                    "DisableLanguageExtensions": "true",
-                    "DisableSpecificWarnings": "string1;string2",
-                    "EnableEnhancedInstructionSet": "StreamingSIMDExtensions",
-                    "EnableFiberSafeOptimizations": "true",
-                    "EnablePREfast": "true",
-                    "Enableprefast": "bogus",
-                    "ErrorReporting": "Prompt",
-                    "ExceptionHandling": "SyncCThrow",
-                    "ExpandAttributedSource": "true",
-                    "FavorSizeOrSpeed": "Neither",
-                    "FloatingPointExceptions": "true",
-                    "FloatingPointModel": "Precise",
-                    "ForceConformanceInForLoopScope": "true",
-                    "ForcedIncludeFiles": "file1;file2",
-                    "ForcedUsingFiles": "file1;file2",
-                    "FunctionLevelLinking": "false",
-                    "GenerateXMLDocumentationFiles": "true",
-                    "IgnoreStandardIncludePath": "true",
-                    "InlineFunctionExpansion": "OnlyExplicitInline",
-                    "IntrinsicFunctions": "false",
-                    "MinimalRebuild": "true",
-                    "MultiProcessorCompilation": "true",
-                    "ObjectFileName": "a_file_name",
-                    "OmitDefaultLibName": "true",
-                    "OmitFramePointers": "true",
-                    "OpenMPSupport": "true",
-                    "Optimization": "Disabled",
-                    "PrecompiledHeader": "NotUsing",
-                    "PrecompiledHeaderFile": "a_file_name",
-                    "PrecompiledHeaderOutputFile": "a_file_name",
-                    "PreprocessKeepComments": "true",
-                    "PreprocessorDefinitions": "string1;string2",
-                    "PreprocessOutputPath": "a string1",
-                    "PreprocessSuppressLineNumbers": "false",
-                    "PreprocessToFile": "false",
-                    "ProcessorNumber": "33",
-                    "ProgramDataBaseFileName": "a_file_name",
-                    "RuntimeLibrary": "MultiThreaded",
-                    "RuntimeTypeInfo": "true",
-                    "ShowIncludes": "true",
-                    "SmallerTypeCheck": "true",
-                    "StringPooling": "true",
-                    "StructMemberAlignment": "1Byte",
-                    "SuppressStartupBanner": "true",
-                    "TrackerLogDirectory": "a_folder",
-                    "TreatSpecificWarningsAsErrors": "string1;string2",
-                    "TreatWarningAsError": "true",
-                    "TreatWChar_tAsBuiltInType": "true",
-                    "UndefineAllPreprocessorDefinitions": "true",
-                    "UndefinePreprocessorDefinitions": "string1;string2",
-                    "UseFullPaths": "true",
-                    "UseUnicodeForAssemblerListing": "true",
-                    "WarningLevel": "TurnOffAllWarnings",
-                    "WholeProgramOptimization": "true",
-                    "XMLDocumentationFileName": "a_file_name",
-                    "ZZXYZ": "bogus",
-                },
-                "Link": {
-                    "AdditionalDependencies": "file1;file2",
-                    "AdditionalLibraryDirectories": "folder1;folder2",
-                    "AdditionalManifestDependencies": "file1;file2",
-                    "AdditionalOptions": "a string1",
-                    "AddModuleNamesToAssembly": "file1;file2",
-                    "AllowIsolation": "true",
-                    "AssemblyDebug": "",
-                    "AssemblyLinkResource": "file1;file2",
-                    "BaseAddress": "a string1",
-                    "BuildingInIDE": "true",
-                    "CLRImageType": "ForceIJWImage",
-                    "CLRSupportLastError": "Enabled",
-                    "CLRThreadAttribute": "MTAThreadingAttribute",
-                    "CLRUnmanagedCodeCheck": "true",
-                    "CreateHotPatchableImage": "X86Image",
-                    "DataExecutionPrevention": "false",
-                    "DelayLoadDLLs": "file1;file2",
-                    "DelaySign": "true",
-                    "Driver": "NotSet",
-                    "EmbedManagedResourceFile": "file1;file2",
-                    "EnableCOMDATFolding": "false",
-                    "EnableUAC": "true",
-                    "EntryPointSymbol": "a string1",
-                    "FixedBaseAddress": "false",
-                    "ForceFileOutput": "Enabled",
-                    "ForceSymbolReferences": "file1;file2",
-                    "FunctionOrder": "a_file_name",
-                    "GenerateDebugInformation": "true",
-                    "GenerateMapFile": "true",
-                    "HeapCommitSize": "a string1",
-                    "HeapReserveSize": "a string1",
-                    "IgnoreAllDefaultLibraries": "true",
-                    "IgnoreEmbeddedIDL": "true",
-                    "IgnoreSpecificDefaultLibraries": "a_file_list",
-                    "ImageHasSafeExceptionHandlers": "true",
-                    "ImportLibrary": "a_file_name",
-                    "KeyContainer": "a_file_name",
-                    "KeyFile": "a_file_name",
-                    "LargeAddressAware": "false",
-                    "LinkDLL": "true",
-                    "LinkErrorReporting": "SendErrorReport",
-                    "LinkStatus": "true",
-                    "LinkTimeCodeGeneration": "UseLinkTimeCodeGeneration",
-                    "ManifestFile": "a_file_name",
-                    "MapExports": "true",
-                    "MapFileName": "a_file_name",
-                    "MergedIDLBaseFileName": "a_file_name",
-                    "MergeSections": "a string1",
-                    "MidlCommandFile": "a_file_name",
-                    "MinimumRequiredVersion": "a string1",
-                    "ModuleDefinitionFile": "a_file_name",
-                    "MSDOSStubFileName": "a_file_name",
-                    "NoEntryPoint": "true",
-                    "OptimizeReferences": "false",
-                    "OutputFile": "a_file_name",
-                    "PerUserRedirection": "true",
-                    "PreventDllBinding": "true",
-                    "Profile": "true",
-                    "ProfileGuidedDatabase": "a_file_name",
-                    "ProgramDatabaseFile": "a_file_name",
-                    "RandomizedBaseAddress": "false",
-                    "RegisterOutput": "true",
-                    "SectionAlignment": "33",
-                    "SetChecksum": "true",
-                    "ShowProgress": "LinkVerboseREF",
-                    "SpecifySectionAttributes": "a string1",
-                    "StackCommitSize": "a string1",
-                    "StackReserveSize": "a string1",
-                    "StripPrivateSymbols": "a_file_name",
-                    "SubSystem": "Console",
-                    "SupportNobindOfDelayLoadedDLL": "true",
-                    "SupportUnloadOfDelayLoadedDLL": "true",
-                    "SuppressStartupBanner": "true",
-                    "SwapRunFromCD": "true",
-                    "SwapRunFromNET": "true",
-                    "TargetMachine": "MachineX86",
-                    "TerminalServerAware": "false",
-                    "TrackerLogDirectory": "a_folder",
-                    "TreatLinkerWarningAsErrors": "true",
-                    "TurnOffAssemblyGeneration": "true",
-                    "TypeLibraryFile": "a_file_name",
-                    "TypeLibraryResourceID": "33",
-                    "UACExecutionLevel": "AsInvoker",
-                    "UACUIAccess": "true",
-                    "Version": "a string1",
-                },
-                "ResourceCompile": {
-                    "AdditionalIncludeDirectories": "folder1;folder2",
-                    "AdditionalOptions": "a string1",
-                    "Culture": "0x236",
-                    "IgnoreStandardIncludePath": "true",
-                    "NullTerminateStrings": "true",
-                    "PreprocessorDefinitions": "string1;string2",
-                    "ResourceOutputFileName": "a string1",
-                    "ShowProgress": "true",
-                    "SuppressStartupBanner": "true",
-                    "TrackerLogDirectory": "a_folder",
-                    "UndefinePreprocessorDefinitions": "string1;string2",
-                },
-                "Midl": {
-                    "AdditionalIncludeDirectories": "folder1;folder2",
-                    "AdditionalOptions": "a string1",
-                    "ApplicationConfigurationMode": "true",
-                    "ClientStubFile": "a_file_name",
-                    "CPreprocessOptions": "a string1",
-                    "DefaultCharType": "Signed",
-                    "DllDataFileName": "a_file_name",
-                    "EnableErrorChecks": "EnableCustom",
-                    "ErrorCheckAllocations": "true",
-                    "ErrorCheckBounds": "true",
-                    "ErrorCheckEnumRange": "true",
-                    "ErrorCheckRefPointers": "true",
-                    "ErrorCheckStubData": "true",
-                    "GenerateClientFiles": "Stub",
-                    "GenerateServerFiles": "None",
-                    "GenerateStublessProxies": "true",
-                    "GenerateTypeLibrary": "true",
-                    "HeaderFileName": "a_file_name",
-                    "IgnoreStandardIncludePath": "true",
-                    "InterfaceIdentifierFileName": "a_file_name",
-                    "LocaleID": "33",
-                    "MkTypLibCompatible": "true",
-                    "OutputDirectory": "a string1",
-                    "PreprocessorDefinitions": "string1;string2",
-                    "ProxyFileName": "a_file_name",
-                    "RedirectOutputAndErrors": "a_file_name",
-                    "ServerStubFile": "a_file_name",
-                    "StructMemberAlignment": "NotSet",
-                    "SuppressCompilerWarnings": "true",
-                    "SuppressStartupBanner": "true",
-                    "TargetEnvironment": "Itanium",
-                    "TrackerLogDirectory": "a_folder",
-                    "TypeLibFormat": "NewFormat",
-                    "TypeLibraryName": "a_file_name",
-                    "UndefinePreprocessorDefinitions": "string1;string2",
-                    "ValidateAllParameters": "true",
-                    "WarnAsError": "true",
-                    "WarningLevel": "1",
-                },
-                "Lib": {
-                    "AdditionalDependencies": "file1;file2",
-                    "AdditionalLibraryDirectories": "folder1;folder2",
-                    "AdditionalOptions": "a string1",
-                    "DisplayLibrary": "a string1",
-                    "ErrorReporting": "PromptImmediately",
-                    "ExportNamedFunctions": "string1;string2",
-                    "ForceSymbolReferences": "a string1",
-                    "IgnoreAllDefaultLibraries": "true",
-                    "IgnoreSpecificDefaultLibraries": "file1;file2",
-                    "LinkTimeCodeGeneration": "true",
-                    "MinimumRequiredVersion": "a string1",
-                    "ModuleDefinitionFile": "a_file_name",
-                    "Name": "a_file_name",
-                    "OutputFile": "a_file_name",
-                    "RemoveObjects": "file1;file2",
-                    "SubSystem": "Console",
-                    "SuppressStartupBanner": "true",
-                    "TargetMachine": "MachineX86i",
-                    "TrackerLogDirectory": "a_folder",
-                    "TreatLibWarningAsErrors": "true",
-                    "UseUnicodeResponseFiles": "true",
-                    "Verbose": "true",
-                },
-                "Manifest": {
-                    "AdditionalManifestFiles": "file1;file2",
-                    "AdditionalOptions": "a string1",
-                    "AssemblyIdentity": "a string1",
-                    "ComponentFileName": "a_file_name",
-                    "EnableDPIAwareness": "fal",
-                    "GenerateCatalogFiles": "truel",
-                    "GenerateCategoryTags": "true",
-                    "InputResourceManifests": "a string1",
-                    "ManifestFromManagedAssembly": "a_file_name",
-                    "notgood3": "bogus",
-                    "OutputManifestFile": "a_file_name",
-                    "OutputResourceManifests": "a string1",
-                    "RegistrarScriptFile": "a_file_name",
-                    "ReplacementsFile": "a_file_name",
-                    "SuppressDependencyElement": "true",
-                    "SuppressStartupBanner": "true",
-                    "TrackerLogDirectory": "a_folder",
-                    "TypeLibraryFile": "a_file_name",
-                    "UpdateFileHashes": "true",
-                    "UpdateFileHashesSearchPath": "a_file_name",
-                    "VerboseOutput": "true",
-                },
-                "ProjectReference": {
-                    "LinkLibraryDependencies": "true",
-                    "UseLibraryDependencyInputs": "true",
-                },
-                "ManifestResourceCompile": {"ResourceOutputFileName": "a_file_name"},
-                "": {
-                    "EmbedManifest": "true",
-                    "GenerateManifest": "true",
-                    "IgnoreImportLibrary": "true",
-                    "LinkIncremental": "false",
-                },
-            },
-            self.stderr,
-        )
-        self._ExpectedWarnings(
-            [
-                "Warning: unrecognized setting ClCompile/Enableprefast",
-                "Warning: unrecognized setting ClCompile/ZZXYZ",
-                "Warning: unrecognized setting Manifest/notgood3",
-                "Warning: for Manifest/GenerateCatalogFiles, "
-                "expected bool; got 'truel'",
-                "Warning: for Lib/TargetMachine, unrecognized enumerated value "
-                "MachineX86i",
-                "Warning: for Manifest/EnableDPIAwareness, expected bool; got 'fal'",
-            ]
-        )
-
-    def testConvertToMSBuildSettings_empty(self):
-        """Tests an empty conversion."""
-        msvs_settings = {}
-        expected_msbuild_settings = {}
-        actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
-            msvs_settings, self.stderr
-        )
-        self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
-        self._ExpectedWarnings([])
-
-    def testConvertToMSBuildSettings_minimal(self):
-        """Tests a minimal conversion."""
-        msvs_settings = {
-            "VCCLCompilerTool": {
-                "AdditionalIncludeDirectories": "dir1",
-                "AdditionalOptions": "/foo",
-                "BasicRuntimeChecks": "0",
-            },
-            "VCLinkerTool": {
-                "LinkTimeCodeGeneration": "1",
-                "ErrorReporting": "1",
-                "DataExecutionPrevention": "2",
-            },
-        }
-        expected_msbuild_settings = {
-            "ClCompile": {
-                "AdditionalIncludeDirectories": "dir1",
-                "AdditionalOptions": "/foo",
-                "BasicRuntimeChecks": "Default",
-            },
-            "Link": {
-                "LinkTimeCodeGeneration": "UseLinkTimeCodeGeneration",
-                "LinkErrorReporting": "PromptImmediately",
-                "DataExecutionPrevention": "true",
-            },
-        }
-        actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
-            msvs_settings, self.stderr
-        )
-        self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
-        self._ExpectedWarnings([])
-
-    def testConvertToMSBuildSettings_warnings(self):
-        """Tests conversion that generates warnings."""
-        msvs_settings = {
-            "VCCLCompilerTool": {
-                "AdditionalIncludeDirectories": "1",
-                "AdditionalOptions": "2",
-                # These are incorrect values:
-                "BasicRuntimeChecks": "12",
-                "BrowseInformation": "21",
-                "UsePrecompiledHeader": "13",
-                "GeneratePreprocessedFile": "14",
-            },
-            "VCLinkerTool": {
-                # These are incorrect values:
-                "Driver": "10",
-                "LinkTimeCodeGeneration": "31",
-                "ErrorReporting": "21",
-                "FixedBaseAddress": "6",
-            },
-            "VCResourceCompilerTool": {
-                # Custom
-                "Culture": "1003"
-            },
-        }
-        expected_msbuild_settings = {
-            "ClCompile": {
-                "AdditionalIncludeDirectories": "1",
-                "AdditionalOptions": "2",
-            },
-            "Link": {},
-            "ResourceCompile": {
-                # Custom
-                "Culture": "0x03eb"
-            },
-        }
-        actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
-            msvs_settings, self.stderr
-        )
-        self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
-        self._ExpectedWarnings(
-            [
-                "Warning: while converting VCCLCompilerTool/BasicRuntimeChecks to "
-                "MSBuild, index value (12) not in expected range [0, 4)",
-                "Warning: while converting VCCLCompilerTool/BrowseInformation to "
-                "MSBuild, index value (21) not in expected range [0, 3)",
-                "Warning: while converting VCCLCompilerTool/UsePrecompiledHeader to "
-                "MSBuild, index value (13) not in expected range [0, 3)",
-                "Warning: while converting "
-                "VCCLCompilerTool/GeneratePreprocessedFile to "
-                "MSBuild, value must be one of [0, 1, 2]; got 14",
-                "Warning: while converting VCLinkerTool/Driver to "
-                "MSBuild, index value (10) not in expected range [0, 4)",
-                "Warning: while converting VCLinkerTool/LinkTimeCodeGeneration to "
-                "MSBuild, index value (31) not in expected range [0, 5)",
-                "Warning: while converting VCLinkerTool/ErrorReporting to "
-                "MSBuild, index value (21) not in expected range [0, 3)",
-                "Warning: while converting VCLinkerTool/FixedBaseAddress to "
-                "MSBuild, index value (6) not in expected range [0, 3)",
-            ]
-        )
-
-    def testConvertToMSBuildSettings_full_synthetic(self):
-        """Tests conversion of all the MSBuild settings."""
-        msvs_settings = {
-            "VCCLCompilerTool": {
-                "AdditionalIncludeDirectories": "folder1;folder2;folder3",
-                "AdditionalOptions": "a_string",
-                "AdditionalUsingDirectories": "folder1;folder2;folder3",
-                "AssemblerListingLocation": "a_file_name",
-                "AssemblerOutput": "0",
-                "BasicRuntimeChecks": "1",
-                "BrowseInformation": "2",
-                "BrowseInformationFile": "a_file_name",
-                "BufferSecurityCheck": "true",
-                "CallingConvention": "0",
-                "CompileAs": "1",
-                "DebugInformationFormat": "4",
-                "DefaultCharIsUnsigned": "true",
-                "Detect64BitPortabilityProblems": "true",
-                "DisableLanguageExtensions": "true",
-                "DisableSpecificWarnings": "d1;d2;d3",
-                "EnableEnhancedInstructionSet": "0",
-                "EnableFiberSafeOptimizations": "true",
-                "EnableFunctionLevelLinking": "true",
-                "EnableIntrinsicFunctions": "true",
-                "EnablePREfast": "true",
-                "ErrorReporting": "1",
-                "ExceptionHandling": "2",
-                "ExpandAttributedSource": "true",
-                "FavorSizeOrSpeed": "0",
-                "FloatingPointExceptions": "true",
-                "FloatingPointModel": "1",
-                "ForceConformanceInForLoopScope": "true",
-                "ForcedIncludeFiles": "file1;file2;file3",
-                "ForcedUsingFiles": "file1;file2;file3",
-                "GeneratePreprocessedFile": "1",
-                "GenerateXMLDocumentationFiles": "true",
-                "IgnoreStandardIncludePath": "true",
-                "InlineFunctionExpansion": "2",
-                "KeepComments": "true",
-                "MinimalRebuild": "true",
-                "ObjectFile": "a_file_name",
-                "OmitDefaultLibName": "true",
-                "OmitFramePointers": "true",
-                "OpenMP": "true",
-                "Optimization": "3",
-                "PrecompiledHeaderFile": "a_file_name",
-                "PrecompiledHeaderThrough": "a_file_name",
-                "PreprocessorDefinitions": "d1;d2;d3",
-                "ProgramDataBaseFileName": "a_file_name",
-                "RuntimeLibrary": "0",
-                "RuntimeTypeInfo": "true",
-                "ShowIncludes": "true",
-                "SmallerTypeCheck": "true",
-                "StringPooling": "true",
-                "StructMemberAlignment": "1",
-                "SuppressStartupBanner": "true",
-                "TreatWChar_tAsBuiltInType": "true",
-                "UndefineAllPreprocessorDefinitions": "true",
-                "UndefinePreprocessorDefinitions": "d1;d2;d3",
-                "UseFullPaths": "true",
-                "UsePrecompiledHeader": "1",
-                "UseUnicodeResponseFiles": "true",
-                "WarnAsError": "true",
-                "WarningLevel": "2",
-                "WholeProgramOptimization": "true",
-                "XMLDocumentationFileName": "a_file_name",
-            },
-            "VCLinkerTool": {
-                "AdditionalDependencies": "file1;file2;file3",
-                "AdditionalLibraryDirectories": "folder1;folder2;folder3",
-                "AdditionalLibraryDirectories_excluded": "folder1;folder2;folder3",
-                "AdditionalManifestDependencies": "file1;file2;file3",
-                "AdditionalOptions": "a_string",
-                "AddModuleNamesToAssembly": "file1;file2;file3",
-                "AllowIsolation": "true",
-                "AssemblyDebug": "0",
-                "AssemblyLinkResource": "file1;file2;file3",
-                "BaseAddress": "a_string",
-                "CLRImageType": "1",
-                "CLRThreadAttribute": "2",
-                "CLRUnmanagedCodeCheck": "true",
-                "DataExecutionPrevention": "0",
-                "DelayLoadDLLs": "file1;file2;file3",
-                "DelaySign": "true",
-                "Driver": "1",
-                "EmbedManagedResourceFile": "file1;file2;file3",
-                "EnableCOMDATFolding": "0",
-                "EnableUAC": "true",
-                "EntryPointSymbol": "a_string",
-                "ErrorReporting": "0",
-                "FixedBaseAddress": "1",
-                "ForceSymbolReferences": "file1;file2;file3",
-                "FunctionOrder": "a_file_name",
-                "GenerateDebugInformation": "true",
-                "GenerateManifest": "true",
-                "GenerateMapFile": "true",
-                "HeapCommitSize": "a_string",
-                "HeapReserveSize": "a_string",
-                "IgnoreAllDefaultLibraries": "true",
-                "IgnoreDefaultLibraryNames": "file1;file2;file3",
-                "IgnoreEmbeddedIDL": "true",
-                "IgnoreImportLibrary": "true",
-                "ImportLibrary": "a_file_name",
-                "KeyContainer": "a_file_name",
-                "KeyFile": "a_file_name",
-                "LargeAddressAware": "2",
-                "LinkIncremental": "1",
-                "LinkLibraryDependencies": "true",
-                "LinkTimeCodeGeneration": "2",
-                "ManifestFile": "a_file_name",
-                "MapExports": "true",
-                "MapFileName": "a_file_name",
-                "MergedIDLBaseFileName": "a_file_name",
-                "MergeSections": "a_string",
-                "MidlCommandFile": "a_file_name",
-                "ModuleDefinitionFile": "a_file_name",
-                "OptimizeForWindows98": "1",
-                "OptimizeReferences": "0",
-                "OutputFile": "a_file_name",
-                "PerUserRedirection": "true",
-                "Profile": "true",
-                "ProfileGuidedDatabase": "a_file_name",
-                "ProgramDatabaseFile": "a_file_name",
-                "RandomizedBaseAddress": "1",
-                "RegisterOutput": "true",
-                "ResourceOnlyDLL": "true",
-                "SetChecksum": "true",
-                "ShowProgress": "0",
-                "StackCommitSize": "a_string",
-                "StackReserveSize": "a_string",
-                "StripPrivateSymbols": "a_file_name",
-                "SubSystem": "2",
-                "SupportUnloadOfDelayLoadedDLL": "true",
-                "SuppressStartupBanner": "true",
-                "SwapRunFromCD": "true",
-                "SwapRunFromNet": "true",
-                "TargetMachine": "3",
-                "TerminalServerAware": "2",
-                "TurnOffAssemblyGeneration": "true",
-                "TypeLibraryFile": "a_file_name",
-                "TypeLibraryResourceID": "33",
-                "UACExecutionLevel": "1",
-                "UACUIAccess": "true",
-                "UseLibraryDependencyInputs": "false",
-                "UseUnicodeResponseFiles": "true",
-                "Version": "a_string",
-            },
-            "VCResourceCompilerTool": {
-                "AdditionalIncludeDirectories": "folder1;folder2;folder3",
-                "AdditionalOptions": "a_string",
-                "Culture": "1003",
-                "IgnoreStandardIncludePath": "true",
-                "PreprocessorDefinitions": "d1;d2;d3",
-                "ResourceOutputFileName": "a_string",
-                "ShowProgress": "true",
-                "SuppressStartupBanner": "true",
-                "UndefinePreprocessorDefinitions": "d1;d2;d3",
-            },
-            "VCMIDLTool": {
-                "AdditionalIncludeDirectories": "folder1;folder2;folder3",
-                "AdditionalOptions": "a_string",
-                "CPreprocessOptions": "a_string",
-                "DefaultCharType": "0",
-                "DLLDataFileName": "a_file_name",
-                "EnableErrorChecks": "2",
-                "ErrorCheckAllocations": "true",
-                "ErrorCheckBounds": "true",
-                "ErrorCheckEnumRange": "true",
-                "ErrorCheckRefPointers": "true",
-                "ErrorCheckStubData": "true",
-                "GenerateStublessProxies": "true",
-                "GenerateTypeLibrary": "true",
-                "HeaderFileName": "a_file_name",
-                "IgnoreStandardIncludePath": "true",
-                "InterfaceIdentifierFileName": "a_file_name",
-                "MkTypLibCompatible": "true",
-                "OutputDirectory": "a_string",
-                "PreprocessorDefinitions": "d1;d2;d3",
-                "ProxyFileName": "a_file_name",
-                "RedirectOutputAndErrors": "a_file_name",
-                "StructMemberAlignment": "3",
-                "SuppressStartupBanner": "true",
-                "TargetEnvironment": "1",
-                "TypeLibraryName": "a_file_name",
-                "UndefinePreprocessorDefinitions": "d1;d2;d3",
-                "ValidateParameters": "true",
-                "WarnAsError": "true",
-                "WarningLevel": "4",
-            },
-            "VCLibrarianTool": {
-                "AdditionalDependencies": "file1;file2;file3",
-                "AdditionalLibraryDirectories": "folder1;folder2;folder3",
-                "AdditionalLibraryDirectories_excluded": "folder1;folder2;folder3",
-                "AdditionalOptions": "a_string",
-                "ExportNamedFunctions": "d1;d2;d3",
-                "ForceSymbolReferences": "a_string",
-                "IgnoreAllDefaultLibraries": "true",
-                "IgnoreSpecificDefaultLibraries": "file1;file2;file3",
-                "LinkLibraryDependencies": "true",
-                "ModuleDefinitionFile": "a_file_name",
-                "OutputFile": "a_file_name",
-                "SuppressStartupBanner": "true",
-                "UseUnicodeResponseFiles": "true",
-            },
-            "VCManifestTool": {
-                "AdditionalManifestFiles": "file1;file2;file3",
-                "AdditionalOptions": "a_string",
-                "AssemblyIdentity": "a_string",
-                "ComponentFileName": "a_file_name",
-                "DependencyInformationFile": "a_file_name",
-                "EmbedManifest": "true",
-                "GenerateCatalogFiles": "true",
-                "InputResourceManifests": "a_string",
-                "ManifestResourceFile": "my_name",
-                "OutputManifestFile": "a_file_name",
-                "RegistrarScriptFile": "a_file_name",
-                "ReplacementsFile": "a_file_name",
-                "SuppressStartupBanner": "true",
-                "TypeLibraryFile": "a_file_name",
-                "UpdateFileHashes": "true",
-                "UpdateFileHashesSearchPath": "a_file_name",
-                "UseFAT32Workaround": "true",
-                "UseUnicodeResponseFiles": "true",
-                "VerboseOutput": "true",
-            },
-        }
-        expected_msbuild_settings = {
-            "ClCompile": {
-                "AdditionalIncludeDirectories": "folder1;folder2;folder3",
-                "AdditionalOptions": "a_string /J",
-                "AdditionalUsingDirectories": "folder1;folder2;folder3",
-                "AssemblerListingLocation": "a_file_name",
-                "AssemblerOutput": "NoListing",
-                "BasicRuntimeChecks": "StackFrameRuntimeCheck",
-                "BrowseInformation": "true",
-                "BrowseInformationFile": "a_file_name",
-                "BufferSecurityCheck": "true",
-                "CallingConvention": "Cdecl",
-                "CompileAs": "CompileAsC",
-                "DebugInformationFormat": "EditAndContinue",
-                "DisableLanguageExtensions": "true",
-                "DisableSpecificWarnings": "d1;d2;d3",
-                "EnableEnhancedInstructionSet": "NotSet",
-                "EnableFiberSafeOptimizations": "true",
-                "EnablePREfast": "true",
-                "ErrorReporting": "Prompt",
-                "ExceptionHandling": "Async",
-                "ExpandAttributedSource": "true",
-                "FavorSizeOrSpeed": "Neither",
-                "FloatingPointExceptions": "true",
-                "FloatingPointModel": "Strict",
-                "ForceConformanceInForLoopScope": "true",
-                "ForcedIncludeFiles": "file1;file2;file3",
-                "ForcedUsingFiles": "file1;file2;file3",
-                "FunctionLevelLinking": "true",
-                "GenerateXMLDocumentationFiles": "true",
-                "IgnoreStandardIncludePath": "true",
-                "InlineFunctionExpansion": "AnySuitable",
-                "IntrinsicFunctions": "true",
-                "MinimalRebuild": "true",
-                "ObjectFileName": "a_file_name",
-                "OmitDefaultLibName": "true",
-                "OmitFramePointers": "true",
-                "OpenMPSupport": "true",
-                "Optimization": "Full",
-                "PrecompiledHeader": "Create",
-                "PrecompiledHeaderFile": "a_file_name",
-                "PrecompiledHeaderOutputFile": "a_file_name",
-                "PreprocessKeepComments": "true",
-                "PreprocessorDefinitions": "d1;d2;d3",
-                "PreprocessSuppressLineNumbers": "false",
-                "PreprocessToFile": "true",
-                "ProgramDataBaseFileName": "a_file_name",
-                "RuntimeLibrary": "MultiThreaded",
-                "RuntimeTypeInfo": "true",
-                "ShowIncludes": "true",
-                "SmallerTypeCheck": "true",
-                "StringPooling": "true",
-                "StructMemberAlignment": "1Byte",
-                "SuppressStartupBanner": "true",
-                "TreatWarningAsError": "true",
-                "TreatWChar_tAsBuiltInType": "true",
-                "UndefineAllPreprocessorDefinitions": "true",
-                "UndefinePreprocessorDefinitions": "d1;d2;d3",
-                "UseFullPaths": "true",
-                "WarningLevel": "Level2",
-                "WholeProgramOptimization": "true",
-                "XMLDocumentationFileName": "a_file_name",
-            },
-            "Link": {
-                "AdditionalDependencies": "file1;file2;file3",
-                "AdditionalLibraryDirectories": "folder1;folder2;folder3",
-                "AdditionalManifestDependencies": "file1;file2;file3",
-                "AdditionalOptions": "a_string",
-                "AddModuleNamesToAssembly": "file1;file2;file3",
-                "AllowIsolation": "true",
-                "AssemblyDebug": "",
-                "AssemblyLinkResource": "file1;file2;file3",
-                "BaseAddress": "a_string",
-                "CLRImageType": "ForceIJWImage",
-                "CLRThreadAttribute": "STAThreadingAttribute",
-                "CLRUnmanagedCodeCheck": "true",
-                "DataExecutionPrevention": "",
-                "DelayLoadDLLs": "file1;file2;file3",
-                "DelaySign": "true",
-                "Driver": "Driver",
-                "EmbedManagedResourceFile": "file1;file2;file3",
-                "EnableCOMDATFolding": "",
-                "EnableUAC": "true",
-                "EntryPointSymbol": "a_string",
-                "FixedBaseAddress": "false",
-                "ForceSymbolReferences": "file1;file2;file3",
-                "FunctionOrder": "a_file_name",
-                "GenerateDebugInformation": "true",
-                "GenerateMapFile": "true",
-                "HeapCommitSize": "a_string",
-                "HeapReserveSize": "a_string",
-                "IgnoreAllDefaultLibraries": "true",
-                "IgnoreEmbeddedIDL": "true",
-                "IgnoreSpecificDefaultLibraries": "file1;file2;file3",
-                "ImportLibrary": "a_file_name",
-                "KeyContainer": "a_file_name",
-                "KeyFile": "a_file_name",
-                "LargeAddressAware": "true",
-                "LinkErrorReporting": "NoErrorReport",
-                "LinkTimeCodeGeneration": "PGInstrument",
-                "ManifestFile": "a_file_name",
-                "MapExports": "true",
-                "MapFileName": "a_file_name",
-                "MergedIDLBaseFileName": "a_file_name",
-                "MergeSections": "a_string",
-                "MidlCommandFile": "a_file_name",
-                "ModuleDefinitionFile": "a_file_name",
-                "NoEntryPoint": "true",
-                "OptimizeReferences": "",
-                "OutputFile": "a_file_name",
-                "PerUserRedirection": "true",
-                "Profile": "true",
-                "ProfileGuidedDatabase": "a_file_name",
-                "ProgramDatabaseFile": "a_file_name",
-                "RandomizedBaseAddress": "false",
-                "RegisterOutput": "true",
-                "SetChecksum": "true",
-                "ShowProgress": "NotSet",
-                "StackCommitSize": "a_string",
-                "StackReserveSize": "a_string",
-                "StripPrivateSymbols": "a_file_name",
-                "SubSystem": "Windows",
-                "SupportUnloadOfDelayLoadedDLL": "true",
-                "SuppressStartupBanner": "true",
-                "SwapRunFromCD": "true",
-                "SwapRunFromNET": "true",
-                "TargetMachine": "MachineARM",
-                "TerminalServerAware": "true",
-                "TurnOffAssemblyGeneration": "true",
-                "TypeLibraryFile": "a_file_name",
-                "TypeLibraryResourceID": "33",
-                "UACExecutionLevel": "HighestAvailable",
-                "UACUIAccess": "true",
-                "Version": "a_string",
-            },
-            "ResourceCompile": {
-                "AdditionalIncludeDirectories": "folder1;folder2;folder3",
-                "AdditionalOptions": "a_string",
-                "Culture": "0x03eb",
-                "IgnoreStandardIncludePath": "true",
-                "PreprocessorDefinitions": "d1;d2;d3",
-                "ResourceOutputFileName": "a_string",
-                "ShowProgress": "true",
-                "SuppressStartupBanner": "true",
-                "UndefinePreprocessorDefinitions": "d1;d2;d3",
-            },
-            "Midl": {
-                "AdditionalIncludeDirectories": "folder1;folder2;folder3",
-                "AdditionalOptions": "a_string",
-                "CPreprocessOptions": "a_string",
-                "DefaultCharType": "Unsigned",
-                "DllDataFileName": "a_file_name",
-                "EnableErrorChecks": "All",
-                "ErrorCheckAllocations": "true",
-                "ErrorCheckBounds": "true",
-                "ErrorCheckEnumRange": "true",
-                "ErrorCheckRefPointers": "true",
-                "ErrorCheckStubData": "true",
-                "GenerateStublessProxies": "true",
-                "GenerateTypeLibrary": "true",
-                "HeaderFileName": "a_file_name",
-                "IgnoreStandardIncludePath": "true",
-                "InterfaceIdentifierFileName": "a_file_name",
-                "MkTypLibCompatible": "true",
-                "OutputDirectory": "a_string",
-                "PreprocessorDefinitions": "d1;d2;d3",
-                "ProxyFileName": "a_file_name",
-                "RedirectOutputAndErrors": "a_file_name",
-                "StructMemberAlignment": "4",
-                "SuppressStartupBanner": "true",
-                "TargetEnvironment": "Win32",
-                "TypeLibraryName": "a_file_name",
-                "UndefinePreprocessorDefinitions": "d1;d2;d3",
-                "ValidateAllParameters": "true",
-                "WarnAsError": "true",
-                "WarningLevel": "4",
-            },
-            "Lib": {
-                "AdditionalDependencies": "file1;file2;file3",
-                "AdditionalLibraryDirectories": "folder1;folder2;folder3",
-                "AdditionalOptions": "a_string",
-                "ExportNamedFunctions": "d1;d2;d3",
-                "ForceSymbolReferences": "a_string",
-                "IgnoreAllDefaultLibraries": "true",
-                "IgnoreSpecificDefaultLibraries": "file1;file2;file3",
-                "ModuleDefinitionFile": "a_file_name",
-                "OutputFile": "a_file_name",
-                "SuppressStartupBanner": "true",
-                "UseUnicodeResponseFiles": "true",
-            },
-            "Manifest": {
-                "AdditionalManifestFiles": "file1;file2;file3",
-                "AdditionalOptions": "a_string",
-                "AssemblyIdentity": "a_string",
-                "ComponentFileName": "a_file_name",
-                "GenerateCatalogFiles": "true",
-                "InputResourceManifests": "a_string",
-                "OutputManifestFile": "a_file_name",
-                "RegistrarScriptFile": "a_file_name",
-                "ReplacementsFile": "a_file_name",
-                "SuppressStartupBanner": "true",
-                "TypeLibraryFile": "a_file_name",
-                "UpdateFileHashes": "true",
-                "UpdateFileHashesSearchPath": "a_file_name",
-                "VerboseOutput": "true",
-            },
-            "ManifestResourceCompile": {"ResourceOutputFileName": "my_name"},
-            "ProjectReference": {
-                "LinkLibraryDependencies": "true",
-                "UseLibraryDependencyInputs": "false",
-            },
-            "": {
-                "EmbedManifest": "true",
-                "GenerateManifest": "true",
-                "IgnoreImportLibrary": "true",
-                "LinkIncremental": "false",
-            },
-        }
-        self.maxDiff = 9999  # on failure display a long diff
-        actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
-            msvs_settings, self.stderr
-        )
-        self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
-        self._ExpectedWarnings([])
-
-    def testConvertToMSBuildSettings_actual(self):
-        """Tests the conversion of an actual project.
-
-    A VS2008 project with most of the options defined was created through the
-    VS2008 IDE.  It was then converted to VS2010.  The tool settings found in
-    the .vcproj and .vcxproj files were converted to the two dictionaries
-    msvs_settings and expected_msbuild_settings.
-
-    Note that for many settings, the VS2010 converter adds macros like
-    %(AdditionalIncludeDirectories) to make sure than inherited values are
-    included.  Since the Gyp projects we generate do not use inheritance,
-    we removed these macros.  They were:
-        ClCompile:
-            AdditionalIncludeDirectories:  ';%(AdditionalIncludeDirectories)'
-            AdditionalOptions:  ' %(AdditionalOptions)'
-            AdditionalUsingDirectories:  ';%(AdditionalUsingDirectories)'
-            DisableSpecificWarnings: ';%(DisableSpecificWarnings)',
-            ForcedIncludeFiles:  ';%(ForcedIncludeFiles)',
-            ForcedUsingFiles:  ';%(ForcedUsingFiles)',
-            PreprocessorDefinitions:  ';%(PreprocessorDefinitions)',
-            UndefinePreprocessorDefinitions:
-                ';%(UndefinePreprocessorDefinitions)',
-        Link:
-            AdditionalDependencies:  ';%(AdditionalDependencies)',
-            AdditionalLibraryDirectories:  ';%(AdditionalLibraryDirectories)',
-            AdditionalManifestDependencies:
-                ';%(AdditionalManifestDependencies)',
-            AdditionalOptions:  ' %(AdditionalOptions)',
-            AddModuleNamesToAssembly:  ';%(AddModuleNamesToAssembly)',
-            AssemblyLinkResource:  ';%(AssemblyLinkResource)',
-            DelayLoadDLLs:  ';%(DelayLoadDLLs)',
-            EmbedManagedResourceFile:  ';%(EmbedManagedResourceFile)',
-            ForceSymbolReferences:  ';%(ForceSymbolReferences)',
-            IgnoreSpecificDefaultLibraries:
-                ';%(IgnoreSpecificDefaultLibraries)',
-        ResourceCompile:
-            AdditionalIncludeDirectories:  ';%(AdditionalIncludeDirectories)',
-            AdditionalOptions:  ' %(AdditionalOptions)',
-            PreprocessorDefinitions:  ';%(PreprocessorDefinitions)',
-        Manifest:
-            AdditionalManifestFiles:  ';%(AdditionalManifestFiles)',
-            AdditionalOptions:  ' %(AdditionalOptions)',
-            InputResourceManifests:  ';%(InputResourceManifests)',
-    """
-        msvs_settings = {
-            "VCCLCompilerTool": {
-                "AdditionalIncludeDirectories": "dir1",
-                "AdditionalOptions": "/more",
-                "AdditionalUsingDirectories": "test",
-                "AssemblerListingLocation": "$(IntDir)\\a",
-                "AssemblerOutput": "1",
-                "BasicRuntimeChecks": "3",
-                "BrowseInformation": "1",
-                "BrowseInformationFile": "$(IntDir)\\e",
-                "BufferSecurityCheck": "false",
-                "CallingConvention": "1",
-                "CompileAs": "1",
-                "DebugInformationFormat": "4",
-                "DefaultCharIsUnsigned": "true",
-                "Detect64BitPortabilityProblems": "true",
-                "DisableLanguageExtensions": "true",
-                "DisableSpecificWarnings": "abc",
-                "EnableEnhancedInstructionSet": "1",
-                "EnableFiberSafeOptimizations": "true",
-                "EnableFunctionLevelLinking": "true",
-                "EnableIntrinsicFunctions": "true",
-                "EnablePREfast": "true",
-                "ErrorReporting": "2",
-                "ExceptionHandling": "2",
-                "ExpandAttributedSource": "true",
-                "FavorSizeOrSpeed": "2",
-                "FloatingPointExceptions": "true",
-                "FloatingPointModel": "1",
-                "ForceConformanceInForLoopScope": "false",
-                "ForcedIncludeFiles": "def",
-                "ForcedUsingFiles": "ge",
-                "GeneratePreprocessedFile": "2",
-                "GenerateXMLDocumentationFiles": "true",
-                "IgnoreStandardIncludePath": "true",
-                "InlineFunctionExpansion": "1",
-                "KeepComments": "true",
-                "MinimalRebuild": "true",
-                "ObjectFile": "$(IntDir)\\b",
-                "OmitDefaultLibName": "true",
-                "OmitFramePointers": "true",
-                "OpenMP": "true",
-                "Optimization": "3",
-                "PrecompiledHeaderFile": "$(IntDir)\\$(TargetName).pche",
-                "PrecompiledHeaderThrough": "StdAfx.hd",
-                "PreprocessorDefinitions": "WIN32;_DEBUG;_CONSOLE",
-                "ProgramDataBaseFileName": "$(IntDir)\\vc90b.pdb",
-                "RuntimeLibrary": "3",
-                "RuntimeTypeInfo": "false",
-                "ShowIncludes": "true",
-                "SmallerTypeCheck": "true",
-                "StringPooling": "true",
-                "StructMemberAlignment": "3",
-                "SuppressStartupBanner": "false",
-                "TreatWChar_tAsBuiltInType": "false",
-                "UndefineAllPreprocessorDefinitions": "true",
-                "UndefinePreprocessorDefinitions": "wer",
-                "UseFullPaths": "true",
-                "UsePrecompiledHeader": "0",
-                "UseUnicodeResponseFiles": "false",
-                "WarnAsError": "true",
-                "WarningLevel": "3",
-                "WholeProgramOptimization": "true",
-                "XMLDocumentationFileName": "$(IntDir)\\c",
-            },
-            "VCLinkerTool": {
-                "AdditionalDependencies": "zx",
-                "AdditionalLibraryDirectories": "asd",
-                "AdditionalManifestDependencies": "s2",
-                "AdditionalOptions": "/mor2",
-                "AddModuleNamesToAssembly": "d1",
-                "AllowIsolation": "false",
-                "AssemblyDebug": "1",
-                "AssemblyLinkResource": "d5",
-                "BaseAddress": "23423",
-                "CLRImageType": "3",
-                "CLRThreadAttribute": "1",
-                "CLRUnmanagedCodeCheck": "true",
-                "DataExecutionPrevention": "0",
-                "DelayLoadDLLs": "d4",
-                "DelaySign": "true",
-                "Driver": "2",
-                "EmbedManagedResourceFile": "d2",
-                "EnableCOMDATFolding": "1",
-                "EnableUAC": "false",
-                "EntryPointSymbol": "f5",
-                "ErrorReporting": "2",
-                "FixedBaseAddress": "1",
-                "ForceSymbolReferences": "d3",
-                "FunctionOrder": "fssdfsd",
-                "GenerateDebugInformation": "true",
-                "GenerateManifest": "false",
-                "GenerateMapFile": "true",
-                "HeapCommitSize": "13",
-                "HeapReserveSize": "12",
-                "IgnoreAllDefaultLibraries": "true",
-                "IgnoreDefaultLibraryNames": "flob;flok",
-                "IgnoreEmbeddedIDL": "true",
-                "IgnoreImportLibrary": "true",
-                "ImportLibrary": "f4",
-                "KeyContainer": "f7",
-                "KeyFile": "f6",
-                "LargeAddressAware": "2",
-                "LinkIncremental": "0",
-                "LinkLibraryDependencies": "false",
-                "LinkTimeCodeGeneration": "1",
-                "ManifestFile": "$(IntDir)\\$(TargetFileName).2intermediate.manifest",
-                "MapExports": "true",
-                "MapFileName": "d5",
-                "MergedIDLBaseFileName": "f2",
-                "MergeSections": "f5",
-                "MidlCommandFile": "f1",
-                "ModuleDefinitionFile": "sdsd",
-                "OptimizeForWindows98": "2",
-                "OptimizeReferences": "2",
-                "OutputFile": "$(OutDir)\\$(ProjectName)2.exe",
-                "PerUserRedirection": "true",
-                "Profile": "true",
-                "ProfileGuidedDatabase": "$(TargetDir)$(TargetName).pgdd",
-                "ProgramDatabaseFile": "Flob.pdb",
-                "RandomizedBaseAddress": "1",
-                "RegisterOutput": "true",
-                "ResourceOnlyDLL": "true",
-                "SetChecksum": "false",
-                "ShowProgress": "1",
-                "StackCommitSize": "15",
-                "StackReserveSize": "14",
-                "StripPrivateSymbols": "d3",
-                "SubSystem": "1",
-                "SupportUnloadOfDelayLoadedDLL": "true",
-                "SuppressStartupBanner": "false",
-                "SwapRunFromCD": "true",
-                "SwapRunFromNet": "true",
-                "TargetMachine": "1",
-                "TerminalServerAware": "1",
-                "TurnOffAssemblyGeneration": "true",
-                "TypeLibraryFile": "f3",
-                "TypeLibraryResourceID": "12",
-                "UACExecutionLevel": "2",
-                "UACUIAccess": "true",
-                "UseLibraryDependencyInputs": "true",
-                "UseUnicodeResponseFiles": "false",
-                "Version": "333",
-            },
-            "VCResourceCompilerTool": {
-                "AdditionalIncludeDirectories": "f3",
-                "AdditionalOptions": "/more3",
-                "Culture": "3084",
-                "IgnoreStandardIncludePath": "true",
-                "PreprocessorDefinitions": "_UNICODE;UNICODE2",
-                "ResourceOutputFileName": "$(IntDir)/$(InputName)3.res",
-                "ShowProgress": "true",
-            },
-            "VCManifestTool": {
-                "AdditionalManifestFiles": "sfsdfsd",
-                "AdditionalOptions": "afdsdafsd",
-                "AssemblyIdentity": "sddfdsadfsa",
-                "ComponentFileName": "fsdfds",
-                "DependencyInformationFile": "$(IntDir)\\mt.depdfd",
-                "EmbedManifest": "false",
-                "GenerateCatalogFiles": "true",
-                "InputResourceManifests": "asfsfdafs",
-                "ManifestResourceFile":
-                    "$(IntDir)\\$(TargetFileName).embed.manifest.resfdsf",
-                "OutputManifestFile": "$(TargetPath).manifestdfs",
-                "RegistrarScriptFile": "sdfsfd",
-                "ReplacementsFile": "sdffsd",
-                "SuppressStartupBanner": "false",
-                "TypeLibraryFile": "sfsd",
-                "UpdateFileHashes": "true",
-                "UpdateFileHashesSearchPath": "sfsd",
-                "UseFAT32Workaround": "true",
-                "UseUnicodeResponseFiles": "false",
-                "VerboseOutput": "true",
-            },
-        }
-        expected_msbuild_settings = {
-            "ClCompile": {
-                "AdditionalIncludeDirectories": "dir1",
-                "AdditionalOptions": "/more /J",
-                "AdditionalUsingDirectories": "test",
-                "AssemblerListingLocation": "$(IntDir)a",
-                "AssemblerOutput": "AssemblyCode",
-                "BasicRuntimeChecks": "EnableFastChecks",
-                "BrowseInformation": "true",
-                "BrowseInformationFile": "$(IntDir)e",
-                "BufferSecurityCheck": "false",
-                "CallingConvention": "FastCall",
-                "CompileAs": "CompileAsC",
-                "DebugInformationFormat": "EditAndContinue",
-                "DisableLanguageExtensions": "true",
-                "DisableSpecificWarnings": "abc",
-                "EnableEnhancedInstructionSet": "StreamingSIMDExtensions",
-                "EnableFiberSafeOptimizations": "true",
-                "EnablePREfast": "true",
-                "ErrorReporting": "Queue",
-                "ExceptionHandling": "Async",
-                "ExpandAttributedSource": "true",
-                "FavorSizeOrSpeed": "Size",
-                "FloatingPointExceptions": "true",
-                "FloatingPointModel": "Strict",
-                "ForceConformanceInForLoopScope": "false",
-                "ForcedIncludeFiles": "def",
-                "ForcedUsingFiles": "ge",
-                "FunctionLevelLinking": "true",
-                "GenerateXMLDocumentationFiles": "true",
-                "IgnoreStandardIncludePath": "true",
-                "InlineFunctionExpansion": "OnlyExplicitInline",
-                "IntrinsicFunctions": "true",
-                "MinimalRebuild": "true",
-                "ObjectFileName": "$(IntDir)b",
-                "OmitDefaultLibName": "true",
-                "OmitFramePointers": "true",
-                "OpenMPSupport": "true",
-                "Optimization": "Full",
-                "PrecompiledHeader": "NotUsing",  # Actual conversion gives ''
-                "PrecompiledHeaderFile": "StdAfx.hd",
-                "PrecompiledHeaderOutputFile": "$(IntDir)$(TargetName).pche",
-                "PreprocessKeepComments": "true",
-                "PreprocessorDefinitions": "WIN32;_DEBUG;_CONSOLE",
-                "PreprocessSuppressLineNumbers": "true",
-                "PreprocessToFile": "true",
-                "ProgramDataBaseFileName": "$(IntDir)vc90b.pdb",
-                "RuntimeLibrary": "MultiThreadedDebugDLL",
-                "RuntimeTypeInfo": "false",
-                "ShowIncludes": "true",
-                "SmallerTypeCheck": "true",
-                "StringPooling": "true",
-                "StructMemberAlignment": "4Bytes",
-                "SuppressStartupBanner": "false",
-                "TreatWarningAsError": "true",
-                "TreatWChar_tAsBuiltInType": "false",
-                "UndefineAllPreprocessorDefinitions": "true",
-                "UndefinePreprocessorDefinitions": "wer",
-                "UseFullPaths": "true",
-                "WarningLevel": "Level3",
-                "WholeProgramOptimization": "true",
-                "XMLDocumentationFileName": "$(IntDir)c",
-            },
-            "Link": {
-                "AdditionalDependencies": "zx",
-                "AdditionalLibraryDirectories": "asd",
-                "AdditionalManifestDependencies": "s2",
-                "AdditionalOptions": "/mor2",
-                "AddModuleNamesToAssembly": "d1",
-                "AllowIsolation": "false",
-                "AssemblyDebug": "true",
-                "AssemblyLinkResource": "d5",
-                "BaseAddress": "23423",
-                "CLRImageType": "ForceSafeILImage",
-                "CLRThreadAttribute": "MTAThreadingAttribute",
-                "CLRUnmanagedCodeCheck": "true",
-                "DataExecutionPrevention": "",
-                "DelayLoadDLLs": "d4",
-                "DelaySign": "true",
-                "Driver": "UpOnly",
-                "EmbedManagedResourceFile": "d2",
-                "EnableCOMDATFolding": "false",
-                "EnableUAC": "false",
-                "EntryPointSymbol": "f5",
-                "FixedBaseAddress": "false",
-                "ForceSymbolReferences": "d3",
-                "FunctionOrder": "fssdfsd",
-                "GenerateDebugInformation": "true",
-                "GenerateMapFile": "true",
-                "HeapCommitSize": "13",
-                "HeapReserveSize": "12",
-                "IgnoreAllDefaultLibraries": "true",
-                "IgnoreEmbeddedIDL": "true",
-                "IgnoreSpecificDefaultLibraries": "flob;flok",
-                "ImportLibrary": "f4",
-                "KeyContainer": "f7",
-                "KeyFile": "f6",
-                "LargeAddressAware": "true",
-                "LinkErrorReporting": "QueueForNextLogin",
-                "LinkTimeCodeGeneration": "UseLinkTimeCodeGeneration",
-                "ManifestFile": "$(IntDir)$(TargetFileName).2intermediate.manifest",
-                "MapExports": "true",
-                "MapFileName": "d5",
-                "MergedIDLBaseFileName": "f2",
-                "MergeSections": "f5",
-                "MidlCommandFile": "f1",
-                "ModuleDefinitionFile": "sdsd",
-                "NoEntryPoint": "true",
-                "OptimizeReferences": "true",
-                "OutputFile": "$(OutDir)$(ProjectName)2.exe",
-                "PerUserRedirection": "true",
-                "Profile": "true",
-                "ProfileGuidedDatabase": "$(TargetDir)$(TargetName).pgdd",
-                "ProgramDatabaseFile": "Flob.pdb",
-                "RandomizedBaseAddress": "false",
-                "RegisterOutput": "true",
-                "SetChecksum": "false",
-                "ShowProgress": "LinkVerbose",
-                "StackCommitSize": "15",
-                "StackReserveSize": "14",
-                "StripPrivateSymbols": "d3",
-                "SubSystem": "Console",
-                "SupportUnloadOfDelayLoadedDLL": "true",
-                "SuppressStartupBanner": "false",
-                "SwapRunFromCD": "true",
-                "SwapRunFromNET": "true",
-                "TargetMachine": "MachineX86",
-                "TerminalServerAware": "false",
-                "TurnOffAssemblyGeneration": "true",
-                "TypeLibraryFile": "f3",
-                "TypeLibraryResourceID": "12",
-                "UACExecutionLevel": "RequireAdministrator",
-                "UACUIAccess": "true",
-                "Version": "333",
-            },
-            "ResourceCompile": {
-                "AdditionalIncludeDirectories": "f3",
-                "AdditionalOptions": "/more3",
-                "Culture": "0x0c0c",
-                "IgnoreStandardIncludePath": "true",
-                "PreprocessorDefinitions": "_UNICODE;UNICODE2",
-                "ResourceOutputFileName": "$(IntDir)%(Filename)3.res",
-                "ShowProgress": "true",
-            },
-            "Manifest": {
-                "AdditionalManifestFiles": "sfsdfsd",
-                "AdditionalOptions": "afdsdafsd",
-                "AssemblyIdentity": "sddfdsadfsa",
-                "ComponentFileName": "fsdfds",
-                "GenerateCatalogFiles": "true",
-                "InputResourceManifests": "asfsfdafs",
-                "OutputManifestFile": "$(TargetPath).manifestdfs",
-                "RegistrarScriptFile": "sdfsfd",
-                "ReplacementsFile": "sdffsd",
-                "SuppressStartupBanner": "false",
-                "TypeLibraryFile": "sfsd",
-                "UpdateFileHashes": "true",
-                "UpdateFileHashesSearchPath": "sfsd",
-                "VerboseOutput": "true",
-            },
-            "ProjectReference": {
-                "LinkLibraryDependencies": "false",
-                "UseLibraryDependencyInputs": "true",
-            },
-            "": {
-                "EmbedManifest": "false",
-                "GenerateManifest": "false",
-                "IgnoreImportLibrary": "true",
-                "LinkIncremental": "",
-            },
-            "ManifestResourceCompile": {
-                "ResourceOutputFileName":
-                    "$(IntDir)$(TargetFileName).embed.manifest.resfdsf"
-            },
-        }
-        self.maxDiff = 9999  # on failure display a long diff
-        actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
-            msvs_settings, self.stderr
-        )
-        self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
-        self._ExpectedWarnings([])
-
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py
deleted file mode 100644
index 2e5c811bdde32..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Visual Studio project reader/writer."""
-
-import gyp.easy_xml as easy_xml
-
-
-class Writer:
-    """Visual Studio XML tool file writer."""
-
-    def __init__(self, tool_file_path, name):
-        """Initializes the tool file.
-
-    Args:
-      tool_file_path: Path to the tool file.
-      name: Name of the tool file.
-    """
-        self.tool_file_path = tool_file_path
-        self.name = name
-        self.rules_section = ["Rules"]
-
-    def AddCustomBuildRule(
-        self, name, cmd, description, additional_dependencies, outputs, extensions
-    ):
-        """Adds a rule to the tool file.
-
-    Args:
-      name: Name of the rule.
-      description: Description of the rule.
-      cmd: Command line of the rule.
-      additional_dependencies: other files which may trigger the rule.
-      outputs: outputs of the rule.
-      extensions: extensions handled by the rule.
-    """
-        rule = [
-            "CustomBuildRule",
-            {
-                "Name": name,
-                "ExecutionDescription": description,
-                "CommandLine": cmd,
-                "Outputs": ";".join(outputs),
-                "FileExtensions": ";".join(extensions),
-                "AdditionalDependencies": ";".join(additional_dependencies),
-            },
-        ]
-        self.rules_section.append(rule)
-
-    def WriteIfChanged(self):
-        """Writes the tool file."""
-        content = [
-            "VisualStudioToolFile",
-            {"Version": "8.00", "Name": self.name},
-            self.rules_section,
-        ]
-        easy_xml.WriteXmlIfChanged(
-            content, self.tool_file_path, encoding="Windows-1252"
-        )
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py
deleted file mode 100644
index e580c00fb76d3..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py
+++ /dev/null
@@ -1,153 +0,0 @@
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Visual Studio user preferences file writer."""
-
-import os
-import re
-import socket  # for gethostname
-
-import gyp.easy_xml as easy_xml
-
-
-# ------------------------------------------------------------------------------
-
-
-def _FindCommandInPath(command):
-    """If there are no slashes in the command given, this function
-     searches the PATH env to find the given command, and converts it
-     to an absolute path.  We have to do this because MSVS is looking
-     for an actual file to launch a debugger on, not just a command
-     line.  Note that this happens at GYP time, so anything needing to
-     be built needs to have a full path."""
-    if "/" in command or "\\" in command:
-        # If the command already has path elements (either relative or
-        # absolute), then assume it is constructed properly.
-        return command
-    else:
-        # Search through the path list and find an existing file that
-        # we can access.
-        paths = os.environ.get("PATH", "").split(os.pathsep)
-        for path in paths:
-            item = os.path.join(path, command)
-            if os.path.isfile(item) and os.access(item, os.X_OK):
-                return item
-    return command
-
-
-def _QuoteWin32CommandLineArgs(args):
-    new_args = []
-    for arg in args:
-        # Replace all double-quotes with double-double-quotes to escape
-        # them for cmd shell, and then quote the whole thing if there
-        # are any.
-        if arg.find('"') != -1:
-            arg = '""'.join(arg.split('"'))
-            arg = '"%s"' % arg
-
-        # Otherwise, if there are any spaces, quote the whole arg.
-        elif re.search(r"[ \t\n]", arg):
-            arg = '"%s"' % arg
-        new_args.append(arg)
-    return new_args
-
-
-class Writer:
-    """Visual Studio XML user user file writer."""
-
-    def __init__(self, user_file_path, version, name):
-        """Initializes the user file.
-
-    Args:
-      user_file_path: Path to the user file.
-      version: Version info.
-      name: Name of the user file.
-    """
-        self.user_file_path = user_file_path
-        self.version = version
-        self.name = name
-        self.configurations = {}
-
-    def AddConfig(self, name):
-        """Adds a configuration to the project.
-
-    Args:
-      name: Configuration name.
-    """
-        self.configurations[name] = ["Configuration", {"Name": name}]
-
-    def AddDebugSettings(
-        self, config_name, command, environment={}, working_directory=""
-    ):
-        """Adds a DebugSettings node to the user file for a particular config.
-
-    Args:
-      command: command line to run.  First element in the list is the
-        executable.  All elements of the command will be quoted if
-        necessary.
-      working_directory: other files which may trigger the rule. (optional)
-    """
-        command = _QuoteWin32CommandLineArgs(command)
-
-        abs_command = _FindCommandInPath(command[0])
-
-        if environment and isinstance(environment, dict):
-            env_list = [f'{key}="{val}"' for (key, val) in environment.items()]
-            environment = " ".join(env_list)
-        else:
-            environment = ""
-
-        n_cmd = [
-            "DebugSettings",
-            {
-                "Command": abs_command,
-                "WorkingDirectory": working_directory,
-                "CommandArguments": " ".join(command[1:]),
-                "RemoteMachine": socket.gethostname(),
-                "Environment": environment,
-                "EnvironmentMerge": "true",
-                # Currently these are all "dummy" values that we're just setting
-                # in the default manner that MSVS does it.  We could use some of
-                # these to add additional capabilities, I suppose, but they might
-                # not have parity with other platforms then.
-                "Attach": "false",
-                "DebuggerType": "3",  # 'auto' debugger
-                "Remote": "1",
-                "RemoteCommand": "",
-                "HttpUrl": "",
-                "PDBPath": "",
-                "SQLDebugging": "",
-                "DebuggerFlavor": "0",
-                "MPIRunCommand": "",
-                "MPIRunArguments": "",
-                "MPIRunWorkingDirectory": "",
-                "ApplicationCommand": "",
-                "ApplicationArguments": "",
-                "ShimCommand": "",
-                "MPIAcceptMode": "",
-                "MPIAcceptFilter": "",
-            },
-        ]
-
-        # Find the config, and add it if it doesn't exist.
-        if config_name not in self.configurations:
-            self.AddConfig(config_name)
-
-        # Add the DebugSettings onto the appropriate config.
-        self.configurations[config_name].append(n_cmd)
-
-    def WriteIfChanged(self):
-        """Writes the user file."""
-        configs = ["Configurations"]
-        for config, spec in sorted(self.configurations.items()):
-            configs.append(spec)
-
-        content = [
-            "VisualStudioUserFile",
-            {"Version": self.version.ProjectVersion(), "Name": self.name},
-            configs,
-        ]
-        easy_xml.WriteXmlIfChanged(
-            content, self.user_file_path, encoding="Windows-1252"
-        )
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py
deleted file mode 100644
index 36bb782bd319a..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py
+++ /dev/null
@@ -1,271 +0,0 @@
-# Copyright (c) 2013 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Utility functions shared amongst the Windows generators."""
-
-import copy
-import os
-
-
-# A dictionary mapping supported target types to extensions.
-TARGET_TYPE_EXT = {
-    "executable": "exe",
-    "loadable_module": "dll",
-    "shared_library": "dll",
-    "static_library": "lib",
-    "windows_driver": "sys",
-}
-
-
-def _GetLargePdbShimCcPath():
-    """Returns the path of the large_pdb_shim.cc file."""
-    this_dir = os.path.abspath(os.path.dirname(__file__))
-    src_dir = os.path.abspath(os.path.join(this_dir, "..", ".."))
-    win_data_dir = os.path.join(src_dir, "data", "win")
-    large_pdb_shim_cc = os.path.join(win_data_dir, "large-pdb-shim.cc")
-    return large_pdb_shim_cc
-
-
-def _DeepCopySomeKeys(in_dict, keys):
-    """Performs a partial deep-copy on |in_dict|, only copying the keys in |keys|.
-
-  Arguments:
-    in_dict: The dictionary to copy.
-    keys: The keys to be copied. If a key is in this list and doesn't exist in
-        |in_dict| this is not an error.
-  Returns:
-    The partially deep-copied dictionary.
-  """
-    d = {}
-    for key in keys:
-        if key not in in_dict:
-            continue
-        d[key] = copy.deepcopy(in_dict[key])
-    return d
-
-
-def _SuffixName(name, suffix):
-    """Add a suffix to the end of a target.
-
-  Arguments:
-    name: name of the target (foo#target)
-    suffix: the suffix to be added
-  Returns:
-    Target name with suffix added (foo_suffix#target)
-  """
-    parts = name.rsplit("#", 1)
-    parts[0] = f"{parts[0]}_{suffix}"
-    return "#".join(parts)
-
-
-def _ShardName(name, number):
-    """Add a shard number to the end of a target.
-
-  Arguments:
-    name: name of the target (foo#target)
-    number: shard number
-  Returns:
-    Target name with shard added (foo_1#target)
-  """
-    return _SuffixName(name, str(number))
-
-
-def ShardTargets(target_list, target_dicts):
-    """Shard some targets apart to work around the linkers limits.
-
-  Arguments:
-    target_list: List of target pairs: 'base/base.gyp:base'.
-    target_dicts: Dict of target properties keyed on target pair.
-  Returns:
-    Tuple of the new sharded versions of the inputs.
-  """
-    # Gather the targets to shard, and how many pieces.
-    targets_to_shard = {}
-    for t in target_dicts:
-        shards = int(target_dicts[t].get("msvs_shard", 0))
-        if shards:
-            targets_to_shard[t] = shards
-    # Shard target_list.
-    new_target_list = []
-    for t in target_list:
-        if t in targets_to_shard:
-            for i in range(targets_to_shard[t]):
-                new_target_list.append(_ShardName(t, i))
-        else:
-            new_target_list.append(t)
-    # Shard target_dict.
-    new_target_dicts = {}
-    for t in target_dicts:
-        if t in targets_to_shard:
-            for i in range(targets_to_shard[t]):
-                name = _ShardName(t, i)
-                new_target_dicts[name] = copy.copy(target_dicts[t])
-                new_target_dicts[name]["target_name"] = _ShardName(
-                    new_target_dicts[name]["target_name"], i
-                )
-                sources = new_target_dicts[name].get("sources", [])
-                new_sources = []
-                for pos in range(i, len(sources), targets_to_shard[t]):
-                    new_sources.append(sources[pos])
-                new_target_dicts[name]["sources"] = new_sources
-        else:
-            new_target_dicts[t] = target_dicts[t]
-    # Shard dependencies.
-    for t in sorted(new_target_dicts):
-        for deptype in ("dependencies", "dependencies_original"):
-            dependencies = copy.copy(new_target_dicts[t].get(deptype, []))
-            new_dependencies = []
-            for d in dependencies:
-                if d in targets_to_shard:
-                    for i in range(targets_to_shard[d]):
-                        new_dependencies.append(_ShardName(d, i))
-                else:
-                    new_dependencies.append(d)
-            new_target_dicts[t][deptype] = new_dependencies
-
-    return (new_target_list, new_target_dicts)
-
-
-def _GetPdbPath(target_dict, config_name, vars):
-    """Returns the path to the PDB file that will be generated by a given
-  configuration.
-
-  The lookup proceeds as follows:
-    - Look for an explicit path in the VCLinkerTool configuration block.
-    - Look for an 'msvs_large_pdb_path' variable.
-    - Use '<(PRODUCT_DIR)/<(product_name).(exe|dll).pdb' if 'product_name' is
-      specified.
-    - Use '<(PRODUCT_DIR)/<(target_name).(exe|dll).pdb'.
-
-  Arguments:
-    target_dict: The target dictionary to be searched.
-    config_name: The name of the configuration of interest.
-    vars: A dictionary of common GYP variables with generator-specific values.
-  Returns:
-    The path of the corresponding PDB file.
-  """
-    config = target_dict["configurations"][config_name]
-    msvs = config.setdefault("msvs_settings", {})
-
-    linker = msvs.get("VCLinkerTool", {})
-
-    pdb_path = linker.get("ProgramDatabaseFile")
-    if pdb_path:
-        return pdb_path
-
-    variables = target_dict.get("variables", {})
-    pdb_path = variables.get("msvs_large_pdb_path", None)
-    if pdb_path:
-        return pdb_path
-
-    pdb_base = target_dict.get("product_name", target_dict["target_name"])
-    pdb_base = "{}.{}.pdb".format(pdb_base, TARGET_TYPE_EXT[target_dict["type"]])
-    pdb_path = vars["PRODUCT_DIR"] + "/" + pdb_base
-
-    return pdb_path
-
-
-def InsertLargePdbShims(target_list, target_dicts, vars):
-    """Insert a shim target that forces the linker to use 4KB pagesize PDBs.
-
-  This is a workaround for targets with PDBs greater than 1GB in size, the
-  limit for the 1KB pagesize PDBs created by the linker by default.
-
-  Arguments:
-    target_list: List of target pairs: 'base/base.gyp:base'.
-    target_dicts: Dict of target properties keyed on target pair.
-    vars: A dictionary of common GYP variables with generator-specific values.
-  Returns:
-    Tuple of the shimmed version of the inputs.
-  """
-    # Determine which targets need shimming.
-    targets_to_shim = []
-    for t in target_dicts:
-        target_dict = target_dicts[t]
-
-        # We only want to shim targets that have msvs_large_pdb enabled.
-        if not int(target_dict.get("msvs_large_pdb", 0)):
-            continue
-        # This is intended for executable, shared_library and loadable_module
-        # targets where every configuration is set up to produce a PDB output.
-        # If any of these conditions is not true then the shim logic will fail
-        # below.
-        targets_to_shim.append(t)
-
-    large_pdb_shim_cc = _GetLargePdbShimCcPath()
-
-    for t in targets_to_shim:
-        target_dict = target_dicts[t]
-        target_name = target_dict.get("target_name")
-
-        base_dict = _DeepCopySomeKeys(
-            target_dict, ["configurations", "default_configuration", "toolset"]
-        )
-
-        # This is the dict for copying the source file (part of the GYP tree)
-        # to the intermediate directory of the project. This is necessary because
-        # we can't always build a relative path to the shim source file (on Windows
-        # GYP and the project may be on different drives), and Ninja hates absolute
-        # paths (it ends up generating the .obj and .obj.d alongside the source
-        # file, polluting GYPs tree).
-        copy_suffix = "large_pdb_copy"
-        copy_target_name = target_name + "_" + copy_suffix
-        full_copy_target_name = _SuffixName(t, copy_suffix)
-        shim_cc_basename = os.path.basename(large_pdb_shim_cc)
-        shim_cc_dir = vars["SHARED_INTERMEDIATE_DIR"] + "/" + copy_target_name
-        shim_cc_path = shim_cc_dir + "/" + shim_cc_basename
-        copy_dict = copy.deepcopy(base_dict)
-        copy_dict["target_name"] = copy_target_name
-        copy_dict["type"] = "none"
-        copy_dict["sources"] = [large_pdb_shim_cc]
-        copy_dict["copies"] = [
-            {"destination": shim_cc_dir, "files": [large_pdb_shim_cc]}
-        ]
-
-        # This is the dict for the PDB generating shim target. It depends on the
-        # copy target.
-        shim_suffix = "large_pdb_shim"
-        shim_target_name = target_name + "_" + shim_suffix
-        full_shim_target_name = _SuffixName(t, shim_suffix)
-        shim_dict = copy.deepcopy(base_dict)
-        shim_dict["target_name"] = shim_target_name
-        shim_dict["type"] = "static_library"
-        shim_dict["sources"] = [shim_cc_path]
-        shim_dict["dependencies"] = [full_copy_target_name]
-
-        # Set up the shim to output its PDB to the same location as the final linker
-        # target.
-        for config_name, config in shim_dict.get("configurations").items():
-            pdb_path = _GetPdbPath(target_dict, config_name, vars)
-
-            # A few keys that we don't want to propagate.
-            for key in ["msvs_precompiled_header", "msvs_precompiled_source", "test"]:
-                config.pop(key, None)
-
-            msvs = config.setdefault("msvs_settings", {})
-
-            # Update the compiler directives in the shim target.
-            compiler = msvs.setdefault("VCCLCompilerTool", {})
-            compiler["DebugInformationFormat"] = "3"
-            compiler["ProgramDataBaseFileName"] = pdb_path
-
-            # Set the explicit PDB path in the appropriate configuration of the
-            # original target.
-            config = target_dict["configurations"][config_name]
-            msvs = config.setdefault("msvs_settings", {})
-            linker = msvs.setdefault("VCLinkerTool", {})
-            linker["GenerateDebugInformation"] = "true"
-            linker["ProgramDatabaseFile"] = pdb_path
-
-        # Add the new targets. They must go to the beginning of the list so that
-        # the dependency generation works as expected in ninja.
-        target_list.insert(0, full_copy_target_name)
-        target_list.insert(0, full_shim_target_name)
-        target_dicts[full_copy_target_name] = copy_dict
-        target_dicts[full_shim_target_name] = shim_dict
-
-        # Update the original target to depend on the shim target.
-        target_dict.setdefault("dependencies", []).append(full_shim_target_name)
-
-    return (target_list, target_dicts)
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
deleted file mode 100644
index 8d7f21e82dd2f..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
+++ /dev/null
@@ -1,574 +0,0 @@
-# Copyright (c) 2013 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Handle version information related to Visual Stuio."""
-
-import errno
-import os
-import re
-import subprocess
-import sys
-import glob
-
-
-def JoinPath(*args):
-    return os.path.normpath(os.path.join(*args))
-
-
-class VisualStudioVersion:
-    """Information regarding a version of Visual Studio."""
-
-    def __init__(
-        self,
-        short_name,
-        description,
-        solution_version,
-        project_version,
-        flat_sln,
-        uses_vcxproj,
-        path,
-        sdk_based,
-        default_toolset=None,
-        compatible_sdks=None,
-    ):
-        self.short_name = short_name
-        self.description = description
-        self.solution_version = solution_version
-        self.project_version = project_version
-        self.flat_sln = flat_sln
-        self.uses_vcxproj = uses_vcxproj
-        self.path = path
-        self.sdk_based = sdk_based
-        self.default_toolset = default_toolset
-        compatible_sdks = compatible_sdks or []
-        compatible_sdks.sort(key=lambda v: float(v.replace("v", "")), reverse=True)
-        self.compatible_sdks = compatible_sdks
-
-    def ShortName(self):
-        return self.short_name
-
-    def Description(self):
-        """Get the full description of the version."""
-        return self.description
-
-    def SolutionVersion(self):
-        """Get the version number of the sln files."""
-        return self.solution_version
-
-    def ProjectVersion(self):
-        """Get the version number of the vcproj or vcxproj files."""
-        return self.project_version
-
-    def FlatSolution(self):
-        return self.flat_sln
-
-    def UsesVcxproj(self):
-        """Returns true if this version uses a vcxproj file."""
-        return self.uses_vcxproj
-
-    def ProjectExtension(self):
-        """Returns the file extension for the project."""
-        return self.uses_vcxproj and ".vcxproj" or ".vcproj"
-
-    def Path(self):
-        """Returns the path to Visual Studio installation."""
-        return self.path
-
-    def ToolPath(self, tool):
-        """Returns the path to a given compiler tool. """
-        return os.path.normpath(os.path.join(self.path, "VC/bin", tool))
-
-    def DefaultToolset(self):
-        """Returns the msbuild toolset version that will be used in the absence
-    of a user override."""
-        return self.default_toolset
-
-    def _SetupScriptInternal(self, target_arch):
-        """Returns a command (with arguments) to be used to set up the
-    environment."""
-        assert target_arch in ("x86", "x64"), "target_arch not supported"
-        # If WindowsSDKDir is set and SetEnv.Cmd exists then we are using the
-        # depot_tools build tools and should run SetEnv.Cmd to set up the
-        # environment. The check for WindowsSDKDir alone is not sufficient because
-        # this is set by running vcvarsall.bat.
-        sdk_dir = os.environ.get("WindowsSDKDir", "")
-        setup_path = JoinPath(sdk_dir, "Bin", "SetEnv.Cmd")
-        if self.sdk_based and sdk_dir and os.path.exists(setup_path):
-            return [setup_path, "/" + target_arch]
-
-        is_host_arch_x64 = (
-            os.environ.get("PROCESSOR_ARCHITECTURE") == "AMD64"
-            or os.environ.get("PROCESSOR_ARCHITEW6432") == "AMD64"
-        )
-
-        # For VS2017 (and newer) it's fairly easy
-        if self.short_name >= "2017":
-            script_path = JoinPath(
-                self.path, "VC", "Auxiliary", "Build", "vcvarsall.bat"
-            )
-
-            # Always use a native executable, cross-compiling if necessary.
-            host_arch = "amd64" if is_host_arch_x64 else "x86"
-            msvc_target_arch = "amd64" if target_arch == "x64" else "x86"
-            arg = host_arch
-            if host_arch != msvc_target_arch:
-                arg += "_" + msvc_target_arch
-
-            return [script_path, arg]
-
-        # We try to find the best version of the env setup batch.
-        vcvarsall = JoinPath(self.path, "VC", "vcvarsall.bat")
-        if target_arch == "x86":
-            if (
-                self.short_name >= "2013"
-                and self.short_name[-1] != "e"
-                and is_host_arch_x64
-            ):
-                # VS2013 and later, non-Express have a x64-x86 cross that we want
-                # to prefer.
-                return [vcvarsall, "amd64_x86"]
-            else:
-                # Otherwise, the standard x86 compiler. We don't use VC/vcvarsall.bat
-                # for x86 because vcvarsall calls vcvars32, which it can only find if
-                # VS??COMNTOOLS is set, which isn't guaranteed.
-                return [JoinPath(self.path, "Common7", "Tools", "vsvars32.bat")]
-        elif target_arch == "x64":
-            arg = "x86_amd64"
-            # Use the 64-on-64 compiler if we're not using an express edition and
-            # we're running on a 64bit OS.
-            if self.short_name[-1] != "e" and is_host_arch_x64:
-                arg = "amd64"
-            return [vcvarsall, arg]
-
-    def SetupScript(self, target_arch):
-        script_data = self._SetupScriptInternal(target_arch)
-        script_path = script_data[0]
-        if not os.path.exists(script_path):
-            raise Exception(
-                "%s is missing - make sure VC++ tools are installed." % script_path
-            )
-        return script_data
-
-
-def _RegistryQueryBase(sysdir, key, value):
-    """Use reg.exe to read a particular key.
-
-  While ideally we might use the win32 module, we would like gyp to be
-  python neutral, so for instance cygwin python lacks this module.
-
-  Arguments:
-    sysdir: The system subdirectory to attempt to launch reg.exe from.
-    key: The registry key to read from.
-    value: The particular value to read.
-  Return:
-    stdout from reg.exe, or None for failure.
-  """
-    # Skip if not on Windows or Python Win32 setup issue
-    if sys.platform not in ("win32", "cygwin"):
-        return None
-    # Setup params to pass to and attempt to launch reg.exe
-    cmd = [os.path.join(os.environ.get("WINDIR", ""), sysdir, "reg.exe"), "query", key]
-    if value:
-        cmd.extend(["/v", value])
-    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    # Obtain the stdout from reg.exe, reading to the end so p.returncode is valid
-    # Note that the error text may be in [1] in some cases
-    text = p.communicate()[0].decode("utf-8")
-    # Check return code from reg.exe; officially 0==success and 1==error
-    if p.returncode:
-        return None
-    return text
-
-
-def _RegistryQuery(key, value=None):
-    r"""Use reg.exe to read a particular key through _RegistryQueryBase.
-
-  First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If
-  that fails, it falls back to System32.  Sysnative is available on Vista and
-  up and available on Windows Server 2003 and XP through KB patch 942589. Note
-  that Sysnative will always fail if using 64-bit python due to it being a
-  virtual directory and System32 will work correctly in the first place.
-
-  KB 942589 - http://support.microsoft.com/kb/942589/en-us.
-
-  Arguments:
-    key: The registry key.
-    value: The particular registry value to read (optional).
-  Return:
-    stdout from reg.exe, or None for failure.
-  """
-    text = None
-    try:
-        text = _RegistryQueryBase("Sysnative", key, value)
-    except OSError as e:
-        if e.errno == errno.ENOENT:
-            text = _RegistryQueryBase("System32", key, value)
-        else:
-            raise
-    return text
-
-
-def _RegistryGetValueUsingWinReg(key, value):
-    """Use the _winreg module to obtain the value of a registry key.
-
-  Args:
-    key: The registry key.
-    value: The particular registry value to read.
-  Return:
-    contents of the registry key's value, or None on failure.  Throws
-    ImportError if winreg is unavailable.
-  """
-    from winreg import HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx
-    try:
-        root, subkey = key.split("\\", 1)
-        assert root == "HKLM"  # Only need HKLM for now.
-        with OpenKey(HKEY_LOCAL_MACHINE, subkey) as hkey:
-            return QueryValueEx(hkey, value)[0]
-    except OSError:
-        return None
-
-
-def _RegistryGetValue(key, value):
-    """Use _winreg or reg.exe to obtain the value of a registry key.
-
-  Using _winreg is preferable because it solves an issue on some corporate
-  environments where access to reg.exe is locked down. However, we still need
-  to fallback to reg.exe for the case where the _winreg module is not available
-  (for example in cygwin python).
-
-  Args:
-    key: The registry key.
-    value: The particular registry value to read.
-  Return:
-    contents of the registry key's value, or None on failure.
-  """
-    try:
-        return _RegistryGetValueUsingWinReg(key, value)
-    except ImportError:
-        pass
-
-    # Fallback to reg.exe if we fail to import _winreg.
-    text = _RegistryQuery(key, value)
-    if not text:
-        return None
-    # Extract value.
-    match = re.search(r"REG_\w+\s+([^\r]+)\r\n", text)
-    if not match:
-        return None
-    return match.group(1)
-
-
-def _CreateVersion(name, path, sdk_based=False):
-    """Sets up MSVS project generation.
-
-  Setup is based off the GYP_MSVS_VERSION environment variable or whatever is
-  autodetected if GYP_MSVS_VERSION is not explicitly specified. If a version is
-  passed in that doesn't match a value in versions python will throw a error.
-  """
-    if path:
-        path = os.path.normpath(path)
-    versions = {
-        "2022": VisualStudioVersion(
-            "2022",
-            "Visual Studio 2022",
-            solution_version="12.00",
-            project_version="17.0",
-            flat_sln=False,
-            uses_vcxproj=True,
-            path=path,
-            sdk_based=sdk_based,
-            default_toolset="v143",
-            compatible_sdks=["v8.1", "v10.0"],
-        ),
-        "2019": VisualStudioVersion(
-            "2019",
-            "Visual Studio 2019",
-            solution_version="12.00",
-            project_version="16.0",
-            flat_sln=False,
-            uses_vcxproj=True,
-            path=path,
-            sdk_based=sdk_based,
-            default_toolset="v142",
-            compatible_sdks=["v8.1", "v10.0"],
-        ),
-        "2017": VisualStudioVersion(
-            "2017",
-            "Visual Studio 2017",
-            solution_version="12.00",
-            project_version="15.0",
-            flat_sln=False,
-            uses_vcxproj=True,
-            path=path,
-            sdk_based=sdk_based,
-            default_toolset="v141",
-            compatible_sdks=["v8.1", "v10.0"],
-        ),
-        "2015": VisualStudioVersion(
-            "2015",
-            "Visual Studio 2015",
-            solution_version="12.00",
-            project_version="14.0",
-            flat_sln=False,
-            uses_vcxproj=True,
-            path=path,
-            sdk_based=sdk_based,
-            default_toolset="v140",
-        ),
-        "2013": VisualStudioVersion(
-            "2013",
-            "Visual Studio 2013",
-            solution_version="13.00",
-            project_version="12.0",
-            flat_sln=False,
-            uses_vcxproj=True,
-            path=path,
-            sdk_based=sdk_based,
-            default_toolset="v120",
-        ),
-        "2013e": VisualStudioVersion(
-            "2013e",
-            "Visual Studio 2013",
-            solution_version="13.00",
-            project_version="12.0",
-            flat_sln=True,
-            uses_vcxproj=True,
-            path=path,
-            sdk_based=sdk_based,
-            default_toolset="v120",
-        ),
-        "2012": VisualStudioVersion(
-            "2012",
-            "Visual Studio 2012",
-            solution_version="12.00",
-            project_version="4.0",
-            flat_sln=False,
-            uses_vcxproj=True,
-            path=path,
-            sdk_based=sdk_based,
-            default_toolset="v110",
-        ),
-        "2012e": VisualStudioVersion(
-            "2012e",
-            "Visual Studio 2012",
-            solution_version="12.00",
-            project_version="4.0",
-            flat_sln=True,
-            uses_vcxproj=True,
-            path=path,
-            sdk_based=sdk_based,
-            default_toolset="v110",
-        ),
-        "2010": VisualStudioVersion(
-            "2010",
-            "Visual Studio 2010",
-            solution_version="11.00",
-            project_version="4.0",
-            flat_sln=False,
-            uses_vcxproj=True,
-            path=path,
-            sdk_based=sdk_based,
-        ),
-        "2010e": VisualStudioVersion(
-            "2010e",
-            "Visual C++ Express 2010",
-            solution_version="11.00",
-            project_version="4.0",
-            flat_sln=True,
-            uses_vcxproj=True,
-            path=path,
-            sdk_based=sdk_based,
-        ),
-        "2008": VisualStudioVersion(
-            "2008",
-            "Visual Studio 2008",
-            solution_version="10.00",
-            project_version="9.00",
-            flat_sln=False,
-            uses_vcxproj=False,
-            path=path,
-            sdk_based=sdk_based,
-        ),
-        "2008e": VisualStudioVersion(
-            "2008e",
-            "Visual Studio 2008",
-            solution_version="10.00",
-            project_version="9.00",
-            flat_sln=True,
-            uses_vcxproj=False,
-            path=path,
-            sdk_based=sdk_based,
-        ),
-        "2005": VisualStudioVersion(
-            "2005",
-            "Visual Studio 2005",
-            solution_version="9.00",
-            project_version="8.00",
-            flat_sln=False,
-            uses_vcxproj=False,
-            path=path,
-            sdk_based=sdk_based,
-        ),
-        "2005e": VisualStudioVersion(
-            "2005e",
-            "Visual Studio 2005",
-            solution_version="9.00",
-            project_version="8.00",
-            flat_sln=True,
-            uses_vcxproj=False,
-            path=path,
-            sdk_based=sdk_based,
-        ),
-    }
-    return versions[str(name)]
-
-
-def _ConvertToCygpath(path):
-    """Convert to cygwin path if we are using cygwin."""
-    if sys.platform == "cygwin":
-        p = subprocess.Popen(["cygpath", path], stdout=subprocess.PIPE)
-        path = p.communicate()[0].decode("utf-8").strip()
-    return path
-
-
-def _DetectVisualStudioVersions(versions_to_check, force_express):
-    """Collect the list of installed visual studio versions.
-
-  Returns:
-    A list of visual studio versions installed in descending order of
-    usage preference.
-    Base this on the registry and a quick check if devenv.exe exists.
-    Possibilities are:
-      2005(e) - Visual Studio 2005 (8)
-      2008(e) - Visual Studio 2008 (9)
-      2010(e) - Visual Studio 2010 (10)
-      2012(e) - Visual Studio 2012 (11)
-      2013(e) - Visual Studio 2013 (12)
-      2015    - Visual Studio 2015 (14)
-      2017    - Visual Studio 2017 (15)
-      2019    - Visual Studio 2019 (16)
-      2022    - Visual Studio 2022 (17)
-    Where (e) is e for express editions of MSVS and blank otherwise.
-  """
-    version_to_year = {
-        "8.0": "2005",
-        "9.0": "2008",
-        "10.0": "2010",
-        "11.0": "2012",
-        "12.0": "2013",
-        "14.0": "2015",
-        "15.0": "2017",
-        "16.0": "2019",
-        "17.0": "2022",
-    }
-    versions = []
-    for version in versions_to_check:
-        # Old method of searching for which VS version is installed
-        # We don't use the 2010-encouraged-way because we also want to get the
-        # path to the binaries, which it doesn't offer.
-        keys = [
-            r"HKLM\Software\Microsoft\VisualStudio\%s" % version,
-            r"HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s" % version,
-            r"HKLM\Software\Microsoft\VCExpress\%s" % version,
-            r"HKLM\Software\Wow6432Node\Microsoft\VCExpress\%s" % version,
-        ]
-        for index in range(len(keys)):
-            path = _RegistryGetValue(keys[index], "InstallDir")
-            if not path:
-                continue
-            path = _ConvertToCygpath(path)
-            # Check for full.
-            full_path = os.path.join(path, "devenv.exe")
-            express_path = os.path.join(path, "*express.exe")
-            if not force_express and os.path.exists(full_path):
-                # Add this one.
-                versions.append(
-                    _CreateVersion(
-                        version_to_year[version], os.path.join(path, "..", "..")
-                    )
-                )
-            # Check for express.
-            elif glob.glob(express_path):
-                # Add this one.
-                versions.append(
-                    _CreateVersion(
-                        version_to_year[version] + "e", os.path.join(path, "..", "..")
-                    )
-                )
-
-        # The old method above does not work when only SDK is installed.
-        keys = [
-            r"HKLM\Software\Microsoft\VisualStudio\SxS\VC7",
-            r"HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7",
-            r"HKLM\Software\Microsoft\VisualStudio\SxS\VS7",
-            r"HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VS7",
-        ]
-        for index in range(len(keys)):
-            path = _RegistryGetValue(keys[index], version)
-            if not path:
-                continue
-            path = _ConvertToCygpath(path)
-            if version == "15.0":
-                if os.path.exists(path):
-                    versions.append(_CreateVersion("2017", path))
-            elif version != "14.0":  # There is no Express edition for 2015.
-                versions.append(
-                    _CreateVersion(
-                        version_to_year[version] + "e",
-                        os.path.join(path, ".."),
-                        sdk_based=True,
-                    )
-                )
-
-    return versions
-
-
-def SelectVisualStudioVersion(version="auto", allow_fallback=True):
-    """Select which version of Visual Studio projects to generate.
-
-  Arguments:
-    version: Hook to allow caller to force a particular version (vs auto).
-  Returns:
-    An object representing a visual studio project format version.
-  """
-    # In auto mode, check environment variable for override.
-    if version == "auto":
-        version = os.environ.get("GYP_MSVS_VERSION", "auto")
-    version_map = {
-        "auto": ("17.0", "16.0", "15.0", "14.0", "12.0", "10.0", "9.0", "8.0", "11.0"),
-        "2005": ("8.0",),
-        "2005e": ("8.0",),
-        "2008": ("9.0",),
-        "2008e": ("9.0",),
-        "2010": ("10.0",),
-        "2010e": ("10.0",),
-        "2012": ("11.0",),
-        "2012e": ("11.0",),
-        "2013": ("12.0",),
-        "2013e": ("12.0",),
-        "2015": ("14.0",),
-        "2017": ("15.0",),
-        "2019": ("16.0",),
-        "2022": ("17.0",),
-    }
-    override_path = os.environ.get("GYP_MSVS_OVERRIDE_PATH")
-    if override_path:
-        msvs_version = os.environ.get("GYP_MSVS_VERSION")
-        if not msvs_version:
-            raise ValueError(
-                "GYP_MSVS_OVERRIDE_PATH requires GYP_MSVS_VERSION to be "
-                "set to a particular version (e.g. 2010e)."
-            )
-        return _CreateVersion(msvs_version, override_path, sdk_based=True)
-    version = str(version)
-    versions = _DetectVisualStudioVersions(version_map[version], "e" in version)
-    if not versions:
-        if not allow_fallback:
-            raise ValueError("Could not locate Visual Studio installation.")
-        if version == "auto":
-            # Default to 2005 if we couldn't find anything
-            return _CreateVersion("2005", None)
-        else:
-            return _CreateVersion(version, None)
-    return versions[0]
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/__init__.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/__init__.py
deleted file mode 100755
index 2aa39d0318860..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/__init__.py
+++ /dev/null
@@ -1,690 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-
-import copy
-import gyp.input
-import argparse
-import os.path
-import re
-import shlex
-import sys
-import traceback
-from gyp.common import GypError
-
-
-# Default debug modes for GYP
-debug = {}
-
-# List of "official" debug modes, but you can use anything you like.
-DEBUG_GENERAL = "general"
-DEBUG_VARIABLES = "variables"
-DEBUG_INCLUDES = "includes"
-
-
-def DebugOutput(mode, message, *args):
-    if "all" in gyp.debug or mode in gyp.debug:
-        ctx = ("unknown", 0, "unknown")
-        try:
-            f = traceback.extract_stack(limit=2)
-            if f:
-                ctx = f[0][:3]
-        except Exception:
-            pass
-        if args:
-            message %= args
-        print(
-            "%s:%s:%d:%s %s"
-            % (mode.upper(), os.path.basename(ctx[0]), ctx[1], ctx[2], message)
-        )
-
-
-def FindBuildFiles():
-    extension = ".gyp"
-    files = os.listdir(os.getcwd())
-    build_files = []
-    for file in files:
-        if file.endswith(extension):
-            build_files.append(file)
-    return build_files
-
-
-def Load(
-    build_files,
-    format,
-    default_variables={},
-    includes=[],
-    depth=".",
-    params=None,
-    check=False,
-    circular_check=True,
-):
-    """
-  Loads one or more specified build files.
-  default_variables and includes will be copied before use.
-  Returns the generator for the specified format and the
-  data returned by loading the specified build files.
-  """
-    if params is None:
-        params = {}
-
-    if "-" in format:
-        format, params["flavor"] = format.split("-", 1)
-
-    default_variables = copy.copy(default_variables)
-
-    # Default variables provided by this program and its modules should be
-    # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace,
-    # avoiding collisions with user and automatic variables.
-    default_variables["GENERATOR"] = format
-    default_variables["GENERATOR_FLAVOR"] = params.get("flavor", "")
-
-    # Format can be a custom python file, or by default the name of a module
-    # within gyp.generator.
-    if format.endswith(".py"):
-        generator_name = os.path.splitext(format)[0]
-        path, generator_name = os.path.split(generator_name)
-
-        # Make sure the path to the custom generator is in sys.path
-        # Don't worry about removing it once we are done.  Keeping the path
-        # to each generator that is used in sys.path is likely harmless and
-        # arguably a good idea.
-        path = os.path.abspath(path)
-        if path not in sys.path:
-            sys.path.insert(0, path)
-    else:
-        generator_name = "gyp.generator." + format
-
-    # These parameters are passed in order (as opposed to by key)
-    # because ActivePython cannot handle key parameters to __import__.
-    generator = __import__(generator_name, globals(), locals(), generator_name)
-    for (key, val) in generator.generator_default_variables.items():
-        default_variables.setdefault(key, val)
-
-    output_dir = params["options"].generator_output or params["options"].toplevel_dir
-    if default_variables["GENERATOR"] == "ninja":
-        default_variables.setdefault(
-            "PRODUCT_DIR_ABS",
-            os.path.join(output_dir, "out", default_variables["build_type"]),
-        )
-    else:
-        default_variables.setdefault(
-            "PRODUCT_DIR_ABS",
-            os.path.join(output_dir, default_variables["CONFIGURATION_NAME"]),
-        )
-
-    # Give the generator the opportunity to set additional variables based on
-    # the params it will receive in the output phase.
-    if getattr(generator, "CalculateVariables", None):
-        generator.CalculateVariables(default_variables, params)
-
-    # Give the generator the opportunity to set generator_input_info based on
-    # the params it will receive in the output phase.
-    if getattr(generator, "CalculateGeneratorInputInfo", None):
-        generator.CalculateGeneratorInputInfo(params)
-
-    # Fetch the generator specific info that gets fed to input, we use getattr
-    # so we can default things and the generators only have to provide what
-    # they need.
-    generator_input_info = {
-        "non_configuration_keys": getattr(
-            generator, "generator_additional_non_configuration_keys", []
-        ),
-        "path_sections": getattr(generator, "generator_additional_path_sections", []),
-        "extra_sources_for_rules": getattr(
-            generator, "generator_extra_sources_for_rules", []
-        ),
-        "generator_supports_multiple_toolsets": getattr(
-            generator, "generator_supports_multiple_toolsets", False
-        ),
-        "generator_wants_static_library_dependencies_adjusted": getattr(
-            generator, "generator_wants_static_library_dependencies_adjusted", True
-        ),
-        "generator_wants_sorted_dependencies": getattr(
-            generator, "generator_wants_sorted_dependencies", False
-        ),
-        "generator_filelist_paths": getattr(
-            generator, "generator_filelist_paths", None
-        ),
-    }
-
-    # Process the input specific to this generator.
-    result = gyp.input.Load(
-        build_files,
-        default_variables,
-        includes[:],
-        depth,
-        generator_input_info,
-        check,
-        circular_check,
-        params["parallel"],
-        params["root_targets"],
-    )
-    return [generator] + result
-
-
-def NameValueListToDict(name_value_list):
-    """
-  Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
-  of the pairs.  If a string is simply NAME, then the value in the dictionary
-  is set to True.  If VALUE can be converted to an integer, it is.
-  """
-    result = {}
-    for item in name_value_list:
-        tokens = item.split("=", 1)
-        if len(tokens) == 2:
-            # If we can make it an int, use that, otherwise, use the string.
-            try:
-                token_value = int(tokens[1])
-            except ValueError:
-                token_value = tokens[1]
-            # Set the variable to the supplied value.
-            result[tokens[0]] = token_value
-        else:
-            # No value supplied, treat it as a boolean and set it.
-            result[tokens[0]] = True
-    return result
-
-
-def ShlexEnv(env_name):
-    flags = os.environ.get(env_name, [])
-    if flags:
-        flags = shlex.split(flags)
-    return flags
-
-
-def FormatOpt(opt, value):
-    if opt.startswith("--"):
-        return f"{opt}={value}"
-    return opt + value
-
-
-def RegenerateAppendFlag(flag, values, predicate, env_name, options):
-    """Regenerate a list of command line flags, for an option of action='append'.
-
-  The |env_name|, if given, is checked in the environment and used to generate
-  an initial list of options, then the options that were specified on the
-  command line (given in |values|) are appended.  This matches the handling of
-  environment variables and command line flags where command line flags override
-  the environment, while not requiring the environment to be set when the flags
-  are used again.
-  """
-    flags = []
-    if options.use_environment and env_name:
-        for flag_value in ShlexEnv(env_name):
-            value = FormatOpt(flag, predicate(flag_value))
-            if value in flags:
-                flags.remove(value)
-            flags.append(value)
-    if values:
-        for flag_value in values:
-            flags.append(FormatOpt(flag, predicate(flag_value)))
-    return flags
-
-
-def RegenerateFlags(options):
-    """Given a parsed options object, and taking the environment variables into
-  account, returns a list of flags that should regenerate an equivalent options
-  object (even in the absence of the environment variables.)
-
-  Any path options will be normalized relative to depth.
-
-  The format flag is not included, as it is assumed the calling generator will
-  set that as appropriate.
-  """
-
-    def FixPath(path):
-        path = gyp.common.FixIfRelativePath(path, options.depth)
-        if not path:
-            return os.path.curdir
-        return path
-
-    def Noop(value):
-        return value
-
-    # We always want to ignore the environment when regenerating, to avoid
-    # duplicate or changed flags in the environment at the time of regeneration.
-    flags = ["--ignore-environment"]
-    for name, metadata in options._regeneration_metadata.items():
-        opt = metadata["opt"]
-        value = getattr(options, name)
-        value_predicate = metadata["type"] == "path" and FixPath or Noop
-        action = metadata["action"]
-        env_name = metadata["env_name"]
-        if action == "append":
-            flags.extend(
-                RegenerateAppendFlag(opt, value, value_predicate, env_name, options)
-            )
-        elif action in ("store", None):  # None is a synonym for 'store'.
-            if value:
-                flags.append(FormatOpt(opt, value_predicate(value)))
-            elif options.use_environment and env_name and os.environ.get(env_name):
-                flags.append(FormatOpt(opt, value_predicate(os.environ.get(env_name))))
-        elif action in ("store_true", "store_false"):
-            if (action == "store_true" and value) or (
-                action == "store_false" and not value
-            ):
-                flags.append(opt)
-            elif options.use_environment and env_name:
-                print(
-                    "Warning: environment regeneration unimplemented "
-                    "for %s flag %r env_name %r" % (action, opt, env_name),
-                    file=sys.stderr,
-                )
-        else:
-            print(
-                "Warning: regeneration unimplemented for action %r "
-                "flag %r" % (action, opt),
-                file=sys.stderr,
-            )
-
-    return flags
-
-
-class RegeneratableOptionParser(argparse.ArgumentParser):
-    def __init__(self, usage):
-        self.__regeneratable_options = {}
-        argparse.ArgumentParser.__init__(self, usage=usage)
-
-    def add_argument(self, *args, **kw):
-        """Add an option to the parser.
-
-    This accepts the same arguments as ArgumentParser.add_argument, plus the
-    following:
-      regenerate: can be set to False to prevent this option from being included
-                  in regeneration.
-      env_name: name of environment variable that additional values for this
-                option come from.
-      type: adds type='path', to tell the regenerator that the values of
-            this option need to be made relative to options.depth
-    """
-        env_name = kw.pop("env_name", None)
-        if "dest" in kw and kw.pop("regenerate", True):
-            dest = kw["dest"]
-
-            # The path type is needed for regenerating, for optparse we can just treat
-            # it as a string.
-            type = kw.get("type")
-            if type == "path":
-                kw["type"] = str
-
-            self.__regeneratable_options[dest] = {
-                "action": kw.get("action"),
-                "type": type,
-                "env_name": env_name,
-                "opt": args[0],
-            }
-
-        argparse.ArgumentParser.add_argument(self, *args, **kw)
-
-    def parse_args(self, *args):
-        values, args = argparse.ArgumentParser.parse_known_args(self, *args)
-        values._regeneration_metadata = self.__regeneratable_options
-        return values, args
-
-
-def gyp_main(args):
-    my_name = os.path.basename(sys.argv[0])
-    usage = "usage: %(prog)s [options ...] [build_file ...]"
-
-    parser = RegeneratableOptionParser(usage=usage.replace("%s", "%(prog)s"))
-    parser.add_argument(
-        "--build",
-        dest="configs",
-        action="append",
-        help="configuration for build after project generation",
-    )
-    parser.add_argument(
-        "--check", dest="check", action="store_true", help="check format of gyp files"
-    )
-    parser.add_argument(
-        "--config-dir",
-        dest="config_dir",
-        action="store",
-        env_name="GYP_CONFIG_DIR",
-        default=None,
-        help="The location for configuration files like " "include.gypi.",
-    )
-    parser.add_argument(
-        "-d",
-        "--debug",
-        dest="debug",
-        metavar="DEBUGMODE",
-        action="append",
-        default=[],
-        help="turn on a debugging "
-        'mode for debugging GYP.  Supported modes are "variables", '
-        '"includes" and "general" or "all" for all of them.',
-    )
-    parser.add_argument(
-        "-D",
-        dest="defines",
-        action="append",
-        metavar="VAR=VAL",
-        env_name="GYP_DEFINES",
-        help="sets variable VAR to value VAL",
-    )
-    parser.add_argument(
-        "--depth",
-        dest="depth",
-        metavar="PATH",
-        type="path",
-        help="set DEPTH gyp variable to a relative path to PATH",
-    )
-    parser.add_argument(
-        "-f",
-        "--format",
-        dest="formats",
-        action="append",
-        env_name="GYP_GENERATORS",
-        regenerate=False,
-        help="output formats to generate",
-    )
-    parser.add_argument(
-        "-G",
-        dest="generator_flags",
-        action="append",
-        default=[],
-        metavar="FLAG=VAL",
-        env_name="GYP_GENERATOR_FLAGS",
-        help="sets generator flag FLAG to VAL",
-    )
-    parser.add_argument(
-        "--generator-output",
-        dest="generator_output",
-        action="store",
-        default=None,
-        metavar="DIR",
-        type="path",
-        env_name="GYP_GENERATOR_OUTPUT",
-        help="puts generated build files under DIR",
-    )
-    parser.add_argument(
-        "--ignore-environment",
-        dest="use_environment",
-        action="store_false",
-        default=True,
-        regenerate=False,
-        help="do not read options from environment variables",
-    )
-    parser.add_argument(
-        "-I",
-        "--include",
-        dest="includes",
-        action="append",
-        metavar="INCLUDE",
-        type="path",
-        help="files to include in all loaded .gyp files",
-    )
-    # --no-circular-check disables the check for circular relationships between
-    # .gyp files.  These relationships should not exist, but they've only been
-    # observed to be harmful with the Xcode generator.  Chromium's .gyp files
-    # currently have some circular relationships on non-Mac platforms, so this
-    # option allows the strict behavior to be used on Macs and the lenient
-    # behavior to be used elsewhere.
-    # TODO(mark): Remove this option when http://crbug.com/35878 is fixed.
-    parser.add_argument(
-        "--no-circular-check",
-        dest="circular_check",
-        action="store_false",
-        default=True,
-        regenerate=False,
-        help="don't check for circular relationships between files",
-    )
-    parser.add_argument(
-        "--no-parallel",
-        action="store_true",
-        default=False,
-        help="Disable multiprocessing",
-    )
-    parser.add_argument(
-        "-S",
-        "--suffix",
-        dest="suffix",
-        default="",
-        help="suffix to add to generated files",
-    )
-    parser.add_argument(
-        "--toplevel-dir",
-        dest="toplevel_dir",
-        action="store",
-        default=None,
-        metavar="DIR",
-        type="path",
-        help="directory to use as the root of the source tree",
-    )
-    parser.add_argument(
-        "-R",
-        "--root-target",
-        dest="root_targets",
-        action="append",
-        metavar="TARGET",
-        help="include only TARGET and its deep dependencies",
-    )
-    parser.add_argument(
-        "-V",
-        "--version",
-        dest="version",
-        action="store_true",
-        help="Show the version and exit.",
-    )
-
-    options, build_files_arg = parser.parse_args(args)
-    if options.version:
-        import pkg_resources
-        print(f"v{pkg_resources.get_distribution('gyp-next').version}")
-        return 0
-    build_files = build_files_arg
-
-    # Set up the configuration directory (defaults to ~/.gyp)
-    if not options.config_dir:
-        home = None
-        home_dot_gyp = None
-        if options.use_environment:
-            home_dot_gyp = os.environ.get("GYP_CONFIG_DIR", None)
-            if home_dot_gyp:
-                home_dot_gyp = os.path.expanduser(home_dot_gyp)
-
-        if not home_dot_gyp:
-            home_vars = ["HOME"]
-            if sys.platform in ("cygwin", "win32"):
-                home_vars.append("USERPROFILE")
-            for home_var in home_vars:
-                home = os.getenv(home_var)
-                if home:
-                    home_dot_gyp = os.path.join(home, ".gyp")
-                    if not os.path.exists(home_dot_gyp):
-                        home_dot_gyp = None
-                    else:
-                        break
-    else:
-        home_dot_gyp = os.path.expanduser(options.config_dir)
-
-    if home_dot_gyp and not os.path.exists(home_dot_gyp):
-        home_dot_gyp = None
-
-    if not options.formats:
-        # If no format was given on the command line, then check the env variable.
-        generate_formats = []
-        if options.use_environment:
-            generate_formats = os.environ.get("GYP_GENERATORS", [])
-        if generate_formats:
-            generate_formats = re.split(r"[\s,]", generate_formats)
-        if generate_formats:
-            options.formats = generate_formats
-        else:
-            # Nothing in the variable, default based on platform.
-            if sys.platform == "darwin":
-                options.formats = ["xcode"]
-            elif sys.platform in ("win32", "cygwin"):
-                options.formats = ["msvs"]
-            else:
-                options.formats = ["make"]
-
-    if not options.generator_output and options.use_environment:
-        g_o = os.environ.get("GYP_GENERATOR_OUTPUT")
-        if g_o:
-            options.generator_output = g_o
-
-    options.parallel = not options.no_parallel
-
-    for mode in options.debug:
-        gyp.debug[mode] = 1
-
-    # Do an extra check to avoid work when we're not debugging.
-    if DEBUG_GENERAL in gyp.debug:
-        DebugOutput(DEBUG_GENERAL, "running with these options:")
-        for option, value in sorted(options.__dict__.items()):
-            if option[0] == "_":
-                continue
-            if isinstance(value, str):
-                DebugOutput(DEBUG_GENERAL, "  %s: '%s'", option, value)
-            else:
-                DebugOutput(DEBUG_GENERAL, "  %s: %s", option, value)
-
-    if not build_files:
-        build_files = FindBuildFiles()
-    if not build_files:
-        raise GypError((usage + "\n\n%s: error: no build_file") % (my_name, my_name))
-
-    # TODO(mark): Chromium-specific hack!
-    # For Chromium, the gyp "depth" variable should always be a relative path
-    # to Chromium's top-level "src" directory.  If no depth variable was set
-    # on the command line, try to find a "src" directory by looking at the
-    # absolute path to each build file's directory.  The first "src" component
-    # found will be treated as though it were the path used for --depth.
-    if not options.depth:
-        for build_file in build_files:
-            build_file_dir = os.path.abspath(os.path.dirname(build_file))
-            build_file_dir_components = build_file_dir.split(os.path.sep)
-            components_len = len(build_file_dir_components)
-            for index in range(components_len - 1, -1, -1):
-                if build_file_dir_components[index] == "src":
-                    options.depth = os.path.sep.join(build_file_dir_components)
-                    break
-                del build_file_dir_components[index]
-
-            # If the inner loop found something, break without advancing to another
-            # build file.
-            if options.depth:
-                break
-
-        if not options.depth:
-            raise GypError(
-                "Could not automatically locate src directory.  This is"
-                "a temporary Chromium feature that will be removed.  Use"
-                "--depth as a workaround."
-            )
-
-    # If toplevel-dir is not set, we assume that depth is the root of our source
-    # tree.
-    if not options.toplevel_dir:
-        options.toplevel_dir = options.depth
-
-    # -D on the command line sets variable defaults - D isn't just for define,
-    # it's for default.  Perhaps there should be a way to force (-F?) a
-    # variable's value so that it can't be overridden by anything else.
-    cmdline_default_variables = {}
-    defines = []
-    if options.use_environment:
-        defines += ShlexEnv("GYP_DEFINES")
-    if options.defines:
-        defines += options.defines
-    cmdline_default_variables = NameValueListToDict(defines)
-    if DEBUG_GENERAL in gyp.debug:
-        DebugOutput(
-            DEBUG_GENERAL, "cmdline_default_variables: %s", cmdline_default_variables
-        )
-
-    # Set up includes.
-    includes = []
-
-    # If ~/.gyp/include.gypi exists, it'll be forcibly included into every
-    # .gyp file that's loaded, before anything else is included.
-    if home_dot_gyp:
-        default_include = os.path.join(home_dot_gyp, "include.gypi")
-        if os.path.exists(default_include):
-            print("Using overrides found in " + default_include)
-            includes.append(default_include)
-
-    # Command-line --include files come after the default include.
-    if options.includes:
-        includes.extend(options.includes)
-
-    # Generator flags should be prefixed with the target generator since they
-    # are global across all generator runs.
-    gen_flags = []
-    if options.use_environment:
-        gen_flags += ShlexEnv("GYP_GENERATOR_FLAGS")
-    if options.generator_flags:
-        gen_flags += options.generator_flags
-    generator_flags = NameValueListToDict(gen_flags)
-    if DEBUG_GENERAL in gyp.debug.keys():
-        DebugOutput(DEBUG_GENERAL, "generator_flags: %s", generator_flags)
-
-    # Generate all requested formats (use a set in case we got one format request
-    # twice)
-    for format in set(options.formats):
-        params = {
-            "options": options,
-            "build_files": build_files,
-            "generator_flags": generator_flags,
-            "cwd": os.getcwd(),
-            "build_files_arg": build_files_arg,
-            "gyp_binary": sys.argv[0],
-            "home_dot_gyp": home_dot_gyp,
-            "parallel": options.parallel,
-            "root_targets": options.root_targets,
-            "target_arch": cmdline_default_variables.get("target_arch", ""),
-        }
-
-        # Start with the default variables from the command line.
-        [generator, flat_list, targets, data] = Load(
-            build_files,
-            format,
-            cmdline_default_variables,
-            includes,
-            options.depth,
-            params,
-            options.check,
-            options.circular_check,
-        )
-
-        # TODO(mark): Pass |data| for now because the generator needs a list of
-        # build files that came in.  In the future, maybe it should just accept
-        # a list, and not the whole data dict.
-        # NOTE: flat_list is the flattened dependency graph specifying the order
-        # that targets may be built.  Build systems that operate serially or that
-        # need to have dependencies defined before dependents reference them should
-        # generate targets in the order specified in flat_list.
-        generator.GenerateOutput(flat_list, targets, data, params)
-
-        if options.configs:
-            valid_configs = targets[flat_list[0]]["configurations"]
-            for conf in options.configs:
-                if conf not in valid_configs:
-                    raise GypError("Invalid config specified via --build: %s" % conf)
-            generator.PerformBuild(data, options.configs, params)
-
-    # Done
-    return 0
-
-
-def main(args):
-    try:
-        return gyp_main(args)
-    except GypError as e:
-        sys.stderr.write("gyp: %s\n" % e)
-        return 1
-
-
-# NOTE: setuptools generated console_scripts calls function with no arguments
-def script_main():
-    return main(sys.argv[1:])
-
-
-if __name__ == "__main__":
-    sys.exit(script_main())
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common.py
deleted file mode 100644
index d77adee8afd55..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common.py
+++ /dev/null
@@ -1,661 +0,0 @@
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import errno
-import filecmp
-import os.path
-import re
-import tempfile
-import sys
-import subprocess
-
-from collections.abc import MutableSet
-
-
-# A minimal memoizing decorator. It'll blow up if the args aren't immutable,
-# among other "problems".
-class memoize:
-    def __init__(self, func):
-        self.func = func
-        self.cache = {}
-
-    def __call__(self, *args):
-        try:
-            return self.cache[args]
-        except KeyError:
-            result = self.func(*args)
-            self.cache[args] = result
-            return result
-
-
-class GypError(Exception):
-    """Error class representing an error, which is to be presented
-  to the user.  The main entry point will catch and display this.
-  """
-
-    pass
-
-
-def ExceptionAppend(e, msg):
-    """Append a message to the given exception's message."""
-    if not e.args:
-        e.args = (msg,)
-    elif len(e.args) == 1:
-        e.args = (str(e.args[0]) + " " + msg,)
-    else:
-        e.args = (str(e.args[0]) + " " + msg,) + e.args[1:]
-
-
-def FindQualifiedTargets(target, qualified_list):
-    """
-  Given a list of qualified targets, return the qualified targets for the
-  specified |target|.
-  """
-    return [t for t in qualified_list if ParseQualifiedTarget(t)[1] == target]
-
-
-def ParseQualifiedTarget(target):
-    # Splits a qualified target into a build file, target name and toolset.
-
-    # NOTE: rsplit is used to disambiguate the Windows drive letter separator.
-    target_split = target.rsplit(":", 1)
-    if len(target_split) == 2:
-        [build_file, target] = target_split
-    else:
-        build_file = None
-
-    target_split = target.rsplit("#", 1)
-    if len(target_split) == 2:
-        [target, toolset] = target_split
-    else:
-        toolset = None
-
-    return [build_file, target, toolset]
-
-
-def ResolveTarget(build_file, target, toolset):
-    # This function resolves a target into a canonical form:
-    # - a fully defined build file, either absolute or relative to the current
-    # directory
-    # - a target name
-    # - a toolset
-    #
-    # build_file is the file relative to which 'target' is defined.
-    # target is the qualified target.
-    # toolset is the default toolset for that target.
-    [parsed_build_file, target, parsed_toolset] = ParseQualifiedTarget(target)
-
-    if parsed_build_file:
-        if build_file:
-            # If a relative path, parsed_build_file is relative to the directory
-            # containing build_file.  If build_file is not in the current directory,
-            # parsed_build_file is not a usable path as-is.  Resolve it by
-            # interpreting it as relative to build_file.  If parsed_build_file is
-            # absolute, it is usable as a path regardless of the current directory,
-            # and os.path.join will return it as-is.
-            build_file = os.path.normpath(
-                os.path.join(os.path.dirname(build_file), parsed_build_file)
-            )
-            # Further (to handle cases like ../cwd), make it relative to cwd)
-            if not os.path.isabs(build_file):
-                build_file = RelativePath(build_file, ".")
-        else:
-            build_file = parsed_build_file
-
-    if parsed_toolset:
-        toolset = parsed_toolset
-
-    return [build_file, target, toolset]
-
-
-def BuildFile(fully_qualified_target):
-    # Extracts the build file from the fully qualified target.
-    return ParseQualifiedTarget(fully_qualified_target)[0]
-
-
-def GetEnvironFallback(var_list, default):
-    """Look up a key in the environment, with fallback to secondary keys
-  and finally falling back to a default value."""
-    for var in var_list:
-        if var in os.environ:
-            return os.environ[var]
-    return default
-
-
-def QualifiedTarget(build_file, target, toolset):
-    # "Qualified" means the file that a target was defined in and the target
-    # name, separated by a colon, suffixed by a # and the toolset name:
-    # /path/to/file.gyp:target_name#toolset
-    fully_qualified = build_file + ":" + target
-    if toolset:
-        fully_qualified = fully_qualified + "#" + toolset
-    return fully_qualified
-
-
-@memoize
-def RelativePath(path, relative_to, follow_path_symlink=True):
-    # Assuming both |path| and |relative_to| are relative to the current
-    # directory, returns a relative path that identifies path relative to
-    # relative_to.
-    # If |follow_symlink_path| is true (default) and |path| is a symlink, then
-    # this method returns a path to the real file represented by |path|. If it is
-    # false, this method returns a path to the symlink. If |path| is not a
-    # symlink, this option has no effect.
-
-    # Convert to normalized (and therefore absolute paths).
-    if follow_path_symlink:
-        path = os.path.realpath(path)
-    else:
-        path = os.path.abspath(path)
-    relative_to = os.path.realpath(relative_to)
-
-    # On Windows, we can't create a relative path to a different drive, so just
-    # use the absolute path.
-    if sys.platform == "win32":
-        if (
-            os.path.splitdrive(path)[0].lower()
-            != os.path.splitdrive(relative_to)[0].lower()
-        ):
-            return path
-
-    # Split the paths into components.
-    path_split = path.split(os.path.sep)
-    relative_to_split = relative_to.split(os.path.sep)
-
-    # Determine how much of the prefix the two paths share.
-    prefix_len = len(os.path.commonprefix([path_split, relative_to_split]))
-
-    # Put enough ".." components to back up out of relative_to to the common
-    # prefix, and then append the part of path_split after the common prefix.
-    relative_split = [os.path.pardir] * (
-        len(relative_to_split) - prefix_len
-    ) + path_split[prefix_len:]
-
-    if len(relative_split) == 0:
-        # The paths were the same.
-        return ""
-
-    # Turn it back into a string and we're done.
-    return os.path.join(*relative_split)
-
-
-@memoize
-def InvertRelativePath(path, toplevel_dir=None):
-    """Given a path like foo/bar that is relative to toplevel_dir, return
-  the inverse relative path back to the toplevel_dir.
-
-  E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path)))
-  should always produce the empty string, unless the path contains symlinks.
-  """
-    if not path:
-        return path
-    toplevel_dir = "." if toplevel_dir is None else toplevel_dir
-    return RelativePath(toplevel_dir, os.path.join(toplevel_dir, path))
-
-
-def FixIfRelativePath(path, relative_to):
-    # Like RelativePath but returns |path| unchanged if it is absolute.
-    if os.path.isabs(path):
-        return path
-    return RelativePath(path, relative_to)
-
-
-def UnrelativePath(path, relative_to):
-    # Assuming that |relative_to| is relative to the current directory, and |path|
-    # is a path relative to the dirname of |relative_to|, returns a path that
-    # identifies |path| relative to the current directory.
-    rel_dir = os.path.dirname(relative_to)
-    return os.path.normpath(os.path.join(rel_dir, path))
-
-
-# re objects used by EncodePOSIXShellArgument.  See IEEE 1003.1 XCU.2.2 at
-# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_02
-# and the documentation for various shells.
-
-# _quote is a pattern that should match any argument that needs to be quoted
-# with double-quotes by EncodePOSIXShellArgument.  It matches the following
-# characters appearing anywhere in an argument:
-#   \t, \n, space  parameter separators
-#   #              comments
-#   $              expansions (quoted to always expand within one argument)
-#   %              called out by IEEE 1003.1 XCU.2.2
-#   &              job control
-#   '              quoting
-#   (, )           subshell execution
-#   *, ?, [        pathname expansion
-#   ;              command delimiter
-#   <, >, |        redirection
-#   =              assignment
-#   {, }           brace expansion (bash)
-#   ~              tilde expansion
-# It also matches the empty string, because "" (or '') is the only way to
-# represent an empty string literal argument to a POSIX shell.
-#
-# This does not match the characters in _escape, because those need to be
-# backslash-escaped regardless of whether they appear in a double-quoted
-# string.
-_quote = re.compile("[\t\n #$%&'()*;<=>?[{|}~]|^$")
-
-# _escape is a pattern that should match any character that needs to be
-# escaped with a backslash, whether or not the argument matched the _quote
-# pattern.  _escape is used with re.sub to backslash anything in _escape's
-# first match group, hence the (parentheses) in the regular expression.
-#
-# _escape matches the following characters appearing anywhere in an argument:
-#   "  to prevent POSIX shells from interpreting this character for quoting
-#   \  to prevent POSIX shells from interpreting this character for escaping
-#   `  to prevent POSIX shells from interpreting this character for command
-#      substitution
-# Missing from this list is $, because the desired behavior of
-# EncodePOSIXShellArgument is to permit parameter (variable) expansion.
-#
-# Also missing from this list is !, which bash will interpret as the history
-# expansion character when history is enabled.  bash does not enable history
-# by default in non-interactive shells, so this is not thought to be a problem.
-# ! was omitted from this list because bash interprets "\!" as a literal string
-# including the backslash character (avoiding history expansion but retaining
-# the backslash), which would not be correct for argument encoding.  Handling
-# this case properly would also be problematic because bash allows the history
-# character to be changed with the histchars shell variable.  Fortunately,
-# as history is not enabled in non-interactive shells and
-# EncodePOSIXShellArgument is only expected to encode for non-interactive
-# shells, there is no room for error here by ignoring !.
-_escape = re.compile(r'(["\\`])')
-
-
-def EncodePOSIXShellArgument(argument):
-    """Encodes |argument| suitably for consumption by POSIX shells.
-
-  argument may be quoted and escaped as necessary to ensure that POSIX shells
-  treat the returned value as a literal representing the argument passed to
-  this function.  Parameter (variable) expansions beginning with $ are allowed
-  to remain intact without escaping the $, to allow the argument to contain
-  references to variables to be expanded by the shell.
-  """
-
-    if not isinstance(argument, str):
-        argument = str(argument)
-
-    if _quote.search(argument):
-        quote = '"'
-    else:
-        quote = ""
-
-    encoded = quote + re.sub(_escape, r"\\\1", argument) + quote
-
-    return encoded
-
-
-def EncodePOSIXShellList(list):
-    """Encodes |list| suitably for consumption by POSIX shells.
-
-  Returns EncodePOSIXShellArgument for each item in list, and joins them
-  together using the space character as an argument separator.
-  """
-
-    encoded_arguments = []
-    for argument in list:
-        encoded_arguments.append(EncodePOSIXShellArgument(argument))
-    return " ".join(encoded_arguments)
-
-
-def DeepDependencyTargets(target_dicts, roots):
-    """Returns the recursive list of target dependencies."""
-    dependencies = set()
-    pending = set(roots)
-    while pending:
-        # Pluck out one.
-        r = pending.pop()
-        # Skip if visited already.
-        if r in dependencies:
-            continue
-        # Add it.
-        dependencies.add(r)
-        # Add its children.
-        spec = target_dicts[r]
-        pending.update(set(spec.get("dependencies", [])))
-        pending.update(set(spec.get("dependencies_original", [])))
-    return list(dependencies - set(roots))
-
-
-def BuildFileTargets(target_list, build_file):
-    """From a target_list, returns the subset from the specified build_file.
-  """
-    return [p for p in target_list if BuildFile(p) == build_file]
-
-
-def AllTargets(target_list, target_dicts, build_file):
-    """Returns all targets (direct and dependencies) for the specified build_file.
-  """
-    bftargets = BuildFileTargets(target_list, build_file)
-    deptargets = DeepDependencyTargets(target_dicts, bftargets)
-    return bftargets + deptargets
-
-
-def WriteOnDiff(filename):
-    """Write to a file only if the new contents differ.
-
-  Arguments:
-    filename: name of the file to potentially write to.
-  Returns:
-    A file like object which will write to temporary file and only overwrite
-    the target if it differs (on close).
-  """
-
-    class Writer:
-        """Wrapper around file which only covers the target if it differs."""
-
-        def __init__(self):
-            # On Cygwin remove the "dir" argument
-            # `C:` prefixed paths are treated as relative,
-            # consequently ending up with current dir "/cygdrive/c/..."
-            # being prefixed to those, which was
-            # obviously a non-existent path,
-            # for example: "/cygdrive/c//C:\".
-            # For more details see:
-            # https://docs.python.org/2/library/tempfile.html#tempfile.mkstemp
-            base_temp_dir = "" if IsCygwin() else os.path.dirname(filename)
-            # Pick temporary file.
-            tmp_fd, self.tmp_path = tempfile.mkstemp(
-                suffix=".tmp",
-                prefix=os.path.split(filename)[1] + ".gyp.",
-                dir=base_temp_dir,
-            )
-            try:
-                self.tmp_file = os.fdopen(tmp_fd, "wb")
-            except Exception:
-                # Don't leave turds behind.
-                os.unlink(self.tmp_path)
-                raise
-
-        def __getattr__(self, attrname):
-            # Delegate everything else to self.tmp_file
-            return getattr(self.tmp_file, attrname)
-
-        def close(self):
-            try:
-                # Close tmp file.
-                self.tmp_file.close()
-                # Determine if different.
-                same = False
-                try:
-                    same = filecmp.cmp(self.tmp_path, filename, False)
-                except OSError as e:
-                    if e.errno != errno.ENOENT:
-                        raise
-
-                if same:
-                    # The new file is identical to the old one, just get rid of the new
-                    # one.
-                    os.unlink(self.tmp_path)
-                else:
-                    # The new file is different from the old one,
-                    # or there is no old one.
-                    # Rename the new file to the permanent name.
-                    #
-                    # tempfile.mkstemp uses an overly restrictive mode, resulting in a
-                    # file that can only be read by the owner, regardless of the umask.
-                    # There's no reason to not respect the umask here,
-                    # which means that an extra hoop is required
-                    # to fetch it and reset the new file's mode.
-                    #
-                    # No way to get the umask without setting a new one?  Set a safe one
-                    # and then set it back to the old value.
-                    umask = os.umask(0o77)
-                    os.umask(umask)
-                    os.chmod(self.tmp_path, 0o666 & ~umask)
-                    if sys.platform == "win32" and os.path.exists(filename):
-                        # NOTE: on windows (but not cygwin) rename will not replace an
-                        # existing file, so it must be preceded with a remove.
-                        # Sadly there is no way to make the switch atomic.
-                        os.remove(filename)
-                    os.rename(self.tmp_path, filename)
-            except Exception:
-                # Don't leave turds behind.
-                os.unlink(self.tmp_path)
-                raise
-
-        def write(self, s):
-            self.tmp_file.write(s.encode("utf-8"))
-
-    return Writer()
-
-
-def EnsureDirExists(path):
-    """Make sure the directory for |path| exists."""
-    try:
-        os.makedirs(os.path.dirname(path))
-    except OSError:
-        pass
-
-
-def GetFlavor(params):
-    """Returns |params.flavor| if it's set, the system's default flavor else."""
-    flavors = {
-        "cygwin": "win",
-        "win32": "win",
-        "darwin": "mac",
-    }
-
-    if "flavor" in params:
-        return params["flavor"]
-    if sys.platform in flavors:
-        return flavors[sys.platform]
-    if sys.platform.startswith("sunos"):
-        return "solaris"
-    if sys.platform.startswith(("dragonfly", "freebsd")):
-        return "freebsd"
-    if sys.platform.startswith("openbsd"):
-        return "openbsd"
-    if sys.platform.startswith("netbsd"):
-        return "netbsd"
-    if sys.platform.startswith("aix"):
-        return "aix"
-    if sys.platform.startswith(("os390", "zos")):
-        return "zos"
-    if sys.platform == "os400":
-        return "os400"
-
-    return "linux"
-
-
-def CopyTool(flavor, out_path, generator_flags={}):
-    """Finds (flock|mac|win)_tool.gyp in the gyp directory and copies it
-  to |out_path|."""
-    # aix and solaris just need flock emulation. mac and win use more complicated
-    # support scripts.
-    prefix = {
-        "aix": "flock",
-        "os400": "flock",
-        "solaris": "flock",
-        "mac": "mac",
-        "ios": "mac",
-        "win": "win",
-    }.get(flavor, None)
-    if not prefix:
-        return
-
-    # Slurp input file.
-    source_path = os.path.join(
-        os.path.dirname(os.path.abspath(__file__)), "%s_tool.py" % prefix
-    )
-    with open(source_path) as source_file:
-        source = source_file.readlines()
-
-    # Set custom header flags.
-    header = "# Generated by gyp. Do not edit.\n"
-    mac_toolchain_dir = generator_flags.get("mac_toolchain_dir", None)
-    if flavor == "mac" and mac_toolchain_dir:
-        header += "import os;\nos.environ['DEVELOPER_DIR']='%s'\n" % mac_toolchain_dir
-
-    # Add header and write it out.
-    tool_path = os.path.join(out_path, "gyp-%s-tool" % prefix)
-    with open(tool_path, "w") as tool_file:
-        tool_file.write("".join([source[0], header] + source[1:]))
-
-    # Make file executable.
-    os.chmod(tool_path, 0o755)
-
-
-# From Alex Martelli,
-# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
-# ASPN: Python Cookbook: Remove duplicates from a sequence
-# First comment, dated 2001/10/13.
-# (Also in the printed Python Cookbook.)
-
-
-def uniquer(seq, idfun=lambda x: x):
-    seen = {}
-    result = []
-    for item in seq:
-        marker = idfun(item)
-        if marker in seen:
-            continue
-        seen[marker] = 1
-        result.append(item)
-    return result
-
-
-# Based on http://code.activestate.com/recipes/576694/.
-class OrderedSet(MutableSet):
-    def __init__(self, iterable=None):
-        self.end = end = []
-        end += [None, end, end]  # sentinel node for doubly linked list
-        self.map = {}  # key --> [key, prev, next]
-        if iterable is not None:
-            self |= iterable
-
-    def __len__(self):
-        return len(self.map)
-
-    def __contains__(self, key):
-        return key in self.map
-
-    def add(self, key):
-        if key not in self.map:
-            end = self.end
-            curr = end[1]
-            curr[2] = end[1] = self.map[key] = [key, curr, end]
-
-    def discard(self, key):
-        if key in self.map:
-            key, prev_item, next_item = self.map.pop(key)
-            prev_item[2] = next_item
-            next_item[1] = prev_item
-
-    def __iter__(self):
-        end = self.end
-        curr = end[2]
-        while curr is not end:
-            yield curr[0]
-            curr = curr[2]
-
-    def __reversed__(self):
-        end = self.end
-        curr = end[1]
-        while curr is not end:
-            yield curr[0]
-            curr = curr[1]
-
-    # The second argument is an addition that causes a pylint warning.
-    def pop(self, last=True):  # pylint: disable=W0221
-        if not self:
-            raise KeyError("set is empty")
-        key = self.end[1][0] if last else self.end[2][0]
-        self.discard(key)
-        return key
-
-    def __repr__(self):
-        if not self:
-            return f"{self.__class__.__name__}()"
-        return f"{self.__class__.__name__}({list(self)!r})"
-
-    def __eq__(self, other):
-        if isinstance(other, OrderedSet):
-            return len(self) == len(other) and list(self) == list(other)
-        return set(self) == set(other)
-
-    # Extensions to the recipe.
-    def update(self, iterable):
-        for i in iterable:
-            if i not in self:
-                self.add(i)
-
-
-class CycleError(Exception):
-    """An exception raised when an unexpected cycle is detected."""
-
-    def __init__(self, nodes):
-        self.nodes = nodes
-
-    def __str__(self):
-        return "CycleError: cycle involving: " + str(self.nodes)
-
-
-def TopologicallySorted(graph, get_edges):
-    r"""Topologically sort based on a user provided edge definition.
-
-  Args:
-    graph: A list of node names.
-    get_edges: A function mapping from node name to a hashable collection
-               of node names which this node has outgoing edges to.
-  Returns:
-    A list containing all of the node in graph in topological order.
-    It is assumed that calling get_edges once for each node and caching is
-    cheaper than repeatedly calling get_edges.
-  Raises:
-    CycleError in the event of a cycle.
-  Example:
-    graph = {'a': '$(b) $(c)', 'b': 'hi', 'c': '$(b)'}
-    def GetEdges(node):
-      return re.findall(r'\$\(([^))]\)', graph[node])
-    print TopologicallySorted(graph.keys(), GetEdges)
-    ==>
-    ['a', 'c', b']
-  """
-    get_edges = memoize(get_edges)
-    visited = set()
-    visiting = set()
-    ordered_nodes = []
-
-    def Visit(node):
-        if node in visiting:
-            raise CycleError(visiting)
-        if node in visited:
-            return
-        visited.add(node)
-        visiting.add(node)
-        for neighbor in get_edges(node):
-            Visit(neighbor)
-        visiting.remove(node)
-        ordered_nodes.insert(0, node)
-
-    for node in sorted(graph):
-        Visit(node)
-    return ordered_nodes
-
-
-def CrossCompileRequested():
-    # TODO: figure out how to not build extra host objects in the
-    # non-cross-compile case when this is enabled, and enable unconditionally.
-    return (
-        os.environ.get("GYP_CROSSCOMPILE")
-        or os.environ.get("AR_host")
-        or os.environ.get("CC_host")
-        or os.environ.get("CXX_host")
-        or os.environ.get("AR_target")
-        or os.environ.get("CC_target")
-        or os.environ.get("CXX_target")
-    )
-
-
-def IsCygwin():
-    try:
-        out = subprocess.Popen(
-            "uname", stdout=subprocess.PIPE, stderr=subprocess.STDOUT
-        )
-        stdout = out.communicate()[0].decode("utf-8")
-        return "CYGWIN" in str(stdout)
-    except Exception:
-        return False
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common_test.py
deleted file mode 100755
index 05344085ad3b1..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/common_test.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Unit tests for the common.py file."""
-
-import gyp.common
-import unittest
-import sys
-
-
-class TestTopologicallySorted(unittest.TestCase):
-    def test_Valid(self):
-        """Test that sorting works on a valid graph with one possible order."""
-        graph = {
-            "a": ["b", "c"],
-            "b": [],
-            "c": ["d"],
-            "d": ["b"],
-        }
-
-        def GetEdge(node):
-            return tuple(graph[node])
-
-        self.assertEqual(
-            gyp.common.TopologicallySorted(graph.keys(), GetEdge), ["a", "c", "d", "b"]
-        )
-
-    def test_Cycle(self):
-        """Test that an exception is thrown on a cyclic graph."""
-        graph = {
-            "a": ["b"],
-            "b": ["c"],
-            "c": ["d"],
-            "d": ["a"],
-        }
-
-        def GetEdge(node):
-            return tuple(graph[node])
-
-        self.assertRaises(
-            gyp.common.CycleError, gyp.common.TopologicallySorted, graph.keys(), GetEdge
-        )
-
-
-class TestGetFlavor(unittest.TestCase):
-    """Test that gyp.common.GetFlavor works as intended"""
-
-    original_platform = ""
-
-    def setUp(self):
-        self.original_platform = sys.platform
-
-    def tearDown(self):
-        sys.platform = self.original_platform
-
-    def assertFlavor(self, expected, argument, param):
-        sys.platform = argument
-        self.assertEqual(expected, gyp.common.GetFlavor(param))
-
-    def test_platform_default(self):
-        self.assertFlavor("freebsd", "freebsd9", {})
-        self.assertFlavor("freebsd", "freebsd10", {})
-        self.assertFlavor("openbsd", "openbsd5", {})
-        self.assertFlavor("solaris", "sunos5", {})
-        self.assertFlavor("solaris", "sunos", {})
-        self.assertFlavor("linux", "linux2", {})
-        self.assertFlavor("linux", "linux3", {})
-        self.assertFlavor("linux", "linux", {})
-
-    def test_param(self):
-        self.assertFlavor("foobar", "linux2", {"flavor": "foobar"})
-
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py
deleted file mode 100644
index bda1a47468ae2..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py
+++ /dev/null
@@ -1,165 +0,0 @@
-# Copyright (c) 2011 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import sys
-import re
-import os
-import locale
-from functools import reduce
-
-
-def XmlToString(content, encoding="utf-8", pretty=False):
-    """ Writes the XML content to disk, touching the file only if it has changed.
-
-  Visual Studio files have a lot of pre-defined structures.  This function makes
-  it easy to represent these structures as Python data structures, instead of
-  having to create a lot of function calls.
-
-  Each XML element of the content is represented as a list composed of:
-  1. The name of the element, a string,
-  2. The attributes of the element, a dictionary (optional), and
-  3+. The content of the element, if any.  Strings are simple text nodes and
-      lists are child elements.
-
-  Example 1:
-      
-  becomes
-      ['test']
-
-  Example 2:
-      
-         This is
-         it!
-      
-
-  becomes
-      ['myelement', {'a':'value1', 'b':'value2'},
-         ['childtype', 'This is'],
-         ['childtype', 'it!'],
-      ]
-
-  Args:
-    content:  The structured content to be converted.
-    encoding: The encoding to report on the first XML line.
-    pretty: True if we want pretty printing with indents and new lines.
-
-  Returns:
-    The XML content as a string.
-  """
-    # We create a huge list of all the elements of the file.
-    xml_parts = ['' % encoding]
-    if pretty:
-        xml_parts.append("\n")
-    _ConstructContentList(xml_parts, content, pretty)
-
-    # Convert it to a string
-    return "".join(xml_parts)
-
-
-def _ConstructContentList(xml_parts, specification, pretty, level=0):
-    """ Appends the XML parts corresponding to the specification.
-
-  Args:
-    xml_parts: A list of XML parts to be appended to.
-    specification:  The specification of the element.  See EasyXml docs.
-    pretty: True if we want pretty printing with indents and new lines.
-    level: Indentation level.
-  """
-    # The first item in a specification is the name of the element.
-    if pretty:
-        indentation = "  " * level
-        new_line = "\n"
-    else:
-        indentation = ""
-        new_line = ""
-    name = specification[0]
-    if not isinstance(name, str):
-        raise Exception(
-            "The first item of an EasyXml specification should be "
-            "a string.  Specification was " + str(specification)
-        )
-    xml_parts.append(indentation + "<" + name)
-
-    # Optionally in second position is a dictionary of the attributes.
-    rest = specification[1:]
-    if rest and isinstance(rest[0], dict):
-        for at, val in sorted(rest[0].items()):
-            xml_parts.append(f' {at}="{_XmlEscape(val, attr=True)}"')
-        rest = rest[1:]
-    if rest:
-        xml_parts.append(">")
-        all_strings = reduce(lambda x, y: x and isinstance(y, str), rest, True)
-        multi_line = not all_strings
-        if multi_line and new_line:
-            xml_parts.append(new_line)
-        for child_spec in rest:
-            # If it's a string, append a text node.
-            # Otherwise recurse over that child definition
-            if isinstance(child_spec, str):
-                xml_parts.append(_XmlEscape(child_spec))
-            else:
-                _ConstructContentList(xml_parts, child_spec, pretty, level + 1)
-        if multi_line and indentation:
-            xml_parts.append(indentation)
-        xml_parts.append(f"{new_line}")
-    else:
-        xml_parts.append("/>%s" % new_line)
-
-
-def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False,
-                      win32=(sys.platform == "win32")):
-    """ Writes the XML content to disk, touching the file only if it has changed.
-
-  Args:
-    content:  The structured content to be written.
-    path: Location of the file.
-    encoding: The encoding to report on the first line of the XML file.
-    pretty: True if we want pretty printing with indents and new lines.
-  """
-    xml_string = XmlToString(content, encoding, pretty)
-    if win32 and os.linesep != "\r\n":
-        xml_string = xml_string.replace("\n", "\r\n")
-
-    default_encoding = locale.getdefaultlocale()[1]
-    if default_encoding and default_encoding.upper() != encoding.upper():
-        xml_string = xml_string.encode(encoding)
-
-    # Get the old content
-    try:
-        with open(path) as file:
-            existing = file.read()
-    except OSError:
-        existing = None
-
-    # It has changed, write it
-    if existing != xml_string:
-        with open(path, "wb") as file:
-            file.write(xml_string)
-
-
-_xml_escape_map = {
-    '"': """,
-    "'": "'",
-    "<": "<",
-    ">": ">",
-    "&": "&",
-    "\n": "
",
-    "\r": "
",
-}
-
-
-_xml_escape_re = re.compile("(%s)" % "|".join(map(re.escape, _xml_escape_map.keys())))
-
-
-def _XmlEscape(value, attr=False):
-    """ Escape a string for inclusion in XML."""
-
-    def replace(match):
-        m = match.string[match.start() : match.end()]
-        # don't replace single quotes in attrs
-        if attr and m == "'":
-            return m
-        return _xml_escape_map[m]
-
-    return _xml_escape_re.sub(replace, value)
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py
deleted file mode 100755
index 342f693a329d2..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright (c) 2011 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-""" Unit tests for the easy_xml.py file. """
-
-import gyp.easy_xml as easy_xml
-import unittest
-
-from io import StringIO
-
-
-class TestSequenceFunctions(unittest.TestCase):
-    def setUp(self):
-        self.stderr = StringIO()
-
-    def test_EasyXml_simple(self):
-        self.assertEqual(
-            easy_xml.XmlToString(["test"]),
-            '',
-        )
-
-        self.assertEqual(
-            easy_xml.XmlToString(["test"], encoding="Windows-1252"),
-            '',
-        )
-
-    def test_EasyXml_simple_with_attributes(self):
-        self.assertEqual(
-            easy_xml.XmlToString(["test2", {"a": "value1", "b": "value2"}]),
-            '',
-        )
-
-    def test_EasyXml_escaping(self):
-        original = "'\"\r&\nfoo"
-        converted = "<test>'"
&
foo"
-        converted_apos = converted.replace("'", "'")
-        self.assertEqual(
-            easy_xml.XmlToString(["test3", {"a": original}, original]),
-            '%s'
-            % (converted, converted_apos),
-        )
-
-    def test_EasyXml_pretty(self):
-        self.assertEqual(
-            easy_xml.XmlToString(
-                ["test3", ["GrandParent", ["Parent1", ["Child"]], ["Parent2"]]],
-                pretty=True,
-            ),
-            '\n'
-            "\n"
-            "  \n"
-            "    \n"
-            "      \n"
-            "    \n"
-            "    \n"
-            "  \n"
-            "\n",
-        )
-
-    def test_EasyXml_complex(self):
-        # We want to create:
-        target = (
-            ''
-            ""
-            ''
-            "{D2250C20-3A94-4FB9-AF73-11BC5B73884B}"
-            "Win32Proj"
-            "automated_ui_tests"
-            ""
-            ''
-            "'
-            "Application"
-            "Unicode"
-            ""
-            ""
-        )
-
-        xml = easy_xml.XmlToString(
-            [
-                "Project",
-                [
-                    "PropertyGroup",
-                    {"Label": "Globals"},
-                    ["ProjectGuid", "{D2250C20-3A94-4FB9-AF73-11BC5B73884B}"],
-                    ["Keyword", "Win32Proj"],
-                    ["RootNamespace", "automated_ui_tests"],
-                ],
-                ["Import", {"Project": "$(VCTargetsPath)\\Microsoft.Cpp.props"}],
-                [
-                    "PropertyGroup",
-                    {
-                        "Condition": "'$(Configuration)|$(Platform)'=='Debug|Win32'",
-                        "Label": "Configuration",
-                    },
-                    ["ConfigurationType", "Application"],
-                    ["CharacterSet", "Unicode"],
-                ],
-            ]
-        )
-        self.assertEqual(xml, target)
-
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py
deleted file mode 100755
index 0754aff26fe7c..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2011 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""These functions are executed via gyp-flock-tool when using the Makefile
-generator.  Used on systems that don't have a built-in flock."""
-
-import fcntl
-import os
-import struct
-import subprocess
-import sys
-
-
-def main(args):
-    executor = FlockTool()
-    executor.Dispatch(args)
-
-
-class FlockTool:
-    """This class emulates the 'flock' command."""
-
-    def Dispatch(self, args):
-        """Dispatches a string command to a method."""
-        if len(args) < 1:
-            raise Exception("Not enough arguments")
-
-        method = "Exec%s" % self._CommandifyName(args[0])
-        getattr(self, method)(*args[1:])
-
-    def _CommandifyName(self, name_string):
-        """Transforms a tool name like copy-info-plist to CopyInfoPlist"""
-        return name_string.title().replace("-", "")
-
-    def ExecFlock(self, lockfile, *cmd_list):
-        """Emulates the most basic behavior of Linux's flock(1)."""
-        # Rely on exception handling to report errors.
-        # Note that the stock python on SunOS has a bug
-        # where fcntl.flock(fd, LOCK_EX) always fails
-        # with EBADF, that's why we use this F_SETLK
-        # hack instead.
-        fd = os.open(lockfile, os.O_WRONLY | os.O_NOCTTY | os.O_CREAT, 0o666)
-        if sys.platform.startswith("aix") or sys.platform == "os400":
-            # Python on AIX is compiled with LARGEFILE support, which changes the
-            # struct size.
-            op = struct.pack("hhIllqq", fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
-        else:
-            op = struct.pack("hhllhhl", fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
-        fcntl.fcntl(fd, fcntl.F_SETLK, op)
-        return subprocess.call(cmd_list)
-
-
-if __name__ == "__main__":
-    sys.exit(main(sys.argv[1:]))
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py
deleted file mode 100644
index e69de29bb2d1d..0000000000000
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py
deleted file mode 100644
index f15df00c36373..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py
+++ /dev/null
@@ -1,808 +0,0 @@
-# Copyright (c) 2014 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""
-This script is intended for use as a GYP_GENERATOR. It takes as input (by way of
-the generator flag config_path) the path of a json file that dictates the files
-and targets to search for. The following keys are supported:
-files: list of paths (relative) of the files to search for.
-test_targets: unqualified target names to search for. Any target in this list
-that depends upon a file in |files| is output regardless of the type of target
-or chain of dependencies.
-additional_compile_targets: Unqualified targets to search for in addition to
-test_targets. Targets in the combined list that depend upon a file in |files|
-are not necessarily output. For example, if the target is of type none then the
-target is not output (but one of the descendants of the target will be).
-
-The following is output:
-error: only supplied if there is an error.
-compile_targets: minimal set of targets that directly or indirectly (for
-  targets of type none) depend on the files in |files| and is one of the
-  supplied targets or a target that one of the supplied targets depends on.
-  The expectation is this set of targets is passed into a build step. This list
-  always contains the output of test_targets as well.
-test_targets: set of targets from the supplied |test_targets| that either
-  directly or indirectly depend upon a file in |files|. This list if useful
-  if additional processing needs to be done for certain targets after the
-  build, such as running tests.
-status: outputs one of three values: none of the supplied files were found,
-  one of the include files changed so that it should be assumed everything
-  changed (in this case test_targets and compile_targets are not output) or at
-  least one file was found.
-invalid_targets: list of supplied targets that were not found.
-
-Example:
-Consider a graph like the following:
-  A     D
- / \
-B   C
-A depends upon both B and C, A is of type none and B and C are executables.
-D is an executable, has no dependencies and nothing depends on it.
-If |additional_compile_targets| = ["A"], |test_targets| = ["B", "C"] and
-files = ["b.cc", "d.cc"] (B depends upon b.cc and D depends upon d.cc), then
-the following is output:
-|compile_targets| = ["B"] B must built as it depends upon the changed file b.cc
-and the supplied target A depends upon it. A is not output as a build_target
-as it is of type none with no rules and actions.
-|test_targets| = ["B"] B directly depends upon the change file b.cc.
-
-Even though the file d.cc, which D depends upon, has changed D is not output
-as it was not supplied by way of |additional_compile_targets| or |test_targets|.
-
-If the generator flag analyzer_output_path is specified, output is written
-there. Otherwise output is written to stdout.
-
-In Gyp the "all" target is shorthand for the root targets in the files passed
-to gyp. For example, if file "a.gyp" contains targets "a1" and
-"a2", and file "b.gyp" contains targets "b1" and "b2" and "a2" has a dependency
-on "b2" and gyp is supplied "a.gyp" then "all" consists of "a1" and "a2".
-Notice that "b1" and "b2" are not in the "all" target as "b.gyp" was not
-directly supplied to gyp. OTOH if both "a.gyp" and "b.gyp" are supplied to gyp
-then the "all" target includes "b1" and "b2".
-"""
-
-
-import gyp.common
-import json
-import os
-import posixpath
-
-debug = False
-
-found_dependency_string = "Found dependency"
-no_dependency_string = "No dependencies"
-# Status when it should be assumed that everything has changed.
-all_changed_string = "Found dependency (all)"
-
-# MatchStatus is used indicate if and how a target depends upon the supplied
-# sources.
-# The target's sources contain one of the supplied paths.
-MATCH_STATUS_MATCHES = 1
-# The target has a dependency on another target that contains one of the
-# supplied paths.
-MATCH_STATUS_MATCHES_BY_DEPENDENCY = 2
-# The target's sources weren't in the supplied paths and none of the target's
-# dependencies depend upon a target that matched.
-MATCH_STATUS_DOESNT_MATCH = 3
-# The target doesn't contain the source, but the dependent targets have not yet
-# been visited to determine a more specific status yet.
-MATCH_STATUS_TBD = 4
-
-generator_supports_multiple_toolsets = gyp.common.CrossCompileRequested()
-
-generator_wants_static_library_dependencies_adjusted = False
-
-generator_default_variables = {}
-for dirname in [
-    "INTERMEDIATE_DIR",
-    "SHARED_INTERMEDIATE_DIR",
-    "PRODUCT_DIR",
-    "LIB_DIR",
-    "SHARED_LIB_DIR",
-]:
-    generator_default_variables[dirname] = "!!!"
-
-for unused in [
-    "RULE_INPUT_PATH",
-    "RULE_INPUT_ROOT",
-    "RULE_INPUT_NAME",
-    "RULE_INPUT_DIRNAME",
-    "RULE_INPUT_EXT",
-    "EXECUTABLE_PREFIX",
-    "EXECUTABLE_SUFFIX",
-    "STATIC_LIB_PREFIX",
-    "STATIC_LIB_SUFFIX",
-    "SHARED_LIB_PREFIX",
-    "SHARED_LIB_SUFFIX",
-    "CONFIGURATION_NAME",
-]:
-    generator_default_variables[unused] = ""
-
-
-def _ToGypPath(path):
-    """Converts a path to the format used by gyp."""
-    if os.sep == "\\" and os.altsep == "/":
-        return path.replace("\\", "/")
-    return path
-
-
-def _ResolveParent(path, base_path_components):
-    """Resolves |path|, which starts with at least one '../'. Returns an empty
-  string if the path shouldn't be considered. See _AddSources() for a
-  description of |base_path_components|."""
-    depth = 0
-    while path.startswith("../"):
-        depth += 1
-        path = path[3:]
-    # Relative includes may go outside the source tree. For example, an action may
-    # have inputs in /usr/include, which are not in the source tree.
-    if depth > len(base_path_components):
-        return ""
-    if depth == len(base_path_components):
-        return path
-    return (
-        "/".join(base_path_components[0 : len(base_path_components) - depth])
-        + "/"
-        + path
-    )
-
-
-def _AddSources(sources, base_path, base_path_components, result):
-    """Extracts valid sources from |sources| and adds them to |result|. Each
-  source file is relative to |base_path|, but may contain '..'. To make
-  resolving '..' easier |base_path_components| contains each of the
-  directories in |base_path|. Additionally each source may contain variables.
-  Such sources are ignored as it is assumed dependencies on them are expressed
-  and tracked in some other means."""
-    # NOTE: gyp paths are always posix style.
-    for source in sources:
-        if not len(source) or source.startswith("!!!") or source.startswith("$"):
-            continue
-        # variable expansion may lead to //.
-        org_source = source
-        source = source[0] + source[1:].replace("//", "/")
-        if source.startswith("../"):
-            source = _ResolveParent(source, base_path_components)
-            if len(source):
-                result.append(source)
-            continue
-        result.append(base_path + source)
-        if debug:
-            print("AddSource", org_source, result[len(result) - 1])
-
-
-def _ExtractSourcesFromAction(action, base_path, base_path_components, results):
-    if "inputs" in action:
-        _AddSources(action["inputs"], base_path, base_path_components, results)
-
-
-def _ToLocalPath(toplevel_dir, path):
-    """Converts |path| to a path relative to |toplevel_dir|."""
-    if path == toplevel_dir:
-        return ""
-    if path.startswith(toplevel_dir + "/"):
-        return path[len(toplevel_dir) + len("/") :]
-    return path
-
-
-def _ExtractSources(target, target_dict, toplevel_dir):
-    # |target| is either absolute or relative and in the format of the OS. Gyp
-    # source paths are always posix. Convert |target| to a posix path relative to
-    # |toplevel_dir_|. This is done to make it easy to build source paths.
-    base_path = posixpath.dirname(_ToLocalPath(toplevel_dir, _ToGypPath(target)))
-    base_path_components = base_path.split("/")
-
-    # Add a trailing '/' so that _AddSources() can easily build paths.
-    if len(base_path):
-        base_path += "/"
-
-    if debug:
-        print("ExtractSources", target, base_path)
-
-    results = []
-    if "sources" in target_dict:
-        _AddSources(target_dict["sources"], base_path, base_path_components, results)
-    # Include the inputs from any actions. Any changes to these affect the
-    # resulting output.
-    if "actions" in target_dict:
-        for action in target_dict["actions"]:
-            _ExtractSourcesFromAction(action, base_path, base_path_components, results)
-    if "rules" in target_dict:
-        for rule in target_dict["rules"]:
-            _ExtractSourcesFromAction(rule, base_path, base_path_components, results)
-
-    return results
-
-
-class Target:
-    """Holds information about a particular target:
-  deps: set of Targets this Target depends upon. This is not recursive, only the
-    direct dependent Targets.
-  match_status: one of the MatchStatus values.
-  back_deps: set of Targets that have a dependency on this Target.
-  visited: used during iteration to indicate whether we've visited this target.
-    This is used for two iterations, once in building the set of Targets and
-    again in _GetBuildTargets().
-  name: fully qualified name of the target.
-  requires_build: True if the target type is such that it needs to be built.
-    See _DoesTargetTypeRequireBuild for details.
-  added_to_compile_targets: used when determining if the target was added to the
-    set of targets that needs to be built.
-  in_roots: true if this target is a descendant of one of the root nodes.
-  is_executable: true if the type of target is executable.
-  is_static_library: true if the type of target is static_library.
-  is_or_has_linked_ancestor: true if the target does a link (eg executable), or
-    if there is a target in back_deps that does a link."""
-
-    def __init__(self, name):
-        self.deps = set()
-        self.match_status = MATCH_STATUS_TBD
-        self.back_deps = set()
-        self.name = name
-        # TODO(sky): I don't like hanging this off Target. This state is specific
-        # to certain functions and should be isolated there.
-        self.visited = False
-        self.requires_build = False
-        self.added_to_compile_targets = False
-        self.in_roots = False
-        self.is_executable = False
-        self.is_static_library = False
-        self.is_or_has_linked_ancestor = False
-
-
-class Config:
-    """Details what we're looking for
-  files: set of files to search for
-  targets: see file description for details."""
-
-    def __init__(self):
-        self.files = []
-        self.targets = set()
-        self.additional_compile_target_names = set()
-        self.test_target_names = set()
-
-    def Init(self, params):
-        """Initializes Config. This is a separate method as it raises an exception
-    if there is a parse error."""
-        generator_flags = params.get("generator_flags", {})
-        config_path = generator_flags.get("config_path", None)
-        if not config_path:
-            return
-        try:
-            f = open(config_path)
-            config = json.load(f)
-            f.close()
-        except OSError:
-            raise Exception("Unable to open file " + config_path)
-        except ValueError as e:
-            raise Exception("Unable to parse config file " + config_path + str(e))
-        if not isinstance(config, dict):
-            raise Exception("config_path must be a JSON file containing a dictionary")
-        self.files = config.get("files", [])
-        self.additional_compile_target_names = set(
-            config.get("additional_compile_targets", [])
-        )
-        self.test_target_names = set(config.get("test_targets", []))
-
-
-def _WasBuildFileModified(build_file, data, files, toplevel_dir):
-    """Returns true if the build file |build_file| is either in |files| or
-  one of the files included by |build_file| is in |files|. |toplevel_dir| is
-  the root of the source tree."""
-    if _ToLocalPath(toplevel_dir, _ToGypPath(build_file)) in files:
-        if debug:
-            print("gyp file modified", build_file)
-        return True
-
-    # First element of included_files is the file itself.
-    if len(data[build_file]["included_files"]) <= 1:
-        return False
-
-    for include_file in data[build_file]["included_files"][1:]:
-        # |included_files| are relative to the directory of the |build_file|.
-        rel_include_file = _ToGypPath(
-            gyp.common.UnrelativePath(include_file, build_file)
-        )
-        if _ToLocalPath(toplevel_dir, rel_include_file) in files:
-            if debug:
-                print(
-                    "included gyp file modified, gyp_file=",
-                    build_file,
-                    "included file=",
-                    rel_include_file,
-                )
-            return True
-    return False
-
-
-def _GetOrCreateTargetByName(targets, target_name):
-    """Creates or returns the Target at targets[target_name]. If there is no
-  Target for |target_name| one is created. Returns a tuple of whether a new
-  Target was created and the Target."""
-    if target_name in targets:
-        return False, targets[target_name]
-    target = Target(target_name)
-    targets[target_name] = target
-    return True, target
-
-
-def _DoesTargetTypeRequireBuild(target_dict):
-    """Returns true if the target type is such that it needs to be built."""
-    # If a 'none' target has rules or actions we assume it requires a build.
-    return bool(
-        target_dict["type"] != "none"
-        or target_dict.get("actions")
-        or target_dict.get("rules")
-    )
-
-
-def _GenerateTargets(data, target_list, target_dicts, toplevel_dir, files, build_files):
-    """Returns a tuple of the following:
-  . A dictionary mapping from fully qualified name to Target.
-  . A list of the targets that have a source file in |files|.
-  . Targets that constitute the 'all' target. See description at top of file
-    for details on the 'all' target.
-  This sets the |match_status| of the targets that contain any of the source
-  files in |files| to MATCH_STATUS_MATCHES.
-  |toplevel_dir| is the root of the source tree."""
-    # Maps from target name to Target.
-    name_to_target = {}
-
-    # Targets that matched.
-    matching_targets = []
-
-    # Queue of targets to visit.
-    targets_to_visit = target_list[:]
-
-    # Maps from build file to a boolean indicating whether the build file is in
-    # |files|.
-    build_file_in_files = {}
-
-    # Root targets across all files.
-    roots = set()
-
-    # Set of Targets in |build_files|.
-    build_file_targets = set()
-
-    while len(targets_to_visit) > 0:
-        target_name = targets_to_visit.pop()
-        created_target, target = _GetOrCreateTargetByName(name_to_target, target_name)
-        if created_target:
-            roots.add(target)
-        elif target.visited:
-            continue
-
-        target.visited = True
-        target.requires_build = _DoesTargetTypeRequireBuild(target_dicts[target_name])
-        target_type = target_dicts[target_name]["type"]
-        target.is_executable = target_type == "executable"
-        target.is_static_library = target_type == "static_library"
-        target.is_or_has_linked_ancestor = (
-            target_type == "executable" or target_type == "shared_library"
-        )
-
-        build_file = gyp.common.ParseQualifiedTarget(target_name)[0]
-        if build_file not in build_file_in_files:
-            build_file_in_files[build_file] = _WasBuildFileModified(
-                build_file, data, files, toplevel_dir
-            )
-
-        if build_file in build_files:
-            build_file_targets.add(target)
-
-        # If a build file (or any of its included files) is modified we assume all
-        # targets in the file are modified.
-        if build_file_in_files[build_file]:
-            print("matching target from modified build file", target_name)
-            target.match_status = MATCH_STATUS_MATCHES
-            matching_targets.append(target)
-        else:
-            sources = _ExtractSources(
-                target_name, target_dicts[target_name], toplevel_dir
-            )
-            for source in sources:
-                if _ToGypPath(os.path.normpath(source)) in files:
-                    print("target", target_name, "matches", source)
-                    target.match_status = MATCH_STATUS_MATCHES
-                    matching_targets.append(target)
-                    break
-
-        # Add dependencies to visit as well as updating back pointers for deps.
-        for dep in target_dicts[target_name].get("dependencies", []):
-            targets_to_visit.append(dep)
-
-            created_dep_target, dep_target = _GetOrCreateTargetByName(
-                name_to_target, dep
-            )
-            if not created_dep_target:
-                roots.discard(dep_target)
-
-            target.deps.add(dep_target)
-            dep_target.back_deps.add(target)
-
-    return name_to_target, matching_targets, roots & build_file_targets
-
-
-def _GetUnqualifiedToTargetMapping(all_targets, to_find):
-    """Returns a tuple of the following:
-  . mapping (dictionary) from unqualified name to Target for all the
-    Targets in |to_find|.
-  . any target names not found. If this is empty all targets were found."""
-    result = {}
-    if not to_find:
-        return {}, []
-    to_find = set(to_find)
-    for target_name in all_targets.keys():
-        extracted = gyp.common.ParseQualifiedTarget(target_name)
-        if len(extracted) > 1 and extracted[1] in to_find:
-            to_find.remove(extracted[1])
-            result[extracted[1]] = all_targets[target_name]
-            if not to_find:
-                return result, []
-    return result, [x for x in to_find]
-
-
-def _DoesTargetDependOnMatchingTargets(target):
-    """Returns true if |target| or any of its dependencies is one of the
-  targets containing the files supplied as input to analyzer. This updates
-  |matches| of the Targets as it recurses.
-  target: the Target to look for."""
-    if target.match_status == MATCH_STATUS_DOESNT_MATCH:
-        return False
-    if (
-        target.match_status == MATCH_STATUS_MATCHES
-        or target.match_status == MATCH_STATUS_MATCHES_BY_DEPENDENCY
-    ):
-        return True
-    for dep in target.deps:
-        if _DoesTargetDependOnMatchingTargets(dep):
-            target.match_status = MATCH_STATUS_MATCHES_BY_DEPENDENCY
-            print("\t", target.name, "matches by dep", dep.name)
-            return True
-    target.match_status = MATCH_STATUS_DOESNT_MATCH
-    return False
-
-
-def _GetTargetsDependingOnMatchingTargets(possible_targets):
-    """Returns the list of Targets in |possible_targets| that depend (either
-  directly on indirectly) on at least one of the targets containing the files
-  supplied as input to analyzer.
-  possible_targets: targets to search from."""
-    found = []
-    print("Targets that matched by dependency:")
-    for target in possible_targets:
-        if _DoesTargetDependOnMatchingTargets(target):
-            found.append(target)
-    return found
-
-
-def _AddCompileTargets(target, roots, add_if_no_ancestor, result):
-    """Recurses through all targets that depend on |target|, adding all targets
-  that need to be built (and are in |roots|) to |result|.
-  roots: set of root targets.
-  add_if_no_ancestor: If true and there are no ancestors of |target| then add
-  |target| to |result|. |target| must still be in |roots|.
-  result: targets that need to be built are added here."""
-    if target.visited:
-        return
-
-    target.visited = True
-    target.in_roots = target in roots
-
-    for back_dep_target in target.back_deps:
-        _AddCompileTargets(back_dep_target, roots, False, result)
-        target.added_to_compile_targets |= back_dep_target.added_to_compile_targets
-        target.in_roots |= back_dep_target.in_roots
-        target.is_or_has_linked_ancestor |= back_dep_target.is_or_has_linked_ancestor
-
-    # Always add 'executable' targets. Even though they may be built by other
-    # targets that depend upon them it makes detection of what is going to be
-    # built easier.
-    # And always add static_libraries that have no dependencies on them from
-    # linkables. This is necessary as the other dependencies on them may be
-    # static libraries themselves, which are not compile time dependencies.
-    if target.in_roots and (
-        target.is_executable
-        or (
-            not target.added_to_compile_targets
-            and (add_if_no_ancestor or target.requires_build)
-        )
-        or (
-            target.is_static_library
-            and add_if_no_ancestor
-            and not target.is_or_has_linked_ancestor
-        )
-    ):
-        print(
-            "\t\tadding to compile targets",
-            target.name,
-            "executable",
-            target.is_executable,
-            "added_to_compile_targets",
-            target.added_to_compile_targets,
-            "add_if_no_ancestor",
-            add_if_no_ancestor,
-            "requires_build",
-            target.requires_build,
-            "is_static_library",
-            target.is_static_library,
-            "is_or_has_linked_ancestor",
-            target.is_or_has_linked_ancestor,
-        )
-        result.add(target)
-        target.added_to_compile_targets = True
-
-
-def _GetCompileTargets(matching_targets, supplied_targets):
-    """Returns the set of Targets that require a build.
-  matching_targets: targets that changed and need to be built.
-  supplied_targets: set of targets supplied to analyzer to search from."""
-    result = set()
-    for target in matching_targets:
-        print("finding compile targets for match", target.name)
-        _AddCompileTargets(target, supplied_targets, True, result)
-    return result
-
-
-def _WriteOutput(params, **values):
-    """Writes the output, either to stdout or a file is specified."""
-    if "error" in values:
-        print("Error:", values["error"])
-    if "status" in values:
-        print(values["status"])
-    if "targets" in values:
-        values["targets"].sort()
-        print("Supplied targets that depend on changed files:")
-        for target in values["targets"]:
-            print("\t", target)
-    if "invalid_targets" in values:
-        values["invalid_targets"].sort()
-        print("The following targets were not found:")
-        for target in values["invalid_targets"]:
-            print("\t", target)
-    if "build_targets" in values:
-        values["build_targets"].sort()
-        print("Targets that require a build:")
-        for target in values["build_targets"]:
-            print("\t", target)
-    if "compile_targets" in values:
-        values["compile_targets"].sort()
-        print("Targets that need to be built:")
-        for target in values["compile_targets"]:
-            print("\t", target)
-    if "test_targets" in values:
-        values["test_targets"].sort()
-        print("Test targets:")
-        for target in values["test_targets"]:
-            print("\t", target)
-
-    output_path = params.get("generator_flags", {}).get("analyzer_output_path", None)
-    if not output_path:
-        print(json.dumps(values))
-        return
-    try:
-        f = open(output_path, "w")
-        f.write(json.dumps(values) + "\n")
-        f.close()
-    except OSError as e:
-        print("Error writing to output file", output_path, str(e))
-
-
-def _WasGypIncludeFileModified(params, files):
-    """Returns true if one of the files in |files| is in the set of included
-  files."""
-    if params["options"].includes:
-        for include in params["options"].includes:
-            if _ToGypPath(os.path.normpath(include)) in files:
-                print("Include file modified, assuming all changed", include)
-                return True
-    return False
-
-
-def _NamesNotIn(names, mapping):
-    """Returns a list of the values in |names| that are not in |mapping|."""
-    return [name for name in names if name not in mapping]
-
-
-def _LookupTargets(names, mapping):
-    """Returns a list of the mapping[name] for each value in |names| that is in
-  |mapping|."""
-    return [mapping[name] for name in names if name in mapping]
-
-
-def CalculateVariables(default_variables, params):
-    """Calculate additional variables for use in the build (called by gyp)."""
-    flavor = gyp.common.GetFlavor(params)
-    if flavor == "mac":
-        default_variables.setdefault("OS", "mac")
-    elif flavor == "win":
-        default_variables.setdefault("OS", "win")
-        gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)
-    else:
-        operating_system = flavor
-        if flavor == "android":
-            operating_system = "linux"  # Keep this legacy behavior for now.
-        default_variables.setdefault("OS", operating_system)
-
-
-class TargetCalculator:
-    """Calculates the matching test_targets and matching compile_targets."""
-
-    def __init__(
-        self,
-        files,
-        additional_compile_target_names,
-        test_target_names,
-        data,
-        target_list,
-        target_dicts,
-        toplevel_dir,
-        build_files,
-    ):
-        self._additional_compile_target_names = set(additional_compile_target_names)
-        self._test_target_names = set(test_target_names)
-        (
-            self._name_to_target,
-            self._changed_targets,
-            self._root_targets,
-        ) = _GenerateTargets(
-            data, target_list, target_dicts, toplevel_dir, frozenset(files), build_files
-        )
-        (
-            self._unqualified_mapping,
-            self.invalid_targets,
-        ) = _GetUnqualifiedToTargetMapping(
-            self._name_to_target, self._supplied_target_names_no_all()
-        )
-
-    def _supplied_target_names(self):
-        return self._additional_compile_target_names | self._test_target_names
-
-    def _supplied_target_names_no_all(self):
-        """Returns the supplied test targets without 'all'."""
-        result = self._supplied_target_names()
-        result.discard("all")
-        return result
-
-    def is_build_impacted(self):
-        """Returns true if the supplied files impact the build at all."""
-        return self._changed_targets
-
-    def find_matching_test_target_names(self):
-        """Returns the set of output test targets."""
-        assert self.is_build_impacted()
-        # Find the test targets first. 'all' is special cased to mean all the
-        # root targets. To deal with all the supplied |test_targets| are expanded
-        # to include the root targets during lookup. If any of the root targets
-        # match, we remove it and replace it with 'all'.
-        test_target_names_no_all = set(self._test_target_names)
-        test_target_names_no_all.discard("all")
-        test_targets_no_all = _LookupTargets(
-            test_target_names_no_all, self._unqualified_mapping
-        )
-        test_target_names_contains_all = "all" in self._test_target_names
-        if test_target_names_contains_all:
-            test_targets = [
-                x for x in (set(test_targets_no_all) | set(self._root_targets))
-            ]
-        else:
-            test_targets = [x for x in test_targets_no_all]
-        print("supplied test_targets")
-        for target_name in self._test_target_names:
-            print("\t", target_name)
-        print("found test_targets")
-        for target in test_targets:
-            print("\t", target.name)
-        print("searching for matching test targets")
-        matching_test_targets = _GetTargetsDependingOnMatchingTargets(test_targets)
-        matching_test_targets_contains_all = test_target_names_contains_all and set(
-            matching_test_targets
-        ) & set(self._root_targets)
-        if matching_test_targets_contains_all:
-            # Remove any of the targets for all that were not explicitly supplied,
-            # 'all' is subsequentely added to the matching names below.
-            matching_test_targets = [
-                x for x in (set(matching_test_targets) & set(test_targets_no_all))
-            ]
-        print("matched test_targets")
-        for target in matching_test_targets:
-            print("\t", target.name)
-        matching_target_names = [
-            gyp.common.ParseQualifiedTarget(target.name)[1]
-            for target in matching_test_targets
-        ]
-        if matching_test_targets_contains_all:
-            matching_target_names.append("all")
-            print("\tall")
-        return matching_target_names
-
-    def find_matching_compile_target_names(self):
-        """Returns the set of output compile targets."""
-        assert self.is_build_impacted()
-        # Compile targets are found by searching up from changed targets.
-        # Reset the visited status for _GetBuildTargets.
-        for target in self._name_to_target.values():
-            target.visited = False
-
-        supplied_targets = _LookupTargets(
-            self._supplied_target_names_no_all(), self._unqualified_mapping
-        )
-        if "all" in self._supplied_target_names():
-            supplied_targets = [
-                x for x in (set(supplied_targets) | set(self._root_targets))
-            ]
-        print("Supplied test_targets & compile_targets")
-        for target in supplied_targets:
-            print("\t", target.name)
-        print("Finding compile targets")
-        compile_targets = _GetCompileTargets(self._changed_targets, supplied_targets)
-        return [
-            gyp.common.ParseQualifiedTarget(target.name)[1]
-            for target in compile_targets
-        ]
-
-
-def GenerateOutput(target_list, target_dicts, data, params):
-    """Called by gyp as the final stage. Outputs results."""
-    config = Config()
-    try:
-        config.Init(params)
-
-        if not config.files:
-            raise Exception(
-                "Must specify files to analyze via config_path generator " "flag"
-            )
-
-        toplevel_dir = _ToGypPath(os.path.abspath(params["options"].toplevel_dir))
-        if debug:
-            print("toplevel_dir", toplevel_dir)
-
-        if _WasGypIncludeFileModified(params, config.files):
-            result_dict = {
-                "status": all_changed_string,
-                "test_targets": list(config.test_target_names),
-                "compile_targets": list(
-                    config.additional_compile_target_names | config.test_target_names
-                ),
-            }
-            _WriteOutput(params, **result_dict)
-            return
-
-        calculator = TargetCalculator(
-            config.files,
-            config.additional_compile_target_names,
-            config.test_target_names,
-            data,
-            target_list,
-            target_dicts,
-            toplevel_dir,
-            params["build_files"],
-        )
-        if not calculator.is_build_impacted():
-            result_dict = {
-                "status": no_dependency_string,
-                "test_targets": [],
-                "compile_targets": [],
-            }
-            if calculator.invalid_targets:
-                result_dict["invalid_targets"] = calculator.invalid_targets
-            _WriteOutput(params, **result_dict)
-            return
-
-        test_target_names = calculator.find_matching_test_target_names()
-        compile_target_names = calculator.find_matching_compile_target_names()
-        found_at_least_one_target = compile_target_names or test_target_names
-        result_dict = {
-            "test_targets": test_target_names,
-            "status": found_dependency_string
-            if found_at_least_one_target
-            else no_dependency_string,
-            "compile_targets": list(set(compile_target_names) | set(test_target_names)),
-        }
-        if calculator.invalid_targets:
-            result_dict["invalid_targets"] = calculator.invalid_targets
-        _WriteOutput(params, **result_dict)
-
-    except Exception as e:
-        _WriteOutput(params, error=str(e))
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py
deleted file mode 100644
index cdf1a4832cf1a..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py
+++ /dev/null
@@ -1,1173 +0,0 @@
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Notes:
-#
-# This generates makefiles suitable for inclusion into the Android build system
-# via an Android.mk file. It is based on make.py, the standard makefile
-# generator.
-#
-# The code below generates a separate .mk file for each target, but
-# all are sourced by the top-level GypAndroid.mk.  This means that all
-# variables in .mk-files clobber one another, and furthermore that any
-# variables set potentially clash with other Android build system variables.
-# Try to avoid setting global variables where possible.
-
-
-import gyp
-import gyp.common
-import gyp.generator.make as make  # Reuse global functions from make backend.
-import os
-import re
-import subprocess
-
-generator_default_variables = {
-    "OS": "android",
-    "EXECUTABLE_PREFIX": "",
-    "EXECUTABLE_SUFFIX": "",
-    "STATIC_LIB_PREFIX": "lib",
-    "SHARED_LIB_PREFIX": "lib",
-    "STATIC_LIB_SUFFIX": ".a",
-    "SHARED_LIB_SUFFIX": ".so",
-    "INTERMEDIATE_DIR": "$(gyp_intermediate_dir)",
-    "SHARED_INTERMEDIATE_DIR": "$(gyp_shared_intermediate_dir)",
-    "PRODUCT_DIR": "$(gyp_shared_intermediate_dir)",
-    "SHARED_LIB_DIR": "$(builddir)/lib.$(TOOLSET)",
-    "LIB_DIR": "$(obj).$(TOOLSET)",
-    "RULE_INPUT_ROOT": "%(INPUT_ROOT)s",  # This gets expanded by Python.
-    "RULE_INPUT_DIRNAME": "%(INPUT_DIRNAME)s",  # This gets expanded by Python.
-    "RULE_INPUT_PATH": "$(RULE_SOURCES)",
-    "RULE_INPUT_EXT": "$(suffix $<)",
-    "RULE_INPUT_NAME": "$(notdir $<)",
-    "CONFIGURATION_NAME": "$(GYP_CONFIGURATION)",
-}
-
-# Make supports multiple toolsets
-generator_supports_multiple_toolsets = True
-
-
-# Generator-specific gyp specs.
-generator_additional_non_configuration_keys = [
-    # Boolean to declare that this target does not want its name mangled.
-    "android_unmangled_name",
-    # Map of android build system variables to set.
-    "aosp_build_settings",
-]
-generator_additional_path_sections = []
-generator_extra_sources_for_rules = []
-
-
-ALL_MODULES_FOOTER = """\
-# "gyp_all_modules" is a concatenation of the "gyp_all_modules" targets from
-# all the included sub-makefiles. This is just here to clarify.
-gyp_all_modules:
-"""
-
-header = """\
-# This file is generated by gyp; do not edit.
-
-"""
-
-# Map gyp target types to Android module classes.
-MODULE_CLASSES = {
-    "static_library": "STATIC_LIBRARIES",
-    "shared_library": "SHARED_LIBRARIES",
-    "executable": "EXECUTABLES",
-}
-
-
-def IsCPPExtension(ext):
-    return make.COMPILABLE_EXTENSIONS.get(ext) == "cxx"
-
-
-def Sourceify(path):
-    """Convert a path to its source directory form. The Android backend does not
-    support options.generator_output, so this function is a noop."""
-    return path
-
-
-# Map from qualified target to path to output.
-# For Android, the target of these maps is a tuple ('static', 'modulename'),
-# ('dynamic', 'modulename'), or ('path', 'some/path') instead of a string,
-# since we link by module.
-target_outputs = {}
-# Map from qualified target to any linkable output.  A subset
-# of target_outputs.  E.g. when mybinary depends on liba, we want to
-# include liba in the linker line; when otherbinary depends on
-# mybinary, we just want to build mybinary first.
-target_link_deps = {}
-
-
-class AndroidMkWriter:
-    """AndroidMkWriter packages up the writing of one target-specific Android.mk.
-
-    Its only real entry point is Write(), and is mostly used for namespacing.
-    """
-
-    def __init__(self, android_top_dir):
-        self.android_top_dir = android_top_dir
-
-    def Write(
-        self,
-        qualified_target,
-        relative_target,
-        base_path,
-        output_filename,
-        spec,
-        configs,
-        part_of_all,
-        write_alias_target,
-        sdk_version,
-    ):
-        """The main entry point: writes a .mk file for a single target.
-
-        Arguments:
-          qualified_target: target we're generating
-          relative_target: qualified target name relative to the root
-          base_path: path relative to source root we're building in, used to resolve
-                     target-relative paths
-          output_filename: output .mk file name to write
-          spec, configs: gyp info
-          part_of_all: flag indicating this target is part of 'all'
-          write_alias_target: flag indicating whether to create short aliases for
-                              this target
-          sdk_version: what to emit for LOCAL_SDK_VERSION in output
-        """
-        gyp.common.EnsureDirExists(output_filename)
-
-        self.fp = open(output_filename, "w")
-
-        self.fp.write(header)
-
-        self.qualified_target = qualified_target
-        self.relative_target = relative_target
-        self.path = base_path
-        self.target = spec["target_name"]
-        self.type = spec["type"]
-        self.toolset = spec["toolset"]
-
-        deps, link_deps = self.ComputeDeps(spec)
-
-        # Some of the generation below can add extra output, sources, or
-        # link dependencies.  All of the out params of the functions that
-        # follow use names like extra_foo.
-        extra_outputs = []
-        extra_sources = []
-
-        self.android_class = MODULE_CLASSES.get(self.type, "GYP")
-        self.android_module = self.ComputeAndroidModule(spec)
-        (self.android_stem, self.android_suffix) = self.ComputeOutputParts(spec)
-        self.output = self.output_binary = self.ComputeOutput(spec)
-
-        # Standard header.
-        self.WriteLn("include $(CLEAR_VARS)\n")
-
-        # Module class and name.
-        self.WriteLn("LOCAL_MODULE_CLASS := " + self.android_class)
-        self.WriteLn("LOCAL_MODULE := " + self.android_module)
-        # Only emit LOCAL_MODULE_STEM if it's different to LOCAL_MODULE.
-        # The library module classes fail if the stem is set. ComputeOutputParts
-        # makes sure that stem == modulename in these cases.
-        if self.android_stem != self.android_module:
-            self.WriteLn("LOCAL_MODULE_STEM := " + self.android_stem)
-        self.WriteLn("LOCAL_MODULE_SUFFIX := " + self.android_suffix)
-        if self.toolset == "host":
-            self.WriteLn("LOCAL_IS_HOST_MODULE := true")
-            self.WriteLn("LOCAL_MULTILIB := $(GYP_HOST_MULTILIB)")
-        elif sdk_version > 0:
-            self.WriteLn(
-                "LOCAL_MODULE_TARGET_ARCH := " "$(TARGET_$(GYP_VAR_PREFIX)ARCH)"
-            )
-            self.WriteLn("LOCAL_SDK_VERSION := %s" % sdk_version)
-
-        # Grab output directories; needed for Actions and Rules.
-        if self.toolset == "host":
-            self.WriteLn(
-                "gyp_intermediate_dir := "
-                "$(call local-intermediates-dir,,$(GYP_HOST_VAR_PREFIX))"
-            )
-        else:
-            self.WriteLn(
-                "gyp_intermediate_dir := "
-                "$(call local-intermediates-dir,,$(GYP_VAR_PREFIX))"
-            )
-        self.WriteLn(
-            "gyp_shared_intermediate_dir := "
-            "$(call intermediates-dir-for,GYP,shared,,,$(GYP_VAR_PREFIX))"
-        )
-        self.WriteLn()
-
-        # List files this target depends on so that actions/rules/copies/sources
-        # can depend on the list.
-        # TODO: doesn't pull in things through transitive link deps; needed?
-        target_dependencies = [x[1] for x in deps if x[0] == "path"]
-        self.WriteLn("# Make sure our deps are built first.")
-        self.WriteList(
-            target_dependencies, "GYP_TARGET_DEPENDENCIES", local_pathify=True
-        )
-
-        # Actions must come first, since they can generate more OBJs for use below.
-        if "actions" in spec:
-            self.WriteActions(spec["actions"], extra_sources, extra_outputs)
-
-        # Rules must be early like actions.
-        if "rules" in spec:
-            self.WriteRules(spec["rules"], extra_sources, extra_outputs)
-
-        if "copies" in spec:
-            self.WriteCopies(spec["copies"], extra_outputs)
-
-        # GYP generated outputs.
-        self.WriteList(extra_outputs, "GYP_GENERATED_OUTPUTS", local_pathify=True)
-
-        # Set LOCAL_ADDITIONAL_DEPENDENCIES so that Android's build rules depend
-        # on both our dependency targets and our generated files.
-        self.WriteLn("# Make sure our deps and generated files are built first.")
-        self.WriteLn(
-            "LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) "
-            "$(GYP_GENERATED_OUTPUTS)"
-        )
-        self.WriteLn()
-
-        # Sources.
-        if spec.get("sources", []) or extra_sources:
-            self.WriteSources(spec, configs, extra_sources)
-
-        self.WriteTarget(
-            spec, configs, deps, link_deps, part_of_all, write_alias_target
-        )
-
-        # Update global list of target outputs, used in dependency tracking.
-        target_outputs[qualified_target] = ("path", self.output_binary)
-
-        # Update global list of link dependencies.
-        if self.type == "static_library":
-            target_link_deps[qualified_target] = ("static", self.android_module)
-        elif self.type == "shared_library":
-            target_link_deps[qualified_target] = ("shared", self.android_module)
-
-        self.fp.close()
-        return self.android_module
-
-    def WriteActions(self, actions, extra_sources, extra_outputs):
-        """Write Makefile code for any 'actions' from the gyp input.
-
-        extra_sources: a list that will be filled in with newly generated source
-                       files, if any
-        extra_outputs: a list that will be filled in with any outputs of these
-                       actions (used to make other pieces dependent on these
-                       actions)
-        """
-        for action in actions:
-            name = make.StringToMakefileVariable(
-                "{}_{}".format(self.relative_target, action["action_name"])
-            )
-            self.WriteLn('### Rules for action "%s":' % action["action_name"])
-            inputs = action["inputs"]
-            outputs = action["outputs"]
-
-            # Build up a list of outputs.
-            # Collect the output dirs we'll need.
-            dirs = set()
-            for out in outputs:
-                if not out.startswith("$"):
-                    print(
-                        'WARNING: Action for target "%s" writes output to local path '
-                        '"%s".' % (self.target, out)
-                    )
-                dir = os.path.split(out)[0]
-                if dir:
-                    dirs.add(dir)
-            if int(action.get("process_outputs_as_sources", False)):
-                extra_sources += outputs
-
-            # Prepare the actual command.
-            command = gyp.common.EncodePOSIXShellList(action["action"])
-            if "message" in action:
-                quiet_cmd = "Gyp action: %s ($@)" % action["message"]
-            else:
-                quiet_cmd = "Gyp action: %s ($@)" % name
-            if len(dirs) > 0:
-                command = "mkdir -p %s" % " ".join(dirs) + "; " + command
-
-            cd_action = "cd $(gyp_local_path)/%s; " % self.path
-            command = cd_action + command
-
-            # The makefile rules are all relative to the top dir, but the gyp actions
-            # are defined relative to their containing dir.  This replaces the gyp_*
-            # variables for the action rule with an absolute version so that the
-            # output goes in the right place.
-            # Only write the gyp_* rules for the "primary" output (:1);
-            # it's superfluous for the "extra outputs", and this avoids accidentally
-            # writing duplicate dummy rules for those outputs.
-            main_output = make.QuoteSpaces(self.LocalPathify(outputs[0]))
-            self.WriteLn("%s: gyp_local_path := $(LOCAL_PATH)" % main_output)
-            self.WriteLn("%s: gyp_var_prefix := $(GYP_VAR_PREFIX)" % main_output)
-            self.WriteLn(
-                "%s: gyp_intermediate_dir := "
-                "$(abspath $(gyp_intermediate_dir))" % main_output
-            )
-            self.WriteLn(
-                "%s: gyp_shared_intermediate_dir := "
-                "$(abspath $(gyp_shared_intermediate_dir))" % main_output
-            )
-
-            # Android's envsetup.sh adds a number of directories to the path including
-            # the built host binary directory. This causes actions/rules invoked by
-            # gyp to sometimes use these instead of system versions, e.g. bison.
-            # The built host binaries may not be suitable, and can cause errors.
-            # So, we remove them from the PATH using the ANDROID_BUILD_PATHS variable
-            # set by envsetup.
-            self.WriteLn(
-                "%s: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))"
-                % main_output
-            )
-
-            # Don't allow spaces in input/output filenames, but make an exception for
-            # filenames which start with '$(' since it's okay for there to be spaces
-            # inside of make function/macro invocations.
-            for input in inputs:
-                if not input.startswith("$(") and " " in input:
-                    raise gyp.common.GypError(
-                        'Action input filename "%s" in target %s contains a space'
-                        % (input, self.target)
-                    )
-            for output in outputs:
-                if not output.startswith("$(") and " " in output:
-                    raise gyp.common.GypError(
-                        'Action output filename "%s" in target %s contains a space'
-                        % (output, self.target)
-                    )
-
-            self.WriteLn(
-                "%s: %s $(GYP_TARGET_DEPENDENCIES)"
-                % (main_output, " ".join(map(self.LocalPathify, inputs)))
-            )
-            self.WriteLn('\t@echo "%s"' % quiet_cmd)
-            self.WriteLn("\t$(hide)%s\n" % command)
-            for output in outputs[1:]:
-                # Make each output depend on the main output, with an empty command
-                # to force make to notice that the mtime has changed.
-                self.WriteLn(f"{self.LocalPathify(output)}: {main_output} ;")
-
-            extra_outputs += outputs
-            self.WriteLn()
-
-        self.WriteLn()
-
-    def WriteRules(self, rules, extra_sources, extra_outputs):
-        """Write Makefile code for any 'rules' from the gyp input.
-
-        extra_sources: a list that will be filled in with newly generated source
-                       files, if any
-        extra_outputs: a list that will be filled in with any outputs of these
-                       rules (used to make other pieces dependent on these rules)
-        """
-        if len(rules) == 0:
-            return
-
-        for rule in rules:
-            if len(rule.get("rule_sources", [])) == 0:
-                continue
-            name = make.StringToMakefileVariable(
-                "{}_{}".format(self.relative_target, rule["rule_name"])
-            )
-            self.WriteLn('\n### Generated for rule "%s":' % name)
-            self.WriteLn('# "%s":' % rule)
-
-            inputs = rule.get("inputs")
-            for rule_source in rule.get("rule_sources", []):
-                (rule_source_dirname, rule_source_basename) = os.path.split(rule_source)
-                (rule_source_root, rule_source_ext) = os.path.splitext(
-                    rule_source_basename
-                )
-
-                outputs = [
-                    self.ExpandInputRoot(out, rule_source_root, rule_source_dirname)
-                    for out in rule["outputs"]
-                ]
-
-                dirs = set()
-                for out in outputs:
-                    if not out.startswith("$"):
-                        print(
-                            "WARNING: Rule for target %s writes output to local path %s"
-                            % (self.target, out)
-                        )
-                    dir = os.path.dirname(out)
-                    if dir:
-                        dirs.add(dir)
-                extra_outputs += outputs
-                if int(rule.get("process_outputs_as_sources", False)):
-                    extra_sources.extend(outputs)
-
-                components = []
-                for component in rule["action"]:
-                    component = self.ExpandInputRoot(
-                        component, rule_source_root, rule_source_dirname
-                    )
-                    if "$(RULE_SOURCES)" in component:
-                        component = component.replace("$(RULE_SOURCES)", rule_source)
-                    components.append(component)
-
-                command = gyp.common.EncodePOSIXShellList(components)
-                cd_action = "cd $(gyp_local_path)/%s; " % self.path
-                command = cd_action + command
-                if dirs:
-                    command = "mkdir -p %s" % " ".join(dirs) + "; " + command
-
-                # We set up a rule to build the first output, and then set up
-                # a rule for each additional output to depend on the first.
-                outputs = map(self.LocalPathify, outputs)
-                main_output = outputs[0]
-                self.WriteLn("%s: gyp_local_path := $(LOCAL_PATH)" % main_output)
-                self.WriteLn("%s: gyp_var_prefix := $(GYP_VAR_PREFIX)" % main_output)
-                self.WriteLn(
-                    "%s: gyp_intermediate_dir := "
-                    "$(abspath $(gyp_intermediate_dir))" % main_output
-                )
-                self.WriteLn(
-                    "%s: gyp_shared_intermediate_dir := "
-                    "$(abspath $(gyp_shared_intermediate_dir))" % main_output
-                )
-
-                # See explanation in WriteActions.
-                self.WriteLn(
-                    "%s: export PATH := "
-                    "$(subst $(ANDROID_BUILD_PATHS),,$(PATH))" % main_output
-                )
-
-                main_output_deps = self.LocalPathify(rule_source)
-                if inputs:
-                    main_output_deps += " "
-                    main_output_deps += " ".join([self.LocalPathify(f) for f in inputs])
-
-                self.WriteLn(
-                    "%s: %s $(GYP_TARGET_DEPENDENCIES)"
-                    % (main_output, main_output_deps)
-                )
-                self.WriteLn("\t%s\n" % command)
-                for output in outputs[1:]:
-                    # Make each output depend on the main output, with an empty command
-                    # to force make to notice that the mtime has changed.
-                    self.WriteLn(f"{output}: {main_output} ;")
-                self.WriteLn()
-
-        self.WriteLn()
-
-    def WriteCopies(self, copies, extra_outputs):
-        """Write Makefile code for any 'copies' from the gyp input.
-
-        extra_outputs: a list that will be filled in with any outputs of this action
-                       (used to make other pieces dependent on this action)
-        """
-        self.WriteLn("### Generated for copy rule.")
-
-        variable = make.StringToMakefileVariable(self.relative_target + "_copies")
-        outputs = []
-        for copy in copies:
-            for path in copy["files"]:
-                # The Android build system does not allow generation of files into the
-                # source tree. The destination should start with a variable, which will
-                # typically be $(gyp_intermediate_dir) or
-                # $(gyp_shared_intermediate_dir). Note that we can't use an assertion
-                # because some of the gyp tests depend on this.
-                if not copy["destination"].startswith("$"):
-                    print(
-                        "WARNING: Copy rule for target %s writes output to "
-                        "local path %s" % (self.target, copy["destination"])
-                    )
-
-                # LocalPathify() calls normpath, stripping trailing slashes.
-                path = Sourceify(self.LocalPathify(path))
-                filename = os.path.split(path)[1]
-                output = Sourceify(
-                    self.LocalPathify(os.path.join(copy["destination"], filename))
-                )
-
-                self.WriteLn(f"{output}: {path} $(GYP_TARGET_DEPENDENCIES) | $(ACP)")
-                self.WriteLn("\t@echo Copying: $@")
-                self.WriteLn("\t$(hide) mkdir -p $(dir $@)")
-                self.WriteLn("\t$(hide) $(ACP) -rpf $< $@")
-                self.WriteLn()
-                outputs.append(output)
-        self.WriteLn(
-            "{} = {}".format(variable, " ".join(map(make.QuoteSpaces, outputs)))
-        )
-        extra_outputs.append("$(%s)" % variable)
-        self.WriteLn()
-
-    def WriteSourceFlags(self, spec, configs):
-        """Write out the flags and include paths used to compile source files for
-        the current target.
-
-        Args:
-          spec, configs: input from gyp.
-        """
-        for configname, config in sorted(configs.items()):
-            extracted_includes = []
-
-            self.WriteLn("\n# Flags passed to both C and C++ files.")
-            cflags, includes_from_cflags = self.ExtractIncludesFromCFlags(
-                config.get("cflags", []) + config.get("cflags_c", [])
-            )
-            extracted_includes.extend(includes_from_cflags)
-            self.WriteList(cflags, "MY_CFLAGS_%s" % configname)
-
-            self.WriteList(
-                config.get("defines"),
-                "MY_DEFS_%s" % configname,
-                prefix="-D",
-                quoter=make.EscapeCppDefine,
-            )
-
-            self.WriteLn("\n# Include paths placed before CFLAGS/CPPFLAGS")
-            includes = list(config.get("include_dirs", []))
-            includes.extend(extracted_includes)
-            includes = map(Sourceify, map(self.LocalPathify, includes))
-            includes = self.NormalizeIncludePaths(includes)
-            self.WriteList(includes, "LOCAL_C_INCLUDES_%s" % configname)
-
-            self.WriteLn("\n# Flags passed to only C++ (and not C) files.")
-            self.WriteList(config.get("cflags_cc"), "LOCAL_CPPFLAGS_%s" % configname)
-
-        self.WriteLn(
-            "\nLOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) "
-            "$(MY_DEFS_$(GYP_CONFIGURATION))"
-        )
-        # Undefine ANDROID for host modules
-        # TODO: the source code should not use macro ANDROID to tell if it's host
-        # or target module.
-        if self.toolset == "host":
-            self.WriteLn("# Undefine ANDROID for host modules")
-            self.WriteLn("LOCAL_CFLAGS += -UANDROID")
-        self.WriteLn(
-            "LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) "
-            "$(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION))"
-        )
-        self.WriteLn("LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION))")
-        # Android uses separate flags for assembly file invocations, but gyp expects
-        # the same CFLAGS to be applied:
-        self.WriteLn("LOCAL_ASFLAGS := $(LOCAL_CFLAGS)")
-
-    def WriteSources(self, spec, configs, extra_sources):
-        """Write Makefile code for any 'sources' from the gyp input.
-        These are source files necessary to build the current target.
-        We need to handle shared_intermediate directory source files as
-        a special case by copying them to the intermediate directory and
-        treating them as a generated sources. Otherwise the Android build
-        rules won't pick them up.
-
-        Args:
-          spec, configs: input from gyp.
-          extra_sources: Sources generated from Actions or Rules.
-        """
-        sources = filter(make.Compilable, spec.get("sources", []))
-        generated_not_sources = [x for x in extra_sources if not make.Compilable(x)]
-        extra_sources = filter(make.Compilable, extra_sources)
-
-        # Determine and output the C++ extension used by these sources.
-        # We simply find the first C++ file and use that extension.
-        all_sources = sources + extra_sources
-        local_cpp_extension = ".cpp"
-        for source in all_sources:
-            (root, ext) = os.path.splitext(source)
-            if IsCPPExtension(ext):
-                local_cpp_extension = ext
-                break
-        if local_cpp_extension != ".cpp":
-            self.WriteLn("LOCAL_CPP_EXTENSION := %s" % local_cpp_extension)
-
-        # We need to move any non-generated sources that are coming from the
-        # shared intermediate directory out of LOCAL_SRC_FILES and put them
-        # into LOCAL_GENERATED_SOURCES. We also need to move over any C++ files
-        # that don't match our local_cpp_extension, since Android will only
-        # generate Makefile rules for a single LOCAL_CPP_EXTENSION.
-        local_files = []
-        for source in sources:
-            (root, ext) = os.path.splitext(source)
-            if "$(gyp_shared_intermediate_dir)" in source:
-                extra_sources.append(source)
-            elif "$(gyp_intermediate_dir)" in source:
-                extra_sources.append(source)
-            elif IsCPPExtension(ext) and ext != local_cpp_extension:
-                extra_sources.append(source)
-            else:
-                local_files.append(os.path.normpath(os.path.join(self.path, source)))
-
-        # For any generated source, if it is coming from the shared intermediate
-        # directory then we add a Make rule to copy them to the local intermediate
-        # directory first. This is because the Android LOCAL_GENERATED_SOURCES
-        # must be in the local module intermediate directory for the compile rules
-        # to work properly. If the file has the wrong C++ extension, then we add
-        # a rule to copy that to intermediates and use the new version.
-        final_generated_sources = []
-        # If a source file gets copied, we still need to add the original source
-        # directory as header search path, for GCC searches headers in the
-        # directory that contains the source file by default.
-        origin_src_dirs = []
-        for source in extra_sources:
-            local_file = source
-            if "$(gyp_intermediate_dir)/" not in local_file:
-                basename = os.path.basename(local_file)
-                local_file = "$(gyp_intermediate_dir)/" + basename
-            (root, ext) = os.path.splitext(local_file)
-            if IsCPPExtension(ext) and ext != local_cpp_extension:
-                local_file = root + local_cpp_extension
-            if local_file != source:
-                self.WriteLn(f"{local_file}: {self.LocalPathify(source)}")
-                self.WriteLn("\tmkdir -p $(@D); cp $< $@")
-                origin_src_dirs.append(os.path.dirname(source))
-            final_generated_sources.append(local_file)
-
-        # We add back in all of the non-compilable stuff to make sure that the
-        # make rules have dependencies on them.
-        final_generated_sources.extend(generated_not_sources)
-        self.WriteList(final_generated_sources, "LOCAL_GENERATED_SOURCES")
-
-        origin_src_dirs = gyp.common.uniquer(origin_src_dirs)
-        origin_src_dirs = map(Sourceify, map(self.LocalPathify, origin_src_dirs))
-        self.WriteList(origin_src_dirs, "GYP_COPIED_SOURCE_ORIGIN_DIRS")
-
-        self.WriteList(local_files, "LOCAL_SRC_FILES")
-
-        # Write out the flags used to compile the source; this must be done last
-        # so that GYP_COPIED_SOURCE_ORIGIN_DIRS can be used as an include path.
-        self.WriteSourceFlags(spec, configs)
-
-    def ComputeAndroidModule(self, spec):
-        """Return the Android module name used for a gyp spec.
-
-        We use the complete qualified target name to avoid collisions between
-        duplicate targets in different directories. We also add a suffix to
-        distinguish gyp-generated module names.
-        """
-
-        if int(spec.get("android_unmangled_name", 0)):
-            assert self.type != "shared_library" or self.target.startswith("lib")
-            return self.target
-
-        if self.type == "shared_library":
-            # For reasons of convention, the Android build system requires that all
-            # shared library modules are named 'libfoo' when generating -l flags.
-            prefix = "lib_"
-        else:
-            prefix = ""
-
-        if spec["toolset"] == "host":
-            suffix = "_$(TARGET_$(GYP_VAR_PREFIX)ARCH)_host_gyp"
-        else:
-            suffix = "_gyp"
-
-        if self.path:
-            middle = make.StringToMakefileVariable(f"{self.path}_{self.target}")
-        else:
-            middle = make.StringToMakefileVariable(self.target)
-
-        return "".join([prefix, middle, suffix])
-
-    def ComputeOutputParts(self, spec):
-        """Return the 'output basename' of a gyp spec, split into filename + ext.
-
-        Android libraries must be named the same thing as their module name,
-        otherwise the linker can't find them, so product_name and so on must be
-        ignored if we are building a library, and the "lib" prepending is
-        not done for Android.
-        """
-        assert self.type != "loadable_module"  # TODO: not supported?
-
-        target = spec["target_name"]
-        target_prefix = ""
-        target_ext = ""
-        if self.type == "static_library":
-            target = self.ComputeAndroidModule(spec)
-            target_ext = ".a"
-        elif self.type == "shared_library":
-            target = self.ComputeAndroidModule(spec)
-            target_ext = ".so"
-        elif self.type == "none":
-            target_ext = ".stamp"
-        elif self.type != "executable":
-            print(
-                "ERROR: What output file should be generated?",
-                "type",
-                self.type,
-                "target",
-                target,
-            )
-
-        if self.type != "static_library" and self.type != "shared_library":
-            target_prefix = spec.get("product_prefix", target_prefix)
-            target = spec.get("product_name", target)
-            product_ext = spec.get("product_extension")
-            if product_ext:
-                target_ext = "." + product_ext
-
-        target_stem = target_prefix + target
-        return (target_stem, target_ext)
-
-    def ComputeOutputBasename(self, spec):
-        """Return the 'output basename' of a gyp spec.
-
-        E.g., the loadable module 'foobar' in directory 'baz' will produce
-          'libfoobar.so'
-        """
-        return "".join(self.ComputeOutputParts(spec))
-
-    def ComputeOutput(self, spec):
-        """Return the 'output' (full output path) of a gyp spec.
-
-        E.g., the loadable module 'foobar' in directory 'baz' will produce
-          '$(obj)/baz/libfoobar.so'
-        """
-        if self.type == "executable":
-            # We install host executables into shared_intermediate_dir so they can be
-            # run by gyp rules that refer to PRODUCT_DIR.
-            path = "$(gyp_shared_intermediate_dir)"
-        elif self.type == "shared_library":
-            if self.toolset == "host":
-                path = "$($(GYP_HOST_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)"
-            else:
-                path = "$($(GYP_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)"
-        else:
-            # Other targets just get built into their intermediate dir.
-            if self.toolset == "host":
-                path = (
-                    "$(call intermediates-dir-for,%s,%s,true,,"
-                    "$(GYP_HOST_VAR_PREFIX))"
-                    % (self.android_class, self.android_module)
-                )
-            else:
-                path = "$(call intermediates-dir-for,{},{},,,$(GYP_VAR_PREFIX))".format(
-                    self.android_class,
-                    self.android_module,
-                )
-
-        assert spec.get("product_dir") is None  # TODO: not supported?
-        return os.path.join(path, self.ComputeOutputBasename(spec))
-
-    def NormalizeIncludePaths(self, include_paths):
-        """Normalize include_paths.
-        Convert absolute paths to relative to the Android top directory.
-
-        Args:
-          include_paths: A list of unprocessed include paths.
-        Returns:
-          A list of normalized include paths.
-        """
-        normalized = []
-        for path in include_paths:
-            if path[0] == "/":
-                path = gyp.common.RelativePath(path, self.android_top_dir)
-            normalized.append(path)
-        return normalized
-
-    def ExtractIncludesFromCFlags(self, cflags):
-        """Extract includes "-I..." out from cflags
-
-        Args:
-          cflags: A list of compiler flags, which may be mixed with "-I.."
-        Returns:
-          A tuple of lists: (clean_clfags, include_paths). "-I.." is trimmed.
-        """
-        clean_cflags = []
-        include_paths = []
-        for flag in cflags:
-            if flag.startswith("-I"):
-                include_paths.append(flag[2:])
-            else:
-                clean_cflags.append(flag)
-
-        return (clean_cflags, include_paths)
-
-    def FilterLibraries(self, libraries):
-        """Filter the 'libraries' key to separate things that shouldn't be ldflags.
-
-        Library entries that look like filenames should be converted to android
-        module names instead of being passed to the linker as flags.
-
-        Args:
-          libraries: the value of spec.get('libraries')
-        Returns:
-          A tuple (static_lib_modules, dynamic_lib_modules, ldflags)
-        """
-        static_lib_modules = []
-        dynamic_lib_modules = []
-        ldflags = []
-        for libs in libraries:
-            # Libs can have multiple words.
-            for lib in libs.split():
-                # Filter the system libraries, which are added by default by the Android
-                # build system.
-                if (
-                    lib == "-lc"
-                    or lib == "-lstdc++"
-                    or lib == "-lm"
-                    or lib.endswith("libgcc.a")
-                ):
-                    continue
-                match = re.search(r"([^/]+)\.a$", lib)
-                if match:
-                    static_lib_modules.append(match.group(1))
-                    continue
-                match = re.search(r"([^/]+)\.so$", lib)
-                if match:
-                    dynamic_lib_modules.append(match.group(1))
-                    continue
-                if lib.startswith("-l"):
-                    ldflags.append(lib)
-        return (static_lib_modules, dynamic_lib_modules, ldflags)
-
-    def ComputeDeps(self, spec):
-        """Compute the dependencies of a gyp spec.
-
-        Returns a tuple (deps, link_deps), where each is a list of
-        filenames that will need to be put in front of make for either
-        building (deps) or linking (link_deps).
-        """
-        deps = []
-        link_deps = []
-        if "dependencies" in spec:
-            deps.extend(
-                [
-                    target_outputs[dep]
-                    for dep in spec["dependencies"]
-                    if target_outputs[dep]
-                ]
-            )
-            for dep in spec["dependencies"]:
-                if dep in target_link_deps:
-                    link_deps.append(target_link_deps[dep])
-            deps.extend(link_deps)
-        return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps))
-
-    def WriteTargetFlags(self, spec, configs, link_deps):
-        """Write Makefile code to specify the link flags and library dependencies.
-
-        spec, configs: input from gyp.
-        link_deps: link dependency list; see ComputeDeps()
-        """
-        # Libraries (i.e. -lfoo)
-        # These must be included even for static libraries as some of them provide
-        # implicit include paths through the build system.
-        libraries = gyp.common.uniquer(spec.get("libraries", []))
-        static_libs, dynamic_libs, ldflags_libs = self.FilterLibraries(libraries)
-
-        if self.type != "static_library":
-            for configname, config in sorted(configs.items()):
-                ldflags = list(config.get("ldflags", []))
-                self.WriteLn("")
-                self.WriteList(ldflags, "LOCAL_LDFLAGS_%s" % configname)
-            self.WriteList(ldflags_libs, "LOCAL_GYP_LIBS")
-            self.WriteLn(
-                "LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) "
-                "$(LOCAL_GYP_LIBS)"
-            )
-
-        # Link dependencies (i.e. other gyp targets this target depends on)
-        # These need not be included for static libraries as within the gyp build
-        # we do not use the implicit include path mechanism.
-        if self.type != "static_library":
-            static_link_deps = [x[1] for x in link_deps if x[0] == "static"]
-            shared_link_deps = [x[1] for x in link_deps if x[0] == "shared"]
-        else:
-            static_link_deps = []
-            shared_link_deps = []
-
-        # Only write the lists if they are non-empty.
-        if static_libs or static_link_deps:
-            self.WriteLn("")
-            self.WriteList(static_libs + static_link_deps, "LOCAL_STATIC_LIBRARIES")
-            self.WriteLn("# Enable grouping to fix circular references")
-            self.WriteLn("LOCAL_GROUP_STATIC_LIBRARIES := true")
-        if dynamic_libs or shared_link_deps:
-            self.WriteLn("")
-            self.WriteList(dynamic_libs + shared_link_deps, "LOCAL_SHARED_LIBRARIES")
-
-    def WriteTarget(
-        self, spec, configs, deps, link_deps, part_of_all, write_alias_target
-    ):
-        """Write Makefile code to produce the final target of the gyp spec.
-
-        spec, configs: input from gyp.
-        deps, link_deps: dependency lists; see ComputeDeps()
-        part_of_all: flag indicating this target is part of 'all'
-        write_alias_target: flag indicating whether to create short aliases for this
-                            target
-        """
-        self.WriteLn("### Rules for final target.")
-
-        if self.type != "none":
-            self.WriteTargetFlags(spec, configs, link_deps)
-
-        settings = spec.get("aosp_build_settings", {})
-        if settings:
-            self.WriteLn("### Set directly by aosp_build_settings.")
-            for k, v in settings.items():
-                if isinstance(v, list):
-                    self.WriteList(v, k)
-                else:
-                    self.WriteLn(f"{k} := {make.QuoteIfNecessary(v)}")
-            self.WriteLn("")
-
-        # Add to the set of targets which represent the gyp 'all' target. We use the
-        # name 'gyp_all_modules' as the Android build system doesn't allow the use
-        # of the Make target 'all' and because 'all_modules' is the equivalent of
-        # the Make target 'all' on Android.
-        if part_of_all and write_alias_target:
-            self.WriteLn('# Add target alias to "gyp_all_modules" target.')
-            self.WriteLn(".PHONY: gyp_all_modules")
-            self.WriteLn("gyp_all_modules: %s" % self.android_module)
-            self.WriteLn("")
-
-        # Add an alias from the gyp target name to the Android module name. This
-        # simplifies manual builds of the target, and is required by the test
-        # framework.
-        if self.target != self.android_module and write_alias_target:
-            self.WriteLn("# Alias gyp target name.")
-            self.WriteLn(".PHONY: %s" % self.target)
-            self.WriteLn(f"{self.target}: {self.android_module}")
-            self.WriteLn("")
-
-        # Add the command to trigger build of the target type depending
-        # on the toolset. Ex: BUILD_STATIC_LIBRARY vs. BUILD_HOST_STATIC_LIBRARY
-        # NOTE: This has to come last!
-        modifier = ""
-        if self.toolset == "host":
-            modifier = "HOST_"
-        if self.type == "static_library":
-            self.WriteLn("include $(BUILD_%sSTATIC_LIBRARY)" % modifier)
-        elif self.type == "shared_library":
-            self.WriteLn("LOCAL_PRELINK_MODULE := false")
-            self.WriteLn("include $(BUILD_%sSHARED_LIBRARY)" % modifier)
-        elif self.type == "executable":
-            self.WriteLn("LOCAL_CXX_STL := libc++_static")
-            # Executables are for build and test purposes only, so they're installed
-            # to a directory that doesn't get included in the system image.
-            self.WriteLn("LOCAL_MODULE_PATH := $(gyp_shared_intermediate_dir)")
-            self.WriteLn("include $(BUILD_%sEXECUTABLE)" % modifier)
-        else:
-            self.WriteLn("LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp")
-            self.WriteLn("LOCAL_UNINSTALLABLE_MODULE := true")
-            if self.toolset == "target":
-                self.WriteLn("LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_VAR_PREFIX)")
-            else:
-                self.WriteLn("LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_HOST_VAR_PREFIX)")
-            self.WriteLn()
-            self.WriteLn("include $(BUILD_SYSTEM)/base_rules.mk")
-            self.WriteLn()
-            self.WriteLn("$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)")
-            self.WriteLn('\t$(hide) echo "Gyp timestamp: $@"')
-            self.WriteLn("\t$(hide) mkdir -p $(dir $@)")
-            self.WriteLn("\t$(hide) touch $@")
-            self.WriteLn()
-            self.WriteLn("LOCAL_2ND_ARCH_VAR_PREFIX :=")
-
-    def WriteList(
-        self,
-        value_list,
-        variable=None,
-        prefix="",
-        quoter=make.QuoteIfNecessary,
-        local_pathify=False,
-    ):
-        """Write a variable definition that is a list of values.
-
-        E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out
-             foo = blaha blahb
-        but in a pretty-printed style.
-        """
-        values = ""
-        if value_list:
-            value_list = [quoter(prefix + value) for value in value_list]
-            if local_pathify:
-                value_list = [self.LocalPathify(value) for value in value_list]
-            values = " \\\n\t" + " \\\n\t".join(value_list)
-        self.fp.write(f"{variable} :={values}\n\n")
-
-    def WriteLn(self, text=""):
-        self.fp.write(text + "\n")
-
-    def LocalPathify(self, path):
-        """Convert a subdirectory-relative path into a normalized path which starts
-        with the make variable $(LOCAL_PATH) (i.e. the top of the project tree).
-        Absolute paths, or paths that contain variables, are just normalized."""
-        if "$(" in path or os.path.isabs(path):
-            # path is not a file in the project tree in this case, but calling
-            # normpath is still important for trimming trailing slashes.
-            return os.path.normpath(path)
-        local_path = os.path.join("$(LOCAL_PATH)", self.path, path)
-        local_path = os.path.normpath(local_path)
-        # Check that normalizing the path didn't ../ itself out of $(LOCAL_PATH)
-        # - i.e. that the resulting path is still inside the project tree. The
-        # path may legitimately have ended up containing just $(LOCAL_PATH), though,
-        # so we don't look for a slash.
-        assert local_path.startswith(
-            "$(LOCAL_PATH)"
-        ), f"Path {path} attempts to escape from gyp path {self.path} !)"
-        return local_path
-
-    def ExpandInputRoot(self, template, expansion, dirname):
-        if "%(INPUT_ROOT)s" not in template and "%(INPUT_DIRNAME)s" not in template:
-            return template
-        path = template % {
-            "INPUT_ROOT": expansion,
-            "INPUT_DIRNAME": dirname,
-        }
-        return os.path.normpath(path)
-
-
-def PerformBuild(data, configurations, params):
-    # The android backend only supports the default configuration.
-    options = params["options"]
-    makefile = os.path.abspath(os.path.join(options.toplevel_dir, "GypAndroid.mk"))
-    env = dict(os.environ)
-    env["ONE_SHOT_MAKEFILE"] = makefile
-    arguments = ["make", "-C", os.environ["ANDROID_BUILD_TOP"], "gyp_all_modules"]
-    print("Building: %s" % arguments)
-    subprocess.check_call(arguments, env=env)
-
-
-def GenerateOutput(target_list, target_dicts, data, params):
-    options = params["options"]
-    generator_flags = params.get("generator_flags", {})
-    limit_to_target_all = generator_flags.get("limit_to_target_all", False)
-    write_alias_targets = generator_flags.get("write_alias_targets", True)
-    sdk_version = generator_flags.get("aosp_sdk_version", 0)
-    android_top_dir = os.environ.get("ANDROID_BUILD_TOP")
-    assert android_top_dir, "$ANDROID_BUILD_TOP not set; you need to run lunch."
-
-    def CalculateMakefilePath(build_file, base_name):
-        """Determine where to write a Makefile for a given gyp file."""
-        # Paths in gyp files are relative to the .gyp file, but we want
-        # paths relative to the source root for the master makefile.  Grab
-        # the path of the .gyp file as the base to relativize against.
-        # E.g. "foo/bar" when we're constructing targets for "foo/bar/baz.gyp".
-        base_path = gyp.common.RelativePath(os.path.dirname(build_file), options.depth)
-        # We write the file in the base_path directory.
-        output_file = os.path.join(options.depth, base_path, base_name)
-        assert (
-            not options.generator_output
-        ), "The Android backend does not support options.generator_output."
-        base_path = gyp.common.RelativePath(
-            os.path.dirname(build_file), options.toplevel_dir
-        )
-        return base_path, output_file
-
-    # TODO:  search for the first non-'Default' target.  This can go
-    # away when we add verification that all targets have the
-    # necessary configurations.
-    default_configuration = None
-    for target in target_list:
-        spec = target_dicts[target]
-        if spec["default_configuration"] != "Default":
-            default_configuration = spec["default_configuration"]
-            break
-    if not default_configuration:
-        default_configuration = "Default"
-
-    makefile_name = "GypAndroid" + options.suffix + ".mk"
-    makefile_path = os.path.join(options.toplevel_dir, makefile_name)
-    assert (
-        not options.generator_output
-    ), "The Android backend does not support options.generator_output."
-    gyp.common.EnsureDirExists(makefile_path)
-    root_makefile = open(makefile_path, "w")
-
-    root_makefile.write(header)
-
-    # We set LOCAL_PATH just once, here, to the top of the project tree. This
-    # allows all the other paths we use to be relative to the Android.mk file,
-    # as the Android build system expects.
-    root_makefile.write("\nLOCAL_PATH := $(call my-dir)\n")
-
-    # Find the list of targets that derive from the gyp file(s) being built.
-    needed_targets = set()
-    for build_file in params["build_files"]:
-        for target in gyp.common.AllTargets(target_list, target_dicts, build_file):
-            needed_targets.add(target)
-
-    build_files = set()
-    include_list = set()
-    android_modules = {}
-    for qualified_target in target_list:
-        build_file, target, toolset = gyp.common.ParseQualifiedTarget(qualified_target)
-        relative_build_file = gyp.common.RelativePath(build_file, options.toplevel_dir)
-        build_files.add(relative_build_file)
-        included_files = data[build_file]["included_files"]
-        for included_file in included_files:
-            # The included_files entries are relative to the dir of the build file
-            # that included them, so we have to undo that and then make them relative
-            # to the root dir.
-            relative_include_file = gyp.common.RelativePath(
-                gyp.common.UnrelativePath(included_file, build_file),
-                options.toplevel_dir,
-            )
-            abs_include_file = os.path.abspath(relative_include_file)
-            # If the include file is from the ~/.gyp dir, we should use absolute path
-            # so that relocating the src dir doesn't break the path.
-            if params["home_dot_gyp"] and abs_include_file.startswith(
-                params["home_dot_gyp"]
-            ):
-                build_files.add(abs_include_file)
-            else:
-                build_files.add(relative_include_file)
-
-        base_path, output_file = CalculateMakefilePath(
-            build_file, target + "." + toolset + options.suffix + ".mk"
-        )
-
-        spec = target_dicts[qualified_target]
-        configs = spec["configurations"]
-
-        part_of_all = qualified_target in needed_targets
-        if limit_to_target_all and not part_of_all:
-            continue
-
-        relative_target = gyp.common.QualifiedTarget(
-            relative_build_file, target, toolset
-        )
-        writer = AndroidMkWriter(android_top_dir)
-        android_module = writer.Write(
-            qualified_target,
-            relative_target,
-            base_path,
-            output_file,
-            spec,
-            configs,
-            part_of_all=part_of_all,
-            write_alias_target=write_alias_targets,
-            sdk_version=sdk_version,
-        )
-        if android_module in android_modules:
-            print(
-                "ERROR: Android module names must be unique. The following "
-                "targets both generate Android module name %s.\n  %s\n  %s"
-                % (android_module, android_modules[android_module], qualified_target)
-            )
-            return
-        android_modules[android_module] = qualified_target
-
-        # Our root_makefile lives at the source root.  Compute the relative path
-        # from there to the output_file for including.
-        mkfile_rel_path = gyp.common.RelativePath(
-            output_file, os.path.dirname(makefile_path)
-        )
-        include_list.add(mkfile_rel_path)
-
-    root_makefile.write("GYP_CONFIGURATION ?= %s\n" % default_configuration)
-    root_makefile.write("GYP_VAR_PREFIX ?=\n")
-    root_makefile.write("GYP_HOST_VAR_PREFIX ?=\n")
-    root_makefile.write("GYP_HOST_MULTILIB ?= first\n")
-
-    # Write out the sorted list of includes.
-    root_makefile.write("\n")
-    for include_file in sorted(include_list):
-        root_makefile.write("include $(LOCAL_PATH)/" + include_file + "\n")
-    root_makefile.write("\n")
-
-    if write_alias_targets:
-        root_makefile.write(ALL_MODULES_FOOTER)
-
-    root_makefile.close()
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py
deleted file mode 100644
index c95d18415cdb3..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py
+++ /dev/null
@@ -1,1321 +0,0 @@
-# Copyright (c) 2013 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""cmake output module
-
-This module is under development and should be considered experimental.
-
-This module produces cmake (2.8.8+) input as its output. One CMakeLists.txt is
-created for each configuration.
-
-This module's original purpose was to support editing in IDEs like KDevelop
-which use CMake for project management. It is also possible to use CMake to
-generate projects for other IDEs such as eclipse cdt and code::blocks. QtCreator
-will convert the CMakeLists.txt to a code::blocks cbp for the editor to read,
-but build using CMake. As a result QtCreator editor is unaware of compiler
-defines. The generated CMakeLists.txt can also be used to build on Linux. There
-is currently no support for building on platforms other than Linux.
-
-The generated CMakeLists.txt should properly compile all projects. However,
-there is a mismatch between gyp and cmake with regard to linking. All attempts
-are made to work around this, but CMake sometimes sees -Wl,--start-group as a
-library and incorrectly repeats it. As a result the output of this generator
-should not be relied on for building.
-
-When using with kdevelop, use version 4.4+. Previous versions of kdevelop will
-not be able to find the header file directories described in the generated
-CMakeLists.txt file.
-"""
-
-
-import multiprocessing
-import os
-import signal
-import subprocess
-import gyp.common
-import gyp.xcode_emulation
-
-_maketrans = str.maketrans
-
-generator_default_variables = {
-    "EXECUTABLE_PREFIX": "",
-    "EXECUTABLE_SUFFIX": "",
-    "STATIC_LIB_PREFIX": "lib",
-    "STATIC_LIB_SUFFIX": ".a",
-    "SHARED_LIB_PREFIX": "lib",
-    "SHARED_LIB_SUFFIX": ".so",
-    "SHARED_LIB_DIR": "${builddir}/lib.${TOOLSET}",
-    "LIB_DIR": "${obj}.${TOOLSET}",
-    "INTERMEDIATE_DIR": "${obj}.${TOOLSET}/${TARGET}/geni",
-    "SHARED_INTERMEDIATE_DIR": "${obj}/gen",
-    "PRODUCT_DIR": "${builddir}",
-    "RULE_INPUT_PATH": "${RULE_INPUT_PATH}",
-    "RULE_INPUT_DIRNAME": "${RULE_INPUT_DIRNAME}",
-    "RULE_INPUT_NAME": "${RULE_INPUT_NAME}",
-    "RULE_INPUT_ROOT": "${RULE_INPUT_ROOT}",
-    "RULE_INPUT_EXT": "${RULE_INPUT_EXT}",
-    "CONFIGURATION_NAME": "${configuration}",
-}
-
-FULL_PATH_VARS = ("${CMAKE_CURRENT_LIST_DIR}", "${builddir}", "${obj}")
-
-generator_supports_multiple_toolsets = True
-generator_wants_static_library_dependencies_adjusted = True
-
-COMPILABLE_EXTENSIONS = {
-    ".c": "cc",
-    ".cc": "cxx",
-    ".cpp": "cxx",
-    ".cxx": "cxx",
-    ".s": "s",  # cc
-    ".S": "s",  # cc
-}
-
-
-def RemovePrefix(a, prefix):
-    """Returns 'a' without 'prefix' if it starts with 'prefix'."""
-    return a[len(prefix) :] if a.startswith(prefix) else a
-
-
-def CalculateVariables(default_variables, params):
-    """Calculate additional variables for use in the build (called by gyp)."""
-    default_variables.setdefault("OS", gyp.common.GetFlavor(params))
-
-
-def Compilable(filename):
-    """Return true if the file is compilable (should be in OBJS)."""
-    return any(filename.endswith(e) for e in COMPILABLE_EXTENSIONS)
-
-
-def Linkable(filename):
-    """Return true if the file is linkable (should be on the link line)."""
-    return filename.endswith(".o")
-
-
-def NormjoinPathForceCMakeSource(base_path, rel_path):
-    """Resolves rel_path against base_path and returns the result.
-
-  If rel_path is an absolute path it is returned unchanged.
-  Otherwise it is resolved against base_path and normalized.
-  If the result is a relative path, it is forced to be relative to the
-  CMakeLists.txt.
-  """
-    if os.path.isabs(rel_path):
-        return rel_path
-    if any([rel_path.startswith(var) for var in FULL_PATH_VARS]):
-        return rel_path
-    # TODO: do we need to check base_path for absolute variables as well?
-    return os.path.join(
-        "${CMAKE_CURRENT_LIST_DIR}", os.path.normpath(os.path.join(base_path, rel_path))
-    )
-
-
-def NormjoinPath(base_path, rel_path):
-    """Resolves rel_path against base_path and returns the result.
-  TODO: what is this really used for?
-  If rel_path begins with '$' it is returned unchanged.
-  Otherwise it is resolved against base_path if relative, then normalized.
-  """
-    if rel_path.startswith("$") and not rel_path.startswith("${configuration}"):
-        return rel_path
-    return os.path.normpath(os.path.join(base_path, rel_path))
-
-
-def CMakeStringEscape(a):
-    """Escapes the string 'a' for use inside a CMake string.
-
-  This means escaping
-  '\' otherwise it may be seen as modifying the next character
-  '"' otherwise it will end the string
-  ';' otherwise the string becomes a list
-
-  The following do not need to be escaped
-  '#' when the lexer is in string state, this does not start a comment
-
-  The following are yet unknown
-  '$' generator variables (like ${obj}) must not be escaped,
-      but text $ should be escaped
-      what is wanted is to know which $ come from generator variables
-  """
-    return a.replace("\\", "\\\\").replace(";", "\\;").replace('"', '\\"')
-
-
-def SetFileProperty(output, source_name, property_name, values, sep):
-    """Given a set of source file, sets the given property on them."""
-    output.write("set_source_files_properties(")
-    output.write(source_name)
-    output.write(" PROPERTIES ")
-    output.write(property_name)
-    output.write(' "')
-    for value in values:
-        output.write(CMakeStringEscape(value))
-        output.write(sep)
-    output.write('")\n')
-
-
-def SetFilesProperty(output, variable, property_name, values, sep):
-    """Given a set of source files, sets the given property on them."""
-    output.write("set_source_files_properties(")
-    WriteVariable(output, variable)
-    output.write(" PROPERTIES ")
-    output.write(property_name)
-    output.write(' "')
-    for value in values:
-        output.write(CMakeStringEscape(value))
-        output.write(sep)
-    output.write('")\n')
-
-
-def SetTargetProperty(output, target_name, property_name, values, sep=""):
-    """Given a target, sets the given property."""
-    output.write("set_target_properties(")
-    output.write(target_name)
-    output.write(" PROPERTIES ")
-    output.write(property_name)
-    output.write(' "')
-    for value in values:
-        output.write(CMakeStringEscape(value))
-        output.write(sep)
-    output.write('")\n')
-
-
-def SetVariable(output, variable_name, value):
-    """Sets a CMake variable."""
-    output.write("set(")
-    output.write(variable_name)
-    output.write(' "')
-    output.write(CMakeStringEscape(value))
-    output.write('")\n')
-
-
-def SetVariableList(output, variable_name, values):
-    """Sets a CMake variable to a list."""
-    if not values:
-        return SetVariable(output, variable_name, "")
-    if len(values) == 1:
-        return SetVariable(output, variable_name, values[0])
-    output.write("list(APPEND ")
-    output.write(variable_name)
-    output.write('\n  "')
-    output.write('"\n  "'.join([CMakeStringEscape(value) for value in values]))
-    output.write('")\n')
-
-
-def UnsetVariable(output, variable_name):
-    """Unsets a CMake variable."""
-    output.write("unset(")
-    output.write(variable_name)
-    output.write(")\n")
-
-
-def WriteVariable(output, variable_name, prepend=None):
-    if prepend:
-        output.write(prepend)
-    output.write("${")
-    output.write(variable_name)
-    output.write("}")
-
-
-class CMakeTargetType:
-    def __init__(self, command, modifier, property_modifier):
-        self.command = command
-        self.modifier = modifier
-        self.property_modifier = property_modifier
-
-
-cmake_target_type_from_gyp_target_type = {
-    "executable": CMakeTargetType("add_executable", None, "RUNTIME"),
-    "static_library": CMakeTargetType("add_library", "STATIC", "ARCHIVE"),
-    "shared_library": CMakeTargetType("add_library", "SHARED", "LIBRARY"),
-    "loadable_module": CMakeTargetType("add_library", "MODULE", "LIBRARY"),
-    "none": CMakeTargetType("add_custom_target", "SOURCES", None),
-}
-
-
-def StringToCMakeTargetName(a):
-    """Converts the given string 'a' to a valid CMake target name.
-
-  All invalid characters are replaced by '_'.
-  Invalid for cmake: ' ', '/', '(', ')', '"'
-  Invalid for make: ':'
-  Invalid for unknown reasons but cause failures: '.'
-  """
-    return a.translate(_maketrans(' /():."', "_______"))
-
-
-def WriteActions(target_name, actions, extra_sources, extra_deps, path_to_gyp, output):
-    """Write CMake for the 'actions' in the target.
-
-  Args:
-    target_name: the name of the CMake target being generated.
-    actions: the Gyp 'actions' dict for this target.
-    extra_sources: [(, )] to append with generated source files.
-    extra_deps: [] to append with generated targets.
-    path_to_gyp: relative path from CMakeLists.txt being generated to
-        the Gyp file in which the target being generated is defined.
-  """
-    for action in actions:
-        action_name = StringToCMakeTargetName(action["action_name"])
-        action_target_name = f"{target_name}__{action_name}"
-
-        inputs = action["inputs"]
-        inputs_name = action_target_name + "__input"
-        SetVariableList(
-            output,
-            inputs_name,
-            [NormjoinPathForceCMakeSource(path_to_gyp, dep) for dep in inputs],
-        )
-
-        outputs = action["outputs"]
-        cmake_outputs = [
-            NormjoinPathForceCMakeSource(path_to_gyp, out) for out in outputs
-        ]
-        outputs_name = action_target_name + "__output"
-        SetVariableList(output, outputs_name, cmake_outputs)
-
-        # Build up a list of outputs.
-        # Collect the output dirs we'll need.
-        dirs = {dir for dir in (os.path.dirname(o) for o in outputs) if dir}
-
-        if int(action.get("process_outputs_as_sources", False)):
-            extra_sources.extend(zip(cmake_outputs, outputs))
-
-        # add_custom_command
-        output.write("add_custom_command(OUTPUT ")
-        WriteVariable(output, outputs_name)
-        output.write("\n")
-
-        if len(dirs) > 0:
-            for directory in dirs:
-                output.write("  COMMAND ${CMAKE_COMMAND} -E make_directory ")
-                output.write(directory)
-                output.write("\n")
-
-        output.write("  COMMAND ")
-        output.write(gyp.common.EncodePOSIXShellList(action["action"]))
-        output.write("\n")
-
-        output.write("  DEPENDS ")
-        WriteVariable(output, inputs_name)
-        output.write("\n")
-
-        output.write("  WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/")
-        output.write(path_to_gyp)
-        output.write("\n")
-
-        output.write("  COMMENT ")
-        if "message" in action:
-            output.write(action["message"])
-        else:
-            output.write(action_target_name)
-        output.write("\n")
-
-        output.write("  VERBATIM\n")
-        output.write(")\n")
-
-        # add_custom_target
-        output.write("add_custom_target(")
-        output.write(action_target_name)
-        output.write("\n  DEPENDS ")
-        WriteVariable(output, outputs_name)
-        output.write("\n  SOURCES ")
-        WriteVariable(output, inputs_name)
-        output.write("\n)\n")
-
-        extra_deps.append(action_target_name)
-
-
-def NormjoinRulePathForceCMakeSource(base_path, rel_path, rule_source):
-    if rel_path.startswith(("${RULE_INPUT_PATH}", "${RULE_INPUT_DIRNAME}")):
-        if any([rule_source.startswith(var) for var in FULL_PATH_VARS]):
-            return rel_path
-    return NormjoinPathForceCMakeSource(base_path, rel_path)
-
-
-def WriteRules(target_name, rules, extra_sources, extra_deps, path_to_gyp, output):
-    """Write CMake for the 'rules' in the target.
-
-  Args:
-    target_name: the name of the CMake target being generated.
-    actions: the Gyp 'actions' dict for this target.
-    extra_sources: [(, )] to append with generated source files.
-    extra_deps: [] to append with generated targets.
-    path_to_gyp: relative path from CMakeLists.txt being generated to
-        the Gyp file in which the target being generated is defined.
-  """
-    for rule in rules:
-        rule_name = StringToCMakeTargetName(target_name + "__" + rule["rule_name"])
-
-        inputs = rule.get("inputs", [])
-        inputs_name = rule_name + "__input"
-        SetVariableList(
-            output,
-            inputs_name,
-            [NormjoinPathForceCMakeSource(path_to_gyp, dep) for dep in inputs],
-        )
-        outputs = rule["outputs"]
-        var_outputs = []
-
-        for count, rule_source in enumerate(rule.get("rule_sources", [])):
-            action_name = rule_name + "_" + str(count)
-
-            rule_source_dirname, rule_source_basename = os.path.split(rule_source)
-            rule_source_root, rule_source_ext = os.path.splitext(rule_source_basename)
-
-            SetVariable(output, "RULE_INPUT_PATH", rule_source)
-            SetVariable(output, "RULE_INPUT_DIRNAME", rule_source_dirname)
-            SetVariable(output, "RULE_INPUT_NAME", rule_source_basename)
-            SetVariable(output, "RULE_INPUT_ROOT", rule_source_root)
-            SetVariable(output, "RULE_INPUT_EXT", rule_source_ext)
-
-            # Build up a list of outputs.
-            # Collect the output dirs we'll need.
-            dirs = {dir for dir in (os.path.dirname(o) for o in outputs) if dir}
-
-            # Create variables for the output, as 'local' variable will be unset.
-            these_outputs = []
-            for output_index, out in enumerate(outputs):
-                output_name = action_name + "_" + str(output_index)
-                SetVariable(
-                    output,
-                    output_name,
-                    NormjoinRulePathForceCMakeSource(path_to_gyp, out, rule_source),
-                )
-                if int(rule.get("process_outputs_as_sources", False)):
-                    extra_sources.append(("${" + output_name + "}", out))
-                these_outputs.append("${" + output_name + "}")
-                var_outputs.append("${" + output_name + "}")
-
-            # add_custom_command
-            output.write("add_custom_command(OUTPUT\n")
-            for out in these_outputs:
-                output.write("  ")
-                output.write(out)
-                output.write("\n")
-
-            for directory in dirs:
-                output.write("  COMMAND ${CMAKE_COMMAND} -E make_directory ")
-                output.write(directory)
-                output.write("\n")
-
-            output.write("  COMMAND ")
-            output.write(gyp.common.EncodePOSIXShellList(rule["action"]))
-            output.write("\n")
-
-            output.write("  DEPENDS ")
-            WriteVariable(output, inputs_name)
-            output.write(" ")
-            output.write(NormjoinPath(path_to_gyp, rule_source))
-            output.write("\n")
-
-            # CMAKE_CURRENT_LIST_DIR is where the CMakeLists.txt lives.
-            # The cwd is the current build directory.
-            output.write("  WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/")
-            output.write(path_to_gyp)
-            output.write("\n")
-
-            output.write("  COMMENT ")
-            if "message" in rule:
-                output.write(rule["message"])
-            else:
-                output.write(action_name)
-            output.write("\n")
-
-            output.write("  VERBATIM\n")
-            output.write(")\n")
-
-            UnsetVariable(output, "RULE_INPUT_PATH")
-            UnsetVariable(output, "RULE_INPUT_DIRNAME")
-            UnsetVariable(output, "RULE_INPUT_NAME")
-            UnsetVariable(output, "RULE_INPUT_ROOT")
-            UnsetVariable(output, "RULE_INPUT_EXT")
-
-        # add_custom_target
-        output.write("add_custom_target(")
-        output.write(rule_name)
-        output.write(" DEPENDS\n")
-        for out in var_outputs:
-            output.write("  ")
-            output.write(out)
-            output.write("\n")
-        output.write("SOURCES ")
-        WriteVariable(output, inputs_name)
-        output.write("\n")
-        for rule_source in rule.get("rule_sources", []):
-            output.write("  ")
-            output.write(NormjoinPath(path_to_gyp, rule_source))
-            output.write("\n")
-        output.write(")\n")
-
-        extra_deps.append(rule_name)
-
-
-def WriteCopies(target_name, copies, extra_deps, path_to_gyp, output):
-    """Write CMake for the 'copies' in the target.
-
-  Args:
-    target_name: the name of the CMake target being generated.
-    actions: the Gyp 'actions' dict for this target.
-    extra_deps: [] to append with generated targets.
-    path_to_gyp: relative path from CMakeLists.txt being generated to
-        the Gyp file in which the target being generated is defined.
-  """
-    copy_name = target_name + "__copies"
-
-    # CMake gets upset with custom targets with OUTPUT which specify no output.
-    have_copies = any(copy["files"] for copy in copies)
-    if not have_copies:
-        output.write("add_custom_target(")
-        output.write(copy_name)
-        output.write(")\n")
-        extra_deps.append(copy_name)
-        return
-
-    class Copy:
-        def __init__(self, ext, command):
-            self.cmake_inputs = []
-            self.cmake_outputs = []
-            self.gyp_inputs = []
-            self.gyp_outputs = []
-            self.ext = ext
-            self.inputs_name = None
-            self.outputs_name = None
-            self.command = command
-
-    file_copy = Copy("", "copy")
-    dir_copy = Copy("_dirs", "copy_directory")
-
-    for copy in copies:
-        files = copy["files"]
-        destination = copy["destination"]
-        for src in files:
-            path = os.path.normpath(src)
-            basename = os.path.split(path)[1]
-            dst = os.path.join(destination, basename)
-
-            copy = file_copy if os.path.basename(src) else dir_copy
-
-            copy.cmake_inputs.append(NormjoinPathForceCMakeSource(path_to_gyp, src))
-            copy.cmake_outputs.append(NormjoinPathForceCMakeSource(path_to_gyp, dst))
-            copy.gyp_inputs.append(src)
-            copy.gyp_outputs.append(dst)
-
-    for copy in (file_copy, dir_copy):
-        if copy.cmake_inputs:
-            copy.inputs_name = copy_name + "__input" + copy.ext
-            SetVariableList(output, copy.inputs_name, copy.cmake_inputs)
-
-            copy.outputs_name = copy_name + "__output" + copy.ext
-            SetVariableList(output, copy.outputs_name, copy.cmake_outputs)
-
-    # add_custom_command
-    output.write("add_custom_command(\n")
-
-    output.write("OUTPUT")
-    for copy in (file_copy, dir_copy):
-        if copy.outputs_name:
-            WriteVariable(output, copy.outputs_name, " ")
-    output.write("\n")
-
-    for copy in (file_copy, dir_copy):
-        for src, dst in zip(copy.gyp_inputs, copy.gyp_outputs):
-            # 'cmake -E copy src dst' will create the 'dst' directory if needed.
-            output.write("COMMAND ${CMAKE_COMMAND} -E %s " % copy.command)
-            output.write(src)
-            output.write(" ")
-            output.write(dst)
-            output.write("\n")
-
-    output.write("DEPENDS")
-    for copy in (file_copy, dir_copy):
-        if copy.inputs_name:
-            WriteVariable(output, copy.inputs_name, " ")
-    output.write("\n")
-
-    output.write("WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/")
-    output.write(path_to_gyp)
-    output.write("\n")
-
-    output.write("COMMENT Copying for ")
-    output.write(target_name)
-    output.write("\n")
-
-    output.write("VERBATIM\n")
-    output.write(")\n")
-
-    # add_custom_target
-    output.write("add_custom_target(")
-    output.write(copy_name)
-    output.write("\n  DEPENDS")
-    for copy in (file_copy, dir_copy):
-        if copy.outputs_name:
-            WriteVariable(output, copy.outputs_name, " ")
-    output.write("\n  SOURCES")
-    if file_copy.inputs_name:
-        WriteVariable(output, file_copy.inputs_name, " ")
-    output.write("\n)\n")
-
-    extra_deps.append(copy_name)
-
-
-def CreateCMakeTargetBaseName(qualified_target):
-    """This is the name we would like the target to have."""
-    _, gyp_target_name, gyp_target_toolset = gyp.common.ParseQualifiedTarget(
-        qualified_target
-    )
-    cmake_target_base_name = gyp_target_name
-    if gyp_target_toolset and gyp_target_toolset != "target":
-        cmake_target_base_name += "_" + gyp_target_toolset
-    return StringToCMakeTargetName(cmake_target_base_name)
-
-
-def CreateCMakeTargetFullName(qualified_target):
-    """An unambiguous name for the target."""
-    gyp_file, gyp_target_name, gyp_target_toolset = gyp.common.ParseQualifiedTarget(
-        qualified_target
-    )
-    cmake_target_full_name = gyp_file + ":" + gyp_target_name
-    if gyp_target_toolset and gyp_target_toolset != "target":
-        cmake_target_full_name += "_" + gyp_target_toolset
-    return StringToCMakeTargetName(cmake_target_full_name)
-
-
-class CMakeNamer:
-    """Converts Gyp target names into CMake target names.
-
-  CMake requires that target names be globally unique. One way to ensure
-  this is to fully qualify the names of the targets. Unfortunately, this
-  ends up with all targets looking like "chrome_chrome_gyp_chrome" instead
-  of just "chrome". If this generator were only interested in building, it
-  would be possible to fully qualify all target names, then create
-  unqualified target names which depend on all qualified targets which
-  should have had that name. This is more or less what the 'make' generator
-  does with aliases. However, one goal of this generator is to create CMake
-  files for use with IDEs, and fully qualified names are not as user
-  friendly.
-
-  Since target name collision is rare, we do the above only when required.
-
-  Toolset variants are always qualified from the base, as this is required for
-  building. However, it also makes sense for an IDE, as it is possible for
-  defines to be different.
-  """
-
-    def __init__(self, target_list):
-        self.cmake_target_base_names_conficting = set()
-
-        cmake_target_base_names_seen = set()
-        for qualified_target in target_list:
-            cmake_target_base_name = CreateCMakeTargetBaseName(qualified_target)
-
-            if cmake_target_base_name not in cmake_target_base_names_seen:
-                cmake_target_base_names_seen.add(cmake_target_base_name)
-            else:
-                self.cmake_target_base_names_conficting.add(cmake_target_base_name)
-
-    def CreateCMakeTargetName(self, qualified_target):
-        base_name = CreateCMakeTargetBaseName(qualified_target)
-        if base_name in self.cmake_target_base_names_conficting:
-            return CreateCMakeTargetFullName(qualified_target)
-        return base_name
-
-
-def WriteTarget(
-    namer,
-    qualified_target,
-    target_dicts,
-    build_dir,
-    config_to_use,
-    options,
-    generator_flags,
-    all_qualified_targets,
-    flavor,
-    output,
-):
-    # The make generator does this always.
-    # TODO: It would be nice to be able to tell CMake all dependencies.
-    circular_libs = generator_flags.get("circular", True)
-
-    if not generator_flags.get("standalone", False):
-        output.write("\n#")
-        output.write(qualified_target)
-        output.write("\n")
-
-    gyp_file, _, _ = gyp.common.ParseQualifiedTarget(qualified_target)
-    rel_gyp_file = gyp.common.RelativePath(gyp_file, options.toplevel_dir)
-    rel_gyp_dir = os.path.dirname(rel_gyp_file)
-
-    # Relative path from build dir to top dir.
-    build_to_top = gyp.common.InvertRelativePath(build_dir, options.toplevel_dir)
-    # Relative path from build dir to gyp dir.
-    build_to_gyp = os.path.join(build_to_top, rel_gyp_dir)
-
-    path_from_cmakelists_to_gyp = build_to_gyp
-
-    spec = target_dicts.get(qualified_target, {})
-    config = spec.get("configurations", {}).get(config_to_use, {})
-
-    xcode_settings = None
-    if flavor == "mac":
-        xcode_settings = gyp.xcode_emulation.XcodeSettings(spec)
-
-    target_name = spec.get("target_name", "")
-    target_type = spec.get("type", "")
-    target_toolset = spec.get("toolset")
-
-    cmake_target_type = cmake_target_type_from_gyp_target_type.get(target_type)
-    if cmake_target_type is None:
-        print(
-            "Target %s has unknown target type %s, skipping."
-            % (target_name, target_type)
-        )
-        return
-
-    SetVariable(output, "TARGET", target_name)
-    SetVariable(output, "TOOLSET", target_toolset)
-
-    cmake_target_name = namer.CreateCMakeTargetName(qualified_target)
-
-    extra_sources = []
-    extra_deps = []
-
-    # Actions must come first, since they can generate more OBJs for use below.
-    if "actions" in spec:
-        WriteActions(
-            cmake_target_name,
-            spec["actions"],
-            extra_sources,
-            extra_deps,
-            path_from_cmakelists_to_gyp,
-            output,
-        )
-
-    # Rules must be early like actions.
-    if "rules" in spec:
-        WriteRules(
-            cmake_target_name,
-            spec["rules"],
-            extra_sources,
-            extra_deps,
-            path_from_cmakelists_to_gyp,
-            output,
-        )
-
-    # Copies
-    if "copies" in spec:
-        WriteCopies(
-            cmake_target_name,
-            spec["copies"],
-            extra_deps,
-            path_from_cmakelists_to_gyp,
-            output,
-        )
-
-    # Target and sources
-    srcs = spec.get("sources", [])
-
-    # Gyp separates the sheep from the goats based on file extensions.
-    # A full separation is done here because of flag handing (see below).
-    s_sources = []
-    c_sources = []
-    cxx_sources = []
-    linkable_sources = []
-    other_sources = []
-    for src in srcs:
-        _, ext = os.path.splitext(src)
-        src_type = COMPILABLE_EXTENSIONS.get(ext, None)
-        src_norm_path = NormjoinPath(path_from_cmakelists_to_gyp, src)
-
-        if src_type == "s":
-            s_sources.append(src_norm_path)
-        elif src_type == "cc":
-            c_sources.append(src_norm_path)
-        elif src_type == "cxx":
-            cxx_sources.append(src_norm_path)
-        elif Linkable(ext):
-            linkable_sources.append(src_norm_path)
-        else:
-            other_sources.append(src_norm_path)
-
-    for extra_source in extra_sources:
-        src, real_source = extra_source
-        _, ext = os.path.splitext(real_source)
-        src_type = COMPILABLE_EXTENSIONS.get(ext, None)
-
-        if src_type == "s":
-            s_sources.append(src)
-        elif src_type == "cc":
-            c_sources.append(src)
-        elif src_type == "cxx":
-            cxx_sources.append(src)
-        elif Linkable(ext):
-            linkable_sources.append(src)
-        else:
-            other_sources.append(src)
-
-    s_sources_name = None
-    if s_sources:
-        s_sources_name = cmake_target_name + "__asm_srcs"
-        SetVariableList(output, s_sources_name, s_sources)
-
-    c_sources_name = None
-    if c_sources:
-        c_sources_name = cmake_target_name + "__c_srcs"
-        SetVariableList(output, c_sources_name, c_sources)
-
-    cxx_sources_name = None
-    if cxx_sources:
-        cxx_sources_name = cmake_target_name + "__cxx_srcs"
-        SetVariableList(output, cxx_sources_name, cxx_sources)
-
-    linkable_sources_name = None
-    if linkable_sources:
-        linkable_sources_name = cmake_target_name + "__linkable_srcs"
-        SetVariableList(output, linkable_sources_name, linkable_sources)
-
-    other_sources_name = None
-    if other_sources:
-        other_sources_name = cmake_target_name + "__other_srcs"
-        SetVariableList(output, other_sources_name, other_sources)
-
-    # CMake gets upset when executable targets provide no sources.
-    # http://www.cmake.org/pipermail/cmake/2010-July/038461.html
-    dummy_sources_name = None
-    has_sources = (
-        s_sources_name
-        or c_sources_name
-        or cxx_sources_name
-        or linkable_sources_name
-        or other_sources_name
-    )
-    if target_type == "executable" and not has_sources:
-        dummy_sources_name = cmake_target_name + "__dummy_srcs"
-        SetVariable(
-            output, dummy_sources_name, "${obj}.${TOOLSET}/${TARGET}/genc/dummy.c"
-        )
-        output.write('if(NOT EXISTS "')
-        WriteVariable(output, dummy_sources_name)
-        output.write('")\n')
-        output.write('  file(WRITE "')
-        WriteVariable(output, dummy_sources_name)
-        output.write('" "")\n')
-        output.write("endif()\n")
-
-    # CMake is opposed to setting linker directories and considers the practice
-    # of setting linker directories dangerous. Instead, it favors the use of
-    # find_library and passing absolute paths to target_link_libraries.
-    # However, CMake does provide the command link_directories, which adds
-    # link directories to targets defined after it is called.
-    # As a result, link_directories must come before the target definition.
-    # CMake unfortunately has no means of removing entries from LINK_DIRECTORIES.
-    library_dirs = config.get("library_dirs")
-    if library_dirs is not None:
-        output.write("link_directories(")
-        for library_dir in library_dirs:
-            output.write(" ")
-            output.write(NormjoinPath(path_from_cmakelists_to_gyp, library_dir))
-            output.write("\n")
-        output.write(")\n")
-
-    output.write(cmake_target_type.command)
-    output.write("(")
-    output.write(cmake_target_name)
-
-    if cmake_target_type.modifier is not None:
-        output.write(" ")
-        output.write(cmake_target_type.modifier)
-
-    if s_sources_name:
-        WriteVariable(output, s_sources_name, " ")
-    if c_sources_name:
-        WriteVariable(output, c_sources_name, " ")
-    if cxx_sources_name:
-        WriteVariable(output, cxx_sources_name, " ")
-    if linkable_sources_name:
-        WriteVariable(output, linkable_sources_name, " ")
-    if other_sources_name:
-        WriteVariable(output, other_sources_name, " ")
-    if dummy_sources_name:
-        WriteVariable(output, dummy_sources_name, " ")
-
-    output.write(")\n")
-
-    # Let CMake know if the 'all' target should depend on this target.
-    exclude_from_all = (
-        "TRUE" if qualified_target not in all_qualified_targets else "FALSE"
-    )
-    SetTargetProperty(output, cmake_target_name, "EXCLUDE_FROM_ALL", exclude_from_all)
-    for extra_target_name in extra_deps:
-        SetTargetProperty(
-            output, extra_target_name, "EXCLUDE_FROM_ALL", exclude_from_all
-        )
-
-    # Output name and location.
-    if target_type != "none":
-        # Link as 'C' if there are no other files
-        if not c_sources and not cxx_sources:
-            SetTargetProperty(output, cmake_target_name, "LINKER_LANGUAGE", ["C"])
-
-        # Mark uncompiled sources as uncompiled.
-        if other_sources_name:
-            output.write("set_source_files_properties(")
-            WriteVariable(output, other_sources_name, "")
-            output.write(' PROPERTIES HEADER_FILE_ONLY "TRUE")\n')
-
-        # Mark object sources as linkable.
-        if linkable_sources_name:
-            output.write("set_source_files_properties(")
-            WriteVariable(output, other_sources_name, "")
-            output.write(' PROPERTIES EXTERNAL_OBJECT "TRUE")\n')
-
-        # Output directory
-        target_output_directory = spec.get("product_dir")
-        if target_output_directory is None:
-            if target_type in ("executable", "loadable_module"):
-                target_output_directory = generator_default_variables["PRODUCT_DIR"]
-            elif target_type == "shared_library":
-                target_output_directory = "${builddir}/lib.${TOOLSET}"
-            elif spec.get("standalone_static_library", False):
-                target_output_directory = generator_default_variables["PRODUCT_DIR"]
-            else:
-                base_path = gyp.common.RelativePath(
-                    os.path.dirname(gyp_file), options.toplevel_dir
-                )
-                target_output_directory = "${obj}.${TOOLSET}"
-                target_output_directory = os.path.join(
-                    target_output_directory, base_path
-                )
-
-        cmake_target_output_directory = NormjoinPathForceCMakeSource(
-            path_from_cmakelists_to_gyp, target_output_directory
-        )
-        SetTargetProperty(
-            output,
-            cmake_target_name,
-            cmake_target_type.property_modifier + "_OUTPUT_DIRECTORY",
-            cmake_target_output_directory,
-        )
-
-        # Output name
-        default_product_prefix = ""
-        default_product_name = target_name
-        default_product_ext = ""
-        if target_type == "static_library":
-            static_library_prefix = generator_default_variables["STATIC_LIB_PREFIX"]
-            default_product_name = RemovePrefix(
-                default_product_name, static_library_prefix
-            )
-            default_product_prefix = static_library_prefix
-            default_product_ext = generator_default_variables["STATIC_LIB_SUFFIX"]
-
-        elif target_type in ("loadable_module", "shared_library"):
-            shared_library_prefix = generator_default_variables["SHARED_LIB_PREFIX"]
-            default_product_name = RemovePrefix(
-                default_product_name, shared_library_prefix
-            )
-            default_product_prefix = shared_library_prefix
-            default_product_ext = generator_default_variables["SHARED_LIB_SUFFIX"]
-
-        elif target_type != "executable":
-            print(
-                "ERROR: What output file should be generated?",
-                "type",
-                target_type,
-                "target",
-                target_name,
-            )
-
-        product_prefix = spec.get("product_prefix", default_product_prefix)
-        product_name = spec.get("product_name", default_product_name)
-        product_ext = spec.get("product_extension")
-        if product_ext:
-            product_ext = "." + product_ext
-        else:
-            product_ext = default_product_ext
-
-        SetTargetProperty(output, cmake_target_name, "PREFIX", product_prefix)
-        SetTargetProperty(
-            output,
-            cmake_target_name,
-            cmake_target_type.property_modifier + "_OUTPUT_NAME",
-            product_name,
-        )
-        SetTargetProperty(output, cmake_target_name, "SUFFIX", product_ext)
-
-        # Make the output of this target referenceable as a source.
-        cmake_target_output_basename = product_prefix + product_name + product_ext
-        cmake_target_output = os.path.join(
-            cmake_target_output_directory, cmake_target_output_basename
-        )
-        SetFileProperty(output, cmake_target_output, "GENERATED", ["TRUE"], "")
-
-        # Includes
-        includes = config.get("include_dirs")
-        if includes:
-            # This (target include directories) is what requires CMake 2.8.8
-            includes_name = cmake_target_name + "__include_dirs"
-            SetVariableList(
-                output,
-                includes_name,
-                [
-                    NormjoinPathForceCMakeSource(path_from_cmakelists_to_gyp, include)
-                    for include in includes
-                ],
-            )
-            output.write("set_property(TARGET ")
-            output.write(cmake_target_name)
-            output.write(" APPEND PROPERTY INCLUDE_DIRECTORIES ")
-            WriteVariable(output, includes_name, "")
-            output.write(")\n")
-
-        # Defines
-        defines = config.get("defines")
-        if defines is not None:
-            SetTargetProperty(
-                output, cmake_target_name, "COMPILE_DEFINITIONS", defines, ";"
-            )
-
-        # Compile Flags - http://www.cmake.org/Bug/view.php?id=6493
-        # CMake currently does not have target C and CXX flags.
-        # So, instead of doing...
-
-        # cflags_c = config.get('cflags_c')
-        # if cflags_c is not None:
-        #   SetTargetProperty(output, cmake_target_name,
-        #                       'C_COMPILE_FLAGS', cflags_c, ' ')
-
-        # cflags_cc = config.get('cflags_cc')
-        # if cflags_cc is not None:
-        #   SetTargetProperty(output, cmake_target_name,
-        #                       'CXX_COMPILE_FLAGS', cflags_cc, ' ')
-
-        # Instead we must...
-        cflags = config.get("cflags", [])
-        cflags_c = config.get("cflags_c", [])
-        cflags_cxx = config.get("cflags_cc", [])
-        if xcode_settings:
-            cflags = xcode_settings.GetCflags(config_to_use)
-            cflags_c = xcode_settings.GetCflagsC(config_to_use)
-            cflags_cxx = xcode_settings.GetCflagsCC(config_to_use)
-            # cflags_objc = xcode_settings.GetCflagsObjC(config_to_use)
-            # cflags_objcc = xcode_settings.GetCflagsObjCC(config_to_use)
-
-        if (not cflags_c or not c_sources) and (not cflags_cxx or not cxx_sources):
-            SetTargetProperty(output, cmake_target_name, "COMPILE_FLAGS", cflags, " ")
-
-        elif c_sources and not (s_sources or cxx_sources):
-            flags = []
-            flags.extend(cflags)
-            flags.extend(cflags_c)
-            SetTargetProperty(output, cmake_target_name, "COMPILE_FLAGS", flags, " ")
-
-        elif cxx_sources and not (s_sources or c_sources):
-            flags = []
-            flags.extend(cflags)
-            flags.extend(cflags_cxx)
-            SetTargetProperty(output, cmake_target_name, "COMPILE_FLAGS", flags, " ")
-
-        else:
-            # TODO: This is broken, one cannot generally set properties on files,
-            # as other targets may require different properties on the same files.
-            if s_sources and cflags:
-                SetFilesProperty(output, s_sources_name, "COMPILE_FLAGS", cflags, " ")
-
-            if c_sources and (cflags or cflags_c):
-                flags = []
-                flags.extend(cflags)
-                flags.extend(cflags_c)
-                SetFilesProperty(output, c_sources_name, "COMPILE_FLAGS", flags, " ")
-
-            if cxx_sources and (cflags or cflags_cxx):
-                flags = []
-                flags.extend(cflags)
-                flags.extend(cflags_cxx)
-                SetFilesProperty(output, cxx_sources_name, "COMPILE_FLAGS", flags, " ")
-
-        # Linker flags
-        ldflags = config.get("ldflags")
-        if ldflags is not None:
-            SetTargetProperty(output, cmake_target_name, "LINK_FLAGS", ldflags, " ")
-
-        # XCode settings
-        xcode_settings = config.get("xcode_settings", {})
-        for xcode_setting, xcode_value in xcode_settings.items():
-            SetTargetProperty(
-                output,
-                cmake_target_name,
-                "XCODE_ATTRIBUTE_%s" % xcode_setting,
-                xcode_value,
-                "" if isinstance(xcode_value, str) else " ",
-            )
-
-    # Note on Dependencies and Libraries:
-    # CMake wants to handle link order, resolving the link line up front.
-    # Gyp does not retain or enforce specifying enough information to do so.
-    # So do as other gyp generators and use --start-group and --end-group.
-    # Give CMake as little information as possible so that it doesn't mess it up.
-
-    # Dependencies
-    rawDeps = spec.get("dependencies", [])
-
-    static_deps = []
-    shared_deps = []
-    other_deps = []
-    for rawDep in rawDeps:
-        dep_cmake_name = namer.CreateCMakeTargetName(rawDep)
-        dep_spec = target_dicts.get(rawDep, {})
-        dep_target_type = dep_spec.get("type", None)
-
-        if dep_target_type == "static_library":
-            static_deps.append(dep_cmake_name)
-        elif dep_target_type == "shared_library":
-            shared_deps.append(dep_cmake_name)
-        else:
-            other_deps.append(dep_cmake_name)
-
-    # ensure all external dependencies are complete before internal dependencies
-    # extra_deps currently only depend on their own deps, so otherwise run early
-    if static_deps or shared_deps or other_deps:
-        for extra_dep in extra_deps:
-            output.write("add_dependencies(")
-            output.write(extra_dep)
-            output.write("\n")
-            for deps in (static_deps, shared_deps, other_deps):
-                for dep in gyp.common.uniquer(deps):
-                    output.write("  ")
-                    output.write(dep)
-                    output.write("\n")
-            output.write(")\n")
-
-    linkable = target_type in ("executable", "loadable_module", "shared_library")
-    other_deps.extend(extra_deps)
-    if other_deps or (not linkable and (static_deps or shared_deps)):
-        output.write("add_dependencies(")
-        output.write(cmake_target_name)
-        output.write("\n")
-        for dep in gyp.common.uniquer(other_deps):
-            output.write("  ")
-            output.write(dep)
-            output.write("\n")
-        if not linkable:
-            for deps in (static_deps, shared_deps):
-                for lib_dep in gyp.common.uniquer(deps):
-                    output.write("  ")
-                    output.write(lib_dep)
-                    output.write("\n")
-        output.write(")\n")
-
-    # Libraries
-    if linkable:
-        external_libs = [lib for lib in spec.get("libraries", []) if len(lib) > 0]
-        if external_libs or static_deps or shared_deps:
-            output.write("target_link_libraries(")
-            output.write(cmake_target_name)
-            output.write("\n")
-            if static_deps:
-                write_group = circular_libs and len(static_deps) > 1 and flavor != "mac"
-                if write_group:
-                    output.write("-Wl,--start-group\n")
-                for dep in gyp.common.uniquer(static_deps):
-                    output.write("  ")
-                    output.write(dep)
-                    output.write("\n")
-                if write_group:
-                    output.write("-Wl,--end-group\n")
-            if shared_deps:
-                for dep in gyp.common.uniquer(shared_deps):
-                    output.write("  ")
-                    output.write(dep)
-                    output.write("\n")
-            if external_libs:
-                for lib in gyp.common.uniquer(external_libs):
-                    output.write('  "')
-                    output.write(RemovePrefix(lib, "$(SDKROOT)"))
-                    output.write('"\n')
-
-            output.write(")\n")
-
-    UnsetVariable(output, "TOOLSET")
-    UnsetVariable(output, "TARGET")
-
-
-def GenerateOutputForConfig(target_list, target_dicts, data, params, config_to_use):
-    options = params["options"]
-    generator_flags = params["generator_flags"]
-    flavor = gyp.common.GetFlavor(params)
-
-    # generator_dir: relative path from pwd to where make puts build files.
-    # Makes migrating from make to cmake easier, cmake doesn't put anything here.
-    # Each Gyp configuration creates a different CMakeLists.txt file
-    # to avoid incompatibilities between Gyp and CMake configurations.
-    generator_dir = os.path.relpath(options.generator_output or ".")
-
-    # output_dir: relative path from generator_dir to the build directory.
-    output_dir = generator_flags.get("output_dir", "out")
-
-    # build_dir: relative path from source root to our output files.
-    # e.g. "out/Debug"
-    build_dir = os.path.normpath(os.path.join(generator_dir, output_dir, config_to_use))
-
-    toplevel_build = os.path.join(options.toplevel_dir, build_dir)
-
-    output_file = os.path.join(toplevel_build, "CMakeLists.txt")
-    gyp.common.EnsureDirExists(output_file)
-
-    output = open(output_file, "w")
-    output.write("cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)\n")
-    output.write("cmake_policy(VERSION 2.8.8)\n")
-
-    gyp_file, project_target, _ = gyp.common.ParseQualifiedTarget(target_list[-1])
-    output.write("project(")
-    output.write(project_target)
-    output.write(")\n")
-
-    SetVariable(output, "configuration", config_to_use)
-
-    ar = None
-    cc = None
-    cxx = None
-
-    make_global_settings = data[gyp_file].get("make_global_settings", [])
-    build_to_top = gyp.common.InvertRelativePath(build_dir, options.toplevel_dir)
-    for key, value in make_global_settings:
-        if key == "AR":
-            ar = os.path.join(build_to_top, value)
-        if key == "CC":
-            cc = os.path.join(build_to_top, value)
-        if key == "CXX":
-            cxx = os.path.join(build_to_top, value)
-
-    ar = gyp.common.GetEnvironFallback(["AR_target", "AR"], ar)
-    cc = gyp.common.GetEnvironFallback(["CC_target", "CC"], cc)
-    cxx = gyp.common.GetEnvironFallback(["CXX_target", "CXX"], cxx)
-
-    if ar:
-        SetVariable(output, "CMAKE_AR", ar)
-    if cc:
-        SetVariable(output, "CMAKE_C_COMPILER", cc)
-    if cxx:
-        SetVariable(output, "CMAKE_CXX_COMPILER", cxx)
-
-    # The following appears to be as-yet undocumented.
-    # http://public.kitware.com/Bug/view.php?id=8392
-    output.write("enable_language(ASM)\n")
-    # ASM-ATT does not support .S files.
-    # output.write('enable_language(ASM-ATT)\n')
-
-    if cc:
-        SetVariable(output, "CMAKE_ASM_COMPILER", cc)
-
-    SetVariable(output, "builddir", "${CMAKE_CURRENT_BINARY_DIR}")
-    SetVariable(output, "obj", "${builddir}/obj")
-    output.write("\n")
-
-    # TODO: Undocumented/unsupported (the CMake Java generator depends on it).
-    # CMake by default names the object resulting from foo.c to be foo.c.o.
-    # Gyp traditionally names the object resulting from foo.c foo.o.
-    # This should be irrelevant, but some targets extract .o files from .a
-    # and depend on the name of the extracted .o files.
-    output.write("set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)\n")
-    output.write("set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)\n")
-    output.write("\n")
-
-    # Force ninja to use rsp files. Otherwise link and ar lines can get too long,
-    # resulting in 'Argument list too long' errors.
-    # However, rsp files don't work correctly on Mac.
-    if flavor != "mac":
-        output.write("set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1)\n")
-    output.write("\n")
-
-    namer = CMakeNamer(target_list)
-
-    # The list of targets upon which the 'all' target should depend.
-    # CMake has it's own implicit 'all' target, one is not created explicitly.
-    all_qualified_targets = set()
-    for build_file in params["build_files"]:
-        for qualified_target in gyp.common.AllTargets(
-            target_list, target_dicts, os.path.normpath(build_file)
-        ):
-            all_qualified_targets.add(qualified_target)
-
-    for qualified_target in target_list:
-        if flavor == "mac":
-            gyp_file, _, _ = gyp.common.ParseQualifiedTarget(qualified_target)
-            spec = target_dicts[qualified_target]
-            gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[gyp_file], spec)
-
-        WriteTarget(
-            namer,
-            qualified_target,
-            target_dicts,
-            build_dir,
-            config_to_use,
-            options,
-            generator_flags,
-            all_qualified_targets,
-            flavor,
-            output,
-        )
-
-    output.close()
-
-
-def PerformBuild(data, configurations, params):
-    options = params["options"]
-    generator_flags = params["generator_flags"]
-
-    # generator_dir: relative path from pwd to where make puts build files.
-    # Makes migrating from make to cmake easier, cmake doesn't put anything here.
-    generator_dir = os.path.relpath(options.generator_output or ".")
-
-    # output_dir: relative path from generator_dir to the build directory.
-    output_dir = generator_flags.get("output_dir", "out")
-
-    for config_name in configurations:
-        # build_dir: relative path from source root to our output files.
-        # e.g. "out/Debug"
-        build_dir = os.path.normpath(
-            os.path.join(generator_dir, output_dir, config_name)
-        )
-        arguments = ["cmake", "-G", "Ninja"]
-        print(f"Generating [{config_name}]: {arguments}")
-        subprocess.check_call(arguments, cwd=build_dir)
-
-        arguments = ["ninja", "-C", build_dir]
-        print(f"Building [{config_name}]: {arguments}")
-        subprocess.check_call(arguments)
-
-
-def CallGenerateOutputForConfig(arglist):
-    # Ignore the interrupt signal so that the parent process catches it and
-    # kills all multiprocessing children.
-    signal.signal(signal.SIGINT, signal.SIG_IGN)
-
-    target_list, target_dicts, data, params, config_name = arglist
-    GenerateOutputForConfig(target_list, target_dicts, data, params, config_name)
-
-
-def GenerateOutput(target_list, target_dicts, data, params):
-    user_config = params.get("generator_flags", {}).get("config", None)
-    if user_config:
-        GenerateOutputForConfig(target_list, target_dicts, data, params, user_config)
-    else:
-        config_names = target_dicts[target_list[0]]["configurations"]
-        if params["parallel"]:
-            try:
-                pool = multiprocessing.Pool(len(config_names))
-                arglists = []
-                for config_name in config_names:
-                    arglists.append(
-                        (target_list, target_dicts, data, params, config_name)
-                    )
-                    pool.map(CallGenerateOutputForConfig, arglists)
-            except KeyboardInterrupt as e:
-                pool.terminate()
-                raise e
-        else:
-            for config_name in config_names:
-                GenerateOutputForConfig(
-                    target_list, target_dicts, data, params, config_name
-                )
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py
deleted file mode 100644
index f330a04dea4c5..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py
+++ /dev/null
@@ -1,120 +0,0 @@
-# Copyright (c) 2016 Ben Noordhuis . All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import gyp.common
-import gyp.xcode_emulation
-import json
-import os
-
-generator_additional_non_configuration_keys = []
-generator_additional_path_sections = []
-generator_extra_sources_for_rules = []
-generator_filelist_paths = None
-generator_supports_multiple_toolsets = True
-generator_wants_sorted_dependencies = False
-
-# Lifted from make.py.  The actual values don't matter much.
-generator_default_variables = {
-    "CONFIGURATION_NAME": "$(BUILDTYPE)",
-    "EXECUTABLE_PREFIX": "",
-    "EXECUTABLE_SUFFIX": "",
-    "INTERMEDIATE_DIR": "$(obj).$(TOOLSET)/$(TARGET)/geni",
-    "PRODUCT_DIR": "$(builddir)",
-    "RULE_INPUT_DIRNAME": "%(INPUT_DIRNAME)s",
-    "RULE_INPUT_EXT": "$(suffix $<)",
-    "RULE_INPUT_NAME": "$(notdir $<)",
-    "RULE_INPUT_PATH": "$(abspath $<)",
-    "RULE_INPUT_ROOT": "%(INPUT_ROOT)s",
-    "SHARED_INTERMEDIATE_DIR": "$(obj)/gen",
-    "SHARED_LIB_PREFIX": "lib",
-    "STATIC_LIB_PREFIX": "lib",
-    "STATIC_LIB_SUFFIX": ".a",
-}
-
-
-def IsMac(params):
-    return "mac" == gyp.common.GetFlavor(params)
-
-
-def CalculateVariables(default_variables, params):
-    default_variables.setdefault("OS", gyp.common.GetFlavor(params))
-
-
-def AddCommandsForTarget(cwd, target, params, per_config_commands):
-    output_dir = params["generator_flags"].get("output_dir", "out")
-    for configuration_name, configuration in target["configurations"].items():
-        if IsMac(params):
-            xcode_settings = gyp.xcode_emulation.XcodeSettings(target)
-            cflags = xcode_settings.GetCflags(configuration_name)
-            cflags_c = xcode_settings.GetCflagsC(configuration_name)
-            cflags_cc = xcode_settings.GetCflagsCC(configuration_name)
-        else:
-            cflags = configuration.get("cflags", [])
-            cflags_c = configuration.get("cflags_c", [])
-            cflags_cc = configuration.get("cflags_cc", [])
-
-        cflags_c = cflags + cflags_c
-        cflags_cc = cflags + cflags_cc
-
-        defines = configuration.get("defines", [])
-        defines = ["-D" + s for s in defines]
-
-        # TODO(bnoordhuis) Handle generated source files.
-        extensions = (".c", ".cc", ".cpp", ".cxx")
-        sources = [s for s in target.get("sources", []) if s.endswith(extensions)]
-
-        def resolve(filename):
-            return os.path.abspath(os.path.join(cwd, filename))
-
-        # TODO(bnoordhuis) Handle generated header files.
-        include_dirs = configuration.get("include_dirs", [])
-        include_dirs = [s for s in include_dirs if not s.startswith("$(obj)")]
-        includes = ["-I" + resolve(s) for s in include_dirs]
-
-        defines = gyp.common.EncodePOSIXShellList(defines)
-        includes = gyp.common.EncodePOSIXShellList(includes)
-        cflags_c = gyp.common.EncodePOSIXShellList(cflags_c)
-        cflags_cc = gyp.common.EncodePOSIXShellList(cflags_cc)
-
-        commands = per_config_commands.setdefault(configuration_name, [])
-        for source in sources:
-            file = resolve(source)
-            isc = source.endswith(".c")
-            cc = "cc" if isc else "c++"
-            cflags = cflags_c if isc else cflags_cc
-            command = " ".join(
-                (
-                    cc,
-                    defines,
-                    includes,
-                    cflags,
-                    "-c",
-                    gyp.common.EncodePOSIXShellArgument(file),
-                )
-            )
-            commands.append(dict(command=command, directory=output_dir, file=file))
-
-
-def GenerateOutput(target_list, target_dicts, data, params):
-    per_config_commands = {}
-    for qualified_target, target in target_dicts.items():
-        build_file, target_name, toolset = gyp.common.ParseQualifiedTarget(
-            qualified_target
-        )
-        if IsMac(params):
-            settings = data[build_file]
-            gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(settings, target)
-        cwd = os.path.dirname(build_file)
-        AddCommandsForTarget(cwd, target, params, per_config_commands)
-
-    output_dir = params["generator_flags"].get("output_dir", "out")
-    for configuration_name, commands in per_config_commands.items():
-        filename = os.path.join(output_dir, configuration_name, "compile_commands.json")
-        gyp.common.EnsureDirExists(filename)
-        fp = open(filename, "w")
-        json.dump(commands, fp=fp, indent=0, check_circular=False)
-
-
-def PerformBuild(data, configurations, params):
-    pass
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py
deleted file mode 100644
index 99d5c1fd69db3..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py
+++ /dev/null
@@ -1,103 +0,0 @@
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-
-import os
-import gyp
-import gyp.common
-import gyp.msvs_emulation
-import json
-
-generator_supports_multiple_toolsets = True
-
-generator_wants_static_library_dependencies_adjusted = False
-
-generator_filelist_paths = {}
-
-generator_default_variables = {}
-for dirname in [
-    "INTERMEDIATE_DIR",
-    "SHARED_INTERMEDIATE_DIR",
-    "PRODUCT_DIR",
-    "LIB_DIR",
-    "SHARED_LIB_DIR",
-]:
-    # Some gyp steps fail if these are empty(!).
-    generator_default_variables[dirname] = "dir"
-for unused in [
-    "RULE_INPUT_PATH",
-    "RULE_INPUT_ROOT",
-    "RULE_INPUT_NAME",
-    "RULE_INPUT_DIRNAME",
-    "RULE_INPUT_EXT",
-    "EXECUTABLE_PREFIX",
-    "EXECUTABLE_SUFFIX",
-    "STATIC_LIB_PREFIX",
-    "STATIC_LIB_SUFFIX",
-    "SHARED_LIB_PREFIX",
-    "SHARED_LIB_SUFFIX",
-    "CONFIGURATION_NAME",
-]:
-    generator_default_variables[unused] = ""
-
-
-def CalculateVariables(default_variables, params):
-    generator_flags = params.get("generator_flags", {})
-    for key, val in generator_flags.items():
-        default_variables.setdefault(key, val)
-    default_variables.setdefault("OS", gyp.common.GetFlavor(params))
-
-    flavor = gyp.common.GetFlavor(params)
-    if flavor == "win":
-        gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)
-
-
-def CalculateGeneratorInputInfo(params):
-    """Calculate the generator specific info that gets fed to input (called by
-  gyp)."""
-    generator_flags = params.get("generator_flags", {})
-    if generator_flags.get("adjust_static_libraries", False):
-        global generator_wants_static_library_dependencies_adjusted
-        generator_wants_static_library_dependencies_adjusted = True
-
-    toplevel = params["options"].toplevel_dir
-    generator_dir = os.path.relpath(params["options"].generator_output or ".")
-    # output_dir: relative path from generator_dir to the build directory.
-    output_dir = generator_flags.get("output_dir", "out")
-    qualified_out_dir = os.path.normpath(
-        os.path.join(toplevel, generator_dir, output_dir, "gypfiles")
-    )
-    global generator_filelist_paths
-    generator_filelist_paths = {
-        "toplevel": toplevel,
-        "qualified_out_dir": qualified_out_dir,
-    }
-
-
-def GenerateOutput(target_list, target_dicts, data, params):
-    # Map of target -> list of targets it depends on.
-    edges = {}
-
-    # Queue of targets to visit.
-    targets_to_visit = target_list[:]
-
-    while len(targets_to_visit) > 0:
-        target = targets_to_visit.pop()
-        if target in edges:
-            continue
-        edges[target] = []
-
-        for dep in target_dicts[target].get("dependencies", []):
-            edges[target].append(dep)
-            targets_to_visit.append(dep)
-
-    try:
-        filepath = params["generator_flags"]["output_dir"]
-    except KeyError:
-        filepath = "."
-    filename = os.path.join(filepath, "dump.json")
-    f = open(filename, "w")
-    json.dump(edges, f)
-    f.close()
-    print("Wrote json to %s." % filename)
diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py
deleted file mode 100644
index a851b4db757ed..0000000000000
--- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py
+++ /dev/null
@@ -1,464 +0,0 @@
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""GYP backend that generates Eclipse CDT settings files.
-
-This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML
-files that can be imported into an Eclipse CDT project. The XML file contains a
-list of include paths and symbols (i.e. defines).
-
-Because a full .cproject definition is not created by this generator, it's not
-possible to properly define the include dirs and symbols for each file
-individually.  Instead, one set of includes/symbols is generated for the entire
-project.  This works fairly well (and is a vast improvement in general), but may
-still result in a few indexer issues here and there.
-
-This generator has no automated tests, so expect it to be broken.
-"""
-
-from xml.sax.saxutils import escape
-import os.path
-import subprocess
-import gyp
-import gyp.common
-import gyp.msvs_emulation
-import shlex
-import xml.etree.ElementTree as ET
-
-generator_wants_static_library_dependencies_adjusted = False
-
-generator_default_variables = {}
-
-for dirname in ["INTERMEDIATE_DIR", "PRODUCT_DIR", "LIB_DIR", "SHARED_LIB_DIR"]:
-    # Some gyp steps fail if these are empty(!), so we convert them to variables
-    generator_default_variables[dirname] = "$" + dirname
-
-for unused in [
-    "RULE_INPUT_PATH",
-    "RULE_INPUT_ROOT",
-    "RULE_INPUT_NAME",
-    "RULE_INPUT_DIRNAME",
-    "RULE_INPUT_EXT",
-    "EXECUTABLE_PREFIX",
-    "EXECUTABLE_SUFFIX",
-    "STATIC_LIB_PREFIX",
-    "STATIC_LIB_SUFFIX",
-    "SHARED_LIB_PREFIX",
-    "SHARED_LIB_SUFFIX",
-    "CONFIGURATION_NAME",
-]:
-    generator_default_variables[unused] = ""
-
-# Include dirs will occasionally use the SHARED_INTERMEDIATE_DIR variable as
-# part of the path when dealing with generated headers.  This value will be
-# replaced dynamically for each configuration.
-generator_default_variables["SHARED_INTERMEDIATE_DIR"] = "$SHARED_INTERMEDIATE_DIR"
-
-
-def CalculateVariables(default_variables, params):
-    generator_flags = params.get("generator_flags", {})
-    for key, val in generator_flags.items():
-        default_variables.setdefault(key, val)
-    flavor = gyp.common.GetFlavor(params)
-    default_variables.setdefault("OS", flavor)
-    if flavor == "win":
-        gyp.msvs_emulation.CalculateCommonVariables(default_variables, params)
-
-
-def CalculateGeneratorInputInfo(params):
-    """Calculate the generator specific info that gets fed to input (called by
-  gyp)."""
-    generator_flags = params.get("generator_flags", {})
-    if generator_flags.get("adjust_static_libraries", False):
-        global generator_wants_static_library_dependencies_adjusted
-        generator_wants_static_library_dependencies_adjusted = True
-
-
-def GetAllIncludeDirectories(
-    target_list,
-    target_dicts,
-    shared_intermediate_dirs,
-    config_name,
-    params,
-    compiler_path,
-):
-    """Calculate the set of include directories to be used.
-
-  Returns:
-    A list including all the include_dir's specified for every target followed
-    by any include directories that were added as cflag compiler options.
-  """
-
-    gyp_includes_set = set()
-    compiler_includes_list = []
-
-    # Find compiler's default include dirs.
-    if compiler_path:
-        command = shlex.split(compiler_path)
-        command.extend(["-E", "-xc++", "-v", "-"])
-        proc = subprocess.Popen(
-            args=command,
-            stdin=subprocess.PIPE,
-            stdout=subprocess.PIPE,
-            stderr=subprocess.PIPE,
-        )
-        output = proc.communicate()[1].decode("utf-8")
-        # Extract the list of include dirs from the output, which has this format:
-        #   ...
-        #   #include "..." search starts here:
-        #   #include <...> search starts here:
-        #    /usr/include/c++/4.6
-        #    /usr/local/include
-        #   End of search list.
-        #   ...
-        in_include_list = False
-        for line in output.splitlines():
-            if line.startswith("#include"):
-                in_include_list = True
-                continue
-            if line.startswith("End of search list."):
-                break
-            if in_include_list:
-                include_dir = line.strip()
-                if include_dir not in compiler_includes_list:
-                    compiler_includes_list.append(include_dir)
-
-    flavor = gyp.common.GetFlavor(params)
-    if flavor == "win":
-        generator_flags = params.get("generator_flags", {})
-    for target_name in target_list:
-        target = target_dicts[target_name]
-        if config_name in target["configurations"]:
-            config = target["configurations"][config_name]
-
-            # Look for any include dirs that were explicitly added via cflags. This
-            # may be done in gyp files to force certain includes to come at the end.
-            # TODO(jgreenwald): Change the gyp files to not abuse cflags for this, and
-            # remove this.
-            if flavor == "win":
-                msvs_settings = gyp.msvs_emulation.MsvsSettings(target, generator_flags)
-                cflags = msvs_settings.GetCflags(config_name)
-            else:
-                cflags = config["cflags"]
-            for cflag in cflags:
-                if cflag.startswith("-I"):
-                    include_dir = cflag[2:]
-                    if include_dir not in compiler_includes_list:
-                        compiler_includes_list.append(include_dir)
-
-            # Find standard gyp include dirs.
-            if "include_dirs" in config:
-                include_dirs = config["include_dirs"]
-                for shared_intermediate_dir in shared_intermediate_dirs:
-                    for include_dir in include_dirs:
-                        include_dir = include_dir.replace(
-                            "$SHARED_INTERMEDIATE_DIR", shared_intermediate_dir
-                        )
-                        if not os.path.isabs(include_dir):
-                            base_dir = os.path.dirname(target_name)
-
-                            include_dir = base_dir + "/" + include_dir
-                            include_dir = os.path.abspath(include_dir)
-
-                        gyp_includes_set.add(include_dir)
-
-    # Generate a list that has all the include dirs.
-    all_includes_list = list(gyp_includes_set)
-    all_includes_list.sort()
-    for compiler_include in compiler_includes_list:
-        if compiler_include not in gyp_includes_set:
-            all_includes_list.append(compiler_include)
-
-    # All done.
-    return all_includes_list
-
-
-def GetCompilerPath(target_list, data, options):
-    """Determine a command that can be used to invoke the compiler.
-
-  Returns:
-    If this is a gyp project that has explicit make settings, try to determine
-    the compiler from that.  Otherwise, see if a compiler was specified via the
-    CC_target environment variable.
-  """
-    # First, see if the compiler is configured in make's settings.
-    build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])
-    make_global_settings_dict = data[build_file].get("make_global_settings", {})
-    for key, value in make_global_settings_dict:
-        if key in ["CC", "CXX"]:
-            return os.path.join(options.toplevel_dir, value)
-
-    # Check to see if the compiler was specified as an environment variable.
-    for key in ["CC_target", "CC", "CXX"]:
-        compiler = os.environ.get(key)
-        if compiler:
-            return compiler
-
-    return "gcc"
-
-
-def GetAllDefines(target_list, target_dicts, data, config_name, params, compiler_path):
-    """Calculate the defines for a project.
-
-  Returns:
-    A dict that includes explicit defines declared in gyp files along with all
-    of the default defines that the compiler uses.
-  """
-
-    # Get defines declared in the gyp files.
-    all_defines = {}
-    flavor = gyp.common.GetFlavor(params)
-    if flavor == "win":
-        generator_flags = params.get("generator_flags", {})
-    for target_name in target_list:
-        target = target_dicts[target_name]
-
-        if flavor == "win":
-            msvs_settings = gyp.msvs_emulation.MsvsSettings(target, generator_flags)
-            extra_defines = msvs_settings.GetComputedDefines(config_name)
-        else:
-            extra_defines = []
-        if config_name in target["configurations"]:
-            config = target["configurations"][config_name]
-            target_defines = config["defines"]
-        else:
-            target_defines = []
-        for define in target_defines + extra_defines:
-            split_define = define.split("=", 1)
-            if len(split_define) == 1:
-                split_define.append("1")
-            if split_define[0].strip() in all_defines:
-                # Already defined
-                continue
-            all_defines[split_define[0].strip()] = split_define[1].strip()
-    # Get default compiler defines (if possible).
-    if flavor == "win":
-        return all_defines  # Default defines already processed in the loop above.
-    if compiler_path:
-        command = shlex.split(compiler_path)
-        command.extend(["-E", "-dM", "-"])
-        cpp_proc = subprocess.Popen(
-            args=command, cwd=".", stdin=subprocess.PIPE, stdout=subprocess.PIPE
-        )
-        cpp_output = cpp_proc.communicate()[0].decode("utf-8")
-        cpp_lines = cpp_output.split("\n")
-        for cpp_line in cpp_lines:
-            if not cpp_line.strip():
-                continue
-            cpp_line_parts = cpp_line.split(" ", 2)
-            key = cpp_line_parts[1]
-            if len(cpp_line_parts) >= 3:
-                val = cpp_line_parts[2]
-            else:
-                val = "1"
-            all_defines[key] = val
-
-    return all_defines
-
-
-def WriteIncludePaths(out, eclipse_langs, include_dirs):
-    """Write the includes section of a CDT settings export file."""
-
-    out.write(
-        '  
\n' - ) - out.write(' \n') - for lang in eclipse_langs: - out.write(' \n' % lang) - for include_dir in include_dirs: - out.write( - ' %s\n' - % include_dir - ) - out.write(" \n") - out.write("
\n") - - -def WriteMacros(out, eclipse_langs, defines): - """Write the macros section of a CDT settings export file.""" - - out.write( - '
\n' - ) - out.write(' \n') - for lang in eclipse_langs: - out.write(' \n' % lang) - for key in sorted(defines): - out.write( - " %s%s\n" - % (escape(key), escape(defines[key])) - ) - out.write(" \n") - out.write("
\n") - - -def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name): - options = params["options"] - generator_flags = params.get("generator_flags", {}) - - # build_dir: relative path from source root to our output files. - # e.g. "out/Debug" - build_dir = os.path.join(generator_flags.get("output_dir", "out"), config_name) - - toplevel_build = os.path.join(options.toplevel_dir, build_dir) - # Ninja uses out/Debug/gen while make uses out/Debug/obj/gen as the - # SHARED_INTERMEDIATE_DIR. Include both possible locations. - shared_intermediate_dirs = [ - os.path.join(toplevel_build, "obj", "gen"), - os.path.join(toplevel_build, "gen"), - ] - - GenerateCdtSettingsFile( - target_list, - target_dicts, - data, - params, - config_name, - os.path.join(toplevel_build, "eclipse-cdt-settings.xml"), - options, - shared_intermediate_dirs, - ) - GenerateClasspathFile( - target_list, - target_dicts, - options.toplevel_dir, - toplevel_build, - os.path.join(toplevel_build, "eclipse-classpath.xml"), - ) - - -def GenerateCdtSettingsFile( - target_list, - target_dicts, - data, - params, - config_name, - out_name, - options, - shared_intermediate_dirs, -): - gyp.common.EnsureDirExists(out_name) - with open(out_name, "w") as out: - out.write('\n') - out.write("\n") - - eclipse_langs = [ - "C++ Source File", - "C Source File", - "Assembly Source File", - "GNU C++", - "GNU C", - "Assembly", - ] - compiler_path = GetCompilerPath(target_list, data, options) - include_dirs = GetAllIncludeDirectories( - target_list, - target_dicts, - shared_intermediate_dirs, - config_name, - params, - compiler_path, - ) - WriteIncludePaths(out, eclipse_langs, include_dirs) - defines = GetAllDefines( - target_list, target_dicts, data, config_name, params, compiler_path - ) - WriteMacros(out, eclipse_langs, defines) - - out.write("\n") - - -def GenerateClasspathFile( - target_list, target_dicts, toplevel_dir, toplevel_build, out_name -): - """Generates a classpath file suitable for symbol navigation and code - completion of Java code (such as in Android projects) by finding all - .java and .jar files used as action inputs.""" - gyp.common.EnsureDirExists(out_name) - result = ET.Element("classpath") - - def AddElements(kind, paths): - # First, we need to normalize the paths so they are all relative to the - # toplevel dir. - rel_paths = set() - for path in paths: - if os.path.isabs(path): - rel_paths.add(os.path.relpath(path, toplevel_dir)) - else: - rel_paths.add(path) - - for path in sorted(rel_paths): - entry_element = ET.SubElement(result, "classpathentry") - entry_element.set("kind", kind) - entry_element.set("path", path) - - AddElements("lib", GetJavaJars(target_list, target_dicts, toplevel_dir)) - AddElements("src", GetJavaSourceDirs(target_list, target_dicts, toplevel_dir)) - # Include the standard JRE container and a dummy out folder - AddElements("con", ["org.eclipse.jdt.launching.JRE_CONTAINER"]) - # Include a dummy out folder so that Eclipse doesn't use the default /bin - # folder in the root of the project. - AddElements("output", [os.path.join(toplevel_build, ".eclipse-java-build")]) - - ET.ElementTree(result).write(out_name) - - -def GetJavaJars(target_list, target_dicts, toplevel_dir): - """Generates a sequence of all .jars used as inputs.""" - for target_name in target_list: - target = target_dicts[target_name] - for action in target.get("actions", []): - for input_ in action["inputs"]: - if os.path.splitext(input_)[1] == ".jar" and not input_.startswith("$"): - if os.path.isabs(input_): - yield input_ - else: - yield os.path.join(os.path.dirname(target_name), input_) - - -def GetJavaSourceDirs(target_list, target_dicts, toplevel_dir): - """Generates a sequence of all likely java package root directories.""" - for target_name in target_list: - target = target_dicts[target_name] - for action in target.get("actions", []): - for input_ in action["inputs"]: - if os.path.splitext(input_)[1] == ".java" and not input_.startswith( - "$" - ): - dir_ = os.path.dirname( - os.path.join(os.path.dirname(target_name), input_) - ) - # If there is a parent 'src' or 'java' folder, navigate up to it - - # these are canonical package root names in Chromium. This will - # break if 'src' or 'java' exists in the package structure. This - # could be further improved by inspecting the java file for the - # package name if this proves to be too fragile in practice. - parent_search = dir_ - while os.path.basename(parent_search) not in ["src", "java"]: - parent_search, _ = os.path.split(parent_search) - if not parent_search or parent_search == toplevel_dir: - # Didn't find a known root, just return the original path - yield dir_ - break - else: - yield parent_search - - -def GenerateOutput(target_list, target_dicts, data, params): - """Generate an XML settings file that can be imported into a CDT project.""" - - if params["options"].generator_output: - raise NotImplementedError("--generator_output not implemented for eclipse") - - user_config = params.get("generator_flags", {}).get("config", None) - if user_config: - GenerateOutputForConfig(target_list, target_dicts, data, params, user_config) - else: - config_names = target_dicts[target_list[0]]["configurations"] - for config_name in config_names: - GenerateOutputForConfig( - target_list, target_dicts, data, params, config_name - ) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py deleted file mode 100644 index 4171704c47a4b..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (c) 2011 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""gypd output module - -This module produces gyp input as its output. Output files are given the -.gypd extension to avoid overwriting the .gyp files that they are generated -from. Internal references to .gyp files (such as those found in -"dependencies" sections) are not adjusted to point to .gypd files instead; -unlike other paths, which are relative to the .gyp or .gypd file, such paths -are relative to the directory from which gyp was run to create the .gypd file. - -This generator module is intended to be a sample and a debugging aid, hence -the "d" for "debug" in .gypd. It is useful to inspect the results of the -various merges, expansions, and conditional evaluations performed by gyp -and to see a representation of what would be fed to a generator module. - -It's not advisable to rename .gypd files produced by this module to .gyp, -because they will have all merges, expansions, and evaluations already -performed and the relevant constructs not present in the output; paths to -dependencies may be wrong; and various sections that do not belong in .gyp -files such as such as "included_files" and "*_excluded" will be present. -Output will also be stripped of comments. This is not intended to be a -general-purpose gyp pretty-printer; for that, you probably just want to -run "pprint.pprint(eval(open('source.gyp').read()))", which will still strip -comments but won't do all of the other things done to this module's output. - -The specific formatting of the output generated by this module is subject -to change. -""" - - -import gyp.common -import pprint - - -# These variables should just be spit back out as variable references. -_generator_identity_variables = [ - "CONFIGURATION_NAME", - "EXECUTABLE_PREFIX", - "EXECUTABLE_SUFFIX", - "INTERMEDIATE_DIR", - "LIB_DIR", - "PRODUCT_DIR", - "RULE_INPUT_ROOT", - "RULE_INPUT_DIRNAME", - "RULE_INPUT_EXT", - "RULE_INPUT_NAME", - "RULE_INPUT_PATH", - "SHARED_INTERMEDIATE_DIR", - "SHARED_LIB_DIR", - "SHARED_LIB_PREFIX", - "SHARED_LIB_SUFFIX", - "STATIC_LIB_PREFIX", - "STATIC_LIB_SUFFIX", -] - -# gypd doesn't define a default value for OS like many other generator -# modules. Specify "-D OS=whatever" on the command line to provide a value. -generator_default_variables = {} - -# gypd supports multiple toolsets -generator_supports_multiple_toolsets = True - -# TODO(mark): This always uses <, which isn't right. The input module should -# notify the generator to tell it which phase it is operating in, and this -# module should use < for the early phase and then switch to > for the late -# phase. Bonus points for carrying @ back into the output too. -for v in _generator_identity_variables: - generator_default_variables[v] = "<(%s)" % v - - -def GenerateOutput(target_list, target_dicts, data, params): - output_files = {} - for qualified_target in target_list: - [input_file, target] = gyp.common.ParseQualifiedTarget(qualified_target)[0:2] - - if input_file[-4:] != ".gyp": - continue - input_file_stem = input_file[:-4] - output_file = input_file_stem + params["options"].suffix + ".gypd" - - output_files[output_file] = output_files.get(output_file, input_file) - - for output_file, input_file in output_files.items(): - output = open(output_file, "w") - pprint.pprint(data[input_file], output) - output.close() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py deleted file mode 100644 index 82a07ddc6577b..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (c) 2011 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""gypsh output module - -gypsh is a GYP shell. It's not really a generator per se. All it does is -fire up an interactive Python session with a few local variables set to the -variables passed to the generator. Like gypd, it's intended as a debugging -aid, to facilitate the exploration of .gyp structures after being processed -by the input module. - -The expected usage is "gyp -f gypsh -D OS=desired_os". -""" - - -import code -import sys - - -# All of this stuff about generator variables was lovingly ripped from gypd.py. -# That module has a much better description of what's going on and why. -_generator_identity_variables = [ - "EXECUTABLE_PREFIX", - "EXECUTABLE_SUFFIX", - "INTERMEDIATE_DIR", - "PRODUCT_DIR", - "RULE_INPUT_ROOT", - "RULE_INPUT_DIRNAME", - "RULE_INPUT_EXT", - "RULE_INPUT_NAME", - "RULE_INPUT_PATH", - "SHARED_INTERMEDIATE_DIR", -] - -generator_default_variables = {} - -for v in _generator_identity_variables: - generator_default_variables[v] = "<(%s)" % v - - -def GenerateOutput(target_list, target_dicts, data, params): - locals = { - "target_list": target_list, - "target_dicts": target_dicts, - "data": data, - } - - # Use a banner that looks like the stock Python one and like what - # code.interact uses by default, but tack on something to indicate what - # locals are available, and identify gypsh. - banner = "Python {} on {}\nlocals.keys() = {}\ngypsh".format( - sys.version, - sys.platform, - repr(sorted(locals.keys())), - ) - - code.interact(banner, local=locals) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py deleted file mode 100644 index 05bb609d16000..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +++ /dev/null @@ -1,2714 +0,0 @@ -# Copyright (c) 2013 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Notes: -# -# This is all roughly based on the Makefile system used by the Linux -# kernel, but is a non-recursive make -- we put the entire dependency -# graph in front of make and let it figure it out. -# -# The code below generates a separate .mk file for each target, but -# all are sourced by the top-level Makefile. This means that all -# variables in .mk-files clobber one another. Be careful to use := -# where appropriate for immediate evaluation, and similarly to watch -# that you're not relying on a variable value to last between different -# .mk files. -# -# TODOs: -# -# Global settings and utility functions are currently stuffed in the -# toplevel Makefile. It may make sense to generate some .mk files on -# the side to keep the files readable. - - -import os -import re -import subprocess -import gyp -import gyp.common -import gyp.xcode_emulation -from gyp.common import GetEnvironFallback - -import hashlib - -generator_default_variables = { - "EXECUTABLE_PREFIX": "", - "EXECUTABLE_SUFFIX": "", - "STATIC_LIB_PREFIX": "lib", - "SHARED_LIB_PREFIX": "lib", - "STATIC_LIB_SUFFIX": ".a", - "INTERMEDIATE_DIR": "$(obj).$(TOOLSET)/$(TARGET)/geni", - "SHARED_INTERMEDIATE_DIR": "$(obj)/gen", - "PRODUCT_DIR": "$(builddir)", - "RULE_INPUT_ROOT": "%(INPUT_ROOT)s", # This gets expanded by Python. - "RULE_INPUT_DIRNAME": "%(INPUT_DIRNAME)s", # This gets expanded by Python. - "RULE_INPUT_PATH": "$(abspath $<)", - "RULE_INPUT_EXT": "$(suffix $<)", - "RULE_INPUT_NAME": "$(notdir $<)", - "CONFIGURATION_NAME": "$(BUILDTYPE)", -} - -# Make supports multiple toolsets -generator_supports_multiple_toolsets = gyp.common.CrossCompileRequested() - -# Request sorted dependencies in the order from dependents to dependencies. -generator_wants_sorted_dependencies = False - -# Placates pylint. -generator_additional_non_configuration_keys = [] -generator_additional_path_sections = [] -generator_extra_sources_for_rules = [] -generator_filelist_paths = None - - -def CalculateVariables(default_variables, params): - """Calculate additional variables for use in the build (called by gyp).""" - flavor = gyp.common.GetFlavor(params) - if flavor == "mac": - default_variables.setdefault("OS", "mac") - default_variables.setdefault("SHARED_LIB_SUFFIX", ".dylib") - default_variables.setdefault( - "SHARED_LIB_DIR", generator_default_variables["PRODUCT_DIR"] - ) - default_variables.setdefault( - "LIB_DIR", generator_default_variables["PRODUCT_DIR"] - ) - - # Copy additional generator configuration data from Xcode, which is shared - # by the Mac Make generator. - import gyp.generator.xcode as xcode_generator - - global generator_additional_non_configuration_keys - generator_additional_non_configuration_keys = getattr( - xcode_generator, "generator_additional_non_configuration_keys", [] - ) - global generator_additional_path_sections - generator_additional_path_sections = getattr( - xcode_generator, "generator_additional_path_sections", [] - ) - global generator_extra_sources_for_rules - generator_extra_sources_for_rules = getattr( - xcode_generator, "generator_extra_sources_for_rules", [] - ) - COMPILABLE_EXTENSIONS.update({".m": "objc", ".mm": "objcxx"}) - else: - operating_system = flavor - if flavor == "android": - operating_system = "linux" # Keep this legacy behavior for now. - default_variables.setdefault("OS", operating_system) - if flavor == "aix": - default_variables.setdefault("SHARED_LIB_SUFFIX", ".a") - elif flavor == "zos": - default_variables.setdefault("SHARED_LIB_SUFFIX", ".x") - COMPILABLE_EXTENSIONS.update({".pli": "pli"}) - else: - default_variables.setdefault("SHARED_LIB_SUFFIX", ".so") - default_variables.setdefault("SHARED_LIB_DIR", "$(builddir)/lib.$(TOOLSET)") - default_variables.setdefault("LIB_DIR", "$(obj).$(TOOLSET)") - - -def CalculateGeneratorInputInfo(params): - """Calculate the generator specific info that gets fed to input (called by - gyp).""" - generator_flags = params.get("generator_flags", {}) - android_ndk_version = generator_flags.get("android_ndk_version", None) - # Android NDK requires a strict link order. - if android_ndk_version: - global generator_wants_sorted_dependencies - generator_wants_sorted_dependencies = True - - output_dir = params["options"].generator_output or params["options"].toplevel_dir - builddir_name = generator_flags.get("output_dir", "out") - qualified_out_dir = os.path.normpath( - os.path.join(output_dir, builddir_name, "gypfiles") - ) - - global generator_filelist_paths - generator_filelist_paths = { - "toplevel": params["options"].toplevel_dir, - "qualified_out_dir": qualified_out_dir, - } - - -# The .d checking code below uses these functions: -# wildcard, sort, foreach, shell, wordlist -# wildcard can handle spaces, the rest can't. -# Since I could find no way to make foreach work with spaces in filenames -# correctly, the .d files have spaces replaced with another character. The .d -# file for -# Chromium\ Framework.framework/foo -# is for example -# out/Release/.deps/out/Release/Chromium?Framework.framework/foo -# This is the replacement character. -SPACE_REPLACEMENT = "?" - - -LINK_COMMANDS_LINUX = """\ -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) - -# Due to circular dependencies between libraries :(, we wrap the -# special "figure out circular dependencies" flags around the entire -# input list during linking. -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group - -# Note: this does not handle spaces in paths -define xargs - $(1) $(word 1,$(2)) -$(if $(word 2,$(2)),$(call xargs,$(1),$(wordlist 2,$(words $(2)),$(2)))) -endef - -define write-to-file - @: >$(1) -$(call xargs,@printf "%s\\n" >>$(1),$(2)) -endef - -OBJ_FILE_LIST := ar-file-list - -define create_archive - rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)` - $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) - $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST) -endef - -define create_thin_archive - rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)` - $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) - $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST) -endef - -# We support two kinds of shared objects (.so): -# 1) shared_library, which is just bundling together many dependent libraries -# into a link line. -# 2) loadable_module, which is generating a module intended for dlopen(). -# -# They differ only slightly: -# In the former case, we want to package all dependent code into the .so. -# In the latter case, we want to package just the API exposed by the -# outermost module. -# This means shared_library uses --whole-archive, while loadable_module doesn't. -# (Note that --whole-archive is incompatible with the --start-group used in -# normal linking.) - -# Other shared-object link notes: -# - Set SONAME to the library filename so our binaries don't reference -# the local, absolute paths used on the link command-line. -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) -""" # noqa: E501 - -LINK_COMMANDS_MAC = """\ -quiet_cmd_alink = LIBTOOL-STATIC $@ -cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^) - -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) - -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -""" # noqa: E501 - -LINK_COMMANDS_ANDROID = """\ -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) - -# Note: this does not handle spaces in paths -define xargs - $(1) $(word 1,$(2)) -$(if $(word 2,$(2)),$(call xargs,$(1),$(wordlist 2,$(words $(2)),$(2)))) -endef - -define write-to-file - @: >$(1) -$(call xargs,@printf "%s\\n" >>$(1),$(2)) -endef - -OBJ_FILE_LIST := ar-file-list - -define create_archive - rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)` - $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) - $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST) -endef - -define create_thin_archive - rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)` - $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2))) - $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST) -endef - -# Due to circular dependencies between libraries :(, we wrap the -# special "figure out circular dependencies" flags around the entire -# input list during linking. -quiet_cmd_link = LINK($(TOOLSET)) $@ -quiet_cmd_link_host = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) -cmd_link_host = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) - -# Other shared-object link notes: -# - Set SONAME to the library filename so our binaries don't reference -# the local, absolute paths used on the link command-line. -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) -quiet_cmd_solink_module_host = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module_host = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -""" # noqa: E501 - - -LINK_COMMANDS_AIX = """\ -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X32_64 crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) -X32_64 crs $@ $(filter %.o,$^) - -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) - -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -""" # noqa: E501 - - -LINK_COMMANDS_OS400 = """\ -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^) - -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) - -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -""" # noqa: E501 - - -LINK_COMMANDS_OS390 = """\ -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) - -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) - -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -""" # noqa: E501 - - -# Header of toplevel Makefile. -# This should go into the build tree, but it's easier to keep it here for now. -SHARED_HEADER = ( - """\ -# We borrow heavily from the kernel build setup, though we are simpler since -# we don't have Kconfig tweaking settings on us. - -# The implicit make rules have it looking for RCS files, among other things. -# We instead explicitly write all the rules we care about. -# It's even quicker (saves ~200ms) to pass -r on the command line. -MAKEFLAGS=-r - -# The source directory tree. -srcdir := %(srcdir)s -abs_srcdir := $(abspath $(srcdir)) - -# The name of the builddir. -builddir_name ?= %(builddir)s - -# The V=1 flag on command line makes us verbosely print command lines. -ifdef V - quiet= -else - quiet=quiet_ -endif - -# Specify BUILDTYPE=Release on the command line for a release build. -BUILDTYPE ?= %(default_configuration)s - -# Directory all our build output goes into. -# Note that this must be two directories beneath src/ for unit tests to pass, -# as they reach into the src/ directory for data with relative paths. -builddir ?= $(builddir_name)/$(BUILDTYPE) -abs_builddir := $(abspath $(builddir)) -depsdir := $(builddir)/.deps - -# Object output directory. -obj := $(builddir)/obj -abs_obj := $(abspath $(obj)) - -# We build up a list of every single one of the targets so we can slurp in the -# generated dependency rule Makefiles in one pass. -all_deps := - -%(make_global_settings)s - -CC.target ?= %(CC.target)s -CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS) -CXX.target ?= %(CXX.target)s -CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS) -LINK.target ?= %(LINK.target)s -LDFLAGS.target ?= $(LDFLAGS) -AR.target ?= $(AR) -PLI.target ?= %(PLI.target)s - -# C++ apps need to be linked with g++. -LINK ?= $(CXX.target) - -# TODO(evan): move all cross-compilation logic to gyp-time so we don't need -# to replicate this environment fallback in make as well. -CC.host ?= %(CC.host)s -CFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host) -CXX.host ?= %(CXX.host)s -CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host) -LINK.host ?= %(LINK.host)s -LDFLAGS.host ?= $(LDFLAGS_host) -AR.host ?= %(AR.host)s -PLI.host ?= %(PLI.host)s - -# Define a dir function that can handle spaces. -# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions -# "leading spaces cannot appear in the text of the first argument as written. -# These characters can be put into the argument value by variable substitution." -empty := -space := $(empty) $(empty) - -# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces -replace_spaces = $(subst $(space),""" - + SPACE_REPLACEMENT - + """,$1) -unreplace_spaces = $(subst """ - + SPACE_REPLACEMENT - + """,$(space),$1) -dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1))) - -# Flags to make gcc output dependency info. Note that you need to be -# careful here to use the flags that ccache and distcc can understand. -# We write to a dep file on the side first and then rename at the end -# so we can't end up with a broken dep file. -depfile = $(depsdir)/$(call replace_spaces,$@).d -DEPFLAGS = %(makedep_args)s -MF $(depfile).raw - -# We have to fixup the deps output in a few ways. -# (1) the file output should mention the proper .o file. -# ccache or distcc lose the path to the target, so we convert a rule of -# the form: -# foobar.o: DEP1 DEP2 -# into -# path/to/foobar.o: DEP1 DEP2 -# (2) we want missing files not to cause us to fail to build. -# We want to rewrite -# foobar.o: DEP1 DEP2 \\ -# DEP3 -# to -# DEP1: -# DEP2: -# DEP3: -# so if the files are missing, they're just considered phony rules. -# We have to do some pretty insane escaping to get those backslashes -# and dollar signs past make, the shell, and sed at the same time. -# Doesn't work with spaces, but that's fine: .d files have spaces in -# their names replaced with other characters.""" - r""" -define fixup_dep -# The depfile may not exist if the input file didn't have any #includes. -touch $(depfile).raw -# Fixup path as in (1). -sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile) -# Add extra rules as in (2). -# We remove slashes and replace spaces with new lines; -# remove blank lines; -# delete the first line and append a colon to the remaining lines. -sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ - grep -v '^$$' |\ - sed -e 1d -e 's|$$|:|' \ - >> $(depfile) -rm $(depfile).raw -endef -""" - """ -# Command definitions: -# - cmd_foo is the actual command to run; -# - quiet_cmd_foo is the brief-output summary of the command. - -quiet_cmd_cc = CC($(TOOLSET)) $@ -cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c - -quiet_cmd_cxx = CXX($(TOOLSET)) $@ -cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -%(extra_commands)s -quiet_cmd_touch = TOUCH $@ -cmd_touch = touch $@ - -quiet_cmd_copy = COPY $@ -# send stderr to /dev/null to ignore messages when linking directories. -cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp %(copy_archive_args)s "$<" "$@") - -quiet_cmd_symlink = SYMLINK $@ -cmd_symlink = ln -sf "$<" "$@" - -%(link_commands)s -""" # noqa: E501 - r""" -# Define an escape_quotes function to escape single quotes. -# This allows us to handle quotes properly as long as we always use -# use single quotes and escape_quotes. -escape_quotes = $(subst ','\'',$(1)) -# This comment is here just to include a ' to unconfuse syntax highlighting. -# Define an escape_vars function to escape '$' variable syntax. -# This allows us to read/write command lines with shell variables (e.g. -# $LD_LIBRARY_PATH), without triggering make substitution. -escape_vars = $(subst $$,$$$$,$(1)) -# Helper that expands to a shell command to echo a string exactly as it is in -# make. This uses printf instead of echo because printf's behaviour with respect -# to escape sequences is more portable than echo's across different shells -# (e.g., dash, bash). -exact_echo = printf '%%s\n' '$(call escape_quotes,$(1))' -""" - """ -# Helper to compare the command we're about to run against the command -# we logged the last time we ran the command. Produces an empty -# string (false) when the commands match. -# Tricky point: Make has no string-equality test function. -# The kernel uses the following, but it seems like it would have false -# positives, where one string reordered its arguments. -# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \\ -# $(filter-out $(cmd_$@), $(cmd_$(1)))) -# We instead substitute each for the empty string into the other, and -# say they're equal if both substitutions produce the empty string. -# .d files contain """ - + SPACE_REPLACEMENT - + """ instead of spaces, take that into account. -command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\\ - $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) - -# Helper that is non-empty when a prerequisite changes. -# Normally make does this implicitly, but we force rules to always run -# so we can check their command lines. -# $? -- new prerequisites -# $| -- order-only dependencies -prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) - -# Helper that executes all postbuilds until one fails. -define do_postbuilds - @E=0;\\ - for p in $(POSTBUILDS); do\\ - eval $$p;\\ - E=$$?;\\ - if [ $$E -ne 0 ]; then\\ - break;\\ - fi;\\ - done;\\ - if [ $$E -ne 0 ]; then\\ - rm -rf "$@";\\ - exit $$E;\\ - fi -endef - -# do_cmd: run a command via the above cmd_foo names, if necessary. -# Should always run for a given target to handle command-line changes. -# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. -# Third argument, if non-zero, makes it do POSTBUILDS processing. -# Note: We intentionally do NOT call dirx for depfile, since it contains """ - + SPACE_REPLACEMENT - + """ for -# spaces already and dirx strips the """ - + SPACE_REPLACEMENT - + """ characters. -define do_cmd -$(if $(or $(command_changed),$(prereq_changed)), - @$(call exact_echo, $($(quiet)cmd_$(1))) - @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" - $(if $(findstring flock,$(word %(flock_index)d,$(cmd_$1))), - @$(cmd_$(1)) - @echo " $(quiet_cmd_$(1)): Finished", - @$(cmd_$(1)) - ) - @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) - @$(if $(2),$(fixup_dep)) - $(if $(and $(3), $(POSTBUILDS)), - $(call do_postbuilds) - ) -) -endef - -# Declare the "%(default_target)s" target first so it is the default, -# even though we don't have the deps yet. -.PHONY: %(default_target)s -%(default_target)s: - -# make looks for ways to re-generate included makefiles, but in our case, we -# don't have a direct way. Explicitly telling make that it has nothing to do -# for them makes it go faster. -%%.d: ; - -# Use FORCE_DO_CMD to force a target to run. Should be coupled with -# do_cmd. -.PHONY: FORCE_DO_CMD -FORCE_DO_CMD: - -""" # noqa: E501 -) - -SHARED_HEADER_MAC_COMMANDS = """ -quiet_cmd_objc = CXX($(TOOLSET)) $@ -cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< - -quiet_cmd_objcxx = CXX($(TOOLSET)) $@ -cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< - -# Commands for precompiled header files. -quiet_cmd_pch_c = CXX($(TOOLSET)) $@ -cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< -quiet_cmd_pch_cc = CXX($(TOOLSET)) $@ -cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< -quiet_cmd_pch_m = CXX($(TOOLSET)) $@ -cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< -quiet_cmd_pch_mm = CXX($(TOOLSET)) $@ -cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< - -# gyp-mac-tool is written next to the root Makefile by gyp. -# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd -# already. -quiet_cmd_mac_tool = MACTOOL $(4) $< -cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@" - -quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@ -cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4) - -quiet_cmd_infoplist = INFOPLIST $@ -cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@" -""" # noqa: E501 - - -def WriteRootHeaderSuffixRules(writer): - extensions = sorted(COMPILABLE_EXTENSIONS.keys(), key=str.lower) - - writer.write("# Suffix rules, putting all outputs into $(obj).\n") - for ext in extensions: - writer.write("$(obj).$(TOOLSET)/%%.o: $(srcdir)/%%%s FORCE_DO_CMD\n" % ext) - writer.write("\t@$(call do_cmd,%s,1)\n" % COMPILABLE_EXTENSIONS[ext]) - - writer.write("\n# Try building from generated source, too.\n") - for ext in extensions: - writer.write( - "$(obj).$(TOOLSET)/%%.o: $(obj).$(TOOLSET)/%%%s FORCE_DO_CMD\n" % ext - ) - writer.write("\t@$(call do_cmd,%s,1)\n" % COMPILABLE_EXTENSIONS[ext]) - writer.write("\n") - for ext in extensions: - writer.write("$(obj).$(TOOLSET)/%%.o: $(obj)/%%%s FORCE_DO_CMD\n" % ext) - writer.write("\t@$(call do_cmd,%s,1)\n" % COMPILABLE_EXTENSIONS[ext]) - writer.write("\n") - - -SHARED_HEADER_OS390_COMMANDS = """ -PLIFLAGS.target ?= -qlp=64 -qlimits=extname=31 $(PLIFLAGS) -PLIFLAGS.host ?= -qlp=64 -qlimits=extname=31 $(PLIFLAGS) - -quiet_cmd_pli = PLI($(TOOLSET)) $@ -cmd_pli = $(PLI.$(TOOLSET)) $(GYP_PLIFLAGS) $(PLIFLAGS.$(TOOLSET)) -c $< && \ - if [ -f $(notdir $@) ]; then /bin/cp $(notdir $@) $@; else true; fi -""" - -SHARED_HEADER_SUFFIX_RULES_COMMENT1 = """\ -# Suffix rules, putting all outputs into $(obj). -""" - - -SHARED_HEADER_SUFFIX_RULES_COMMENT2 = """\ -# Try building from generated source, too. -""" - - -SHARED_FOOTER = """\ -# "all" is a concatenation of the "all" targets from all the included -# sub-makefiles. This is just here to clarify. -all: - -# Add in dependency-tracking rules. $(all_deps) is the list of every single -# target in our tree. Only consider the ones with .d (dependency) info: -d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) -ifneq ($(d_files),) - include $(d_files) -endif -""" - -header = """\ -# This file is generated by gyp; do not edit. - -""" - -# Maps every compilable file extension to the do_cmd that compiles it. -COMPILABLE_EXTENSIONS = { - ".c": "cc", - ".cc": "cxx", - ".cpp": "cxx", - ".cxx": "cxx", - ".s": "cc", - ".S": "cc", -} - - -def Compilable(filename): - """Return true if the file is compilable (should be in OBJS).""" - for res in (filename.endswith(e) for e in COMPILABLE_EXTENSIONS): - if res: - return True - return False - - -def Linkable(filename): - """Return true if the file is linkable (should be on the link line).""" - return filename.endswith(".o") - - -def Target(filename): - """Translate a compilable filename to its .o target.""" - return os.path.splitext(filename)[0] + ".o" - - -def EscapeShellArgument(s): - """Quotes an argument so that it will be interpreted literally by a POSIX - shell. Taken from - http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python - """ - return "'" + s.replace("'", "'\\''") + "'" - - -def EscapeMakeVariableExpansion(s): - """Make has its own variable expansion syntax using $. We must escape it for - string to be interpreted literally.""" - return s.replace("$", "$$") - - -def EscapeCppDefine(s): - """Escapes a CPP define so that it will reach the compiler unaltered.""" - s = EscapeShellArgument(s) - s = EscapeMakeVariableExpansion(s) - # '#' characters must be escaped even embedded in a string, else Make will - # treat it as the start of a comment. - return s.replace("#", r"\#") - - -def QuoteIfNecessary(string): - """TODO: Should this ideally be replaced with one or more of the above - functions?""" - if '"' in string: - string = '"' + string.replace('"', '\\"') + '"' - return string - - -def StringToMakefileVariable(string): - """Convert a string to a value that is acceptable as a make variable name.""" - return re.sub("[^a-zA-Z0-9_]", "_", string) - - -srcdir_prefix = "" - - -def Sourceify(path): - """Convert a path to its source directory form.""" - if "$(" in path: - return path - if os.path.isabs(path): - return path - return srcdir_prefix + path - - -def QuoteSpaces(s, quote=r"\ "): - return s.replace(" ", quote) - - -def SourceifyAndQuoteSpaces(path): - """Convert a path to its source directory form and quote spaces.""" - return QuoteSpaces(Sourceify(path)) - - -# Map from qualified target to path to output. -target_outputs = {} -# Map from qualified target to any linkable output. A subset -# of target_outputs. E.g. when mybinary depends on liba, we want to -# include liba in the linker line; when otherbinary depends on -# mybinary, we just want to build mybinary first. -target_link_deps = {} - - -class MakefileWriter: - """MakefileWriter packages up the writing of one target-specific foobar.mk. - - Its only real entry point is Write(), and is mostly used for namespacing. - """ - - def __init__(self, generator_flags, flavor): - self.generator_flags = generator_flags - self.flavor = flavor - - self.suffix_rules_srcdir = {} - self.suffix_rules_objdir1 = {} - self.suffix_rules_objdir2 = {} - - # Generate suffix rules for all compilable extensions. - for ext in COMPILABLE_EXTENSIONS.keys(): - # Suffix rules for source folder. - self.suffix_rules_srcdir.update( - { - ext: ( - """\ -$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(srcdir)/%%%s FORCE_DO_CMD -\t@$(call do_cmd,%s,1) -""" - % (ext, COMPILABLE_EXTENSIONS[ext]) - ) - } - ) - - # Suffix rules for generated source files. - self.suffix_rules_objdir1.update( - { - ext: ( - """\ -$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj).$(TOOLSET)/%%%s FORCE_DO_CMD -\t@$(call do_cmd,%s,1) -""" - % (ext, COMPILABLE_EXTENSIONS[ext]) - ) - } - ) - self.suffix_rules_objdir2.update( - { - ext: ( - """\ -$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD -\t@$(call do_cmd,%s,1) -""" - % (ext, COMPILABLE_EXTENSIONS[ext]) - ) - } - ) - - def Write( - self, qualified_target, base_path, output_filename, spec, configs, part_of_all - ): - """The main entry point: writes a .mk file for a single target. - - Arguments: - qualified_target: target we're generating - base_path: path relative to source root we're building in, used to resolve - target-relative paths - output_filename: output .mk file name to write - spec, configs: gyp info - part_of_all: flag indicating this target is part of 'all' - """ - gyp.common.EnsureDirExists(output_filename) - - self.fp = open(output_filename, "w") - - self.fp.write(header) - - self.qualified_target = qualified_target - self.path = base_path - self.target = spec["target_name"] - self.type = spec["type"] - self.toolset = spec["toolset"] - - self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) - if self.flavor == "mac": - self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) - else: - self.xcode_settings = None - - deps, link_deps = self.ComputeDeps(spec) - - # Some of the generation below can add extra output, sources, or - # link dependencies. All of the out params of the functions that - # follow use names like extra_foo. - extra_outputs = [] - extra_sources = [] - extra_link_deps = [] - extra_mac_bundle_resources = [] - mac_bundle_deps = [] - - if self.is_mac_bundle: - self.output = self.ComputeMacBundleOutput(spec) - self.output_binary = self.ComputeMacBundleBinaryOutput(spec) - else: - self.output = self.output_binary = self.ComputeOutput(spec) - - self.is_standalone_static_library = bool( - spec.get("standalone_static_library", 0) - ) - self._INSTALLABLE_TARGETS = ("executable", "loadable_module", "shared_library") - if self.is_standalone_static_library or self.type in self._INSTALLABLE_TARGETS: - self.alias = os.path.basename(self.output) - install_path = self._InstallableTargetInstallPath() - else: - self.alias = self.output - install_path = self.output - - self.WriteLn("TOOLSET := " + self.toolset) - self.WriteLn("TARGET := " + self.target) - - # Actions must come first, since they can generate more OBJs for use below. - if "actions" in spec: - self.WriteActions( - spec["actions"], - extra_sources, - extra_outputs, - extra_mac_bundle_resources, - part_of_all, - ) - - # Rules must be early like actions. - if "rules" in spec: - self.WriteRules( - spec["rules"], - extra_sources, - extra_outputs, - extra_mac_bundle_resources, - part_of_all, - ) - - if "copies" in spec: - self.WriteCopies(spec["copies"], extra_outputs, part_of_all) - - # Bundle resources. - if self.is_mac_bundle: - all_mac_bundle_resources = ( - spec.get("mac_bundle_resources", []) + extra_mac_bundle_resources - ) - self.WriteMacBundleResources(all_mac_bundle_resources, mac_bundle_deps) - self.WriteMacInfoPlist(mac_bundle_deps) - - # Sources. - all_sources = spec.get("sources", []) + extra_sources - if all_sources: - self.WriteSources( - configs, - deps, - all_sources, - extra_outputs, - extra_link_deps, - part_of_all, - gyp.xcode_emulation.MacPrefixHeader( - self.xcode_settings, - lambda p: Sourceify(self.Absolutify(p)), - self.Pchify, - ), - ) - sources = [x for x in all_sources if Compilable(x)] - if sources: - self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT1) - extensions = {os.path.splitext(s)[1] for s in sources} - for ext in extensions: - if ext in self.suffix_rules_srcdir: - self.WriteLn(self.suffix_rules_srcdir[ext]) - self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT2) - for ext in extensions: - if ext in self.suffix_rules_objdir1: - self.WriteLn(self.suffix_rules_objdir1[ext]) - for ext in extensions: - if ext in self.suffix_rules_objdir2: - self.WriteLn(self.suffix_rules_objdir2[ext]) - self.WriteLn("# End of this set of suffix rules") - - # Add dependency from bundle to bundle binary. - if self.is_mac_bundle: - mac_bundle_deps.append(self.output_binary) - - self.WriteTarget( - spec, - configs, - deps, - extra_link_deps + link_deps, - mac_bundle_deps, - extra_outputs, - part_of_all, - ) - - # Update global list of target outputs, used in dependency tracking. - target_outputs[qualified_target] = install_path - - # Update global list of link dependencies. - if self.type in ("static_library", "shared_library"): - target_link_deps[qualified_target] = self.output_binary - - # Currently any versions have the same effect, but in future the behavior - # could be different. - if self.generator_flags.get("android_ndk_version", None): - self.WriteAndroidNdkModuleRule(self.target, all_sources, link_deps) - - self.fp.close() - - def WriteSubMake(self, output_filename, makefile_path, targets, build_dir): - """Write a "sub-project" Makefile. - - This is a small, wrapper Makefile that calls the top-level Makefile to build - the targets from a single gyp file (i.e. a sub-project). - - Arguments: - output_filename: sub-project Makefile name to write - makefile_path: path to the top-level Makefile - targets: list of "all" targets for this sub-project - build_dir: build output directory, relative to the sub-project - """ - gyp.common.EnsureDirExists(output_filename) - self.fp = open(output_filename, "w") - self.fp.write(header) - # For consistency with other builders, put sub-project build output in the - # sub-project dir (see test/subdirectory/gyptest-subdir-all.py). - self.WriteLn( - "export builddir_name ?= %s" - % os.path.join(os.path.dirname(output_filename), build_dir) - ) - self.WriteLn(".PHONY: all") - self.WriteLn("all:") - if makefile_path: - makefile_path = " -C " + makefile_path - self.WriteLn("\t$(MAKE){} {}".format(makefile_path, " ".join(targets))) - self.fp.close() - - def WriteActions( - self, - actions, - extra_sources, - extra_outputs, - extra_mac_bundle_resources, - part_of_all, - ): - """Write Makefile code for any 'actions' from the gyp input. - - extra_sources: a list that will be filled in with newly generated source - files, if any - extra_outputs: a list that will be filled in with any outputs of these - actions (used to make other pieces dependent on these - actions) - part_of_all: flag indicating this target is part of 'all' - """ - env = self.GetSortedXcodeEnv() - for action in actions: - name = StringToMakefileVariable( - "{}_{}".format(self.qualified_target, action["action_name"]) - ) - self.WriteLn('### Rules for action "%s":' % action["action_name"]) - inputs = action["inputs"] - outputs = action["outputs"] - - # Build up a list of outputs. - # Collect the output dirs we'll need. - dirs = set() - for out in outputs: - dir = os.path.split(out)[0] - if dir: - dirs.add(dir) - if int(action.get("process_outputs_as_sources", False)): - extra_sources += outputs - if int(action.get("process_outputs_as_mac_bundle_resources", False)): - extra_mac_bundle_resources += outputs - - # Write the actual command. - action_commands = action["action"] - if self.flavor == "mac": - action_commands = [ - gyp.xcode_emulation.ExpandEnvVars(command, env) - for command in action_commands - ] - command = gyp.common.EncodePOSIXShellList(action_commands) - if "message" in action: - self.WriteLn( - "quiet_cmd_{} = ACTION {} $@".format(name, action["message"]) - ) - else: - self.WriteLn(f"quiet_cmd_{name} = ACTION {name} $@") - if len(dirs) > 0: - command = "mkdir -p %s" % " ".join(dirs) + "; " + command - - cd_action = "cd %s; " % Sourceify(self.path or ".") - - # command and cd_action get written to a toplevel variable called - # cmd_foo. Toplevel variables can't handle things that change per - # makefile like $(TARGET), so hardcode the target. - command = command.replace("$(TARGET)", self.target) - cd_action = cd_action.replace("$(TARGET)", self.target) - - # Set LD_LIBRARY_PATH in case the action runs an executable from this - # build which links to shared libs from this build. - # actions run on the host, so they should in theory only use host - # libraries, but until everything is made cross-compile safe, also use - # target libraries. - # TODO(piman): when everything is cross-compile safe, remove lib.target - if self.flavor == "zos" or self.flavor == "aix": - self.WriteLn( - "cmd_%s = LIBPATH=$(builddir)/lib.host:" - "$(builddir)/lib.target:$$LIBPATH; " - "export LIBPATH; " - "%s%s" % (name, cd_action, command) - ) - else: - self.WriteLn( - "cmd_%s = LD_LIBRARY_PATH=$(builddir)/lib.host:" - "$(builddir)/lib.target:$$LD_LIBRARY_PATH; " - "export LD_LIBRARY_PATH; " - "%s%s" % (name, cd_action, command) - ) - self.WriteLn() - outputs = [self.Absolutify(o) for o in outputs] - # The makefile rules are all relative to the top dir, but the gyp actions - # are defined relative to their containing dir. This replaces the obj - # variable for the action rule with an absolute version so that the output - # goes in the right place. - # Only write the 'obj' and 'builddir' rules for the "primary" output (:1); - # it's superfluous for the "extra outputs", and this avoids accidentally - # writing duplicate dummy rules for those outputs. - # Same for environment. - self.WriteLn("%s: obj := $(abs_obj)" % QuoteSpaces(outputs[0])) - self.WriteLn("%s: builddir := $(abs_builddir)" % QuoteSpaces(outputs[0])) - self.WriteSortedXcodeEnv(outputs[0], self.GetSortedXcodeEnv()) - - for input in inputs: - assert " " not in input, ( - "Spaces in action input filenames not supported (%s)" % input - ) - for output in outputs: - assert " " not in output, ( - "Spaces in action output filenames not supported (%s)" % output - ) - - # See the comment in WriteCopies about expanding env vars. - outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs] - inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs] - - self.WriteDoCmd( - outputs, - [Sourceify(self.Absolutify(i)) for i in inputs], - part_of_all=part_of_all, - command=name, - ) - - # Stuff the outputs in a variable so we can refer to them later. - outputs_variable = "action_%s_outputs" % name - self.WriteLn("{} := {}".format(outputs_variable, " ".join(outputs))) - extra_outputs.append("$(%s)" % outputs_variable) - self.WriteLn() - - self.WriteLn() - - def WriteRules( - self, - rules, - extra_sources, - extra_outputs, - extra_mac_bundle_resources, - part_of_all, - ): - """Write Makefile code for any 'rules' from the gyp input. - - extra_sources: a list that will be filled in with newly generated source - files, if any - extra_outputs: a list that will be filled in with any outputs of these - rules (used to make other pieces dependent on these rules) - part_of_all: flag indicating this target is part of 'all' - """ - env = self.GetSortedXcodeEnv() - for rule in rules: - name = StringToMakefileVariable( - "{}_{}".format(self.qualified_target, rule["rule_name"]) - ) - count = 0 - self.WriteLn("### Generated for rule %s:" % name) - - all_outputs = [] - - for rule_source in rule.get("rule_sources", []): - dirs = set() - (rule_source_dirname, rule_source_basename) = os.path.split(rule_source) - (rule_source_root, rule_source_ext) = os.path.splitext( - rule_source_basename - ) - - outputs = [ - self.ExpandInputRoot(out, rule_source_root, rule_source_dirname) - for out in rule["outputs"] - ] - - for out in outputs: - dir = os.path.dirname(out) - if dir: - dirs.add(dir) - if int(rule.get("process_outputs_as_sources", False)): - extra_sources += outputs - if int(rule.get("process_outputs_as_mac_bundle_resources", False)): - extra_mac_bundle_resources += outputs - inputs = [ - Sourceify(self.Absolutify(i)) - for i in [rule_source] + rule.get("inputs", []) - ] - actions = ["$(call do_cmd,%s_%d)" % (name, count)] - - if name == "resources_grit": - # HACK: This is ugly. Grit intentionally doesn't touch the - # timestamp of its output file when the file doesn't change, - # which is fine in hash-based dependency systems like scons - # and forge, but not kosher in the make world. After some - # discussion, hacking around it here seems like the least - # amount of pain. - actions += ["@touch --no-create $@"] - - # See the comment in WriteCopies about expanding env vars. - outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs] - inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs] - - outputs = [self.Absolutify(o) for o in outputs] - all_outputs += outputs - # Only write the 'obj' and 'builddir' rules for the "primary" output - # (:1); it's superfluous for the "extra outputs", and this avoids - # accidentally writing duplicate dummy rules for those outputs. - self.WriteLn("%s: obj := $(abs_obj)" % outputs[0]) - self.WriteLn("%s: builddir := $(abs_builddir)" % outputs[0]) - self.WriteMakeRule( - outputs, inputs, actions, command="%s_%d" % (name, count) - ) - # Spaces in rule filenames are not supported, but rule variables have - # spaces in them (e.g. RULE_INPUT_PATH expands to '$(abspath $<)'). - # The spaces within the variables are valid, so remove the variables - # before checking. - variables_with_spaces = re.compile(r"\$\([^ ]* \$<\)") - for output in outputs: - output = re.sub(variables_with_spaces, "", output) - assert " " not in output, ( - "Spaces in rule filenames not yet supported (%s)" % output - ) - self.WriteLn("all_deps += %s" % " ".join(outputs)) - - action = [ - self.ExpandInputRoot(ac, rule_source_root, rule_source_dirname) - for ac in rule["action"] - ] - mkdirs = "" - if len(dirs) > 0: - mkdirs = "mkdir -p %s; " % " ".join(dirs) - cd_action = "cd %s; " % Sourceify(self.path or ".") - - # action, cd_action, and mkdirs get written to a toplevel variable - # called cmd_foo. Toplevel variables can't handle things that change - # per makefile like $(TARGET), so hardcode the target. - if self.flavor == "mac": - action = [ - gyp.xcode_emulation.ExpandEnvVars(command, env) - for command in action - ] - action = gyp.common.EncodePOSIXShellList(action) - action = action.replace("$(TARGET)", self.target) - cd_action = cd_action.replace("$(TARGET)", self.target) - mkdirs = mkdirs.replace("$(TARGET)", self.target) - - # Set LD_LIBRARY_PATH in case the rule runs an executable from this - # build which links to shared libs from this build. - # rules run on the host, so they should in theory only use host - # libraries, but until everything is made cross-compile safe, also use - # target libraries. - # TODO(piman): when everything is cross-compile safe, remove lib.target - self.WriteLn( - "cmd_%(name)s_%(count)d = LD_LIBRARY_PATH=" - "$(builddir)/lib.host:$(builddir)/lib.target:$$LD_LIBRARY_PATH; " - "export LD_LIBRARY_PATH; " - "%(cd_action)s%(mkdirs)s%(action)s" - % { - "action": action, - "cd_action": cd_action, - "count": count, - "mkdirs": mkdirs, - "name": name, - } - ) - self.WriteLn( - "quiet_cmd_%(name)s_%(count)d = RULE %(name)s_%(count)d $@" - % {"count": count, "name": name} - ) - self.WriteLn() - count += 1 - - outputs_variable = "rule_%s_outputs" % name - self.WriteList(all_outputs, outputs_variable) - extra_outputs.append("$(%s)" % outputs_variable) - - self.WriteLn("### Finished generating for rule: %s" % name) - self.WriteLn() - self.WriteLn("### Finished generating for all rules") - self.WriteLn("") - - def WriteCopies(self, copies, extra_outputs, part_of_all): - """Write Makefile code for any 'copies' from the gyp input. - - extra_outputs: a list that will be filled in with any outputs of this action - (used to make other pieces dependent on this action) - part_of_all: flag indicating this target is part of 'all' - """ - self.WriteLn("### Generated for copy rule.") - - variable = StringToMakefileVariable(self.qualified_target + "_copies") - outputs = [] - for copy in copies: - for path in copy["files"]: - # Absolutify() may call normpath, and will strip trailing slashes. - path = Sourceify(self.Absolutify(path)) - filename = os.path.split(path)[1] - output = Sourceify( - self.Absolutify(os.path.join(copy["destination"], filename)) - ) - - # If the output path has variables in it, which happens in practice for - # 'copies', writing the environment as target-local doesn't work, - # because the variables are already needed for the target name. - # Copying the environment variables into global make variables doesn't - # work either, because then the .d files will potentially contain spaces - # after variable expansion, and .d file handling cannot handle spaces. - # As a workaround, manually expand variables at gyp time. Since 'copies' - # can't run scripts, there's no need to write the env then. - # WriteDoCmd() will escape spaces for .d files. - env = self.GetSortedXcodeEnv() - output = gyp.xcode_emulation.ExpandEnvVars(output, env) - path = gyp.xcode_emulation.ExpandEnvVars(path, env) - self.WriteDoCmd([output], [path], "copy", part_of_all) - outputs.append(output) - self.WriteLn( - "{} = {}".format(variable, " ".join(QuoteSpaces(o) for o in outputs)) - ) - extra_outputs.append("$(%s)" % variable) - self.WriteLn() - - def WriteMacBundleResources(self, resources, bundle_deps): - """Writes Makefile code for 'mac_bundle_resources'.""" - self.WriteLn("### Generated for mac_bundle_resources") - - for output, res in gyp.xcode_emulation.GetMacBundleResources( - generator_default_variables["PRODUCT_DIR"], - self.xcode_settings, - [Sourceify(self.Absolutify(r)) for r in resources], - ): - _, ext = os.path.splitext(output) - if ext != ".xcassets": - # Make does not supports '.xcassets' emulation. - self.WriteDoCmd( - [output], [res], "mac_tool,,,copy-bundle-resource", part_of_all=True - ) - bundle_deps.append(output) - - def WriteMacInfoPlist(self, bundle_deps): - """Write Makefile code for bundle Info.plist files.""" - info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist( - generator_default_variables["PRODUCT_DIR"], - self.xcode_settings, - lambda p: Sourceify(self.Absolutify(p)), - ) - if not info_plist: - return - if defines: - # Create an intermediate file to store preprocessed results. - intermediate_plist = "$(obj).$(TOOLSET)/$(TARGET)/" + os.path.basename( - info_plist - ) - self.WriteList( - defines, - intermediate_plist + ": INFOPLIST_DEFINES", - "-D", - quoter=EscapeCppDefine, - ) - self.WriteMakeRule( - [intermediate_plist], - [info_plist], - [ - "$(call do_cmd,infoplist)", - # "Convert" the plist so that any weird whitespace changes from the - # preprocessor do not affect the XML parser in mac_tool. - "@plutil -convert xml1 $@ $@", - ], - ) - info_plist = intermediate_plist - # plists can contain envvars and substitute them into the file. - self.WriteSortedXcodeEnv( - out, self.GetSortedXcodeEnv(additional_settings=extra_env) - ) - self.WriteDoCmd( - [out], [info_plist], "mac_tool,,,copy-info-plist", part_of_all=True - ) - bundle_deps.append(out) - - def WriteSources( - self, - configs, - deps, - sources, - extra_outputs, - extra_link_deps, - part_of_all, - precompiled_header, - ): - """Write Makefile code for any 'sources' from the gyp input. - These are source files necessary to build the current target. - - configs, deps, sources: input from gyp. - extra_outputs: a list of extra outputs this action should be dependent on; - used to serialize action/rules before compilation - extra_link_deps: a list that will be filled in with any outputs of - compilation (to be used in link lines) - part_of_all: flag indicating this target is part of 'all' - """ - - # Write configuration-specific variables for CFLAGS, etc. - for configname in sorted(configs.keys()): - config = configs[configname] - self.WriteList( - config.get("defines"), - "DEFS_%s" % configname, - prefix="-D", - quoter=EscapeCppDefine, - ) - - if self.flavor == "mac": - cflags = self.xcode_settings.GetCflags( - configname, arch=config.get("xcode_configuration_platform") - ) - cflags_c = self.xcode_settings.GetCflagsC(configname) - cflags_cc = self.xcode_settings.GetCflagsCC(configname) - cflags_objc = self.xcode_settings.GetCflagsObjC(configname) - cflags_objcc = self.xcode_settings.GetCflagsObjCC(configname) - else: - cflags = config.get("cflags") - cflags_c = config.get("cflags_c") - cflags_cc = config.get("cflags_cc") - - self.WriteLn("# Flags passed to all source files.") - self.WriteList(cflags, "CFLAGS_%s" % configname) - self.WriteLn("# Flags passed to only C files.") - self.WriteList(cflags_c, "CFLAGS_C_%s" % configname) - self.WriteLn("# Flags passed to only C++ files.") - self.WriteList(cflags_cc, "CFLAGS_CC_%s" % configname) - if self.flavor == "mac": - self.WriteLn("# Flags passed to only ObjC files.") - self.WriteList(cflags_objc, "CFLAGS_OBJC_%s" % configname) - self.WriteLn("# Flags passed to only ObjC++ files.") - self.WriteList(cflags_objcc, "CFLAGS_OBJCC_%s" % configname) - includes = config.get("include_dirs") - if includes: - includes = [Sourceify(self.Absolutify(i)) for i in includes] - self.WriteList(includes, "INCS_%s" % configname, prefix="-I") - - compilable = list(filter(Compilable, sources)) - objs = [self.Objectify(self.Absolutify(Target(c))) for c in compilable] - self.WriteList(objs, "OBJS") - - for obj in objs: - assert " " not in obj, "Spaces in object filenames not supported (%s)" % obj - self.WriteLn( - "# Add to the list of files we specially track " "dependencies for." - ) - self.WriteLn("all_deps += $(OBJS)") - self.WriteLn() - - # Make sure our dependencies are built first. - if deps: - self.WriteMakeRule( - ["$(OBJS)"], - deps, - comment="Make sure our dependencies are built " "before any of us.", - order_only=True, - ) - - # Make sure the actions and rules run first. - # If they generate any extra headers etc., the per-.o file dep tracking - # will catch the proper rebuilds, so order only is still ok here. - if extra_outputs: - self.WriteMakeRule( - ["$(OBJS)"], - extra_outputs, - comment="Make sure our actions/rules run " "before any of us.", - order_only=True, - ) - - pchdeps = precompiled_header.GetObjDependencies(compilable, objs) - if pchdeps: - self.WriteLn("# Dependencies from obj files to their precompiled headers") - for source, obj, gch in pchdeps: - self.WriteLn(f"{obj}: {gch}") - self.WriteLn("# End precompiled header dependencies") - - if objs: - extra_link_deps.append("$(OBJS)") - self.WriteLn( - """\ -# CFLAGS et al overrides must be target-local. -# See "Target-specific Variable Values" in the GNU Make manual.""" - ) - self.WriteLn("$(OBJS): TOOLSET := $(TOOLSET)") - self.WriteLn( - "$(OBJS): GYP_CFLAGS := " - "$(DEFS_$(BUILDTYPE)) " - "$(INCS_$(BUILDTYPE)) " - "%s " % precompiled_header.GetInclude("c") + "$(CFLAGS_$(BUILDTYPE)) " - "$(CFLAGS_C_$(BUILDTYPE))" - ) - self.WriteLn( - "$(OBJS): GYP_CXXFLAGS := " - "$(DEFS_$(BUILDTYPE)) " - "$(INCS_$(BUILDTYPE)) " - "%s " % precompiled_header.GetInclude("cc") + "$(CFLAGS_$(BUILDTYPE)) " - "$(CFLAGS_CC_$(BUILDTYPE))" - ) - if self.flavor == "mac": - self.WriteLn( - "$(OBJS): GYP_OBJCFLAGS := " - "$(DEFS_$(BUILDTYPE)) " - "$(INCS_$(BUILDTYPE)) " - "%s " % precompiled_header.GetInclude("m") - + "$(CFLAGS_$(BUILDTYPE)) " - "$(CFLAGS_C_$(BUILDTYPE)) " - "$(CFLAGS_OBJC_$(BUILDTYPE))" - ) - self.WriteLn( - "$(OBJS): GYP_OBJCXXFLAGS := " - "$(DEFS_$(BUILDTYPE)) " - "$(INCS_$(BUILDTYPE)) " - "%s " % precompiled_header.GetInclude("mm") - + "$(CFLAGS_$(BUILDTYPE)) " - "$(CFLAGS_CC_$(BUILDTYPE)) " - "$(CFLAGS_OBJCC_$(BUILDTYPE))" - ) - - self.WritePchTargets(precompiled_header.GetPchBuildCommands()) - - # If there are any object files in our input file list, link them into our - # output. - extra_link_deps += [source for source in sources if Linkable(source)] - - self.WriteLn() - - def WritePchTargets(self, pch_commands): - """Writes make rules to compile prefix headers.""" - if not pch_commands: - return - - for gch, lang_flag, lang, input in pch_commands: - extra_flags = { - "c": "$(CFLAGS_C_$(BUILDTYPE))", - "cc": "$(CFLAGS_CC_$(BUILDTYPE))", - "m": "$(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))", - "mm": "$(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE))", - }[lang] - var_name = { - "c": "GYP_PCH_CFLAGS", - "cc": "GYP_PCH_CXXFLAGS", - "m": "GYP_PCH_OBJCFLAGS", - "mm": "GYP_PCH_OBJCXXFLAGS", - }[lang] - self.WriteLn( - f"{gch}: {var_name} := {lang_flag} " + "$(DEFS_$(BUILDTYPE)) " - "$(INCS_$(BUILDTYPE)) " - "$(CFLAGS_$(BUILDTYPE)) " + extra_flags - ) - - self.WriteLn(f"{gch}: {input} FORCE_DO_CMD") - self.WriteLn("\t@$(call do_cmd,pch_%s,1)" % lang) - self.WriteLn("") - assert " " not in gch, "Spaces in gch filenames not supported (%s)" % gch - self.WriteLn("all_deps += %s" % gch) - self.WriteLn("") - - def ComputeOutputBasename(self, spec): - """Return the 'output basename' of a gyp spec. - - E.g., the loadable module 'foobar' in directory 'baz' will produce - 'libfoobar.so' - """ - assert not self.is_mac_bundle - - if self.flavor == "mac" and self.type in ( - "static_library", - "executable", - "shared_library", - "loadable_module", - ): - return self.xcode_settings.GetExecutablePath() - - target = spec["target_name"] - target_prefix = "" - target_ext = "" - if self.type == "static_library": - if target[:3] == "lib": - target = target[3:] - target_prefix = "lib" - target_ext = ".a" - elif self.type in ("loadable_module", "shared_library"): - if target[:3] == "lib": - target = target[3:] - target_prefix = "lib" - if self.flavor == "aix": - target_ext = ".a" - elif self.flavor == "zos": - target_ext = ".x" - else: - target_ext = ".so" - elif self.type == "none": - target = "%s.stamp" % target - elif self.type != "executable": - print( - "ERROR: What output file should be generated?", - "type", - self.type, - "target", - target, - ) - - target_prefix = spec.get("product_prefix", target_prefix) - target = spec.get("product_name", target) - product_ext = spec.get("product_extension") - if product_ext: - target_ext = "." + product_ext - - return target_prefix + target + target_ext - - def _InstallImmediately(self): - return ( - self.toolset == "target" - and self.flavor == "mac" - and self.type - in ("static_library", "executable", "shared_library", "loadable_module") - ) - - def ComputeOutput(self, spec): - """Return the 'output' (full output path) of a gyp spec. - - E.g., the loadable module 'foobar' in directory 'baz' will produce - '$(obj)/baz/libfoobar.so' - """ - assert not self.is_mac_bundle - - path = os.path.join("$(obj)." + self.toolset, self.path) - if self.type == "executable" or self._InstallImmediately(): - path = "$(builddir)" - path = spec.get("product_dir", path) - return os.path.join(path, self.ComputeOutputBasename(spec)) - - def ComputeMacBundleOutput(self, spec): - """Return the 'output' (full output path) to a bundle output directory.""" - assert self.is_mac_bundle - path = generator_default_variables["PRODUCT_DIR"] - return os.path.join(path, self.xcode_settings.GetWrapperName()) - - def ComputeMacBundleBinaryOutput(self, spec): - """Return the 'output' (full output path) to the binary in a bundle.""" - path = generator_default_variables["PRODUCT_DIR"] - return os.path.join(path, self.xcode_settings.GetExecutablePath()) - - def ComputeDeps(self, spec): - """Compute the dependencies of a gyp spec. - - Returns a tuple (deps, link_deps), where each is a list of - filenames that will need to be put in front of make for either - building (deps) or linking (link_deps). - """ - deps = [] - link_deps = [] - if "dependencies" in spec: - deps.extend( - [ - target_outputs[dep] - for dep in spec["dependencies"] - if target_outputs[dep] - ] - ) - for dep in spec["dependencies"]: - if dep in target_link_deps: - link_deps.append(target_link_deps[dep]) - deps.extend(link_deps) - # TODO: It seems we need to transitively link in libraries (e.g. -lfoo)? - # This hack makes it work: - # link_deps.extend(spec.get('libraries', [])) - return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps)) - - def GetSharedObjectFromSidedeck(self, sidedeck): - """Return the shared object files based on sidedeck""" - return re.sub(r"\.x$", ".so", sidedeck) - - def GetUnversionedSidedeckFromSidedeck(self, sidedeck): - """Return the shared object files based on sidedeck""" - return re.sub(r"\.\d+\.x$", ".x", sidedeck) - - def WriteDependencyOnExtraOutputs(self, target, extra_outputs): - self.WriteMakeRule( - [self.output_binary], - extra_outputs, - comment="Build our special outputs first.", - order_only=True, - ) - - def WriteTarget( - self, spec, configs, deps, link_deps, bundle_deps, extra_outputs, part_of_all - ): - """Write Makefile code to produce the final target of the gyp spec. - - spec, configs: input from gyp. - deps, link_deps: dependency lists; see ComputeDeps() - extra_outputs: any extra outputs that our target should depend on - part_of_all: flag indicating this target is part of 'all' - """ - - self.WriteLn("### Rules for final target.") - - if extra_outputs: - self.WriteDependencyOnExtraOutputs(self.output_binary, extra_outputs) - self.WriteMakeRule( - extra_outputs, - deps, - comment=("Preserve order dependency of " "special output on deps."), - order_only=True, - ) - - target_postbuilds = {} - if self.type != "none": - for configname in sorted(configs.keys()): - config = configs[configname] - if self.flavor == "mac": - ldflags = self.xcode_settings.GetLdflags( - configname, - generator_default_variables["PRODUCT_DIR"], - lambda p: Sourceify(self.Absolutify(p)), - arch=config.get("xcode_configuration_platform"), - ) - - # TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on. - gyp_to_build = gyp.common.InvertRelativePath(self.path) - target_postbuild = self.xcode_settings.AddImplicitPostbuilds( - configname, - QuoteSpaces( - os.path.normpath(os.path.join(gyp_to_build, self.output)) - ), - QuoteSpaces( - os.path.normpath( - os.path.join(gyp_to_build, self.output_binary) - ) - ), - ) - if target_postbuild: - target_postbuilds[configname] = target_postbuild - else: - ldflags = config.get("ldflags", []) - # Compute an rpath for this output if needed. - if any(dep.endswith(".so") or ".so." in dep for dep in deps): - # We want to get the literal string "$ORIGIN" - # into the link command, so we need lots of escaping. - ldflags.append(r"-Wl,-rpath=\$$ORIGIN/") - ldflags.append(r"-Wl,-rpath-link=\$(builddir)/") - library_dirs = config.get("library_dirs", []) - ldflags += [("-L%s" % library_dir) for library_dir in library_dirs] - self.WriteList(ldflags, "LDFLAGS_%s" % configname) - if self.flavor == "mac": - self.WriteList( - self.xcode_settings.GetLibtoolflags(configname), - "LIBTOOLFLAGS_%s" % configname, - ) - libraries = spec.get("libraries") - if libraries: - # Remove duplicate entries - libraries = gyp.common.uniquer(libraries) - if self.flavor == "mac": - libraries = self.xcode_settings.AdjustLibraries(libraries) - self.WriteList(libraries, "LIBS") - self.WriteLn( - "%s: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))" - % QuoteSpaces(self.output_binary) - ) - self.WriteLn("%s: LIBS := $(LIBS)" % QuoteSpaces(self.output_binary)) - - if self.flavor == "mac": - self.WriteLn( - "%s: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))" - % QuoteSpaces(self.output_binary) - ) - - # Postbuild actions. Like actions, but implicitly depend on the target's - # output. - postbuilds = [] - if self.flavor == "mac": - if target_postbuilds: - postbuilds.append("$(TARGET_POSTBUILDS_$(BUILDTYPE))") - postbuilds.extend(gyp.xcode_emulation.GetSpecPostbuildCommands(spec)) - - if postbuilds: - # Envvars may be referenced by TARGET_POSTBUILDS_$(BUILDTYPE), - # so we must output its definition first, since we declare variables - # using ":=". - self.WriteSortedXcodeEnv(self.output, self.GetSortedXcodePostbuildEnv()) - - for configname in target_postbuilds: - self.WriteLn( - "%s: TARGET_POSTBUILDS_%s := %s" - % ( - QuoteSpaces(self.output), - configname, - gyp.common.EncodePOSIXShellList(target_postbuilds[configname]), - ) - ) - - # Postbuilds expect to be run in the gyp file's directory, so insert an - # implicit postbuild to cd to there. - postbuilds.insert(0, gyp.common.EncodePOSIXShellList(["cd", self.path])) - for i, postbuild in enumerate(postbuilds): - if not postbuild.startswith("$"): - postbuilds[i] = EscapeShellArgument(postbuild) - self.WriteLn("%s: builddir := $(abs_builddir)" % QuoteSpaces(self.output)) - self.WriteLn( - "%s: POSTBUILDS := %s" - % (QuoteSpaces(self.output), " ".join(postbuilds)) - ) - - # A bundle directory depends on its dependencies such as bundle resources - # and bundle binary. When all dependencies have been built, the bundle - # needs to be packaged. - if self.is_mac_bundle: - # If the framework doesn't contain a binary, then nothing depends - # on the actions -- make the framework depend on them directly too. - self.WriteDependencyOnExtraOutputs(self.output, extra_outputs) - - # Bundle dependencies. Note that the code below adds actions to this - # target, so if you move these two lines, move the lines below as well. - self.WriteList([QuoteSpaces(dep) for dep in bundle_deps], "BUNDLE_DEPS") - self.WriteLn("%s: $(BUNDLE_DEPS)" % QuoteSpaces(self.output)) - - # After the framework is built, package it. Needs to happen before - # postbuilds, since postbuilds depend on this. - if self.type in ("shared_library", "loadable_module"): - self.WriteLn( - "\t@$(call do_cmd,mac_package_framework,,,%s)" - % self.xcode_settings.GetFrameworkVersion() - ) - - # Bundle postbuilds can depend on the whole bundle, so run them after - # the bundle is packaged, not already after the bundle binary is done. - if postbuilds: - self.WriteLn("\t@$(call do_postbuilds)") - postbuilds = [] # Don't write postbuilds for target's output. - - # Needed by test/mac/gyptest-rebuild.py. - self.WriteLn("\t@true # No-op, used by tests") - - # Since this target depends on binary and resources which are in - # nested subfolders, the framework directory will be older than - # its dependencies usually. To prevent this rule from executing - # on every build (expensive, especially with postbuilds), expliclity - # update the time on the framework directory. - self.WriteLn("\t@touch -c %s" % QuoteSpaces(self.output)) - - if postbuilds: - assert not self.is_mac_bundle, ( - "Postbuilds for bundles should be done " - "on the bundle, not the binary (target '%s')" % self.target - ) - assert "product_dir" not in spec, ( - "Postbuilds do not work with " "custom product_dir" - ) - - if self.type == "executable": - self.WriteLn( - "%s: LD_INPUTS := %s" - % ( - QuoteSpaces(self.output_binary), - " ".join(QuoteSpaces(dep) for dep in link_deps), - ) - ) - if self.toolset == "host" and self.flavor == "android": - self.WriteDoCmd( - [self.output_binary], - link_deps, - "link_host", - part_of_all, - postbuilds=postbuilds, - ) - else: - self.WriteDoCmd( - [self.output_binary], - link_deps, - "link", - part_of_all, - postbuilds=postbuilds, - ) - - elif self.type == "static_library": - for link_dep in link_deps: - assert " " not in link_dep, ( - "Spaces in alink input filenames not supported (%s)" % link_dep - ) - if ( - self.flavor not in ("mac", "openbsd", "netbsd", "win") - and not self.is_standalone_static_library - ): - if self.flavor in ("linux", "android"): - self.WriteMakeRule( - [self.output_binary], - link_deps, - actions=["$(call create_thin_archive,$@,$^)"], - ) - else: - self.WriteDoCmd( - [self.output_binary], - link_deps, - "alink_thin", - part_of_all, - postbuilds=postbuilds, - ) - else: - if self.flavor in ("linux", "android"): - self.WriteMakeRule( - [self.output_binary], - link_deps, - actions=["$(call create_archive,$@,$^)"], - ) - else: - self.WriteDoCmd( - [self.output_binary], - link_deps, - "alink", - part_of_all, - postbuilds=postbuilds, - ) - elif self.type == "shared_library": - self.WriteLn( - "%s: LD_INPUTS := %s" - % ( - QuoteSpaces(self.output_binary), - " ".join(QuoteSpaces(dep) for dep in link_deps), - ) - ) - self.WriteDoCmd( - [self.output_binary], - link_deps, - "solink", - part_of_all, - postbuilds=postbuilds, - ) - # z/OS has a .so target as well as a sidedeck .x target - if self.flavor == "zos": - self.WriteLn( - "%s: %s" - % ( - QuoteSpaces( - self.GetSharedObjectFromSidedeck(self.output_binary) - ), - QuoteSpaces(self.output_binary), - ) - ) - elif self.type == "loadable_module": - for link_dep in link_deps: - assert " " not in link_dep, ( - "Spaces in module input filenames not supported (%s)" % link_dep - ) - if self.toolset == "host" and self.flavor == "android": - self.WriteDoCmd( - [self.output_binary], - link_deps, - "solink_module_host", - part_of_all, - postbuilds=postbuilds, - ) - else: - self.WriteDoCmd( - [self.output_binary], - link_deps, - "solink_module", - part_of_all, - postbuilds=postbuilds, - ) - elif self.type == "none": - # Write a stamp line. - self.WriteDoCmd( - [self.output_binary], deps, "touch", part_of_all, postbuilds=postbuilds - ) - else: - print("WARNING: no output for", self.type, self.target) - - # Add an alias for each target (if there are any outputs). - # Installable target aliases are created below. - if (self.output and self.output != self.target) and ( - self.type not in self._INSTALLABLE_TARGETS - ): - self.WriteMakeRule( - [self.target], [self.output], comment="Add target alias", phony=True - ) - if part_of_all: - self.WriteMakeRule( - ["all"], - [self.target], - comment='Add target alias to "all" target.', - phony=True, - ) - - # Add special-case rules for our installable targets. - # 1) They need to install to the build dir or "product" dir. - # 2) They get shortcuts for building (e.g. "make chrome"). - # 3) They are part of "make all". - if self.type in self._INSTALLABLE_TARGETS or self.is_standalone_static_library: - if self.type == "shared_library": - file_desc = "shared library" - elif self.type == "static_library": - file_desc = "static library" - else: - file_desc = "executable" - install_path = self._InstallableTargetInstallPath() - installable_deps = [] - if self.flavor != "zos": - installable_deps.append(self.output) - if ( - self.flavor == "mac" - and "product_dir" not in spec - and self.toolset == "target" - ): - # On macOS, products are created in install_path immediately. - assert install_path == self.output, f"{install_path} != {self.output}" - - # Point the target alias to the final binary output. - self.WriteMakeRule( - [self.target], [install_path], comment="Add target alias", phony=True - ) - if install_path != self.output: - assert not self.is_mac_bundle # See comment a few lines above. - self.WriteDoCmd( - [install_path], - [self.output], - "copy", - comment="Copy this to the %s output path." % file_desc, - part_of_all=part_of_all, - ) - if self.flavor != "zos": - installable_deps.append(install_path) - if self.flavor == "zos" and self.type == "shared_library": - # lib.target/libnode.so has a dependency on $(obj).target/libnode.so - self.WriteDoCmd( - [self.GetSharedObjectFromSidedeck(install_path)], - [self.GetSharedObjectFromSidedeck(self.output)], - "copy", - comment="Copy this to the %s output path." % file_desc, - part_of_all=part_of_all, - ) - # Create a symlink of libnode.x to libnode.version.x - self.WriteDoCmd( - [self.GetUnversionedSidedeckFromSidedeck(install_path)], - [install_path], - "symlink", - comment="Symlnk this to the %s output path." % file_desc, - part_of_all=part_of_all, - ) - # Place libnode.version.so and libnode.x symlink in lib.target dir - installable_deps.append(self.GetSharedObjectFromSidedeck(install_path)) - installable_deps.append( - self.GetUnversionedSidedeckFromSidedeck(install_path) - ) - if self.output != self.alias and self.alias != self.target: - self.WriteMakeRule( - [self.alias], - installable_deps, - comment="Short alias for building this %s." % file_desc, - phony=True, - ) - if self.flavor == "zos" and self.type == "shared_library": - # Make sure that .x symlink target is run - self.WriteMakeRule( - ["all"], - [ - self.GetUnversionedSidedeckFromSidedeck(install_path), - self.GetSharedObjectFromSidedeck(install_path), - ], - comment='Add %s to "all" target.' % file_desc, - phony=True, - ) - elif part_of_all: - self.WriteMakeRule( - ["all"], - [install_path], - comment='Add %s to "all" target.' % file_desc, - phony=True, - ) - - def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessary): - """Write a variable definition that is a list of values. - - E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out - foo = blaha blahb - but in a pretty-printed style. - """ - values = "" - if value_list: - value_list = [quoter(prefix + value) for value in value_list] - values = " \\\n\t" + " \\\n\t".join(value_list) - self.fp.write(f"{variable} :={values}\n\n") - - def WriteDoCmd( - self, outputs, inputs, command, part_of_all, comment=None, postbuilds=False - ): - """Write a Makefile rule that uses do_cmd. - - This makes the outputs dependent on the command line that was run, - as well as support the V= make command line flag. - """ - suffix = "" - if postbuilds: - assert "," not in command - suffix = ",,1" # Tell do_cmd to honor $POSTBUILDS - self.WriteMakeRule( - outputs, - inputs, - actions=[f"$(call do_cmd,{command}{suffix})"], - comment=comment, - command=command, - force=True, - ) - # Add our outputs to the list of targets we read depfiles from. - # all_deps is only used for deps file reading, and for deps files we replace - # spaces with ? because escaping doesn't work with make's $(sort) and - # other functions. - outputs = [QuoteSpaces(o, SPACE_REPLACEMENT) for o in outputs] - self.WriteLn("all_deps += %s" % " ".join(outputs)) - - def WriteMakeRule( - self, - outputs, - inputs, - actions=None, - comment=None, - order_only=False, - force=False, - phony=False, - command=None, - ): - """Write a Makefile rule, with some extra tricks. - - outputs: a list of outputs for the rule (note: this is not directly - supported by make; see comments below) - inputs: a list of inputs for the rule - actions: a list of shell commands to run for the rule - comment: a comment to put in the Makefile above the rule (also useful - for making this Python script's code self-documenting) - order_only: if true, makes the dependency order-only - force: if true, include FORCE_DO_CMD as an order-only dep - phony: if true, the rule does not actually generate the named output, the - output is just a name to run the rule - command: (optional) command name to generate unambiguous labels - """ - outputs = [QuoteSpaces(o) for o in outputs] - inputs = [QuoteSpaces(i) for i in inputs] - - if comment: - self.WriteLn("# " + comment) - if phony: - self.WriteLn(".PHONY: " + " ".join(outputs)) - if actions: - self.WriteLn("%s: TOOLSET := $(TOOLSET)" % outputs[0]) - force_append = " FORCE_DO_CMD" if force else "" - - if order_only: - # Order only rule: Just write a simple rule. - # TODO(evanm): just make order_only a list of deps instead of this hack. - self.WriteLn( - "{}: | {}{}".format(" ".join(outputs), " ".join(inputs), force_append) - ) - elif len(outputs) == 1: - # Regular rule, one output: Just write a simple rule. - self.WriteLn("{}: {}{}".format(outputs[0], " ".join(inputs), force_append)) - else: - # Regular rule, more than one output: Multiple outputs are tricky in - # make. We will write three rules: - # - All outputs depend on an intermediate file. - # - Make .INTERMEDIATE depend on the intermediate. - # - The intermediate file depends on the inputs and executes the - # actual command. - # - The intermediate recipe will 'touch' the intermediate file. - # - The multi-output rule will have an do-nothing recipe. - - # Hash the target name to avoid generating overlong filenames. - cmddigest = hashlib.sha1( - (command or self.target).encode("utf-8") - ).hexdigest() - intermediate = "%s.intermediate" % cmddigest - self.WriteLn("{}: {}".format(" ".join(outputs), intermediate)) - self.WriteLn("\t%s" % "@:") - self.WriteLn("{}: {}".format(".INTERMEDIATE", intermediate)) - self.WriteLn( - "{}: {}{}".format(intermediate, " ".join(inputs), force_append) - ) - actions.insert(0, "$(call do_cmd,touch)") - - if actions: - for action in actions: - self.WriteLn("\t%s" % action) - self.WriteLn() - - def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps): - """Write a set of LOCAL_XXX definitions for Android NDK. - - These variable definitions will be used by Android NDK but do nothing for - non-Android applications. - - Arguments: - module_name: Android NDK module name, which must be unique among all - module names. - all_sources: A list of source files (will be filtered by Compilable). - link_deps: A list of link dependencies, which must be sorted in - the order from dependencies to dependents. - """ - if self.type not in ("executable", "shared_library", "static_library"): - return - - self.WriteLn("# Variable definitions for Android applications") - self.WriteLn("include $(CLEAR_VARS)") - self.WriteLn("LOCAL_MODULE := " + module_name) - self.WriteLn( - "LOCAL_CFLAGS := $(CFLAGS_$(BUILDTYPE)) " - "$(DEFS_$(BUILDTYPE)) " - # LOCAL_CFLAGS is applied to both of C and C++. There is - # no way to specify $(CFLAGS_C_$(BUILDTYPE)) only for C - # sources. - "$(CFLAGS_C_$(BUILDTYPE)) " - # $(INCS_$(BUILDTYPE)) includes the prefix '-I' while - # LOCAL_C_INCLUDES does not expect it. So put it in - # LOCAL_CFLAGS. - "$(INCS_$(BUILDTYPE))" - ) - # LOCAL_CXXFLAGS is obsolete and LOCAL_CPPFLAGS is preferred. - self.WriteLn("LOCAL_CPPFLAGS := $(CFLAGS_CC_$(BUILDTYPE))") - self.WriteLn("LOCAL_C_INCLUDES :=") - self.WriteLn("LOCAL_LDLIBS := $(LDFLAGS_$(BUILDTYPE)) $(LIBS)") - - # Detect the C++ extension. - cpp_ext = {".cc": 0, ".cpp": 0, ".cxx": 0} - default_cpp_ext = ".cpp" - for filename in all_sources: - ext = os.path.splitext(filename)[1] - if ext in cpp_ext: - cpp_ext[ext] += 1 - if cpp_ext[ext] > cpp_ext[default_cpp_ext]: - default_cpp_ext = ext - self.WriteLn("LOCAL_CPP_EXTENSION := " + default_cpp_ext) - - self.WriteList( - list(map(self.Absolutify, filter(Compilable, all_sources))), - "LOCAL_SRC_FILES", - ) - - # Filter out those which do not match prefix and suffix and produce - # the resulting list without prefix and suffix. - def DepsToModules(deps, prefix, suffix): - modules = [] - for filepath in deps: - filename = os.path.basename(filepath) - if filename.startswith(prefix) and filename.endswith(suffix): - modules.append(filename[len(prefix) : -len(suffix)]) - return modules - - # Retrieve the default value of 'SHARED_LIB_SUFFIX' - params = {"flavor": "linux"} - default_variables = {} - CalculateVariables(default_variables, params) - - self.WriteList( - DepsToModules( - link_deps, - generator_default_variables["SHARED_LIB_PREFIX"], - default_variables["SHARED_LIB_SUFFIX"], - ), - "LOCAL_SHARED_LIBRARIES", - ) - self.WriteList( - DepsToModules( - link_deps, - generator_default_variables["STATIC_LIB_PREFIX"], - generator_default_variables["STATIC_LIB_SUFFIX"], - ), - "LOCAL_STATIC_LIBRARIES", - ) - - if self.type == "executable": - self.WriteLn("include $(BUILD_EXECUTABLE)") - elif self.type == "shared_library": - self.WriteLn("include $(BUILD_SHARED_LIBRARY)") - elif self.type == "static_library": - self.WriteLn("include $(BUILD_STATIC_LIBRARY)") - self.WriteLn() - - def WriteLn(self, text=""): - self.fp.write(text + "\n") - - def GetSortedXcodeEnv(self, additional_settings=None): - return gyp.xcode_emulation.GetSortedXcodeEnv( - self.xcode_settings, - "$(abs_builddir)", - os.path.join("$(abs_srcdir)", self.path), - "$(BUILDTYPE)", - additional_settings, - ) - - def GetSortedXcodePostbuildEnv(self): - # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack. - # TODO(thakis): It would be nice to have some general mechanism instead. - strip_save_file = self.xcode_settings.GetPerTargetSetting( - "CHROMIUM_STRIP_SAVE_FILE", "" - ) - # Even if strip_save_file is empty, explicitly write it. Else a postbuild - # might pick up an export from an earlier target. - return self.GetSortedXcodeEnv( - additional_settings={"CHROMIUM_STRIP_SAVE_FILE": strip_save_file} - ) - - def WriteSortedXcodeEnv(self, target, env): - for k, v in env: - # For - # foo := a\ b - # the escaped space does the right thing. For - # export foo := a\ b - # it does not -- the backslash is written to the env as literal character. - # So don't escape spaces in |env[k]|. - self.WriteLn(f"{QuoteSpaces(target)}: export {k} := {v}") - - def Objectify(self, path): - """Convert a path to its output directory form.""" - if "$(" in path: - path = path.replace("$(obj)/", "$(obj).%s/$(TARGET)/" % self.toolset) - if "$(obj)" not in path: - path = f"$(obj).{self.toolset}/$(TARGET)/{path}" - return path - - def Pchify(self, path, lang): - """Convert a prefix header path to its output directory form.""" - path = self.Absolutify(path) - if "$(" in path: - path = path.replace( - "$(obj)/", f"$(obj).{self.toolset}/$(TARGET)/pch-{lang}" - ) - return path - return f"$(obj).{self.toolset}/$(TARGET)/pch-{lang}/{path}" - - def Absolutify(self, path): - """Convert a subdirectory-relative path into a base-relative path. - Skips over paths that contain variables.""" - if "$(" in path: - # Don't call normpath in this case, as it might collapse the - # path too aggressively if it features '..'. However it's still - # important to strip trailing slashes. - return path.rstrip("/") - return os.path.normpath(os.path.join(self.path, path)) - - def ExpandInputRoot(self, template, expansion, dirname): - if "%(INPUT_ROOT)s" not in template and "%(INPUT_DIRNAME)s" not in template: - return template - path = template % { - "INPUT_ROOT": expansion, - "INPUT_DIRNAME": dirname, - } - return path - - def _InstallableTargetInstallPath(self): - """Returns the location of the final output for an installable target.""" - # Functionality removed for all platforms to match Xcode and hoist - # shared libraries into PRODUCT_DIR for users: - # Xcode puts shared_library results into PRODUCT_DIR, and some gyp files - # rely on this. Emulate this behavior for mac. - # if self.type == "shared_library" and ( - # self.flavor != "mac" or self.toolset != "target" - # ): - # # Install all shared libs into a common directory (per toolset) for - # # convenient access with LD_LIBRARY_PATH. - # return "$(builddir)/lib.%s/%s" % (self.toolset, self.alias) - if self.flavor == "zos" and self.type == "shared_library": - return "$(builddir)/lib.%s/%s" % (self.toolset, self.alias) - - return "$(builddir)/" + self.alias - - -def WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files): - """Write the target to regenerate the Makefile.""" - options = params["options"] - build_files_args = [ - gyp.common.RelativePath(filename, options.toplevel_dir) - for filename in params["build_files_arg"] - ] - - gyp_binary = gyp.common.FixIfRelativePath( - params["gyp_binary"], options.toplevel_dir - ) - if not gyp_binary.startswith(os.sep): - gyp_binary = os.path.join(".", gyp_binary) - - root_makefile.write( - "quiet_cmd_regen_makefile = ACTION Regenerating $@\n" - "cmd_regen_makefile = cd $(srcdir); %(cmd)s\n" - "%(makefile_name)s: %(deps)s\n" - "\t$(call do_cmd,regen_makefile)\n\n" - % { - "makefile_name": makefile_name, - "deps": " ".join(SourceifyAndQuoteSpaces(bf) for bf in build_files), - "cmd": gyp.common.EncodePOSIXShellList( - [gyp_binary, "-fmake"] + gyp.RegenerateFlags(options) + build_files_args - ), - } - ) - - -def PerformBuild(data, configurations, params): - options = params["options"] - for config in configurations: - arguments = ["make"] - if options.toplevel_dir and options.toplevel_dir != ".": - arguments += "-C", options.toplevel_dir - arguments.append("BUILDTYPE=" + config) - print(f"Building [{config}]: {arguments}") - subprocess.check_call(arguments) - - -def GenerateOutput(target_list, target_dicts, data, params): - options = params["options"] - flavor = gyp.common.GetFlavor(params) - generator_flags = params.get("generator_flags", {}) - builddir_name = generator_flags.get("output_dir", "out") - android_ndk_version = generator_flags.get("android_ndk_version", None) - default_target = generator_flags.get("default_target", "all") - - def CalculateMakefilePath(build_file, base_name): - """Determine where to write a Makefile for a given gyp file.""" - # Paths in gyp files are relative to the .gyp file, but we want - # paths relative to the source root for the master makefile. Grab - # the path of the .gyp file as the base to relativize against. - # E.g. "foo/bar" when we're constructing targets for "foo/bar/baz.gyp". - base_path = gyp.common.RelativePath(os.path.dirname(build_file), options.depth) - # We write the file in the base_path directory. - output_file = os.path.join(options.depth, base_path, base_name) - if options.generator_output: - output_file = os.path.join( - options.depth, options.generator_output, base_path, base_name - ) - base_path = gyp.common.RelativePath( - os.path.dirname(build_file), options.toplevel_dir - ) - return base_path, output_file - - # TODO: search for the first non-'Default' target. This can go - # away when we add verification that all targets have the - # necessary configurations. - default_configuration = None - toolsets = {target_dicts[target]["toolset"] for target in target_list} - for target in target_list: - spec = target_dicts[target] - if spec["default_configuration"] != "Default": - default_configuration = spec["default_configuration"] - break - if not default_configuration: - default_configuration = "Default" - - srcdir = "." - makefile_name = "Makefile" + options.suffix - makefile_path = os.path.join(options.toplevel_dir, makefile_name) - if options.generator_output: - global srcdir_prefix - makefile_path = os.path.join( - options.toplevel_dir, options.generator_output, makefile_name - ) - srcdir = gyp.common.RelativePath(srcdir, options.generator_output) - srcdir_prefix = "$(srcdir)/" - - flock_command = "flock" - copy_archive_arguments = "-af" - makedep_arguments = "-MMD" - header_params = { - "default_target": default_target, - "builddir": builddir_name, - "default_configuration": default_configuration, - "flock": flock_command, - "flock_index": 1, - "link_commands": LINK_COMMANDS_LINUX, - "extra_commands": "", - "srcdir": srcdir, - "copy_archive_args": copy_archive_arguments, - "makedep_args": makedep_arguments, - "CC.target": GetEnvironFallback(("CC_target", "CC"), "$(CC)"), - "AR.target": GetEnvironFallback(("AR_target", "AR"), "$(AR)"), - "CXX.target": GetEnvironFallback(("CXX_target", "CXX"), "$(CXX)"), - "LINK.target": GetEnvironFallback(("LINK_target", "LINK"), "$(LINK)"), - "PLI.target": GetEnvironFallback(("PLI_target", "PLI"), "pli"), - "CC.host": GetEnvironFallback(("CC_host", "CC"), "gcc"), - "AR.host": GetEnvironFallback(("AR_host", "AR"), "ar"), - "CXX.host": GetEnvironFallback(("CXX_host", "CXX"), "g++"), - "LINK.host": GetEnvironFallback(("LINK_host", "LINK"), "$(CXX.host)"), - "PLI.host": GetEnvironFallback(("PLI_host", "PLI"), "pli"), - } - if flavor == "mac": - flock_command = "./gyp-mac-tool flock" - header_params.update( - { - "flock": flock_command, - "flock_index": 2, - "link_commands": LINK_COMMANDS_MAC, - "extra_commands": SHARED_HEADER_MAC_COMMANDS, - } - ) - elif flavor == "android": - header_params.update({"link_commands": LINK_COMMANDS_ANDROID}) - elif flavor == "zos": - copy_archive_arguments = "-fPR" - CC_target = GetEnvironFallback(("CC_target", "CC"), "njsc") - makedep_arguments = "-MMD" - if CC_target == "clang": - CC_host = GetEnvironFallback(("CC_host", "CC"), "clang") - CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "clang++") - CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "clang++") - elif CC_target == "ibm-clang64": - CC_host = GetEnvironFallback(("CC_host", "CC"), "ibm-clang64") - CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "ibm-clang++64") - CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "ibm-clang++64") - elif CC_target == "ibm-clang": - CC_host = GetEnvironFallback(("CC_host", "CC"), "ibm-clang") - CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "ibm-clang++") - CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "ibm-clang++") - else: - # Node.js versions prior to v18: - makedep_arguments = "-qmakedep=gcc" - CC_host = GetEnvironFallback(("CC_host", "CC"), "njsc") - CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "njsc++") - CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "njsc++") - header_params.update( - { - "copy_archive_args": copy_archive_arguments, - "makedep_args": makedep_arguments, - "link_commands": LINK_COMMANDS_OS390, - "extra_commands": SHARED_HEADER_OS390_COMMANDS, - "CC.target": CC_target, - "CXX.target": CXX_target, - "CC.host": CC_host, - "CXX.host": CXX_host, - } - ) - elif flavor == "solaris": - copy_archive_arguments = "-pPRf@" - header_params.update( - { - "copy_archive_args": copy_archive_arguments, - "flock": "./gyp-flock-tool flock", - "flock_index": 2, - } - ) - elif flavor == "freebsd": - # Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific. - header_params.update({"flock": "lockf"}) - elif flavor == "openbsd": - copy_archive_arguments = "-pPRf" - header_params.update({"copy_archive_args": copy_archive_arguments}) - elif flavor == "aix": - copy_archive_arguments = "-pPRf" - header_params.update( - { - "copy_archive_args": copy_archive_arguments, - "link_commands": LINK_COMMANDS_AIX, - "flock": "./gyp-flock-tool flock", - "flock_index": 2, - } - ) - elif flavor == "os400": - copy_archive_arguments = "-pPRf" - header_params.update( - { - "copy_archive_args": copy_archive_arguments, - "link_commands": LINK_COMMANDS_OS400, - "flock": "./gyp-flock-tool flock", - "flock_index": 2, - } - ) - - build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) - make_global_settings_array = data[build_file].get("make_global_settings", []) - wrappers = {} - for key, value in make_global_settings_array: - if key.endswith("_wrapper"): - wrappers[key[: -len("_wrapper")]] = "$(abspath %s)" % value - make_global_settings = "" - for key, value in make_global_settings_array: - if re.match(".*_wrapper", key): - continue - if value[0] != "$": - value = "$(abspath %s)" % value - wrapper = wrappers.get(key) - if wrapper: - value = f"{wrapper} {value}" - del wrappers[key] - if key in ("CC", "CC.host", "CXX", "CXX.host"): - make_global_settings += ( - "ifneq (,$(filter $(origin %s), undefined default))\n" % key - ) - # Let gyp-time envvars win over global settings. - env_key = key.replace(".", "_") # CC.host -> CC_host - if env_key in os.environ: - value = os.environ[env_key] - make_global_settings += f" {key} = {value}\n" - make_global_settings += "endif\n" - else: - make_global_settings += f"{key} ?= {value}\n" - # TODO(ukai): define cmd when only wrapper is specified in - # make_global_settings. - - header_params["make_global_settings"] = make_global_settings - - gyp.common.EnsureDirExists(makefile_path) - root_makefile = open(makefile_path, "w") - root_makefile.write(SHARED_HEADER % header_params) - # Currently any versions have the same effect, but in future the behavior - # could be different. - if android_ndk_version: - root_makefile.write( - "# Define LOCAL_PATH for build of Android applications.\n" - "LOCAL_PATH := $(call my-dir)\n" - "\n" - ) - for toolset in toolsets: - root_makefile.write("TOOLSET := %s\n" % toolset) - WriteRootHeaderSuffixRules(root_makefile) - - # Put build-time support tools next to the root Makefile. - dest_path = os.path.dirname(makefile_path) - gyp.common.CopyTool(flavor, dest_path) - - # Find the list of targets that derive from the gyp file(s) being built. - needed_targets = set() - for build_file in params["build_files"]: - for target in gyp.common.AllTargets(target_list, target_dicts, build_file): - needed_targets.add(target) - - build_files = set() - include_list = set() - for qualified_target in target_list: - build_file, target, toolset = gyp.common.ParseQualifiedTarget(qualified_target) - - this_make_global_settings = data[build_file].get("make_global_settings", []) - assert make_global_settings_array == this_make_global_settings, ( - "make_global_settings needs to be the same for all targets " - f"{this_make_global_settings} vs. {make_global_settings}" - ) - - build_files.add(gyp.common.RelativePath(build_file, options.toplevel_dir)) - included_files = data[build_file]["included_files"] - for included_file in included_files: - # The included_files entries are relative to the dir of the build file - # that included them, so we have to undo that and then make them relative - # to the root dir. - relative_include_file = gyp.common.RelativePath( - gyp.common.UnrelativePath(included_file, build_file), - options.toplevel_dir, - ) - abs_include_file = os.path.abspath(relative_include_file) - # If the include file is from the ~/.gyp dir, we should use absolute path - # so that relocating the src dir doesn't break the path. - if params["home_dot_gyp"] and abs_include_file.startswith( - params["home_dot_gyp"] - ): - build_files.add(abs_include_file) - else: - build_files.add(relative_include_file) - - base_path, output_file = CalculateMakefilePath( - build_file, target + "." + toolset + options.suffix + ".mk" - ) - - spec = target_dicts[qualified_target] - configs = spec["configurations"] - - if flavor == "mac": - gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec) - - writer = MakefileWriter(generator_flags, flavor) - writer.Write( - qualified_target, - base_path, - output_file, - spec, - configs, - part_of_all=qualified_target in needed_targets, - ) - - # Our root_makefile lives at the source root. Compute the relative path - # from there to the output_file for including. - mkfile_rel_path = gyp.common.RelativePath( - output_file, os.path.dirname(makefile_path) - ) - include_list.add(mkfile_rel_path) - - # Write out per-gyp (sub-project) Makefiles. - depth_rel_path = gyp.common.RelativePath(options.depth, os.getcwd()) - for build_file in build_files: - # The paths in build_files were relativized above, so undo that before - # testing against the non-relativized items in target_list and before - # calculating the Makefile path. - build_file = os.path.join(depth_rel_path, build_file) - gyp_targets = [ - target_dicts[qualified_target]["target_name"] - for qualified_target in target_list - if qualified_target.startswith(build_file) - and qualified_target in needed_targets - ] - # Only generate Makefiles for gyp files with targets. - if not gyp_targets: - continue - base_path, output_file = CalculateMakefilePath( - build_file, os.path.splitext(os.path.basename(build_file))[0] + ".Makefile" - ) - makefile_rel_path = gyp.common.RelativePath( - os.path.dirname(makefile_path), os.path.dirname(output_file) - ) - writer.WriteSubMake(output_file, makefile_rel_path, gyp_targets, builddir_name) - - # Write out the sorted list of includes. - root_makefile.write("\n") - for include_file in sorted(include_list): - # We wrap each .mk include in an if statement so users can tell make to - # not load a file by setting NO_LOAD. The below make code says, only - # load the .mk file if the .mk filename doesn't start with a token in - # NO_LOAD. - root_makefile.write( - "ifeq ($(strip $(foreach prefix,$(NO_LOAD),\\\n" - " $(findstring $(join ^,$(prefix)),\\\n" - " $(join ^," + include_file + ")))),)\n" - ) - root_makefile.write(" include " + include_file + "\n") - root_makefile.write("endif\n") - root_makefile.write("\n") - - if not generator_flags.get("standalone") and generator_flags.get( - "auto_regeneration", True - ): - WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) - - root_makefile.write(SHARED_FOOTER) - - root_makefile.close() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py deleted file mode 100644 index fd95005784798..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +++ /dev/null @@ -1,3981 +0,0 @@ -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - - -import ntpath -import os -import posixpath -import re -import subprocess -import sys - -from collections import OrderedDict - -import gyp.common -import gyp.easy_xml as easy_xml -import gyp.generator.ninja as ninja_generator -import gyp.MSVSNew as MSVSNew -import gyp.MSVSProject as MSVSProject -import gyp.MSVSSettings as MSVSSettings -import gyp.MSVSToolFile as MSVSToolFile -import gyp.MSVSUserFile as MSVSUserFile -import gyp.MSVSUtil as MSVSUtil -import gyp.MSVSVersion as MSVSVersion -from gyp.common import GypError -from gyp.common import OrderedSet - - -# Regular expression for validating Visual Studio GUIDs. If the GUID -# contains lowercase hex letters, MSVS will be fine. However, -# IncrediBuild BuildConsole will parse the solution file, but then -# silently skip building the target causing hard to track down errors. -# Note that this only happens with the BuildConsole, and does not occur -# if IncrediBuild is executed from inside Visual Studio. This regex -# validates that the string looks like a GUID with all uppercase hex -# letters. -VALID_MSVS_GUID_CHARS = re.compile(r"^[A-F0-9\-]+$") - -generator_supports_multiple_toolsets = gyp.common.CrossCompileRequested() - -generator_default_variables = { - "DRIVER_PREFIX": "", - "DRIVER_SUFFIX": ".sys", - "EXECUTABLE_PREFIX": "", - "EXECUTABLE_SUFFIX": ".exe", - "STATIC_LIB_PREFIX": "", - "SHARED_LIB_PREFIX": "", - "STATIC_LIB_SUFFIX": ".lib", - "SHARED_LIB_SUFFIX": ".dll", - "INTERMEDIATE_DIR": "$(IntDir)", - "SHARED_INTERMEDIATE_DIR": "$(OutDir)/obj/global_intermediate", - "OS": "win", - "PRODUCT_DIR": "$(OutDir)", - "LIB_DIR": "$(OutDir)lib", - "RULE_INPUT_ROOT": "$(InputName)", - "RULE_INPUT_DIRNAME": "$(InputDir)", - "RULE_INPUT_EXT": "$(InputExt)", - "RULE_INPUT_NAME": "$(InputFileName)", - "RULE_INPUT_PATH": "$(InputPath)", - "CONFIGURATION_NAME": "$(ConfigurationName)", -} - - -# The msvs specific sections that hold paths -generator_additional_path_sections = [ - "msvs_cygwin_dirs", - "msvs_props", -] - - -generator_additional_non_configuration_keys = [ - "msvs_cygwin_dirs", - "msvs_cygwin_shell", - "msvs_large_pdb", - "msvs_shard", - "msvs_external_builder", - "msvs_external_builder_out_dir", - "msvs_external_builder_build_cmd", - "msvs_external_builder_clean_cmd", - "msvs_external_builder_clcompile_cmd", - "msvs_enable_winrt", - "msvs_requires_importlibrary", - "msvs_enable_winphone", - "msvs_application_type_revision", - "msvs_target_platform_version", - "msvs_target_platform_minversion", -] - -generator_filelist_paths = None - -# List of precompiled header related keys. -precomp_keys = [ - "msvs_precompiled_header", - "msvs_precompiled_source", -] - - -cached_username = None - - -cached_domain = None - - -# TODO(gspencer): Switch the os.environ calls to be -# win32api.GetDomainName() and win32api.GetUserName() once the -# python version in depot_tools has been updated to work on Vista -# 64-bit. -def _GetDomainAndUserName(): - if sys.platform not in ("win32", "cygwin"): - return ("DOMAIN", "USERNAME") - global cached_username - global cached_domain - if not cached_domain or not cached_username: - domain = os.environ.get("USERDOMAIN") - username = os.environ.get("USERNAME") - if not domain or not username: - call = subprocess.Popen( - ["net", "config", "Workstation"], stdout=subprocess.PIPE - ) - config = call.communicate()[0].decode("utf-8") - username_re = re.compile(r"^User name\s+(\S+)", re.MULTILINE) - username_match = username_re.search(config) - if username_match: - username = username_match.group(1) - domain_re = re.compile(r"^Logon domain\s+(\S+)", re.MULTILINE) - domain_match = domain_re.search(config) - if domain_match: - domain = domain_match.group(1) - cached_domain = domain - cached_username = username - return (cached_domain, cached_username) - - -fixpath_prefix = None - - -def _NormalizedSource(source): - """Normalize the path. - - But not if that gets rid of a variable, as this may expand to something - larger than one directory. - - Arguments: - source: The path to be normalize.d - - Returns: - The normalized path. - """ - normalized = os.path.normpath(source) - if source.count("$") == normalized.count("$"): - source = normalized - return source - - -def _FixPath(path, separator="\\"): - """Convert paths to a form that will make sense in a vcproj file. - - Arguments: - path: The path to convert, may contain / etc. - Returns: - The path with all slashes made into backslashes. - """ - if ( - fixpath_prefix - and path - and not os.path.isabs(path) - and not path[0] == "$" - and not _IsWindowsAbsPath(path) - ): - path = os.path.join(fixpath_prefix, path) - if separator == "\\": - path = path.replace("/", "\\") - path = _NormalizedSource(path) - if separator == "/": - path = path.replace("\\", "/") - if path and path[-1] == separator: - path = path[:-1] - return path - - -def _IsWindowsAbsPath(path): - """ - On Cygwin systems Python needs a little help determining if a path - is an absolute Windows path or not, so that - it does not treat those as relative, which results in bad paths like: - '..\\C:\\\\some_source_code_file.cc' - """ - return path.startswith("c:") or path.startswith("C:") - - -def _FixPaths(paths, separator="\\"): - """Fix each of the paths of the list.""" - return [_FixPath(i, separator) for i in paths] - - -def _ConvertSourcesToFilterHierarchy( - sources, prefix=None, excluded=None, list_excluded=True, msvs_version=None -): - """Converts a list split source file paths into a vcproj folder hierarchy. - - Arguments: - sources: A list of source file paths split. - prefix: A list of source file path layers meant to apply to each of sources. - excluded: A set of excluded files. - msvs_version: A MSVSVersion object. - - Returns: - A hierarchy of filenames and MSVSProject.Filter objects that matches the - layout of the source tree. - For example: - _ConvertSourcesToFilterHierarchy([['a', 'bob1.c'], ['b', 'bob2.c']], - prefix=['joe']) - --> - [MSVSProject.Filter('a', contents=['joe\\a\\bob1.c']), - MSVSProject.Filter('b', contents=['joe\\b\\bob2.c'])] - """ - if not prefix: - prefix = [] - result = [] - excluded_result = [] - folders = OrderedDict() - # Gather files into the final result, excluded, or folders. - for s in sources: - if len(s) == 1: - filename = _NormalizedSource("\\".join(prefix + s)) - if filename in excluded: - excluded_result.append(filename) - else: - result.append(filename) - elif msvs_version and not msvs_version.UsesVcxproj(): - # For MSVS 2008 and earlier, we need to process all files before walking - # the sub folders. - if not folders.get(s[0]): - folders[s[0]] = [] - folders[s[0]].append(s[1:]) - else: - contents = _ConvertSourcesToFilterHierarchy( - [s[1:]], - prefix + [s[0]], - excluded=excluded, - list_excluded=list_excluded, - msvs_version=msvs_version, - ) - contents = MSVSProject.Filter(s[0], contents=contents) - result.append(contents) - # Add a folder for excluded files. - if excluded_result and list_excluded: - excluded_folder = MSVSProject.Filter( - "_excluded_files", contents=excluded_result - ) - result.append(excluded_folder) - - if msvs_version and msvs_version.UsesVcxproj(): - return result - - # Populate all the folders. - for f in folders: - contents = _ConvertSourcesToFilterHierarchy( - folders[f], - prefix=prefix + [f], - excluded=excluded, - list_excluded=list_excluded, - msvs_version=msvs_version, - ) - contents = MSVSProject.Filter(f, contents=contents) - result.append(contents) - return result - - -def _ToolAppend(tools, tool_name, setting, value, only_if_unset=False): - if not value: - return - _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset) - - -def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False): - # TODO(bradnelson): ugly hack, fix this more generally!!! - if "Directories" in setting or "Dependencies" in setting: - if type(value) == str: - value = value.replace("/", "\\") - else: - value = [i.replace("/", "\\") for i in value] - if not tools.get(tool_name): - tools[tool_name] = dict() - tool = tools[tool_name] - if "CompileAsWinRT" == setting: - return - if tool.get(setting): - if only_if_unset: - return - if type(tool[setting]) == list and type(value) == list: - tool[setting] += value - else: - raise TypeError( - 'Appending "%s" to a non-list setting "%s" for tool "%s" is ' - "not allowed, previous value: %s" - % (value, setting, tool_name, str(tool[setting])) - ) - else: - tool[setting] = value - - -def _ConfigTargetVersion(config_data): - return config_data.get("msvs_target_version", "Windows7") - - -def _ConfigPlatform(config_data): - return config_data.get("msvs_configuration_platform", "Win32") - - -def _ConfigBaseName(config_name, platform_name): - if config_name.endswith("_" + platform_name): - return config_name[0 : -len(platform_name) - 1] - else: - return config_name - - -def _ConfigFullName(config_name, config_data): - platform_name = _ConfigPlatform(config_data) - return f"{_ConfigBaseName(config_name, platform_name)}|{platform_name}" - - -def _ConfigWindowsTargetPlatformVersion(config_data, version): - target_ver = config_data.get("msvs_windows_target_platform_version") - if target_ver and re.match(r"^\d+", target_ver): - return target_ver - config_ver = config_data.get("msvs_windows_sdk_version") - vers = [config_ver] if config_ver else version.compatible_sdks - for ver in vers: - for key in [ - r"HKLM\Software\Microsoft\Microsoft SDKs\Windows\%s", - r"HKLM\Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows\%s", - ]: - sdk_dir = MSVSVersion._RegistryGetValue(key % ver, "InstallationFolder") - if not sdk_dir: - continue - version = MSVSVersion._RegistryGetValue(key % ver, "ProductVersion") or "" - # Find a matching entry in sdk_dir\include. - expected_sdk_dir = r"%s\include" % sdk_dir - names = sorted( - ( - x - for x in ( - os.listdir(expected_sdk_dir) - if os.path.isdir(expected_sdk_dir) - else [] - ) - if x.startswith(version) - ), - reverse=True, - ) - if names: - return names[0] - else: - print( - "Warning: No include files found for detected " - "Windows SDK version %s" % (version), - file=sys.stdout, - ) - - -def _BuildCommandLineForRuleRaw( - spec, cmd, cygwin_shell, has_input_path, quote_cmd, do_setup_env -): - - if [x for x in cmd if "$(InputDir)" in x]: - input_dir_preamble = ( - "set INPUTDIR=$(InputDir)\n" - "if NOT DEFINED INPUTDIR set INPUTDIR=.\\\n" - "set INPUTDIR=%INPUTDIR:~0,-1%\n" - ) - else: - input_dir_preamble = "" - - if cygwin_shell: - # Find path to cygwin. - cygwin_dir = _FixPath(spec.get("msvs_cygwin_dirs", ["."])[0]) - # Prepare command. - direct_cmd = cmd - direct_cmd = [ - i.replace("$(IntDir)", '`cygpath -m "${INTDIR}"`') for i in direct_cmd - ] - direct_cmd = [ - i.replace("$(OutDir)", '`cygpath -m "${OUTDIR}"`') for i in direct_cmd - ] - direct_cmd = [ - i.replace("$(InputDir)", '`cygpath -m "${INPUTDIR}"`') for i in direct_cmd - ] - if has_input_path: - direct_cmd = [ - i.replace("$(InputPath)", '`cygpath -m "${INPUTPATH}"`') - for i in direct_cmd - ] - direct_cmd = ['\\"%s\\"' % i.replace('"', '\\\\\\"') for i in direct_cmd] - # direct_cmd = gyp.common.EncodePOSIXShellList(direct_cmd) - direct_cmd = " ".join(direct_cmd) - # TODO(quote): regularize quoting path names throughout the module - cmd = "" - if do_setup_env: - cmd += 'call "$(ProjectDir)%(cygwin_dir)s\\setup_env.bat" && ' - cmd += "set CYGWIN=nontsec&& " - if direct_cmd.find("NUMBER_OF_PROCESSORS") >= 0: - cmd += "set /a NUMBER_OF_PROCESSORS_PLUS_1=%%NUMBER_OF_PROCESSORS%%+1&& " - if direct_cmd.find("INTDIR") >= 0: - cmd += "set INTDIR=$(IntDir)&& " - if direct_cmd.find("OUTDIR") >= 0: - cmd += "set OUTDIR=$(OutDir)&& " - if has_input_path and direct_cmd.find("INPUTPATH") >= 0: - cmd += "set INPUTPATH=$(InputPath) && " - cmd += 'bash -c "%(cmd)s"' - cmd = cmd % {"cygwin_dir": cygwin_dir, "cmd": direct_cmd} - return input_dir_preamble + cmd - else: - # Convert cat --> type to mimic unix. - if cmd[0] == "cat": - command = ["type"] - else: - command = [cmd[0].replace("/", "\\")] - # Add call before command to ensure that commands can be tied together one - # after the other without aborting in Incredibuild, since IB makes a bat - # file out of the raw command string, and some commands (like python) are - # actually batch files themselves. - command.insert(0, "call") - # Fix the paths - # TODO(quote): This is a really ugly heuristic, and will miss path fixing - # for arguments like "--arg=path", arg=path, or "/opt:path". - # If the argument starts with a slash or dash, or contains an equal sign, - # it's probably a command line switch. - # Return the path with forward slashes because the command using it might - # not support backslashes. - arguments = [ - i if (i[:1] in "/-" or "=" in i) else _FixPath(i, "/") - for i in cmd[1:] - ] - arguments = [i.replace("$(InputDir)", "%INPUTDIR%") for i in arguments] - arguments = [MSVSSettings.FixVCMacroSlashes(i) for i in arguments] - if quote_cmd: - # Support a mode for using cmd directly. - # Convert any paths to native form (first element is used directly). - # TODO(quote): regularize quoting path names throughout the module - arguments = ['"%s"' % i for i in arguments] - # Collapse into a single command. - return input_dir_preamble + " ".join(command + arguments) - - -def _BuildCommandLineForRule(spec, rule, has_input_path, do_setup_env): - # Currently this weird argument munging is used to duplicate the way a - # python script would need to be run as part of the chrome tree. - # Eventually we should add some sort of rule_default option to set this - # per project. For now the behavior chrome needs is the default. - mcs = rule.get("msvs_cygwin_shell") - if mcs is None: - mcs = int(spec.get("msvs_cygwin_shell", 1)) - elif isinstance(mcs, str): - mcs = int(mcs) - quote_cmd = int(rule.get("msvs_quote_cmd", 1)) - return _BuildCommandLineForRuleRaw( - spec, rule["action"], mcs, has_input_path, quote_cmd, do_setup_env=do_setup_env - ) - - -def _AddActionStep(actions_dict, inputs, outputs, description, command): - """Merge action into an existing list of actions. - - Care must be taken so that actions which have overlapping inputs either don't - get assigned to the same input, or get collapsed into one. - - Arguments: - actions_dict: dictionary keyed on input name, which maps to a list of - dicts describing the actions attached to that input file. - inputs: list of inputs - outputs: list of outputs - description: description of the action - command: command line to execute - """ - # Require there to be at least one input (call sites will ensure this). - assert inputs - - action = { - "inputs": inputs, - "outputs": outputs, - "description": description, - "command": command, - } - - # Pick where to stick this action. - # While less than optimal in terms of build time, attach them to the first - # input for now. - chosen_input = inputs[0] - - # Add it there. - if chosen_input not in actions_dict: - actions_dict[chosen_input] = [] - actions_dict[chosen_input].append(action) - - -def _AddCustomBuildToolForMSVS( - p, spec, primary_input, inputs, outputs, description, cmd -): - """Add a custom build tool to execute something. - - Arguments: - p: the target project - spec: the target project dict - primary_input: input file to attach the build tool to - inputs: list of inputs - outputs: list of outputs - description: description of the action - cmd: command line to execute - """ - inputs = _FixPaths(inputs) - outputs = _FixPaths(outputs) - tool = MSVSProject.Tool( - "VCCustomBuildTool", - { - "Description": description, - "AdditionalDependencies": ";".join(inputs), - "Outputs": ";".join(outputs), - "CommandLine": cmd, - }, - ) - # Add to the properties of primary input for each config. - for config_name, c_data in spec["configurations"].items(): - p.AddFileConfig( - _FixPath(primary_input), _ConfigFullName(config_name, c_data), tools=[tool] - ) - - -def _AddAccumulatedActionsToMSVS(p, spec, actions_dict): - """Add actions accumulated into an actions_dict, merging as needed. - - Arguments: - p: the target project - spec: the target project dict - actions_dict: dictionary keyed on input name, which maps to a list of - dicts describing the actions attached to that input file. - """ - for primary_input in actions_dict: - inputs = OrderedSet() - outputs = OrderedSet() - descriptions = [] - commands = [] - for action in actions_dict[primary_input]: - inputs.update(OrderedSet(action["inputs"])) - outputs.update(OrderedSet(action["outputs"])) - descriptions.append(action["description"]) - commands.append(action["command"]) - # Add the custom build step for one input file. - description = ", and also ".join(descriptions) - command = "\r\n".join(commands) - _AddCustomBuildToolForMSVS( - p, - spec, - primary_input=primary_input, - inputs=inputs, - outputs=outputs, - description=description, - cmd=command, - ) - - -def _RuleExpandPath(path, input_file): - """Given the input file to which a rule applied, string substitute a path. - - Arguments: - path: a path to string expand - input_file: the file to which the rule applied. - Returns: - The string substituted path. - """ - path = path.replace( - "$(InputName)", os.path.splitext(os.path.split(input_file)[1])[0] - ) - path = path.replace("$(InputDir)", os.path.dirname(input_file)) - path = path.replace( - "$(InputExt)", os.path.splitext(os.path.split(input_file)[1])[1] - ) - path = path.replace("$(InputFileName)", os.path.split(input_file)[1]) - path = path.replace("$(InputPath)", input_file) - return path - - -def _FindRuleTriggerFiles(rule, sources): - """Find the list of files which a particular rule applies to. - - Arguments: - rule: the rule in question - sources: the set of all known source files for this project - Returns: - The list of sources that trigger a particular rule. - """ - return rule.get("rule_sources", []) - - -def _RuleInputsAndOutputs(rule, trigger_file): - """Find the inputs and outputs generated by a rule. - - Arguments: - rule: the rule in question. - trigger_file: the main trigger for this rule. - Returns: - The pair of (inputs, outputs) involved in this rule. - """ - raw_inputs = _FixPaths(rule.get("inputs", [])) - raw_outputs = _FixPaths(rule.get("outputs", [])) - inputs = OrderedSet() - outputs = OrderedSet() - inputs.add(trigger_file) - for i in raw_inputs: - inputs.add(_RuleExpandPath(i, trigger_file)) - for o in raw_outputs: - outputs.add(_RuleExpandPath(o, trigger_file)) - return (inputs, outputs) - - -def _GenerateNativeRulesForMSVS(p, rules, output_dir, spec, options): - """Generate a native rules file. - - Arguments: - p: the target project - rules: the set of rules to include - output_dir: the directory in which the project/gyp resides - spec: the project dict - options: global generator options - """ - rules_filename = "{}{}.rules".format(spec["target_name"], options.suffix) - rules_file = MSVSToolFile.Writer( - os.path.join(output_dir, rules_filename), spec["target_name"] - ) - # Add each rule. - for r in rules: - rule_name = r["rule_name"] - rule_ext = r["extension"] - inputs = _FixPaths(r.get("inputs", [])) - outputs = _FixPaths(r.get("outputs", [])) - # Skip a rule with no action and no inputs. - if "action" not in r and not r.get("rule_sources", []): - continue - cmd = _BuildCommandLineForRule(spec, r, has_input_path=True, do_setup_env=True) - rules_file.AddCustomBuildRule( - name=rule_name, - description=r.get("message", rule_name), - extensions=[rule_ext], - additional_dependencies=inputs, - outputs=outputs, - cmd=cmd, - ) - # Write out rules file. - rules_file.WriteIfChanged() - - # Add rules file to project. - p.AddToolFile(rules_filename) - - -def _Cygwinify(path): - path = path.replace("$(OutDir)", "$(OutDirCygwin)") - path = path.replace("$(IntDir)", "$(IntDirCygwin)") - return path - - -def _GenerateExternalRules(rules, output_dir, spec, sources, options, actions_to_add): - """Generate an external makefile to do a set of rules. - - Arguments: - rules: the list of rules to include - output_dir: path containing project and gyp files - spec: project specification data - sources: set of sources known - options: global generator options - actions_to_add: The list of actions we will add to. - """ - filename = "{}_rules{}.mk".format(spec["target_name"], options.suffix) - mk_file = gyp.common.WriteOnDiff(os.path.join(output_dir, filename)) - # Find cygwin style versions of some paths. - mk_file.write('OutDirCygwin:=$(shell cygpath -u "$(OutDir)")\n') - mk_file.write('IntDirCygwin:=$(shell cygpath -u "$(IntDir)")\n') - # Gather stuff needed to emit all: target. - all_inputs = OrderedSet() - all_outputs = OrderedSet() - all_output_dirs = OrderedSet() - first_outputs = [] - for rule in rules: - trigger_files = _FindRuleTriggerFiles(rule, sources) - for tf in trigger_files: - inputs, outputs = _RuleInputsAndOutputs(rule, tf) - all_inputs.update(OrderedSet(inputs)) - all_outputs.update(OrderedSet(outputs)) - # Only use one target from each rule as the dependency for - # 'all' so we don't try to build each rule multiple times. - first_outputs.append(list(outputs)[0]) - # Get the unique output directories for this rule. - output_dirs = [os.path.split(i)[0] for i in outputs] - for od in output_dirs: - all_output_dirs.add(od) - first_outputs_cyg = [_Cygwinify(i) for i in first_outputs] - # Write out all: target, including mkdir for each output directory. - mk_file.write("all: %s\n" % " ".join(first_outputs_cyg)) - for od in all_output_dirs: - if od: - mk_file.write('\tmkdir -p `cygpath -u "%s"`\n' % od) - mk_file.write("\n") - # Define how each output is generated. - for rule in rules: - trigger_files = _FindRuleTriggerFiles(rule, sources) - for tf in trigger_files: - # Get all the inputs and outputs for this rule for this trigger file. - inputs, outputs = _RuleInputsAndOutputs(rule, tf) - inputs = [_Cygwinify(i) for i in inputs] - outputs = [_Cygwinify(i) for i in outputs] - # Prepare the command line for this rule. - cmd = [_RuleExpandPath(c, tf) for c in rule["action"]] - cmd = ['"%s"' % i for i in cmd] - cmd = " ".join(cmd) - # Add it to the makefile. - mk_file.write("{}: {}\n".format(" ".join(outputs), " ".join(inputs))) - mk_file.write("\t%s\n\n" % cmd) - # Close up the file. - mk_file.close() - - # Add makefile to list of sources. - sources.add(filename) - # Add a build action to call makefile. - cmd = [ - "make", - "OutDir=$(OutDir)", - "IntDir=$(IntDir)", - "-j", - "${NUMBER_OF_PROCESSORS_PLUS_1}", - "-f", - filename, - ] - cmd = _BuildCommandLineForRuleRaw(spec, cmd, True, False, True, True) - # Insert makefile as 0'th input, so it gets the action attached there, - # as this is easier to understand from in the IDE. - all_inputs = list(all_inputs) - all_inputs.insert(0, filename) - _AddActionStep( - actions_to_add, - inputs=_FixPaths(all_inputs), - outputs=_FixPaths(all_outputs), - description="Running external rules for %s" % spec["target_name"], - command=cmd, - ) - - -def _EscapeEnvironmentVariableExpansion(s): - """Escapes % characters. - - Escapes any % characters so that Windows-style environment variable - expansions will leave them alone. - See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile - to understand why we have to do this. - - Args: - s: The string to be escaped. - - Returns: - The escaped string. - """ # noqa: E731,E123,E501 - s = s.replace("%", "%%") - return s - - -quote_replacer_regex = re.compile(r'(\\*)"') - - -def _EscapeCommandLineArgumentForMSVS(s): - """Escapes a Windows command-line argument. - - So that the Win32 CommandLineToArgv function will turn the escaped result back - into the original string. - See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx - ("Parsing C++ Command-Line Arguments") to understand why we have to do - this. - - Args: - s: the string to be escaped. - Returns: - the escaped string. - """ - - def _Replace(match): - # For a literal quote, CommandLineToArgv requires an odd number of - # backslashes preceding it, and it produces half as many literal backslashes - # (rounded down). So we need to produce 2n+1 backslashes. - return 2 * match.group(1) + '\\"' - - # Escape all quotes so that they are interpreted literally. - s = quote_replacer_regex.sub(_Replace, s) - # Now add unescaped quotes so that any whitespace is interpreted literally. - s = '"' + s + '"' - return s - - -delimiters_replacer_regex = re.compile(r"(\\*)([,;]+)") - - -def _EscapeVCProjCommandLineArgListItem(s): - """Escapes command line arguments for MSVS. - - The VCProj format stores string lists in a single string using commas and - semi-colons as separators, which must be quoted if they are to be - interpreted literally. However, command-line arguments may already have - quotes, and the VCProj parser is ignorant of the backslash escaping - convention used by CommandLineToArgv, so the command-line quotes and the - VCProj quotes may not be the same quotes. So to store a general - command-line argument in a VCProj list, we need to parse the existing - quoting according to VCProj's convention and quote any delimiters that are - not already quoted by that convention. The quotes that we add will also be - seen by CommandLineToArgv, so if backslashes precede them then we also have - to escape those backslashes according to the CommandLineToArgv - convention. - - Args: - s: the string to be escaped. - Returns: - the escaped string. - """ - - def _Replace(match): - # For a non-literal quote, CommandLineToArgv requires an even number of - # backslashes preceding it, and it produces half as many literal - # backslashes. So we need to produce 2n backslashes. - return 2 * match.group(1) + '"' + match.group(2) + '"' - - segments = s.split('"') - # The unquoted segments are at the even-numbered indices. - for i in range(0, len(segments), 2): - segments[i] = delimiters_replacer_regex.sub(_Replace, segments[i]) - # Concatenate back into a single string - s = '"'.join(segments) - if len(segments) % 2 == 0: - # String ends while still quoted according to VCProj's convention. This - # means the delimiter and the next list item that follow this one in the - # .vcproj file will be misinterpreted as part of this item. There is nothing - # we can do about this. Adding an extra quote would correct the problem in - # the VCProj but cause the same problem on the final command-line. Moving - # the item to the end of the list does works, but that's only possible if - # there's only one such item. Let's just warn the user. - print( - "Warning: MSVS may misinterpret the odd number of " + "quotes in " + s, - file=sys.stderr, - ) - return s - - -def _EscapeCppDefineForMSVS(s): - """Escapes a CPP define so that it will reach the compiler unaltered.""" - s = _EscapeEnvironmentVariableExpansion(s) - s = _EscapeCommandLineArgumentForMSVS(s) - s = _EscapeVCProjCommandLineArgListItem(s) - # cl.exe replaces literal # characters with = in preprocessor definitions for - # some reason. Octal-encode to work around that. - s = s.replace("#", "\\%03o" % ord("#")) - return s - - -quote_replacer_regex2 = re.compile(r'(\\+)"') - - -def _EscapeCommandLineArgumentForMSBuild(s): - """Escapes a Windows command-line argument for use by MSBuild.""" - - def _Replace(match): - return (len(match.group(1)) / 2 * 4) * "\\" + '\\"' - - # Escape all quotes so that they are interpreted literally. - s = quote_replacer_regex2.sub(_Replace, s) - return s - - -def _EscapeMSBuildSpecialCharacters(s): - escape_dictionary = { - "%": "%25", - "$": "%24", - "@": "%40", - "'": "%27", - ";": "%3B", - "?": "%3F", - "*": "%2A", - } - result = "".join([escape_dictionary.get(c, c) for c in s]) - return result - - -def _EscapeCppDefineForMSBuild(s): - """Escapes a CPP define so that it will reach the compiler unaltered.""" - s = _EscapeEnvironmentVariableExpansion(s) - s = _EscapeCommandLineArgumentForMSBuild(s) - s = _EscapeMSBuildSpecialCharacters(s) - # cl.exe replaces literal # characters with = in preprocessor definitions for - # some reason. Octal-encode to work around that. - s = s.replace("#", "\\%03o" % ord("#")) - return s - - -def _GenerateRulesForMSVS( - p, output_dir, options, spec, sources, excluded_sources, actions_to_add -): - """Generate all the rules for a particular project. - - Arguments: - p: the project - output_dir: directory to emit rules to - options: global options passed to the generator - spec: the specification for this project - sources: the set of all known source files in this project - excluded_sources: the set of sources excluded from normal processing - actions_to_add: deferred list of actions to add in - """ - rules = spec.get("rules", []) - rules_native = [r for r in rules if not int(r.get("msvs_external_rule", 0))] - rules_external = [r for r in rules if int(r.get("msvs_external_rule", 0))] - - # Handle rules that use a native rules file. - if rules_native: - _GenerateNativeRulesForMSVS(p, rules_native, output_dir, spec, options) - - # Handle external rules (non-native rules). - if rules_external: - _GenerateExternalRules( - rules_external, output_dir, spec, sources, options, actions_to_add - ) - _AdjustSourcesForRules(rules, sources, excluded_sources, False) - - -def _AdjustSourcesForRules(rules, sources, excluded_sources, is_msbuild): - # Add outputs generated by each rule (if applicable). - for rule in rules: - # Add in the outputs from this rule. - trigger_files = _FindRuleTriggerFiles(rule, sources) - for trigger_file in trigger_files: - # Remove trigger_file from excluded_sources to let the rule be triggered - # (e.g. rule trigger ax_enums.idl is added to excluded_sources - # because it's also in an action's inputs in the same project) - excluded_sources.discard(_FixPath(trigger_file)) - # Done if not processing outputs as sources. - if int(rule.get("process_outputs_as_sources", False)): - inputs, outputs = _RuleInputsAndOutputs(rule, trigger_file) - inputs = OrderedSet(_FixPaths(inputs)) - outputs = OrderedSet(_FixPaths(outputs)) - inputs.remove(_FixPath(trigger_file)) - sources.update(inputs) - if not is_msbuild: - excluded_sources.update(inputs) - sources.update(outputs) - - -def _FilterActionsFromExcluded(excluded_sources, actions_to_add): - """Take inputs with actions attached out of the list of exclusions. - - Arguments: - excluded_sources: list of source files not to be built. - actions_to_add: dict of actions keyed on source file they're attached to. - Returns: - excluded_sources with files that have actions attached removed. - """ - must_keep = OrderedSet(_FixPaths(actions_to_add.keys())) - return [s for s in excluded_sources if s not in must_keep] - - -def _GetDefaultConfiguration(spec): - return spec["configurations"][spec["default_configuration"]] - - -def _GetGuidOfProject(proj_path, spec): - """Get the guid for the project. - - Arguments: - proj_path: Path of the vcproj or vcxproj file to generate. - spec: The target dictionary containing the properties of the target. - Returns: - the guid. - Raises: - ValueError: if the specified GUID is invalid. - """ - # Pluck out the default configuration. - default_config = _GetDefaultConfiguration(spec) - # Decide the guid of the project. - guid = default_config.get("msvs_guid") - if guid: - if VALID_MSVS_GUID_CHARS.match(guid) is None: - raise ValueError( - 'Invalid MSVS guid: "%s". Must match regex: "%s".' - % (guid, VALID_MSVS_GUID_CHARS.pattern) - ) - guid = "{%s}" % guid - guid = guid or MSVSNew.MakeGuid(proj_path) - return guid - - -def _GetMsbuildToolsetOfProject(proj_path, spec, version): - """Get the platform toolset for the project. - - Arguments: - proj_path: Path of the vcproj or vcxproj file to generate. - spec: The target dictionary containing the properties of the target. - version: The MSVSVersion object. - Returns: - the platform toolset string or None. - """ - # Pluck out the default configuration. - default_config = _GetDefaultConfiguration(spec) - toolset = default_config.get("msbuild_toolset") - if not toolset and version.DefaultToolset(): - toolset = version.DefaultToolset() - if spec["type"] == "windows_driver": - toolset = "WindowsKernelModeDriver10.0" - return toolset - - -def _GenerateProject(project, options, version, generator_flags, spec): - """Generates a vcproj file. - - Arguments: - project: the MSVSProject object. - options: global generator options. - version: the MSVSVersion object. - generator_flags: dict of generator-specific flags. - Returns: - A list of source files that cannot be found on disk. - """ - default_config = _GetDefaultConfiguration(project.spec) - - # Skip emitting anything if told to with msvs_existing_vcproj option. - if default_config.get("msvs_existing_vcproj"): - return [] - - if version.UsesVcxproj(): - return _GenerateMSBuildProject(project, options, version, generator_flags, spec) - else: - return _GenerateMSVSProject(project, options, version, generator_flags) - - -def _GenerateMSVSProject(project, options, version, generator_flags): - """Generates a .vcproj file. It may create .rules and .user files too. - - Arguments: - project: The project object we will generate the file for. - options: Global options passed to the generator. - version: The VisualStudioVersion object. - generator_flags: dict of generator-specific flags. - """ - spec = project.spec - gyp.common.EnsureDirExists(project.path) - - platforms = _GetUniquePlatforms(spec) - p = MSVSProject.Writer( - project.path, version, spec["target_name"], project.guid, platforms - ) - - # Get directory project file is in. - project_dir = os.path.split(project.path)[0] - gyp_path = _NormalizedSource(project.build_file) - relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir) - - config_type = _GetMSVSConfigurationType(spec, project.build_file) - for config_name, config in spec["configurations"].items(): - _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config) - - # Prepare list of sources and excluded sources. - gyp_file = os.path.split(project.build_file)[1] - sources, excluded_sources = _PrepareListOfSources(spec, generator_flags, gyp_file) - - # Add rules. - actions_to_add = {} - _GenerateRulesForMSVS( - p, project_dir, options, spec, sources, excluded_sources, actions_to_add - ) - list_excluded = generator_flags.get("msvs_list_excluded_files", True) - sources, excluded_sources, excluded_idl = _AdjustSourcesAndConvertToFilterHierarchy( - spec, options, project_dir, sources, excluded_sources, list_excluded, version - ) - - # Add in files. - missing_sources = _VerifySourcesExist(sources, project_dir) - p.AddFiles(sources) - - _AddToolFilesToMSVS(p, spec) - _HandlePreCompiledHeaders(p, sources, spec) - _AddActions(actions_to_add, spec, relative_path_of_gyp_file) - _AddCopies(actions_to_add, spec) - _WriteMSVSUserFile(project.path, version, spec) - - # NOTE: this stanza must appear after all actions have been decided. - # Don't excluded sources with actions attached, or they won't run. - excluded_sources = _FilterActionsFromExcluded(excluded_sources, actions_to_add) - _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl, list_excluded) - _AddAccumulatedActionsToMSVS(p, spec, actions_to_add) - - # Write it out. - p.WriteIfChanged() - - return missing_sources - - -def _GetUniquePlatforms(spec): - """Returns the list of unique platforms for this spec, e.g ['win32', ...]. - - Arguments: - spec: The target dictionary containing the properties of the target. - Returns: - The MSVSUserFile object created. - """ - # Gather list of unique platforms. - platforms = OrderedSet() - for configuration in spec["configurations"]: - platforms.add(_ConfigPlatform(spec["configurations"][configuration])) - platforms = list(platforms) - return platforms - - -def _CreateMSVSUserFile(proj_path, version, spec): - """Generates a .user file for the user running this Gyp program. - - Arguments: - proj_path: The path of the project file being created. The .user file - shares the same path (with an appropriate suffix). - version: The VisualStudioVersion object. - spec: The target dictionary containing the properties of the target. - Returns: - The MSVSUserFile object created. - """ - (domain, username) = _GetDomainAndUserName() - vcuser_filename = ".".join([proj_path, domain, username, "user"]) - user_file = MSVSUserFile.Writer(vcuser_filename, version, spec["target_name"]) - return user_file - - -def _GetMSVSConfigurationType(spec, build_file): - """Returns the configuration type for this project. - - It's a number defined by Microsoft. May raise an exception. - - Args: - spec: The target dictionary containing the properties of the target. - build_file: The path of the gyp file. - Returns: - An integer, the configuration type. - """ - try: - config_type = { - "executable": "1", # .exe - "shared_library": "2", # .dll - "loadable_module": "2", # .dll - "static_library": "4", # .lib - "windows_driver": "5", # .sys - "none": "10", # Utility type - }[spec["type"]] - except KeyError: - if spec.get("type"): - raise GypError( - "Target type %s is not a valid target type for " - "target %s in %s." % (spec["type"], spec["target_name"], build_file) - ) - else: - raise GypError( - "Missing type field for target %s in %s." - % (spec["target_name"], build_file) - ) - return config_type - - -def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config): - """Adds a configuration to the MSVS project. - - Many settings in a vcproj file are specific to a configuration. This - function the main part of the vcproj file that's configuration specific. - - Arguments: - p: The target project being generated. - spec: The target dictionary containing the properties of the target. - config_type: The configuration type, a number as defined by Microsoft. - config_name: The name of the configuration. - config: The dictionary that defines the special processing to be done - for this configuration. - """ - # Get the information for this configuration - include_dirs, midl_include_dirs, resource_include_dirs = _GetIncludeDirs(config) - libraries = _GetLibraries(spec) - library_dirs = _GetLibraryDirs(config) - out_file, vc_tool, _ = _GetOutputFilePathAndTool(spec, msbuild=False) - defines = _GetDefines(config) - defines = [_EscapeCppDefineForMSVS(d) for d in defines] - disabled_warnings = _GetDisabledWarnings(config) - prebuild = config.get("msvs_prebuild") - postbuild = config.get("msvs_postbuild") - def_file = _GetModuleDefinition(spec) - precompiled_header = config.get("msvs_precompiled_header") - - # Prepare the list of tools as a dictionary. - tools = dict() - # Add in user specified msvs_settings. - msvs_settings = config.get("msvs_settings", {}) - MSVSSettings.ValidateMSVSSettings(msvs_settings) - - # Prevent default library inheritance from the environment. - _ToolAppend(tools, "VCLinkerTool", "AdditionalDependencies", ["$(NOINHERIT)"]) - - for tool in msvs_settings: - settings = config["msvs_settings"][tool] - for setting in settings: - _ToolAppend(tools, tool, setting, settings[setting]) - # Add the information to the appropriate tool - _ToolAppend(tools, "VCCLCompilerTool", "AdditionalIncludeDirectories", include_dirs) - _ToolAppend(tools, "VCMIDLTool", "AdditionalIncludeDirectories", midl_include_dirs) - _ToolAppend( - tools, - "VCResourceCompilerTool", - "AdditionalIncludeDirectories", - resource_include_dirs, - ) - # Add in libraries. - _ToolAppend(tools, "VCLinkerTool", "AdditionalDependencies", libraries) - _ToolAppend(tools, "VCLinkerTool", "AdditionalLibraryDirectories", library_dirs) - if out_file: - _ToolAppend(tools, vc_tool, "OutputFile", out_file, only_if_unset=True) - # Add defines. - _ToolAppend(tools, "VCCLCompilerTool", "PreprocessorDefinitions", defines) - _ToolAppend(tools, "VCResourceCompilerTool", "PreprocessorDefinitions", defines) - # Change program database directory to prevent collisions. - _ToolAppend( - tools, - "VCCLCompilerTool", - "ProgramDataBaseFileName", - "$(IntDir)$(ProjectName)\\vc80.pdb", - only_if_unset=True, - ) - # Add disabled warnings. - _ToolAppend(tools, "VCCLCompilerTool", "DisableSpecificWarnings", disabled_warnings) - # Add Pre-build. - _ToolAppend(tools, "VCPreBuildEventTool", "CommandLine", prebuild) - # Add Post-build. - _ToolAppend(tools, "VCPostBuildEventTool", "CommandLine", postbuild) - # Turn on precompiled headers if appropriate. - if precompiled_header: - precompiled_header = os.path.split(precompiled_header)[1] - _ToolAppend(tools, "VCCLCompilerTool", "UsePrecompiledHeader", "2") - _ToolAppend( - tools, "VCCLCompilerTool", "PrecompiledHeaderThrough", precompiled_header - ) - _ToolAppend(tools, "VCCLCompilerTool", "ForcedIncludeFiles", precompiled_header) - # Loadable modules don't generate import libraries; - # tell dependent projects to not expect one. - if spec["type"] == "loadable_module": - _ToolAppend(tools, "VCLinkerTool", "IgnoreImportLibrary", "true") - # Set the module definition file if any. - if def_file: - _ToolAppend(tools, "VCLinkerTool", "ModuleDefinitionFile", def_file) - - _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name) - - -def _GetIncludeDirs(config): - """Returns the list of directories to be used for #include directives. - - Arguments: - config: The dictionary that defines the special processing to be done - for this configuration. - Returns: - The list of directory paths. - """ - # TODO(bradnelson): include_dirs should really be flexible enough not to - # require this sort of thing. - include_dirs = config.get("include_dirs", []) + config.get( - "msvs_system_include_dirs", [] - ) - midl_include_dirs = config.get("midl_include_dirs", []) + config.get( - "msvs_system_include_dirs", [] - ) - resource_include_dirs = config.get("resource_include_dirs", include_dirs) - include_dirs = _FixPaths(include_dirs) - midl_include_dirs = _FixPaths(midl_include_dirs) - resource_include_dirs = _FixPaths(resource_include_dirs) - return include_dirs, midl_include_dirs, resource_include_dirs - - -def _GetLibraryDirs(config): - """Returns the list of directories to be used for library search paths. - - Arguments: - config: The dictionary that defines the special processing to be done - for this configuration. - Returns: - The list of directory paths. - """ - - library_dirs = config.get("library_dirs", []) - library_dirs = _FixPaths(library_dirs) - return library_dirs - - -def _GetLibraries(spec): - """Returns the list of libraries for this configuration. - - Arguments: - spec: The target dictionary containing the properties of the target. - Returns: - The list of directory paths. - """ - libraries = spec.get("libraries", []) - # Strip out -l, as it is not used on windows (but is needed so we can pass - # in libraries that are assumed to be in the default library path). - # Also remove duplicate entries, leaving only the last duplicate, while - # preserving order. - found = OrderedSet() - unique_libraries_list = [] - for entry in reversed(libraries): - library = re.sub(r"^\-l", "", entry) - if not os.path.splitext(library)[1]: - library += ".lib" - if library not in found: - found.add(library) - unique_libraries_list.append(library) - unique_libraries_list.reverse() - return unique_libraries_list - - -def _GetOutputFilePathAndTool(spec, msbuild): - """Returns the path and tool to use for this target. - - Figures out the path of the file this spec will create and the name of - the VC tool that will create it. - - Arguments: - spec: The target dictionary containing the properties of the target. - Returns: - A triple of (file path, name of the vc tool, name of the msbuild tool) - """ - # Select a name for the output file. - out_file = "" - vc_tool = "" - msbuild_tool = "" - output_file_map = { - "executable": ("VCLinkerTool", "Link", "$(OutDir)", ".exe"), - "shared_library": ("VCLinkerTool", "Link", "$(OutDir)", ".dll"), - "loadable_module": ("VCLinkerTool", "Link", "$(OutDir)", ".dll"), - "windows_driver": ("VCLinkerTool", "Link", "$(OutDir)", ".sys"), - "static_library": ("VCLibrarianTool", "Lib", "$(OutDir)lib\\", ".lib"), - } - output_file_props = output_file_map.get(spec["type"]) - if output_file_props and int(spec.get("msvs_auto_output_file", 1)): - vc_tool, msbuild_tool, out_dir, suffix = output_file_props - if spec.get("standalone_static_library", 0): - out_dir = "$(OutDir)" - out_dir = spec.get("product_dir", out_dir) - product_extension = spec.get("product_extension") - if product_extension: - suffix = "." + product_extension - elif msbuild: - suffix = "$(TargetExt)" - prefix = spec.get("product_prefix", "") - product_name = spec.get("product_name", "$(ProjectName)") - out_file = ntpath.join(out_dir, prefix + product_name + suffix) - return out_file, vc_tool, msbuild_tool - - -def _GetOutputTargetExt(spec): - """Returns the extension for this target, including the dot - - If product_extension is specified, set target_extension to this to avoid - MSB8012, returns None otherwise. Ignores any target_extension settings in - the input files. - - Arguments: - spec: The target dictionary containing the properties of the target. - Returns: - A string with the extension, or None - """ - target_extension = spec.get("product_extension") - if target_extension: - return "." + target_extension - return None - - -def _GetDefines(config): - """Returns the list of preprocessor definitions for this configuration. - - Arguments: - config: The dictionary that defines the special processing to be done - for this configuration. - Returns: - The list of preprocessor definitions. - """ - defines = [] - for d in config.get("defines", []): - if type(d) == list: - fd = "=".join([str(dpart) for dpart in d]) - else: - fd = str(d) - defines.append(fd) - return defines - - -def _GetDisabledWarnings(config): - return [str(i) for i in config.get("msvs_disabled_warnings", [])] - - -def _GetModuleDefinition(spec): - def_file = "" - if spec["type"] in [ - "shared_library", - "loadable_module", - "executable", - "windows_driver", - ]: - def_files = [s for s in spec.get("sources", []) if s.endswith(".def")] - if len(def_files) == 1: - def_file = _FixPath(def_files[0]) - elif def_files: - raise ValueError( - "Multiple module definition files in one target, target %s lists " - "multiple .def files: %s" % (spec["target_name"], " ".join(def_files)) - ) - return def_file - - -def _ConvertToolsToExpectedForm(tools): - """Convert tools to a form expected by Visual Studio. - - Arguments: - tools: A dictionary of settings; the tool name is the key. - Returns: - A list of Tool objects. - """ - tool_list = [] - for tool, settings in tools.items(): - # Collapse settings with lists. - settings_fixed = {} - for setting, value in settings.items(): - if type(value) == list: - if ( - tool == "VCLinkerTool" and setting == "AdditionalDependencies" - ) or setting == "AdditionalOptions": - settings_fixed[setting] = " ".join(value) - else: - settings_fixed[setting] = ";".join(value) - else: - settings_fixed[setting] = value - # Add in this tool. - tool_list.append(MSVSProject.Tool(tool, settings_fixed)) - return tool_list - - -def _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name): - """Add to the project file the configuration specified by config. - - Arguments: - p: The target project being generated. - spec: the target project dict. - tools: A dictionary of settings; the tool name is the key. - config: The dictionary that defines the special processing to be done - for this configuration. - config_type: The configuration type, a number as defined by Microsoft. - config_name: The name of the configuration. - """ - attributes = _GetMSVSAttributes(spec, config, config_type) - # Add in this configuration. - tool_list = _ConvertToolsToExpectedForm(tools) - p.AddConfig(_ConfigFullName(config_name, config), attrs=attributes, tools=tool_list) - - -def _GetMSVSAttributes(spec, config, config_type): - # Prepare configuration attributes. - prepared_attrs = {} - source_attrs = config.get("msvs_configuration_attributes", {}) - for a in source_attrs: - prepared_attrs[a] = source_attrs[a] - # Add props files. - vsprops_dirs = config.get("msvs_props", []) - vsprops_dirs = _FixPaths(vsprops_dirs) - if vsprops_dirs: - prepared_attrs["InheritedPropertySheets"] = ";".join(vsprops_dirs) - # Set configuration type. - prepared_attrs["ConfigurationType"] = config_type - output_dir = prepared_attrs.get( - "OutputDirectory", "$(SolutionDir)$(ConfigurationName)" - ) - prepared_attrs["OutputDirectory"] = _FixPath(output_dir) + "\\" - if "IntermediateDirectory" not in prepared_attrs: - intermediate = "$(ConfigurationName)\\obj\\$(ProjectName)" - prepared_attrs["IntermediateDirectory"] = _FixPath(intermediate) + "\\" - else: - intermediate = _FixPath(prepared_attrs["IntermediateDirectory"]) + "\\" - intermediate = MSVSSettings.FixVCMacroSlashes(intermediate) - prepared_attrs["IntermediateDirectory"] = intermediate - return prepared_attrs - - -def _AddNormalizedSources(sources_set, sources_array): - sources_set.update(_NormalizedSource(s) for s in sources_array) - - -def _PrepareListOfSources(spec, generator_flags, gyp_file): - """Prepare list of sources and excluded sources. - - Besides the sources specified directly in the spec, adds the gyp file so - that a change to it will cause a re-compile. Also adds appropriate sources - for actions and copies. Assumes later stage will un-exclude files which - have custom build steps attached. - - Arguments: - spec: The target dictionary containing the properties of the target. - gyp_file: The name of the gyp file. - Returns: - A pair of (list of sources, list of excluded sources). - The sources will be relative to the gyp file. - """ - sources = OrderedSet() - _AddNormalizedSources(sources, spec.get("sources", [])) - excluded_sources = OrderedSet() - # Add in the gyp file. - if not generator_flags.get("standalone"): - sources.add(gyp_file) - - # Add in 'action' inputs and outputs. - for a in spec.get("actions", []): - inputs = a["inputs"] - inputs = [_NormalizedSource(i) for i in inputs] - # Add all inputs to sources and excluded sources. - inputs = OrderedSet(inputs) - sources.update(inputs) - if not spec.get("msvs_external_builder"): - excluded_sources.update(inputs) - if int(a.get("process_outputs_as_sources", False)): - _AddNormalizedSources(sources, a.get("outputs", [])) - # Add in 'copies' inputs and outputs. - for cpy in spec.get("copies", []): - _AddNormalizedSources(sources, cpy.get("files", [])) - return (sources, excluded_sources) - - -def _AdjustSourcesAndConvertToFilterHierarchy( - spec, options, gyp_dir, sources, excluded_sources, list_excluded, version -): - """Adjusts the list of sources and excluded sources. - - Also converts the sets to lists. - - Arguments: - spec: The target dictionary containing the properties of the target. - options: Global generator options. - gyp_dir: The path to the gyp file being processed. - sources: A set of sources to be included for this project. - excluded_sources: A set of sources to be excluded for this project. - version: A MSVSVersion object. - Returns: - A trio of (list of sources, list of excluded sources, - path of excluded IDL file) - """ - # Exclude excluded sources coming into the generator. - excluded_sources.update(OrderedSet(spec.get("sources_excluded", []))) - # Add excluded sources into sources for good measure. - sources.update(excluded_sources) - # Convert to proper windows form. - # NOTE: sources goes from being a set to a list here. - # NOTE: excluded_sources goes from being a set to a list here. - sources = _FixPaths(sources) - # Convert to proper windows form. - excluded_sources = _FixPaths(excluded_sources) - - excluded_idl = _IdlFilesHandledNonNatively(spec, sources) - - precompiled_related = _GetPrecompileRelatedFiles(spec) - # Find the excluded ones, minus the precompiled header related ones. - fully_excluded = [i for i in excluded_sources if i not in precompiled_related] - - # Convert to folders and the right slashes. - sources = [i.split("\\") for i in sources] - sources = _ConvertSourcesToFilterHierarchy( - sources, - excluded=fully_excluded, - list_excluded=list_excluded, - msvs_version=version, - ) - - # Prune filters with a single child to flatten ugly directory structures - # such as ../../src/modules/module1 etc. - if version.UsesVcxproj(): - while ( - all([isinstance(s, MSVSProject.Filter) for s in sources]) - and len({s.name for s in sources}) == 1 - ): - assert all([len(s.contents) == 1 for s in sources]) - sources = [s.contents[0] for s in sources] - else: - while len(sources) == 1 and isinstance(sources[0], MSVSProject.Filter): - sources = sources[0].contents - - return sources, excluded_sources, excluded_idl - - -def _IdlFilesHandledNonNatively(spec, sources): - # If any non-native rules use 'idl' as an extension exclude idl files. - # Gather a list here to use later. - using_idl = False - for rule in spec.get("rules", []): - if rule["extension"] == "idl" and int(rule.get("msvs_external_rule", 0)): - using_idl = True - break - if using_idl: - excluded_idl = [i for i in sources if i.endswith(".idl")] - else: - excluded_idl = [] - return excluded_idl - - -def _GetPrecompileRelatedFiles(spec): - # Gather a list of precompiled header related sources. - precompiled_related = [] - for _, config in spec["configurations"].items(): - for k in precomp_keys: - f = config.get(k) - if f: - precompiled_related.append(_FixPath(f)) - return precompiled_related - - -def _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl, list_excluded): - exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl) - for file_name, excluded_configs in exclusions.items(): - if not list_excluded and len(excluded_configs) == len(spec["configurations"]): - # If we're not listing excluded files, then they won't appear in the - # project, so don't try to configure them to be excluded. - pass - else: - for config_name, config in excluded_configs: - p.AddFileConfig( - file_name, - _ConfigFullName(config_name, config), - {"ExcludedFromBuild": "true"}, - ) - - -def _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl): - exclusions = {} - # Exclude excluded sources from being built. - for f in excluded_sources: - excluded_configs = [] - for config_name, config in spec["configurations"].items(): - precomped = [_FixPath(config.get(i, "")) for i in precomp_keys] - # Don't do this for ones that are precompiled header related. - if f not in precomped: - excluded_configs.append((config_name, config)) - exclusions[f] = excluded_configs - # If any non-native rules use 'idl' as an extension exclude idl files. - # Exclude them now. - for f in excluded_idl: - excluded_configs = [] - for config_name, config in spec["configurations"].items(): - excluded_configs.append((config_name, config)) - exclusions[f] = excluded_configs - return exclusions - - -def _AddToolFilesToMSVS(p, spec): - # Add in tool files (rules). - tool_files = OrderedSet() - for _, config in spec["configurations"].items(): - for f in config.get("msvs_tool_files", []): - tool_files.add(f) - for f in tool_files: - p.AddToolFile(f) - - -def _HandlePreCompiledHeaders(p, sources, spec): - # Pre-compiled header source stubs need a different compiler flag - # (generate precompiled header) and any source file not of the same - # kind (i.e. C vs. C++) as the precompiled header source stub needs - # to have use of precompiled headers disabled. - extensions_excluded_from_precompile = [] - for config_name, config in spec["configurations"].items(): - source = config.get("msvs_precompiled_source") - if source: - source = _FixPath(source) - # UsePrecompiledHeader=1 for if using precompiled headers. - tool = MSVSProject.Tool("VCCLCompilerTool", {"UsePrecompiledHeader": "1"}) - p.AddFileConfig( - source, _ConfigFullName(config_name, config), {}, tools=[tool] - ) - basename, extension = os.path.splitext(source) - if extension == ".c": - extensions_excluded_from_precompile = [".cc", ".cpp", ".cxx"] - else: - extensions_excluded_from_precompile = [".c"] - - def DisableForSourceTree(source_tree): - for source in source_tree: - if isinstance(source, MSVSProject.Filter): - DisableForSourceTree(source.contents) - else: - basename, extension = os.path.splitext(source) - if extension in extensions_excluded_from_precompile: - for config_name, config in spec["configurations"].items(): - tool = MSVSProject.Tool( - "VCCLCompilerTool", - { - "UsePrecompiledHeader": "0", - "ForcedIncludeFiles": "$(NOINHERIT)", - }, - ) - p.AddFileConfig( - _FixPath(source), - _ConfigFullName(config_name, config), - {}, - tools=[tool], - ) - - # Do nothing if there was no precompiled source. - if extensions_excluded_from_precompile: - DisableForSourceTree(sources) - - -def _AddActions(actions_to_add, spec, relative_path_of_gyp_file): - # Add actions. - actions = spec.get("actions", []) - # Don't setup_env every time. When all the actions are run together in one - # batch file in VS, the PATH will grow too long. - # Membership in this set means that the cygwin environment has been set up, - # and does not need to be set up again. - have_setup_env = set() - for a in actions: - # Attach actions to the gyp file if nothing else is there. - inputs = a.get("inputs") or [relative_path_of_gyp_file] - attached_to = inputs[0] - need_setup_env = attached_to not in have_setup_env - cmd = _BuildCommandLineForRule( - spec, a, has_input_path=False, do_setup_env=need_setup_env - ) - have_setup_env.add(attached_to) - # Add the action. - _AddActionStep( - actions_to_add, - inputs=inputs, - outputs=a.get("outputs", []), - description=a.get("message", a["action_name"]), - command=cmd, - ) - - -def _WriteMSVSUserFile(project_path, version, spec): - # Add run_as and test targets. - if "run_as" in spec: - run_as = spec["run_as"] - action = run_as.get("action", []) - environment = run_as.get("environment", []) - working_directory = run_as.get("working_directory", ".") - elif int(spec.get("test", 0)): - action = ["$(TargetPath)", "--gtest_print_time"] - environment = [] - working_directory = "." - else: - return # Nothing to add - # Write out the user file. - user_file = _CreateMSVSUserFile(project_path, version, spec) - for config_name, c_data in spec["configurations"].items(): - user_file.AddDebugSettings( - _ConfigFullName(config_name, c_data), action, environment, working_directory - ) - user_file.WriteIfChanged() - - -def _AddCopies(actions_to_add, spec): - copies = _GetCopies(spec) - for inputs, outputs, cmd, description in copies: - _AddActionStep( - actions_to_add, - inputs=inputs, - outputs=outputs, - description=description, - command=cmd, - ) - - -def _GetCopies(spec): - copies = [] - # Add copies. - for cpy in spec.get("copies", []): - for src in cpy.get("files", []): - dst = os.path.join(cpy["destination"], os.path.basename(src)) - # _AddCustomBuildToolForMSVS() will call _FixPath() on the inputs and - # outputs, so do the same for our generated command line. - if src.endswith("/"): - src_bare = src[:-1] - base_dir = posixpath.split(src_bare)[0] - outer_dir = posixpath.split(src_bare)[1] - fixed_dst = _FixPath(dst) - full_dst = f'"{fixed_dst}\\{outer_dir}\\"' - cmd = 'mkdir {} 2>nul & cd "{}" && xcopy /e /f /y "{}" {}'.format( - full_dst, - _FixPath(base_dir), - outer_dir, - full_dst, - ) - copies.append( - ( - [src], - ["dummy_copies", dst], - cmd, - f"Copying {src} to {fixed_dst}", - ) - ) - else: - fix_dst = _FixPath(cpy["destination"]) - cmd = 'mkdir "{}" 2>nul & set ERRORLEVEL=0 & copy /Y "{}" "{}"'.format( - fix_dst, - _FixPath(src), - _FixPath(dst), - ) - copies.append(([src], [dst], cmd, f"Copying {src} to {fix_dst}")) - return copies - - -def _GetPathDict(root, path): - # |path| will eventually be empty (in the recursive calls) if it was initially - # relative; otherwise it will eventually end up as '\', 'D:\', etc. - if not path or path.endswith(os.sep): - return root - parent, folder = os.path.split(path) - parent_dict = _GetPathDict(root, parent) - if folder not in parent_dict: - parent_dict[folder] = dict() - return parent_dict[folder] - - -def _DictsToFolders(base_path, bucket, flat): - # Convert to folders recursively. - children = [] - for folder, contents in bucket.items(): - if type(contents) == dict: - folder_children = _DictsToFolders( - os.path.join(base_path, folder), contents, flat - ) - if flat: - children += folder_children - else: - folder_children = MSVSNew.MSVSFolder( - os.path.join(base_path, folder), - name="(" + folder + ")", - entries=folder_children, - ) - children.append(folder_children) - else: - children.append(contents) - return children - - -def _CollapseSingles(parent, node): - # Recursively explorer the tree of dicts looking for projects which are - # the sole item in a folder which has the same name as the project. Bring - # such projects up one level. - if type(node) == dict and len(node) == 1 and next(iter(node)) == parent + ".vcproj": - return node[next(iter(node))] - if type(node) != dict: - return node - for child in node: - node[child] = _CollapseSingles(child, node[child]) - return node - - -def _GatherSolutionFolders(sln_projects, project_objects, flat): - root = {} - # Convert into a tree of dicts on path. - for p in sln_projects: - gyp_file, target = gyp.common.ParseQualifiedTarget(p)[0:2] - if p.endswith("#host"): - target += "_host" - gyp_dir = os.path.dirname(gyp_file) - path_dict = _GetPathDict(root, gyp_dir) - path_dict[target + ".vcproj"] = project_objects[p] - # Walk down from the top until we hit a folder that has more than one entry. - # In practice, this strips the top-level "src/" dir from the hierarchy in - # the solution. - while len(root) == 1 and type(root[next(iter(root))]) == dict: - root = root[next(iter(root))] - # Collapse singles. - root = _CollapseSingles("", root) - # Merge buckets until everything is a root entry. - return _DictsToFolders("", root, flat) - - -def _GetPathOfProject(qualified_target, spec, options, msvs_version): - default_config = _GetDefaultConfiguration(spec) - proj_filename = default_config.get("msvs_existing_vcproj") - if not proj_filename: - proj_filename = spec["target_name"] - if spec["toolset"] == "host": - proj_filename += "_host" - proj_filename = proj_filename + options.suffix + msvs_version.ProjectExtension() - - build_file = gyp.common.BuildFile(qualified_target) - proj_path = os.path.join(os.path.dirname(build_file), proj_filename) - fix_prefix = None - if options.generator_output: - project_dir_path = os.path.dirname(os.path.abspath(proj_path)) - proj_path = os.path.join(options.generator_output, proj_path) - fix_prefix = gyp.common.RelativePath( - project_dir_path, os.path.dirname(proj_path) - ) - return proj_path, fix_prefix - - -def _GetPlatformOverridesOfProject(spec): - # Prepare a dict indicating which project configurations are used for which - # solution configurations for this target. - config_platform_overrides = {} - for config_name, c in spec["configurations"].items(): - config_fullname = _ConfigFullName(config_name, c) - platform = c.get("msvs_target_platform", _ConfigPlatform(c)) - fixed_config_fullname = "{}|{}".format( - _ConfigBaseName(config_name, _ConfigPlatform(c)), - platform, - ) - if spec["toolset"] == "host" and generator_supports_multiple_toolsets: - fixed_config_fullname = f"{config_name}|x64" - config_platform_overrides[config_fullname] = fixed_config_fullname - return config_platform_overrides - - -def _CreateProjectObjects(target_list, target_dicts, options, msvs_version): - """Create a MSVSProject object for the targets found in target list. - - Arguments: - target_list: the list of targets to generate project objects for. - target_dicts: the dictionary of specifications. - options: global generator options. - msvs_version: the MSVSVersion object. - Returns: - A set of created projects, keyed by target. - """ - global fixpath_prefix - # Generate each project. - projects = {} - for qualified_target in target_list: - spec = target_dicts[qualified_target] - proj_path, fixpath_prefix = _GetPathOfProject( - qualified_target, spec, options, msvs_version - ) - guid = _GetGuidOfProject(proj_path, spec) - overrides = _GetPlatformOverridesOfProject(spec) - build_file = gyp.common.BuildFile(qualified_target) - # Create object for this project. - target_name = spec["target_name"] - if spec["toolset"] == "host": - target_name += "_host" - obj = MSVSNew.MSVSProject( - proj_path, - name=target_name, - guid=guid, - spec=spec, - build_file=build_file, - config_platform_overrides=overrides, - fixpath_prefix=fixpath_prefix, - ) - # Set project toolset if any (MS build only) - if msvs_version.UsesVcxproj(): - obj.set_msbuild_toolset( - _GetMsbuildToolsetOfProject(proj_path, spec, msvs_version) - ) - projects[qualified_target] = obj - # Set all the dependencies, but not if we are using an external builder like - # ninja - for project in projects.values(): - if not project.spec.get("msvs_external_builder"): - deps = project.spec.get("dependencies", []) - deps = [projects[d] for d in deps] - project.set_dependencies(deps) - return projects - - -def _InitNinjaFlavor(params, target_list, target_dicts): - """Initialize targets for the ninja flavor. - - This sets up the necessary variables in the targets to generate msvs projects - that use ninja as an external builder. The variables in the spec are only set - if they have not been set. This allows individual specs to override the - default values initialized here. - Arguments: - params: Params provided to the generator. - target_list: List of target pairs: 'base/base.gyp:base'. - target_dicts: Dict of target properties keyed on target pair. - """ - for qualified_target in target_list: - spec = target_dicts[qualified_target] - if spec.get("msvs_external_builder"): - # The spec explicitly defined an external builder, so don't change it. - continue - - path_to_ninja = spec.get("msvs_path_to_ninja", "ninja.exe") - - spec["msvs_external_builder"] = "ninja" - if not spec.get("msvs_external_builder_out_dir"): - gyp_file, _, _ = gyp.common.ParseQualifiedTarget(qualified_target) - gyp_dir = os.path.dirname(gyp_file) - configuration = "$(Configuration)" - if params.get("target_arch") == "x64": - configuration += "_x64" - if params.get("target_arch") == "arm64": - configuration += "_arm64" - spec["msvs_external_builder_out_dir"] = os.path.join( - gyp.common.RelativePath(params["options"].toplevel_dir, gyp_dir), - ninja_generator.ComputeOutputDir(params), - configuration, - ) - if not spec.get("msvs_external_builder_build_cmd"): - spec["msvs_external_builder_build_cmd"] = [ - path_to_ninja, - "-C", - "$(OutDir)", - "$(ProjectName)", - ] - if not spec.get("msvs_external_builder_clean_cmd"): - spec["msvs_external_builder_clean_cmd"] = [ - path_to_ninja, - "-C", - "$(OutDir)", - "-tclean", - "$(ProjectName)", - ] - - -def CalculateVariables(default_variables, params): - """Generated variables that require params to be known.""" - - generator_flags = params.get("generator_flags", {}) - - # Select project file format version (if unset, default to auto detecting). - msvs_version = MSVSVersion.SelectVisualStudioVersion( - generator_flags.get("msvs_version", "auto") - ) - # Stash msvs_version for later (so we don't have to probe the system twice). - params["msvs_version"] = msvs_version - - # Set a variable so conditions can be based on msvs_version. - default_variables["MSVS_VERSION"] = msvs_version.ShortName() - - # To determine processor word size on Windows, in addition to checking - # PROCESSOR_ARCHITECTURE (which reflects the word size of the current - # process), it is also necessary to check PROCESSOR_ARCITEW6432 (which - # contains the actual word size of the system when running thru WOW64). - if ( - os.environ.get("PROCESSOR_ARCHITECTURE", "").find("64") >= 0 - or os.environ.get("PROCESSOR_ARCHITEW6432", "").find("64") >= 0 - ): - default_variables["MSVS_OS_BITS"] = 64 - else: - default_variables["MSVS_OS_BITS"] = 32 - - if gyp.common.GetFlavor(params) == "ninja": - default_variables["SHARED_INTERMEDIATE_DIR"] = "$(OutDir)gen" - - -def PerformBuild(data, configurations, params): - options = params["options"] - msvs_version = params["msvs_version"] - devenv = os.path.join(msvs_version.path, "Common7", "IDE", "devenv.com") - - for build_file, build_file_dict in data.items(): - (build_file_root, build_file_ext) = os.path.splitext(build_file) - if build_file_ext != ".gyp": - continue - sln_path = build_file_root + options.suffix + ".sln" - if options.generator_output: - sln_path = os.path.join(options.generator_output, sln_path) - - for config in configurations: - arguments = [devenv, sln_path, "/Build", config] - print(f"Building [{config}]: {arguments}") - subprocess.check_call(arguments) - - -def CalculateGeneratorInputInfo(params): - if params.get("flavor") == "ninja": - toplevel = params["options"].toplevel_dir - qualified_out_dir = os.path.normpath( - os.path.join( - toplevel, - ninja_generator.ComputeOutputDir(params), - "gypfiles-msvs-ninja", - ) - ) - - global generator_filelist_paths - generator_filelist_paths = { - "toplevel": toplevel, - "qualified_out_dir": qualified_out_dir, - } - - -def GenerateOutput(target_list, target_dicts, data, params): - """Generate .sln and .vcproj files. - - This is the entry point for this generator. - Arguments: - target_list: List of target pairs: 'base/base.gyp:base'. - target_dicts: Dict of target properties keyed on target pair. - data: Dictionary containing per .gyp data. - """ - global fixpath_prefix - - options = params["options"] - - # Get the project file format version back out of where we stashed it in - # GeneratorCalculatedVariables. - msvs_version = params["msvs_version"] - - generator_flags = params.get("generator_flags", {}) - - # Optionally shard targets marked with 'msvs_shard': SHARD_COUNT. - (target_list, target_dicts) = MSVSUtil.ShardTargets(target_list, target_dicts) - - # Optionally use the large PDB workaround for targets marked with - # 'msvs_large_pdb': 1. - (target_list, target_dicts) = MSVSUtil.InsertLargePdbShims( - target_list, target_dicts, generator_default_variables - ) - - # Optionally configure each spec to use ninja as the external builder. - if params.get("flavor") == "ninja": - _InitNinjaFlavor(params, target_list, target_dicts) - - # Prepare the set of configurations. - configs = set() - for qualified_target in target_list: - spec = target_dicts[qualified_target] - for config_name, config in spec["configurations"].items(): - config_name = _ConfigFullName(config_name, config) - configs.add(config_name) - if config_name == "Release|arm64": - configs.add("Release|x64") - configs = list(configs) - - # Figure out all the projects that will be generated and their guids - project_objects = _CreateProjectObjects( - target_list, target_dicts, options, msvs_version - ) - - # Generate each project. - missing_sources = [] - for project in project_objects.values(): - fixpath_prefix = project.fixpath_prefix - missing_sources.extend( - _GenerateProject(project, options, msvs_version, generator_flags, spec) - ) - fixpath_prefix = None - - for build_file in data: - # Validate build_file extension - target_only_configs = configs - if generator_supports_multiple_toolsets: - target_only_configs = [i for i in configs if i.endswith("arm64")] - if not build_file.endswith(".gyp"): - continue - sln_path = os.path.splitext(build_file)[0] + options.suffix + ".sln" - if options.generator_output: - sln_path = os.path.join(options.generator_output, sln_path) - # Get projects in the solution, and their dependents. - sln_projects = gyp.common.BuildFileTargets(target_list, build_file) - sln_projects += gyp.common.DeepDependencyTargets(target_dicts, sln_projects) - # Create folder hierarchy. - root_entries = _GatherSolutionFolders( - sln_projects, project_objects, flat=msvs_version.FlatSolution() - ) - # Create solution. - sln = MSVSNew.MSVSSolution( - sln_path, - entries=root_entries, - variants=target_only_configs, - websiteProperties=False, - version=msvs_version, - ) - sln.Write() - - if missing_sources: - error_message = "Missing input files:\n" + "\n".join(set(missing_sources)) - if generator_flags.get("msvs_error_on_missing_sources", False): - raise GypError(error_message) - else: - print("Warning: " + error_message, file=sys.stdout) - - -def _GenerateMSBuildFiltersFile( - filters_path, - source_files, - rule_dependencies, - extension_to_rule_name, - platforms, - toolset, -): - """Generate the filters file. - - This file is used by Visual Studio to organize the presentation of source - files into folders. - - Arguments: - filters_path: The path of the file to be created. - source_files: The hierarchical structure of all the sources. - extension_to_rule_name: A dictionary mapping file extensions to rules. - """ - filter_group = [] - source_group = [] - _AppendFiltersForMSBuild( - "", - source_files, - rule_dependencies, - extension_to_rule_name, - platforms, - toolset, - filter_group, - source_group, - ) - if filter_group: - content = [ - "Project", - { - "ToolsVersion": "4.0", - "xmlns": "http://schemas.microsoft.com/developer/msbuild/2003", - }, - ["ItemGroup"] + filter_group, - ["ItemGroup"] + source_group, - ] - easy_xml.WriteXmlIfChanged(content, filters_path, pretty=True, win32=True) - elif os.path.exists(filters_path): - # We don't need this filter anymore. Delete the old filter file. - os.unlink(filters_path) - - -def _AppendFiltersForMSBuild( - parent_filter_name, - sources, - rule_dependencies, - extension_to_rule_name, - platforms, - toolset, - filter_group, - source_group, -): - """Creates the list of filters and sources to be added in the filter file. - - Args: - parent_filter_name: The name of the filter under which the sources are - found. - sources: The hierarchy of filters and sources to process. - extension_to_rule_name: A dictionary mapping file extensions to rules. - filter_group: The list to which filter entries will be appended. - source_group: The list to which source entries will be appended. - """ - for source in sources: - if isinstance(source, MSVSProject.Filter): - # We have a sub-filter. Create the name of that sub-filter. - if not parent_filter_name: - filter_name = source.name - else: - filter_name = f"{parent_filter_name}\\{source.name}" - # Add the filter to the group. - filter_group.append( - [ - "Filter", - {"Include": filter_name}, - ["UniqueIdentifier", MSVSNew.MakeGuid(source.name)], - ] - ) - # Recurse and add its dependents. - _AppendFiltersForMSBuild( - filter_name, - source.contents, - rule_dependencies, - extension_to_rule_name, - platforms, - toolset, - filter_group, - source_group, - ) - else: - # It's a source. Create a source entry. - _, element = _MapFileToMsBuildSourceType( - source, rule_dependencies, extension_to_rule_name, platforms, toolset - ) - source_entry = [element, {"Include": source}] - # Specify the filter it is part of, if any. - if parent_filter_name: - source_entry.append(["Filter", parent_filter_name]) - source_group.append(source_entry) - - -def _MapFileToMsBuildSourceType( - source, rule_dependencies, extension_to_rule_name, platforms, toolset -): - """Returns the group and element type of the source file. - - Arguments: - source: The source file name. - extension_to_rule_name: A dictionary mapping file extensions to rules. - - Returns: - A pair of (group this file should be part of, the label of element) - """ - _, ext = os.path.splitext(source) - ext = ext.lower() - if ext in extension_to_rule_name: - group = "rule" - element = extension_to_rule_name[ext] - elif ext in [".cc", ".cpp", ".c", ".cxx", ".mm"]: - group = "compile" - element = "ClCompile" - elif ext in [".h", ".hxx"]: - group = "include" - element = "ClInclude" - elif ext == ".rc": - group = "resource" - element = "ResourceCompile" - elif ext in [".s", ".asm"]: - group = "masm" - element = "MASM" - if "arm64" in platforms and toolset == "target": - element = "MARMASM" - elif ext == ".idl": - group = "midl" - element = "Midl" - elif source in rule_dependencies: - group = "rule_dependency" - element = "CustomBuild" - else: - group = "none" - element = "None" - return (group, element) - - -def _GenerateRulesForMSBuild( - output_dir, - options, - spec, - sources, - excluded_sources, - props_files_of_rules, - targets_files_of_rules, - actions_to_add, - rule_dependencies, - extension_to_rule_name, -): - # MSBuild rules are implemented using three files: an XML file, a .targets - # file and a .props file. - # For more details see: - # https://devblogs.microsoft.com/cppblog/quick-help-on-vs2010-custom-build-rule/ - rules = spec.get("rules", []) - rules_native = [r for r in rules if not int(r.get("msvs_external_rule", 0))] - rules_external = [r for r in rules if int(r.get("msvs_external_rule", 0))] - - msbuild_rules = [] - for rule in rules_native: - # Skip a rule with no action and no inputs. - if "action" not in rule and not rule.get("rule_sources", []): - continue - msbuild_rule = MSBuildRule(rule, spec) - msbuild_rules.append(msbuild_rule) - rule_dependencies.update(msbuild_rule.additional_dependencies.split(";")) - extension_to_rule_name[msbuild_rule.extension] = msbuild_rule.rule_name - if msbuild_rules: - base = spec["target_name"] + options.suffix - props_name = base + ".props" - targets_name = base + ".targets" - xml_name = base + ".xml" - - props_files_of_rules.add(props_name) - targets_files_of_rules.add(targets_name) - - props_path = os.path.join(output_dir, props_name) - targets_path = os.path.join(output_dir, targets_name) - xml_path = os.path.join(output_dir, xml_name) - - _GenerateMSBuildRulePropsFile(props_path, msbuild_rules) - _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules) - _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules) - - if rules_external: - _GenerateExternalRules( - rules_external, output_dir, spec, sources, options, actions_to_add - ) - _AdjustSourcesForRules(rules, sources, excluded_sources, True) - - -class MSBuildRule: - """Used to store information used to generate an MSBuild rule. - - Attributes: - rule_name: The rule name, sanitized to use in XML. - target_name: The name of the target. - after_targets: The name of the AfterTargets element. - before_targets: The name of the BeforeTargets element. - depends_on: The name of the DependsOn element. - compute_output: The name of the ComputeOutput element. - dirs_to_make: The name of the DirsToMake element. - inputs: The name of the _inputs element. - tlog: The name of the _tlog element. - extension: The extension this rule applies to. - description: The message displayed when this rule is invoked. - additional_dependencies: A string listing additional dependencies. - outputs: The outputs of this rule. - command: The command used to run the rule. - """ - - def __init__(self, rule, spec): - self.display_name = rule["rule_name"] - # Assure that the rule name is only characters and numbers - self.rule_name = re.sub(r"\W", "_", self.display_name) - # Create the various element names, following the example set by the - # Visual Studio 2008 to 2010 conversion. I don't know if VS2010 - # is sensitive to the exact names. - self.target_name = "_" + self.rule_name - self.after_targets = self.rule_name + "AfterTargets" - self.before_targets = self.rule_name + "BeforeTargets" - self.depends_on = self.rule_name + "DependsOn" - self.compute_output = "Compute%sOutput" % self.rule_name - self.dirs_to_make = self.rule_name + "DirsToMake" - self.inputs = self.rule_name + "_inputs" - self.tlog = self.rule_name + "_tlog" - self.extension = rule["extension"] - if not self.extension.startswith("."): - self.extension = "." + self.extension - - self.description = MSVSSettings.ConvertVCMacrosToMSBuild( - rule.get("message", self.rule_name) - ) - old_additional_dependencies = _FixPaths(rule.get("inputs", [])) - self.additional_dependencies = ";".join( - [ - MSVSSettings.ConvertVCMacrosToMSBuild(i) - for i in old_additional_dependencies - ] - ) - old_outputs = _FixPaths(rule.get("outputs", [])) - self.outputs = ";".join( - [MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in old_outputs] - ) - old_command = _BuildCommandLineForRule( - spec, rule, has_input_path=True, do_setup_env=True - ) - self.command = MSVSSettings.ConvertVCMacrosToMSBuild(old_command) - - -def _GenerateMSBuildRulePropsFile(props_path, msbuild_rules): - """Generate the .props file.""" - content = [ - "Project", - {"xmlns": "http://schemas.microsoft.com/developer/msbuild/2003"}, - ] - for rule in msbuild_rules: - content.extend( - [ - [ - "PropertyGroup", - { - "Condition": "'$(%s)' == '' and '$(%s)' == '' and " - "'$(ConfigurationType)' != 'Makefile'" - % (rule.before_targets, rule.after_targets) - }, - [rule.before_targets, "Midl"], - [rule.after_targets, "CustomBuild"], - ], - [ - "PropertyGroup", - [ - rule.depends_on, - {"Condition": "'$(ConfigurationType)' != 'Makefile'"}, - "_SelectedFiles;$(%s)" % rule.depends_on, - ], - ], - [ - "ItemDefinitionGroup", - [ - rule.rule_name, - ["CommandLineTemplate", rule.command], - ["Outputs", rule.outputs], - ["ExecutionDescription", rule.description], - ["AdditionalDependencies", rule.additional_dependencies], - ], - ], - ] - ) - easy_xml.WriteXmlIfChanged(content, props_path, pretty=True, win32=True) - - -def _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules): - """Generate the .targets file.""" - content = [ - "Project", - {"xmlns": "http://schemas.microsoft.com/developer/msbuild/2003"}, - ] - item_group = [ - "ItemGroup", - [ - "PropertyPageSchema", - {"Include": "$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml"}, - ], - ] - for rule in msbuild_rules: - item_group.append( - [ - "AvailableItemName", - {"Include": rule.rule_name}, - ["Targets", rule.target_name], - ] - ) - content.append(item_group) - - for rule in msbuild_rules: - content.append( - [ - "UsingTask", - { - "TaskName": rule.rule_name, - "TaskFactory": "XamlTaskFactory", - "AssemblyName": "Microsoft.Build.Tasks.v4.0", - }, - ["Task", "$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml"], - ] - ) - for rule in msbuild_rules: - rule_name = rule.rule_name - target_outputs = "%%(%s.Outputs)" % rule_name - target_inputs = ( - "%%(%s.Identity);%%(%s.AdditionalDependencies);" "$(MSBuildProjectFile)" - ) % (rule_name, rule_name) - rule_inputs = "%%(%s.Identity)" % rule_name - extension_condition = ( - "'%(Extension)'=='.obj' or " - "'%(Extension)'=='.res' or " - "'%(Extension)'=='.rsc' or " - "'%(Extension)'=='.lib'" - ) - remove_section = [ - "ItemGroup", - {"Condition": "'@(SelectedFiles)' != ''"}, - [ - rule_name, - { - "Remove": "@(%s)" % rule_name, - "Condition": "'%(Identity)' != '@(SelectedFiles)'", - }, - ], - ] - inputs_section = [ - "ItemGroup", - [rule.inputs, {"Include": "%%(%s.AdditionalDependencies)" % rule_name}], - ] - logging_section = [ - "ItemGroup", - [ - rule.tlog, - { - "Include": "%%(%s.Outputs)" % rule_name, - "Condition": ( - "'%%(%s.Outputs)' != '' and " - "'%%(%s.ExcludedFromBuild)' != 'true'" % (rule_name, rule_name) - ), - }, - ["Source", "@(%s, '|')" % rule_name], - ["Inputs", "@(%s -> '%%(Fullpath)', ';')" % rule.inputs], - ], - ] - message_section = [ - "Message", - {"Importance": "High", "Text": "%%(%s.ExecutionDescription)" % rule_name}, - ] - write_tlog_section = [ - "WriteLinesToFile", - { - "Condition": "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " - "'true'" % (rule.tlog, rule.tlog), - "File": "$(IntDir)$(ProjectName).write.1.tlog", - "Lines": "^%%(%s.Source);@(%s->'%%(Fullpath)')" - % (rule.tlog, rule.tlog), - }, - ] - read_tlog_section = [ - "WriteLinesToFile", - { - "Condition": "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " - "'true'" % (rule.tlog, rule.tlog), - "File": "$(IntDir)$(ProjectName).read.1.tlog", - "Lines": f"^%({rule.tlog}.Source);%({rule.tlog}.Inputs)", - }, - ] - command_and_input_section = [ - rule_name, - { - "Condition": "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " - "'true'" % (rule_name, rule_name), - "EchoOff": "true", - "StandardOutputImportance": "High", - "StandardErrorImportance": "High", - "CommandLineTemplate": "%%(%s.CommandLineTemplate)" % rule_name, - "AdditionalOptions": "%%(%s.AdditionalOptions)" % rule_name, - "Inputs": rule_inputs, - }, - ] - content.extend( - [ - [ - "Target", - { - "Name": rule.target_name, - "BeforeTargets": "$(%s)" % rule.before_targets, - "AfterTargets": "$(%s)" % rule.after_targets, - "Condition": "'@(%s)' != ''" % rule_name, - "DependsOnTargets": "$(%s);%s" - % (rule.depends_on, rule.compute_output), - "Outputs": target_outputs, - "Inputs": target_inputs, - }, - remove_section, - inputs_section, - logging_section, - message_section, - write_tlog_section, - read_tlog_section, - command_and_input_section, - ], - [ - "PropertyGroup", - [ - "ComputeLinkInputsTargets", - "$(ComputeLinkInputsTargets);", - "%s;" % rule.compute_output, - ], - [ - "ComputeLibInputsTargets", - "$(ComputeLibInputsTargets);", - "%s;" % rule.compute_output, - ], - ], - [ - "Target", - { - "Name": rule.compute_output, - "Condition": "'@(%s)' != ''" % rule_name, - }, - [ - "ItemGroup", - [ - rule.dirs_to_make, - { - "Condition": "'@(%s)' != '' and " - "'%%(%s.ExcludedFromBuild)' != 'true'" - % (rule_name, rule_name), - "Include": "%%(%s.Outputs)" % rule_name, - }, - ], - [ - "Link", - { - "Include": "%%(%s.Identity)" % rule.dirs_to_make, - "Condition": extension_condition, - }, - ], - [ - "Lib", - { - "Include": "%%(%s.Identity)" % rule.dirs_to_make, - "Condition": extension_condition, - }, - ], - [ - "ImpLib", - { - "Include": "%%(%s.Identity)" % rule.dirs_to_make, - "Condition": extension_condition, - }, - ], - ], - [ - "MakeDir", - { - "Directories": ( - "@(%s->'%%(RootDir)%%(Directory)')" % rule.dirs_to_make - ) - }, - ], - ], - ] - ) - easy_xml.WriteXmlIfChanged(content, targets_path, pretty=True, win32=True) - - -def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules): - # Generate the .xml file - content = [ - "ProjectSchemaDefinitions", - { - "xmlns": ( - "clr-namespace:Microsoft.Build.Framework.XamlTypes;" - "assembly=Microsoft.Build.Framework" - ), - "xmlns:x": "http://schemas.microsoft.com/winfx/2006/xaml", - "xmlns:sys": "clr-namespace:System;assembly=mscorlib", - "xmlns:transformCallback": "Microsoft.Cpp.Dev10.ConvertPropertyCallback", - }, - ] - for rule in msbuild_rules: - content.extend( - [ - [ - "Rule", - { - "Name": rule.rule_name, - "PageTemplate": "tool", - "DisplayName": rule.display_name, - "Order": "200", - }, - [ - "Rule.DataSource", - [ - "DataSource", - {"Persistence": "ProjectFile", "ItemType": rule.rule_name}, - ], - ], - [ - "Rule.Categories", - [ - "Category", - {"Name": "General"}, - ["Category.DisplayName", ["sys:String", "General"]], - ], - [ - "Category", - {"Name": "Command Line", "Subtype": "CommandLine"}, - ["Category.DisplayName", ["sys:String", "Command Line"]], - ], - ], - [ - "StringListProperty", - { - "Name": "Inputs", - "Category": "Command Line", - "IsRequired": "true", - "Switch": " ", - }, - [ - "StringListProperty.DataSource", - [ - "DataSource", - { - "Persistence": "ProjectFile", - "ItemType": rule.rule_name, - "SourceType": "Item", - }, - ], - ], - ], - [ - "StringProperty", - { - "Name": "CommandLineTemplate", - "DisplayName": "Command Line", - "Visible": "False", - "IncludeInCommandLine": "False", - }, - ], - [ - "DynamicEnumProperty", - { - "Name": rule.before_targets, - "Category": "General", - "EnumProvider": "Targets", - "IncludeInCommandLine": "False", - }, - [ - "DynamicEnumProperty.DisplayName", - ["sys:String", "Execute Before"], - ], - [ - "DynamicEnumProperty.Description", - [ - "sys:String", - "Specifies the targets for the build customization" - " to run before.", - ], - ], - [ - "DynamicEnumProperty.ProviderSettings", - [ - "NameValuePair", - { - "Name": "Exclude", - "Value": "^%s|^Compute" % rule.before_targets, - }, - ], - ], - [ - "DynamicEnumProperty.DataSource", - [ - "DataSource", - { - "Persistence": "ProjectFile", - "HasConfigurationCondition": "true", - }, - ], - ], - ], - [ - "DynamicEnumProperty", - { - "Name": rule.after_targets, - "Category": "General", - "EnumProvider": "Targets", - "IncludeInCommandLine": "False", - }, - [ - "DynamicEnumProperty.DisplayName", - ["sys:String", "Execute After"], - ], - [ - "DynamicEnumProperty.Description", - [ - "sys:String", - ( - "Specifies the targets for the build customization" - " to run after." - ), - ], - ], - [ - "DynamicEnumProperty.ProviderSettings", - [ - "NameValuePair", - { - "Name": "Exclude", - "Value": "^%s|^Compute" % rule.after_targets, - }, - ], - ], - [ - "DynamicEnumProperty.DataSource", - [ - "DataSource", - { - "Persistence": "ProjectFile", - "ItemType": "", - "HasConfigurationCondition": "true", - }, - ], - ], - ], - [ - "StringListProperty", - { - "Name": "Outputs", - "DisplayName": "Outputs", - "Visible": "False", - "IncludeInCommandLine": "False", - }, - ], - [ - "StringProperty", - { - "Name": "ExecutionDescription", - "DisplayName": "Execution Description", - "Visible": "False", - "IncludeInCommandLine": "False", - }, - ], - [ - "StringListProperty", - { - "Name": "AdditionalDependencies", - "DisplayName": "Additional Dependencies", - "IncludeInCommandLine": "False", - "Visible": "false", - }, - ], - [ - "StringProperty", - { - "Subtype": "AdditionalOptions", - "Name": "AdditionalOptions", - "Category": "Command Line", - }, - [ - "StringProperty.DisplayName", - ["sys:String", "Additional Options"], - ], - [ - "StringProperty.Description", - ["sys:String", "Additional Options"], - ], - ], - ], - [ - "ItemType", - {"Name": rule.rule_name, "DisplayName": rule.display_name}, - ], - [ - "FileExtension", - {"Name": "*" + rule.extension, "ContentType": rule.rule_name}, - ], - [ - "ContentType", - { - "Name": rule.rule_name, - "DisplayName": "", - "ItemType": rule.rule_name, - }, - ], - ] - ) - easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True) - - -def _GetConfigurationAndPlatform(name, settings, spec): - configuration = name.rsplit("_", 1)[0] - platform = settings.get("msvs_configuration_platform", "Win32") - if spec["toolset"] == "host" and platform == "arm64": - platform = "x64" # Host-only tools are always built for x64 - return (configuration, platform) - - -def _GetConfigurationCondition(name, settings, spec): - return r"'$(Configuration)|$(Platform)'=='%s|%s'" % _GetConfigurationAndPlatform( - name, settings, spec - ) - - -def _GetMSBuildProjectConfigurations(configurations, spec): - group = ["ItemGroup", {"Label": "ProjectConfigurations"}] - for (name, settings) in sorted(configurations.items()): - configuration, platform = _GetConfigurationAndPlatform(name, settings, spec) - designation = f"{configuration}|{platform}" - group.append( - [ - "ProjectConfiguration", - {"Include": designation}, - ["Configuration", configuration], - ["Platform", platform], - ] - ) - return [group] - - -def _GetMSBuildGlobalProperties(spec, version, guid, gyp_file_name): - namespace = os.path.splitext(gyp_file_name)[0] - properties = [ - [ - "PropertyGroup", - {"Label": "Globals"}, - ["ProjectGuid", guid], - ["Keyword", "Win32Proj"], - ["RootNamespace", namespace], - ["IgnoreWarnCompileDuplicatedFilename", "true"], - ] - ] - - if ( - os.environ.get("PROCESSOR_ARCHITECTURE") == "AMD64" - or os.environ.get("PROCESSOR_ARCHITEW6432") == "AMD64" - ): - properties[0].append(["PreferredToolArchitecture", "x64"]) - - if spec.get("msvs_target_platform_version"): - target_platform_version = spec.get("msvs_target_platform_version") - properties[0].append(["WindowsTargetPlatformVersion", target_platform_version]) - if spec.get("msvs_target_platform_minversion"): - target_platform_minversion = spec.get("msvs_target_platform_minversion") - properties[0].append( - ["WindowsTargetPlatformMinVersion", target_platform_minversion] - ) - else: - properties[0].append( - ["WindowsTargetPlatformMinVersion", target_platform_version] - ) - - if spec.get("msvs_enable_winrt"): - properties[0].append(["DefaultLanguage", "en-US"]) - properties[0].append(["AppContainerApplication", "true"]) - if spec.get("msvs_application_type_revision"): - app_type_revision = spec.get("msvs_application_type_revision") - properties[0].append(["ApplicationTypeRevision", app_type_revision]) - else: - properties[0].append(["ApplicationTypeRevision", "8.1"]) - if spec.get("msvs_enable_winphone"): - properties[0].append(["ApplicationType", "Windows Phone"]) - else: - properties[0].append(["ApplicationType", "Windows Store"]) - - platform_name = None - msvs_windows_sdk_version = None - for configuration in spec["configurations"].values(): - platform_name = platform_name or _ConfigPlatform(configuration) - msvs_windows_sdk_version = ( - msvs_windows_sdk_version - or _ConfigWindowsTargetPlatformVersion(configuration, version) - ) - if platform_name and msvs_windows_sdk_version: - break - if msvs_windows_sdk_version: - properties[0].append( - ["WindowsTargetPlatformVersion", str(msvs_windows_sdk_version)] - ) - elif version.compatible_sdks: - raise GypError( - "%s requires any SDK of %s version, but none were found" - % (version.description, version.compatible_sdks) - ) - - if platform_name == "ARM": - properties[0].append(["WindowsSDKDesktopARMSupport", "true"]) - - return properties - - -def _GetMSBuildConfigurationDetails(spec, build_file): - properties = {} - for name, settings in spec["configurations"].items(): - msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file) - condition = _GetConfigurationCondition(name, settings, spec) - character_set = msbuild_attributes.get("CharacterSet") - config_type = msbuild_attributes.get("ConfigurationType") - _AddConditionalProperty(properties, condition, "ConfigurationType", config_type) - if config_type == "Driver": - _AddConditionalProperty(properties, condition, "DriverType", "WDM") - _AddConditionalProperty( - properties, condition, "TargetVersion", _ConfigTargetVersion(settings) - ) - if character_set: - if "msvs_enable_winrt" not in spec: - _AddConditionalProperty( - properties, condition, "CharacterSet", character_set - ) - return _GetMSBuildPropertyGroup(spec, "Configuration", properties) - - -def _GetMSBuildLocalProperties(msbuild_toolset): - # Currently the only local property we support is PlatformToolset - properties = {} - if msbuild_toolset: - properties = [ - [ - "PropertyGroup", - {"Label": "Locals"}, - ["PlatformToolset", msbuild_toolset], - ] - ] - return properties - - -def _GetMSBuildPropertySheets(configurations, spec): - user_props = r"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" - additional_props = {} - props_specified = False - for name, settings in sorted(configurations.items()): - configuration = _GetConfigurationCondition(name, settings, spec) - if "msbuild_props" in settings: - additional_props[configuration] = _FixPaths(settings["msbuild_props"]) - props_specified = True - else: - additional_props[configuration] = "" - - if not props_specified: - return [ - [ - "ImportGroup", - {"Label": "PropertySheets"}, - [ - "Import", - { - "Project": user_props, - "Condition": "exists('%s')" % user_props, - "Label": "LocalAppDataPlatform", - }, - ], - ] - ] - else: - sheets = [] - for condition, props in additional_props.items(): - import_group = [ - "ImportGroup", - {"Label": "PropertySheets", "Condition": condition}, - [ - "Import", - { - "Project": user_props, - "Condition": "exists('%s')" % user_props, - "Label": "LocalAppDataPlatform", - }, - ], - ] - for props_file in props: - import_group.append(["Import", {"Project": props_file}]) - sheets.append(import_group) - return sheets - - -def _ConvertMSVSBuildAttributes(spec, config, build_file): - config_type = _GetMSVSConfigurationType(spec, build_file) - msvs_attributes = _GetMSVSAttributes(spec, config, config_type) - msbuild_attributes = {} - for a in msvs_attributes: - if a in ["IntermediateDirectory", "OutputDirectory"]: - directory = MSVSSettings.ConvertVCMacrosToMSBuild(msvs_attributes[a]) - if not directory.endswith("\\"): - directory += "\\" - msbuild_attributes[a] = directory - elif a == "CharacterSet": - msbuild_attributes[a] = _ConvertMSVSCharacterSet(msvs_attributes[a]) - elif a == "ConfigurationType": - msbuild_attributes[a] = _ConvertMSVSConfigurationType(msvs_attributes[a]) - else: - print("Warning: Do not know how to convert MSVS attribute " + a) - return msbuild_attributes - - -def _ConvertMSVSCharacterSet(char_set): - if char_set.isdigit(): - char_set = {"0": "MultiByte", "1": "Unicode", "2": "MultiByte"}[char_set] - return char_set - - -def _ConvertMSVSConfigurationType(config_type): - if config_type.isdigit(): - config_type = { - "1": "Application", - "2": "DynamicLibrary", - "4": "StaticLibrary", - "5": "Driver", - "10": "Utility", - }[config_type] - return config_type - - -def _GetMSBuildAttributes(spec, config, build_file): - if "msbuild_configuration_attributes" not in config: - msbuild_attributes = _ConvertMSVSBuildAttributes(spec, config, build_file) - - else: - config_type = _GetMSVSConfigurationType(spec, build_file) - config_type = _ConvertMSVSConfigurationType(config_type) - msbuild_attributes = config.get("msbuild_configuration_attributes", {}) - msbuild_attributes.setdefault("ConfigurationType", config_type) - output_dir = msbuild_attributes.get( - "OutputDirectory", "$(SolutionDir)$(Configuration)" - ) - msbuild_attributes["OutputDirectory"] = _FixPath(output_dir) + "\\" - if "IntermediateDirectory" not in msbuild_attributes: - intermediate = _FixPath("$(Configuration)") + "\\" - msbuild_attributes["IntermediateDirectory"] = intermediate - if "CharacterSet" in msbuild_attributes: - msbuild_attributes["CharacterSet"] = _ConvertMSVSCharacterSet( - msbuild_attributes["CharacterSet"] - ) - if "TargetName" not in msbuild_attributes: - prefix = spec.get("product_prefix", "") - product_name = spec.get("product_name", "$(ProjectName)") - target_name = prefix + product_name - msbuild_attributes["TargetName"] = target_name - if "TargetExt" not in msbuild_attributes and "product_extension" in spec: - ext = spec.get("product_extension") - msbuild_attributes["TargetExt"] = "." + ext - - if spec.get("msvs_external_builder"): - external_out_dir = spec.get("msvs_external_builder_out_dir", ".") - msbuild_attributes["OutputDirectory"] = _FixPath(external_out_dir) + "\\" - - # Make sure that 'TargetPath' matches 'Lib.OutputFile' or 'Link.OutputFile' - # (depending on the tool used) to avoid MSB8012 warning. - msbuild_tool_map = { - "executable": "Link", - "shared_library": "Link", - "loadable_module": "Link", - "windows_driver": "Link", - "static_library": "Lib", - } - msbuild_tool = msbuild_tool_map.get(spec["type"]) - if msbuild_tool: - msbuild_settings = config["finalized_msbuild_settings"] - out_file = msbuild_settings[msbuild_tool].get("OutputFile") - if out_file: - msbuild_attributes["TargetPath"] = _FixPath(out_file) - target_ext = msbuild_settings[msbuild_tool].get("TargetExt") - if target_ext: - msbuild_attributes["TargetExt"] = target_ext - - return msbuild_attributes - - -def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file): - # TODO(jeanluc) We could optimize out the following and do it only if - # there are actions. - # TODO(jeanluc) Handle the equivalent of setting 'CYGWIN=nontsec'. - new_paths = [] - cygwin_dirs = spec.get("msvs_cygwin_dirs", ["."])[0] - if cygwin_dirs: - cyg_path = "$(MSBuildProjectDirectory)\\%s\\bin\\" % _FixPath(cygwin_dirs) - new_paths.append(cyg_path) - # TODO(jeanluc) Change the convention to have both a cygwin_dir and a - # python_dir. - python_path = cyg_path.replace("cygwin\\bin", "python_26") - new_paths.append(python_path) - if new_paths: - new_paths = "$(ExecutablePath);" + ";".join(new_paths) - - properties = {} - for (name, configuration) in sorted(configurations.items()): - condition = _GetConfigurationCondition(name, configuration, spec) - attributes = _GetMSBuildAttributes(spec, configuration, build_file) - msbuild_settings = configuration["finalized_msbuild_settings"] - _AddConditionalProperty( - properties, condition, "IntDir", attributes["IntermediateDirectory"] - ) - _AddConditionalProperty( - properties, condition, "OutDir", attributes["OutputDirectory"] - ) - _AddConditionalProperty( - properties, condition, "TargetName", attributes["TargetName"] - ) - if "TargetExt" in attributes: - _AddConditionalProperty( - properties, condition, "TargetExt", attributes["TargetExt"] - ) - - if attributes.get("TargetPath"): - _AddConditionalProperty( - properties, condition, "TargetPath", attributes["TargetPath"] - ) - if attributes.get("TargetExt"): - _AddConditionalProperty( - properties, condition, "TargetExt", attributes["TargetExt"] - ) - - if new_paths: - _AddConditionalProperty(properties, condition, "ExecutablePath", new_paths) - tool_settings = msbuild_settings.get("", {}) - for name, value in sorted(tool_settings.items()): - formatted_value = _GetValueFormattedForMSBuild("", name, value) - _AddConditionalProperty(properties, condition, name, formatted_value) - return _GetMSBuildPropertyGroup(spec, None, properties) - - -def _AddConditionalProperty(properties, condition, name, value): - """Adds a property / conditional value pair to a dictionary. - - Arguments: - properties: The dictionary to be modified. The key is the name of the - property. The value is itself a dictionary; its key is the value and - the value a list of condition for which this value is true. - condition: The condition under which the named property has the value. - name: The name of the property. - value: The value of the property. - """ - if name not in properties: - properties[name] = {} - values = properties[name] - if value not in values: - values[value] = [] - conditions = values[value] - conditions.append(condition) - - -# Regex for msvs variable references ( i.e. $(FOO) ). -MSVS_VARIABLE_REFERENCE = re.compile(r"\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)") - - -def _GetMSBuildPropertyGroup(spec, label, properties): - """Returns a PropertyGroup definition for the specified properties. - - Arguments: - spec: The target project dict. - label: An optional label for the PropertyGroup. - properties: The dictionary to be converted. The key is the name of the - property. The value is itself a dictionary; its key is the value and - the value a list of condition for which this value is true. - """ - group = ["PropertyGroup"] - if label: - group.append({"Label": label}) - num_configurations = len(spec["configurations"]) - - def GetEdges(node): - # Use a definition of edges such that user_of_variable -> used_varible. - # This happens to be easier in this case, since a variable's - # definition contains all variables it references in a single string. - edges = set() - for value in sorted(properties[node].keys()): - # Add to edges all $(...) references to variables. - # - # Variable references that refer to names not in properties are excluded - # These can exist for instance to refer built in definitions like - # $(SolutionDir). - # - # Self references are ignored. Self reference is used in a few places to - # append to the default value. I.e. PATH=$(PATH);other_path - edges.update( - { - v - for v in MSVS_VARIABLE_REFERENCE.findall(value) - if v in properties and v != node - } - ) - return edges - - properties_ordered = gyp.common.TopologicallySorted(properties.keys(), GetEdges) - # Walk properties in the reverse of a topological sort on - # user_of_variable -> used_variable as this ensures variables are - # defined before they are used. - # NOTE: reverse(topsort(DAG)) = topsort(reverse_edges(DAG)) - for name in reversed(properties_ordered): - values = properties[name] - for value, conditions in sorted(values.items()): - if len(conditions) == num_configurations: - # If the value is the same all configurations, - # just add one unconditional entry. - group.append([name, value]) - else: - for condition in conditions: - group.append([name, {"Condition": condition}, value]) - return [group] - - -def _GetMSBuildToolSettingsSections(spec, configurations): - groups = [] - for (name, configuration) in sorted(configurations.items()): - msbuild_settings = configuration["finalized_msbuild_settings"] - group = [ - "ItemDefinitionGroup", - {"Condition": _GetConfigurationCondition(name, configuration, spec)}, - ] - for tool_name, tool_settings in sorted(msbuild_settings.items()): - # Skip the tool named '' which is a holder of global settings handled - # by _GetMSBuildConfigurationGlobalProperties. - if tool_name: - if tool_settings: - tool = [tool_name] - for name, value in sorted(tool_settings.items()): - formatted_value = _GetValueFormattedForMSBuild( - tool_name, name, value - ) - tool.append([name, formatted_value]) - group.append(tool) - groups.append(group) - return groups - - -def _FinalizeMSBuildSettings(spec, configuration): - if "msbuild_settings" in configuration: - converted = False - msbuild_settings = configuration["msbuild_settings"] - MSVSSettings.ValidateMSBuildSettings(msbuild_settings) - else: - converted = True - msvs_settings = configuration.get("msvs_settings", {}) - msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(msvs_settings) - include_dirs, midl_include_dirs, resource_include_dirs = _GetIncludeDirs( - configuration - ) - libraries = _GetLibraries(spec) - library_dirs = _GetLibraryDirs(configuration) - out_file, _, msbuild_tool = _GetOutputFilePathAndTool(spec, msbuild=True) - target_ext = _GetOutputTargetExt(spec) - defines = _GetDefines(configuration) - if converted: - # Visual Studio 2010 has TR1 - defines = [d for d in defines if d != "_HAS_TR1=0"] - # Warn of ignored settings - ignored_settings = ["msvs_tool_files"] - for ignored_setting in ignored_settings: - value = configuration.get(ignored_setting) - if value: - print( - "Warning: The automatic conversion to MSBuild does not handle " - "%s. Ignoring setting of %s" % (ignored_setting, str(value)) - ) - - defines = [_EscapeCppDefineForMSBuild(d) for d in defines] - disabled_warnings = _GetDisabledWarnings(configuration) - prebuild = configuration.get("msvs_prebuild") - postbuild = configuration.get("msvs_postbuild") - def_file = _GetModuleDefinition(spec) - precompiled_header = configuration.get("msvs_precompiled_header") - - # Add the information to the appropriate tool - # TODO(jeanluc) We could optimize and generate these settings only if - # the corresponding files are found, e.g. don't generate ResourceCompile - # if you don't have any resources. - _ToolAppend( - msbuild_settings, "ClCompile", "AdditionalIncludeDirectories", include_dirs - ) - _ToolAppend( - msbuild_settings, "Midl", "AdditionalIncludeDirectories", midl_include_dirs - ) - _ToolAppend( - msbuild_settings, - "ResourceCompile", - "AdditionalIncludeDirectories", - resource_include_dirs, - ) - # Add in libraries, note that even for empty libraries, we want this - # set, to prevent inheriting default libraries from the environment. - _ToolSetOrAppend(msbuild_settings, "Link", "AdditionalDependencies", libraries) - _ToolAppend(msbuild_settings, "Link", "AdditionalLibraryDirectories", library_dirs) - if out_file: - _ToolAppend( - msbuild_settings, msbuild_tool, "OutputFile", out_file, only_if_unset=True - ) - if target_ext: - _ToolAppend( - msbuild_settings, msbuild_tool, "TargetExt", target_ext, only_if_unset=True - ) - # Add defines. - _ToolAppend(msbuild_settings, "ClCompile", "PreprocessorDefinitions", defines) - _ToolAppend(msbuild_settings, "ResourceCompile", "PreprocessorDefinitions", defines) - # Add disabled warnings. - _ToolAppend( - msbuild_settings, "ClCompile", "DisableSpecificWarnings", disabled_warnings - ) - # Turn on precompiled headers if appropriate. - if precompiled_header: - precompiled_header = os.path.split(precompiled_header)[1] - _ToolAppend(msbuild_settings, "ClCompile", "PrecompiledHeader", "Use") - _ToolAppend( - msbuild_settings, "ClCompile", "PrecompiledHeaderFile", precompiled_header - ) - _ToolAppend( - msbuild_settings, "ClCompile", "ForcedIncludeFiles", [precompiled_header] - ) - else: - _ToolAppend(msbuild_settings, "ClCompile", "PrecompiledHeader", "NotUsing") - # Turn off WinRT compilation - _ToolAppend(msbuild_settings, "ClCompile", "CompileAsWinRT", "false") - # Turn on import libraries if appropriate - if spec.get("msvs_requires_importlibrary"): - _ToolAppend(msbuild_settings, "", "IgnoreImportLibrary", "false") - # Loadable modules don't generate import libraries; - # tell dependent projects to not expect one. - if spec["type"] == "loadable_module": - _ToolAppend(msbuild_settings, "", "IgnoreImportLibrary", "true") - # Set the module definition file if any. - if def_file: - _ToolAppend(msbuild_settings, "Link", "ModuleDefinitionFile", def_file) - configuration["finalized_msbuild_settings"] = msbuild_settings - if prebuild: - _ToolAppend(msbuild_settings, "PreBuildEvent", "Command", prebuild) - if postbuild: - _ToolAppend(msbuild_settings, "PostBuildEvent", "Command", postbuild) - - -def _GetValueFormattedForMSBuild(tool_name, name, value): - if type(value) == list: - # For some settings, VS2010 does not automatically extends the settings - # TODO(jeanluc) Is this what we want? - if name in [ - "AdditionalIncludeDirectories", - "AdditionalLibraryDirectories", - "AdditionalOptions", - "DelayLoadDLLs", - "DisableSpecificWarnings", - "PreprocessorDefinitions", - ]: - value.append("%%(%s)" % name) - # For most tools, entries in a list should be separated with ';' but some - # settings use a space. Check for those first. - exceptions = { - "ClCompile": ["AdditionalOptions"], - "Link": ["AdditionalOptions"], - "Lib": ["AdditionalOptions"], - } - if tool_name in exceptions and name in exceptions[tool_name]: - char = " " - else: - char = ";" - formatted_value = char.join( - [MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in value] - ) - else: - formatted_value = MSVSSettings.ConvertVCMacrosToMSBuild(value) - return formatted_value - - -def _VerifySourcesExist(sources, root_dir): - """Verifies that all source files exist on disk. - - Checks that all regular source files, i.e. not created at run time, - exist on disk. Missing files cause needless recompilation but no otherwise - visible errors. - - Arguments: - sources: A recursive list of Filter/file names. - root_dir: The root directory for the relative path names. - Returns: - A list of source files that cannot be found on disk. - """ - missing_sources = [] - for source in sources: - if isinstance(source, MSVSProject.Filter): - missing_sources.extend(_VerifySourcesExist(source.contents, root_dir)) - else: - if "$" not in source: - full_path = os.path.join(root_dir, source) - if not os.path.exists(full_path): - missing_sources.append(full_path) - return missing_sources - - -def _GetMSBuildSources( - spec, - sources, - exclusions, - rule_dependencies, - extension_to_rule_name, - actions_spec, - sources_handled_by_action, - list_excluded, -): - groups = [ - "none", - "masm", - "midl", - "include", - "compile", - "resource", - "rule", - "rule_dependency", - ] - grouped_sources = {} - for g in groups: - grouped_sources[g] = [] - - _AddSources2( - spec, - sources, - exclusions, - grouped_sources, - rule_dependencies, - extension_to_rule_name, - sources_handled_by_action, - list_excluded, - ) - sources = [] - for g in groups: - if grouped_sources[g]: - sources.append(["ItemGroup"] + grouped_sources[g]) - if actions_spec: - sources.append(["ItemGroup"] + actions_spec) - return sources - - -def _AddSources2( - spec, - sources, - exclusions, - grouped_sources, - rule_dependencies, - extension_to_rule_name, - sources_handled_by_action, - list_excluded, -): - extensions_excluded_from_precompile = [] - for source in sources: - if isinstance(source, MSVSProject.Filter): - _AddSources2( - spec, - source.contents, - exclusions, - grouped_sources, - rule_dependencies, - extension_to_rule_name, - sources_handled_by_action, - list_excluded, - ) - else: - if source not in sources_handled_by_action: - detail = [] - excluded_configurations = exclusions.get(source, []) - if len(excluded_configurations) == len(spec["configurations"]): - detail.append(["ExcludedFromBuild", "true"]) - else: - for config_name, configuration in sorted(excluded_configurations): - condition = _GetConfigurationCondition( - config_name, configuration - ) - detail.append( - ["ExcludedFromBuild", {"Condition": condition}, "true"] - ) - # Add precompile if needed - for config_name, configuration in spec["configurations"].items(): - precompiled_source = configuration.get( - "msvs_precompiled_source", "" - ) - if precompiled_source != "": - precompiled_source = _FixPath(precompiled_source) - if not extensions_excluded_from_precompile: - # If the precompiled header is generated by a C source, - # we must not try to use it for C++ sources, - # and vice versa. - basename, extension = os.path.splitext(precompiled_source) - if extension == ".c": - extensions_excluded_from_precompile = [ - ".cc", - ".cpp", - ".cxx", - ] - else: - extensions_excluded_from_precompile = [".c"] - - if precompiled_source == source: - condition = _GetConfigurationCondition( - config_name, configuration, spec - ) - detail.append( - ["PrecompiledHeader", {"Condition": condition}, "Create"] - ) - else: - # Turn off precompiled header usage for source files of a - # different type than the file that generated the - # precompiled header. - for extension in extensions_excluded_from_precompile: - if source.endswith(extension): - detail.append(["PrecompiledHeader", ""]) - detail.append(["ForcedIncludeFiles", ""]) - - group, element = _MapFileToMsBuildSourceType( - source, - rule_dependencies, - extension_to_rule_name, - _GetUniquePlatforms(spec), - spec["toolset"], - ) - if group == "compile" and not os.path.isabs(source): - # Add an value to support duplicate source - # file basenames, except for absolute paths to avoid paths - # with more than 260 characters. - file_name = os.path.splitext(source)[0] + ".obj" - if file_name.startswith("..\\"): - file_name = re.sub(r"^(\.\.\\)+", "", file_name) - elif file_name.startswith("$("): - file_name = re.sub(r"^\$\([^)]+\)\\", "", file_name) - detail.append(["ObjectFileName", "$(IntDir)\\" + file_name]) - grouped_sources[group].append([element, {"Include": source}] + detail) - - -def _GetMSBuildProjectReferences(project): - references = [] - if project.dependencies: - group = ["ItemGroup"] - added_dependency_set = set() - for dependency in project.dependencies: - dependency_spec = dependency.spec - should_skip_dep = False - if project.spec["toolset"] == "target": - if dependency_spec["toolset"] == "host": - if dependency_spec["type"] == "static_library": - should_skip_dep = True - if dependency.name.startswith("run_"): - should_skip_dep = False - if should_skip_dep: - continue - - canonical_name = dependency.name.replace("_host", "") - added_dependency_set.add(canonical_name) - guid = dependency.guid - project_dir = os.path.split(project.path)[0] - relative_path = gyp.common.RelativePath(dependency.path, project_dir) - project_ref = [ - "ProjectReference", - {"Include": relative_path}, - ["Project", guid], - ["ReferenceOutputAssembly", "false"], - ] - for config in dependency.spec.get("configurations", {}).values(): - if config.get("msvs_use_library_dependency_inputs", 0): - project_ref.append(["UseLibraryDependencyInputs", "true"]) - break - # If it's disabled in any config, turn it off in the reference. - if config.get("msvs_2010_disable_uldi_when_referenced", 0): - project_ref.append(["UseLibraryDependencyInputs", "false"]) - break - group.append(project_ref) - references.append(group) - return references - - -def _GenerateMSBuildProject(project, options, version, generator_flags, spec): - spec = project.spec - configurations = spec["configurations"] - toolset = spec["toolset"] - project_dir, project_file_name = os.path.split(project.path) - gyp.common.EnsureDirExists(project.path) - # Prepare list of sources and excluded sources. - - gyp_file = os.path.split(project.build_file)[1] - sources, excluded_sources = _PrepareListOfSources(spec, generator_flags, gyp_file) - # Add rules. - actions_to_add = {} - props_files_of_rules = set() - targets_files_of_rules = set() - rule_dependencies = set() - extension_to_rule_name = {} - list_excluded = generator_flags.get("msvs_list_excluded_files", True) - platforms = _GetUniquePlatforms(spec) - - # Don't generate rules if we are using an external builder like ninja. - if not spec.get("msvs_external_builder"): - _GenerateRulesForMSBuild( - project_dir, - options, - spec, - sources, - excluded_sources, - props_files_of_rules, - targets_files_of_rules, - actions_to_add, - rule_dependencies, - extension_to_rule_name, - ) - else: - rules = spec.get("rules", []) - _AdjustSourcesForRules(rules, sources, excluded_sources, True) - - sources, excluded_sources, excluded_idl = _AdjustSourcesAndConvertToFilterHierarchy( - spec, options, project_dir, sources, excluded_sources, list_excluded, version - ) - - # Don't add actions if we are using an external builder like ninja. - if not spec.get("msvs_external_builder"): - _AddActions(actions_to_add, spec, project.build_file) - _AddCopies(actions_to_add, spec) - - # NOTE: this stanza must appear after all actions have been decided. - # Don't excluded sources with actions attached, or they won't run. - excluded_sources = _FilterActionsFromExcluded(excluded_sources, actions_to_add) - - exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl) - actions_spec, sources_handled_by_action = _GenerateActionsForMSBuild( - spec, actions_to_add - ) - - _GenerateMSBuildFiltersFile( - project.path + ".filters", - sources, - rule_dependencies, - extension_to_rule_name, - platforms, - toolset, - ) - missing_sources = _VerifySourcesExist(sources, project_dir) - - for configuration in configurations.values(): - _FinalizeMSBuildSettings(spec, configuration) - - # Add attributes to root element - - import_default_section = [ - ["Import", {"Project": r"$(VCTargetsPath)\Microsoft.Cpp.Default.props"}] - ] - import_cpp_props_section = [ - ["Import", {"Project": r"$(VCTargetsPath)\Microsoft.Cpp.props"}] - ] - import_cpp_targets_section = [ - ["Import", {"Project": r"$(VCTargetsPath)\Microsoft.Cpp.targets"}] - ] - import_masm_props_section = [ - ["Import", {"Project": r"$(VCTargetsPath)\BuildCustomizations\masm.props"}] - ] - import_masm_targets_section = [ - ["Import", {"Project": r"$(VCTargetsPath)\BuildCustomizations\masm.targets"}] - ] - import_marmasm_props_section = [ - ["Import", {"Project": r"$(VCTargetsPath)\BuildCustomizations\marmasm.props"}] - ] - import_marmasm_targets_section = [ - ["Import", {"Project": r"$(VCTargetsPath)\BuildCustomizations\marmasm.targets"}] - ] - macro_section = [["PropertyGroup", {"Label": "UserMacros"}]] - - content = [ - "Project", - { - "xmlns": "http://schemas.microsoft.com/developer/msbuild/2003", - "ToolsVersion": version.ProjectVersion(), - "DefaultTargets": "Build", - }, - ] - - content += _GetMSBuildProjectConfigurations(configurations, spec) - content += _GetMSBuildGlobalProperties( - spec, version, project.guid, project_file_name - ) - content += import_default_section - content += _GetMSBuildConfigurationDetails(spec, project.build_file) - if spec.get("msvs_enable_winphone"): - content += _GetMSBuildLocalProperties("v120_wp81") - else: - content += _GetMSBuildLocalProperties(project.msbuild_toolset) - content += import_cpp_props_section - content += import_masm_props_section - if "arm64" in platforms and toolset == "target": - content += import_marmasm_props_section - content += _GetMSBuildExtensions(props_files_of_rules) - content += _GetMSBuildPropertySheets(configurations, spec) - content += macro_section - content += _GetMSBuildConfigurationGlobalProperties( - spec, configurations, project.build_file - ) - content += _GetMSBuildToolSettingsSections(spec, configurations) - content += _GetMSBuildSources( - spec, - sources, - exclusions, - rule_dependencies, - extension_to_rule_name, - actions_spec, - sources_handled_by_action, - list_excluded, - ) - content += _GetMSBuildProjectReferences(project) - content += import_cpp_targets_section - content += import_masm_targets_section - if "arm64" in platforms and toolset == "target": - content += import_marmasm_targets_section - content += _GetMSBuildExtensionTargets(targets_files_of_rules) - - if spec.get("msvs_external_builder"): - content += _GetMSBuildExternalBuilderTargets(spec) - - # TODO(jeanluc) File a bug to get rid of runas. We had in MSVS: - # has_run_as = _WriteMSVSUserFile(project.path, version, spec) - - easy_xml.WriteXmlIfChanged(content, project.path, pretty=True, win32=True) - - return missing_sources - - -def _GetMSBuildExternalBuilderTargets(spec): - """Return a list of MSBuild targets for external builders. - - The "Build" and "Clean" targets are always generated. If the spec contains - 'msvs_external_builder_clcompile_cmd', then the "ClCompile" target will also - be generated, to support building selected C/C++ files. - - Arguments: - spec: The gyp target spec. - Returns: - List of MSBuild 'Target' specs. - """ - build_cmd = _BuildCommandLineForRuleRaw( - spec, spec["msvs_external_builder_build_cmd"], False, False, False, False - ) - build_target = ["Target", {"Name": "Build"}] - build_target.append(["Exec", {"Command": build_cmd}]) - - clean_cmd = _BuildCommandLineForRuleRaw( - spec, spec["msvs_external_builder_clean_cmd"], False, False, False, False - ) - clean_target = ["Target", {"Name": "Clean"}] - clean_target.append(["Exec", {"Command": clean_cmd}]) - - targets = [build_target, clean_target] - - if spec.get("msvs_external_builder_clcompile_cmd"): - clcompile_cmd = _BuildCommandLineForRuleRaw( - spec, - spec["msvs_external_builder_clcompile_cmd"], - False, - False, - False, - False, - ) - clcompile_target = ["Target", {"Name": "ClCompile"}] - clcompile_target.append(["Exec", {"Command": clcompile_cmd}]) - targets.append(clcompile_target) - - return targets - - -def _GetMSBuildExtensions(props_files_of_rules): - extensions = ["ImportGroup", {"Label": "ExtensionSettings"}] - for props_file in props_files_of_rules: - extensions.append(["Import", {"Project": props_file}]) - return [extensions] - - -def _GetMSBuildExtensionTargets(targets_files_of_rules): - targets_node = ["ImportGroup", {"Label": "ExtensionTargets"}] - for targets_file in sorted(targets_files_of_rules): - targets_node.append(["Import", {"Project": targets_file}]) - return [targets_node] - - -def _GenerateActionsForMSBuild(spec, actions_to_add): - """Add actions accumulated into an actions_to_add, merging as needed. - - Arguments: - spec: the target project dict - actions_to_add: dictionary keyed on input name, which maps to a list of - dicts describing the actions attached to that input file. - - Returns: - A pair of (action specification, the sources handled by this action). - """ - sources_handled_by_action = OrderedSet() - actions_spec = [] - for primary_input, actions in actions_to_add.items(): - if generator_supports_multiple_toolsets: - primary_input = primary_input.replace(".exe", "_host.exe") - inputs = OrderedSet() - outputs = OrderedSet() - descriptions = [] - commands = [] - for action in actions: - - def fixup_host_exe(i): - if "$(OutDir)" in i: - i = i.replace(".exe", "_host.exe") - return i - - if generator_supports_multiple_toolsets: - action["inputs"] = [fixup_host_exe(i) for i in action["inputs"]] - inputs.update(OrderedSet(action["inputs"])) - outputs.update(OrderedSet(action["outputs"])) - descriptions.append(action["description"]) - cmd = action["command"] - if generator_supports_multiple_toolsets: - cmd = cmd.replace(".exe", "_host.exe") - # For most actions, add 'call' so that actions that invoke batch files - # return and continue executing. msbuild_use_call provides a way to - # disable this but I have not seen any adverse effect from doing that - # for everything. - if action.get("msbuild_use_call", True): - cmd = "call " + cmd - commands.append(cmd) - # Add the custom build action for one input file. - description = ", and also ".join(descriptions) - - # We can't join the commands simply with && because the command line will - # get too long. See also _AddActions: cygwin's setup_env mustn't be called - # for every invocation or the command that sets the PATH will grow too - # long. - command = "\r\n".join( - [c + "\r\nif %errorlevel% neq 0 exit /b %errorlevel%" for c in commands] - ) - _AddMSBuildAction( - spec, - primary_input, - inputs, - outputs, - command, - description, - sources_handled_by_action, - actions_spec, - ) - return actions_spec, sources_handled_by_action - - -def _AddMSBuildAction( - spec, - primary_input, - inputs, - outputs, - cmd, - description, - sources_handled_by_action, - actions_spec, -): - command = MSVSSettings.ConvertVCMacrosToMSBuild(cmd) - primary_input = _FixPath(primary_input) - inputs_array = _FixPaths(inputs) - outputs_array = _FixPaths(outputs) - additional_inputs = ";".join([i for i in inputs_array if i != primary_input]) - outputs = ";".join(outputs_array) - sources_handled_by_action.add(primary_input) - action_spec = ["CustomBuild", {"Include": primary_input}] - action_spec.extend( - # TODO(jeanluc) 'Document' for all or just if as_sources? - [ - ["FileType", "Document"], - ["Command", command], - ["Message", description], - ["Outputs", outputs], - ] - ) - if additional_inputs: - action_spec.append(["AdditionalInputs", additional_inputs]) - actions_spec.append(action_spec) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py deleted file mode 100755 index e80b57f06a130..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" Unit tests for the msvs.py file. """ - -import gyp.generator.msvs as msvs -import unittest - -from io import StringIO - - -class TestSequenceFunctions(unittest.TestCase): - def setUp(self): - self.stderr = StringIO() - - def test_GetLibraries(self): - self.assertEqual(msvs._GetLibraries({}), []) - self.assertEqual(msvs._GetLibraries({"libraries": []}), []) - self.assertEqual( - msvs._GetLibraries({"other": "foo", "libraries": ["a.lib"]}), ["a.lib"] - ) - self.assertEqual(msvs._GetLibraries({"libraries": ["-la"]}), ["a.lib"]) - self.assertEqual( - msvs._GetLibraries( - { - "libraries": [ - "a.lib", - "b.lib", - "c.lib", - "-lb.lib", - "-lb.lib", - "d.lib", - "a.lib", - ] - } - ), - ["c.lib", "b.lib", "d.lib", "a.lib"], - ) - - -if __name__ == "__main__": - unittest.main() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py deleted file mode 100644 index ca04ee13a1c1b..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +++ /dev/null @@ -1,2936 +0,0 @@ -# Copyright (c) 2013 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - - -import collections -import copy -import hashlib -import json -import multiprocessing -import os.path -import re -import signal -import subprocess -import sys -import gyp -import gyp.common -import gyp.msvs_emulation -import gyp.MSVSUtil as MSVSUtil -import gyp.xcode_emulation - -from io import StringIO - -from gyp.common import GetEnvironFallback -import gyp.ninja_syntax as ninja_syntax - -generator_default_variables = { - "EXECUTABLE_PREFIX": "", - "EXECUTABLE_SUFFIX": "", - "STATIC_LIB_PREFIX": "lib", - "STATIC_LIB_SUFFIX": ".a", - "SHARED_LIB_PREFIX": "lib", - # Gyp expects the following variables to be expandable by the build - # system to the appropriate locations. Ninja prefers paths to be - # known at gyp time. To resolve this, introduce special - # variables starting with $! and $| (which begin with a $ so gyp knows it - # should be treated specially, but is otherwise an invalid - # ninja/shell variable) that are passed to gyp here but expanded - # before writing out into the target .ninja files; see - # ExpandSpecial. - # $! is used for variables that represent a path and that can only appear at - # the start of a string, while $| is used for variables that can appear - # anywhere in a string. - "INTERMEDIATE_DIR": "$!INTERMEDIATE_DIR", - "SHARED_INTERMEDIATE_DIR": "$!PRODUCT_DIR/gen", - "PRODUCT_DIR": "$!PRODUCT_DIR", - "CONFIGURATION_NAME": "$|CONFIGURATION_NAME", - # Special variables that may be used by gyp 'rule' targets. - # We generate definitions for these variables on the fly when processing a - # rule. - "RULE_INPUT_ROOT": "${root}", - "RULE_INPUT_DIRNAME": "${dirname}", - "RULE_INPUT_PATH": "${source}", - "RULE_INPUT_EXT": "${ext}", - "RULE_INPUT_NAME": "${name}", -} - -# Placates pylint. -generator_additional_non_configuration_keys = [] -generator_additional_path_sections = [] -generator_extra_sources_for_rules = [] -generator_filelist_paths = None - -generator_supports_multiple_toolsets = gyp.common.CrossCompileRequested() - - -def StripPrefix(arg, prefix): - if arg.startswith(prefix): - return arg[len(prefix) :] - return arg - - -def QuoteShellArgument(arg, flavor): - """Quote a string such that it will be interpreted as a single argument - by the shell.""" - # Rather than attempting to enumerate the bad shell characters, just - # allow common OK ones and quote anything else. - if re.match(r"^[a-zA-Z0-9_=.\\/-]+$", arg): - return arg # No quoting necessary. - if flavor == "win": - return gyp.msvs_emulation.QuoteForRspFile(arg) - return "'" + arg.replace("'", "'" + '"\'"' + "'") + "'" - - -def Define(d, flavor): - """Takes a preprocessor define and returns a -D parameter that's ninja- and - shell-escaped.""" - if flavor == "win": - # cl.exe replaces literal # characters with = in preprocessor definitions for - # some reason. Octal-encode to work around that. - d = d.replace("#", "\\%03o" % ord("#")) - return QuoteShellArgument(ninja_syntax.escape("-D" + d), flavor) - - -def AddArch(output, arch): - """Adds an arch string to an output path.""" - output, extension = os.path.splitext(output) - return f"{output}.{arch}{extension}" - - -class Target: - """Target represents the paths used within a single gyp target. - - Conceptually, building a single target A is a series of steps: - - 1) actions/rules/copies generates source/resources/etc. - 2) compiles generates .o files - 3) link generates a binary (library/executable) - 4) bundle merges the above in a mac bundle - - (Any of these steps can be optional.) - - From a build ordering perspective, a dependent target B could just - depend on the last output of this series of steps. - - But some dependent commands sometimes need to reach inside the box. - For example, when linking B it needs to get the path to the static - library generated by A. - - This object stores those paths. To keep things simple, member - variables only store concrete paths to single files, while methods - compute derived values like "the last output of the target". - """ - - def __init__(self, type): - # Gyp type ("static_library", etc.) of this target. - self.type = type - # File representing whether any input dependencies necessary for - # dependent actions have completed. - self.preaction_stamp = None - # File representing whether any input dependencies necessary for - # dependent compiles have completed. - self.precompile_stamp = None - # File representing the completion of actions/rules/copies, if any. - self.actions_stamp = None - # Path to the output of the link step, if any. - self.binary = None - # Path to the file representing the completion of building the bundle, - # if any. - self.bundle = None - # On Windows, incremental linking requires linking against all the .objs - # that compose a .lib (rather than the .lib itself). That list is stored - # here. In this case, we also need to save the compile_deps for the target, - # so that the target that directly depends on the .objs can also depend - # on those. - self.component_objs = None - self.compile_deps = None - # Windows only. The import .lib is the output of a build step, but - # because dependents only link against the lib (not both the lib and the - # dll) we keep track of the import library here. - self.import_lib = None - # Track if this target contains any C++ files, to decide if gcc or g++ - # should be used for linking. - self.uses_cpp = False - - def Linkable(self): - """Return true if this is a target that can be linked against.""" - return self.type in ("static_library", "shared_library") - - def UsesToc(self, flavor): - """Return true if the target should produce a restat rule based on a TOC - file.""" - # For bundles, the .TOC should be produced for the binary, not for - # FinalOutput(). But the naive approach would put the TOC file into the - # bundle, so don't do this for bundles for now. - if flavor == "win" or self.bundle: - return False - return self.type in ("shared_library", "loadable_module") - - def PreActionInput(self, flavor): - """Return the path, if any, that should be used as a dependency of - any dependent action step.""" - if self.UsesToc(flavor): - return self.FinalOutput() + ".TOC" - return self.FinalOutput() or self.preaction_stamp - - def PreCompileInput(self): - """Return the path, if any, that should be used as a dependency of - any dependent compile step.""" - return self.actions_stamp or self.precompile_stamp - - def FinalOutput(self): - """Return the last output of the target, which depends on all prior - steps.""" - return self.bundle or self.binary or self.actions_stamp - - -# A small discourse on paths as used within the Ninja build: -# All files we produce (both at gyp and at build time) appear in the -# build directory (e.g. out/Debug). -# -# Paths within a given .gyp file are always relative to the directory -# containing the .gyp file. Call these "gyp paths". This includes -# sources as well as the starting directory a given gyp rule/action -# expects to be run from. We call the path from the source root to -# the gyp file the "base directory" within the per-.gyp-file -# NinjaWriter code. -# -# All paths as written into the .ninja files are relative to the build -# directory. Call these paths "ninja paths". -# -# We translate between these two notions of paths with two helper -# functions: -# -# - GypPathToNinja translates a gyp path (i.e. relative to the .gyp file) -# into the equivalent ninja path. -# -# - GypPathToUniqueOutput translates a gyp path into a ninja path to write -# an output file; the result can be namespaced such that it is unique -# to the input file name as well as the output target name. - - -class NinjaWriter: - def __init__( - self, - hash_for_rules, - target_outputs, - base_dir, - build_dir, - output_file, - toplevel_build, - output_file_name, - flavor, - toplevel_dir=None, - ): - """ - base_dir: path from source root to directory containing this gyp file, - by gyp semantics, all input paths are relative to this - build_dir: path from source root to build output - toplevel_dir: path to the toplevel directory - """ - - self.hash_for_rules = hash_for_rules - self.target_outputs = target_outputs - self.base_dir = base_dir - self.build_dir = build_dir - self.ninja = ninja_syntax.Writer(output_file) - self.toplevel_build = toplevel_build - self.output_file_name = output_file_name - - self.flavor = flavor - self.abs_build_dir = None - if toplevel_dir is not None: - self.abs_build_dir = os.path.abspath(os.path.join(toplevel_dir, build_dir)) - self.obj_ext = ".obj" if flavor == "win" else ".o" - if flavor == "win": - # See docstring of msvs_emulation.GenerateEnvironmentFiles(). - self.win_env = {} - for arch in ("x86", "x64"): - self.win_env[arch] = "environment." + arch - - # Relative path from build output dir to base dir. - build_to_top = gyp.common.InvertRelativePath(build_dir, toplevel_dir) - self.build_to_base = os.path.join(build_to_top, base_dir) - # Relative path from base dir to build dir. - base_to_top = gyp.common.InvertRelativePath(base_dir, toplevel_dir) - self.base_to_build = os.path.join(base_to_top, build_dir) - - def ExpandSpecial(self, path, product_dir=None): - """Expand specials like $!PRODUCT_DIR in |path|. - - If |product_dir| is None, assumes the cwd is already the product - dir. Otherwise, |product_dir| is the relative path to the product - dir. - """ - - PRODUCT_DIR = "$!PRODUCT_DIR" - if PRODUCT_DIR in path: - if product_dir: - path = path.replace(PRODUCT_DIR, product_dir) - else: - path = path.replace(PRODUCT_DIR + "/", "") - path = path.replace(PRODUCT_DIR + "\\", "") - path = path.replace(PRODUCT_DIR, ".") - - INTERMEDIATE_DIR = "$!INTERMEDIATE_DIR" - if INTERMEDIATE_DIR in path: - int_dir = self.GypPathToUniqueOutput("gen") - # GypPathToUniqueOutput generates a path relative to the product dir, - # so insert product_dir in front if it is provided. - path = path.replace( - INTERMEDIATE_DIR, os.path.join(product_dir or "", int_dir) - ) - - CONFIGURATION_NAME = "$|CONFIGURATION_NAME" - path = path.replace(CONFIGURATION_NAME, self.config_name) - - return path - - def ExpandRuleVariables(self, path, root, dirname, source, ext, name): - if self.flavor == "win": - path = self.msvs_settings.ConvertVSMacros(path, config=self.config_name) - path = path.replace(generator_default_variables["RULE_INPUT_ROOT"], root) - path = path.replace(generator_default_variables["RULE_INPUT_DIRNAME"], dirname) - path = path.replace(generator_default_variables["RULE_INPUT_PATH"], source) - path = path.replace(generator_default_variables["RULE_INPUT_EXT"], ext) - path = path.replace(generator_default_variables["RULE_INPUT_NAME"], name) - return path - - def GypPathToNinja(self, path, env=None): - """Translate a gyp path to a ninja path, optionally expanding environment - variable references in |path| with |env|. - - See the above discourse on path conversions.""" - if env: - if self.flavor == "mac": - path = gyp.xcode_emulation.ExpandEnvVars(path, env) - elif self.flavor == "win": - path = gyp.msvs_emulation.ExpandMacros(path, env) - if path.startswith("$!"): - expanded = self.ExpandSpecial(path) - if self.flavor == "win": - expanded = os.path.normpath(expanded) - return expanded - if "$|" in path: - path = self.ExpandSpecial(path) - assert "$" not in path, path - return os.path.normpath(os.path.join(self.build_to_base, path)) - - def GypPathToUniqueOutput(self, path, qualified=True): - """Translate a gyp path to a ninja path for writing output. - - If qualified is True, qualify the resulting filename with the name - of the target. This is necessary when e.g. compiling the same - path twice for two separate output targets. - - See the above discourse on path conversions.""" - - path = self.ExpandSpecial(path) - assert not path.startswith("$"), path - - # Translate the path following this scheme: - # Input: foo/bar.gyp, target targ, references baz/out.o - # Output: obj/foo/baz/targ.out.o (if qualified) - # obj/foo/baz/out.o (otherwise) - # (and obj.host instead of obj for cross-compiles) - # - # Why this scheme and not some other one? - # 1) for a given input, you can compute all derived outputs by matching - # its path, even if the input is brought via a gyp file with '..'. - # 2) simple files like libraries and stamps have a simple filename. - - obj = "obj" - if self.toolset != "target": - obj += "." + self.toolset - - path_dir, path_basename = os.path.split(path) - assert not os.path.isabs(path_dir), ( - "'%s' can not be absolute path (see crbug.com/462153)." % path_dir - ) - - if qualified: - path_basename = self.name + "." + path_basename - return os.path.normpath( - os.path.join(obj, self.base_dir, path_dir, path_basename) - ) - - def WriteCollapsedDependencies(self, name, targets, order_only=None): - """Given a list of targets, return a path for a single file - representing the result of building all the targets or None. - - Uses a stamp file if necessary.""" - - assert targets == [item for item in targets if item], targets - if len(targets) == 0: - assert not order_only - return None - if len(targets) > 1 or order_only: - stamp = self.GypPathToUniqueOutput(name + ".stamp") - targets = self.ninja.build(stamp, "stamp", targets, order_only=order_only) - self.ninja.newline() - return targets[0] - - def _SubninjaNameForArch(self, arch): - output_file_base = os.path.splitext(self.output_file_name)[0] - return f"{output_file_base}.{arch}.ninja" - - def WriteSpec(self, spec, config_name, generator_flags): - """The main entry point for NinjaWriter: write the build rules for a spec. - - Returns a Target object, which represents the output paths for this spec. - Returns None if there are no outputs (e.g. a settings-only 'none' type - target).""" - - self.config_name = config_name - self.name = spec["target_name"] - self.toolset = spec["toolset"] - config = spec["configurations"][config_name] - self.target = Target(spec["type"]) - self.is_standalone_static_library = bool( - spec.get("standalone_static_library", 0) - ) - - self.target_rpath = generator_flags.get("target_rpath", r"\$$ORIGIN/lib/") - - self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) - self.xcode_settings = self.msvs_settings = None - if self.flavor == "mac": - self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) - mac_toolchain_dir = generator_flags.get("mac_toolchain_dir", None) - if mac_toolchain_dir: - self.xcode_settings.mac_toolchain_dir = mac_toolchain_dir - - if self.flavor == "win": - self.msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, generator_flags) - arch = self.msvs_settings.GetArch(config_name) - self.ninja.variable("arch", self.win_env[arch]) - self.ninja.variable("cc", "$cl_" + arch) - self.ninja.variable("cxx", "$cl_" + arch) - self.ninja.variable("cc_host", "$cl_" + arch) - self.ninja.variable("cxx_host", "$cl_" + arch) - self.ninja.variable("asm", "$ml_" + arch) - - if self.flavor == "mac": - self.archs = self.xcode_settings.GetActiveArchs(config_name) - if len(self.archs) > 1: - self.arch_subninjas = { - arch: ninja_syntax.Writer( - OpenOutput( - os.path.join( - self.toplevel_build, self._SubninjaNameForArch(arch) - ), - "w", - ) - ) - for arch in self.archs - } - - # Compute predepends for all rules. - # actions_depends is the dependencies this target depends on before running - # any of its action/rule/copy steps. - # compile_depends is the dependencies this target depends on before running - # any of its compile steps. - actions_depends = [] - compile_depends = [] - # TODO(evan): it is rather confusing which things are lists and which - # are strings. Fix these. - if "dependencies" in spec: - for dep in spec["dependencies"]: - if dep in self.target_outputs: - target = self.target_outputs[dep] - actions_depends.append(target.PreActionInput(self.flavor)) - compile_depends.append(target.PreCompileInput()) - if target.uses_cpp: - self.target.uses_cpp = True - actions_depends = [item for item in actions_depends if item] - compile_depends = [item for item in compile_depends if item] - actions_depends = self.WriteCollapsedDependencies( - "actions_depends", actions_depends - ) - compile_depends = self.WriteCollapsedDependencies( - "compile_depends", compile_depends - ) - self.target.preaction_stamp = actions_depends - self.target.precompile_stamp = compile_depends - - # Write out actions, rules, and copies. These must happen before we - # compile any sources, so compute a list of predependencies for sources - # while we do it. - extra_sources = [] - mac_bundle_depends = [] - self.target.actions_stamp = self.WriteActionsRulesCopies( - spec, extra_sources, actions_depends, mac_bundle_depends - ) - - # If we have actions/rules/copies, we depend directly on those, but - # otherwise we depend on dependent target's actions/rules/copies etc. - # We never need to explicitly depend on previous target's link steps, - # because no compile ever depends on them. - compile_depends_stamp = self.target.actions_stamp or compile_depends - - # Write out the compilation steps, if any. - link_deps = [] - try: - sources = extra_sources + spec.get("sources", []) - except TypeError: - print("extra_sources: ", str(extra_sources)) - print('spec.get("sources"): ', str(spec.get("sources"))) - raise - if sources: - if self.flavor == "mac" and len(self.archs) > 1: - # Write subninja file containing compile and link commands scoped to - # a single arch if a fat binary is being built. - for arch in self.archs: - self.ninja.subninja(self._SubninjaNameForArch(arch)) - - pch = None - if self.flavor == "win": - gyp.msvs_emulation.VerifyMissingSources( - sources, self.abs_build_dir, generator_flags, self.GypPathToNinja - ) - pch = gyp.msvs_emulation.PrecompiledHeader( - self.msvs_settings, - config_name, - self.GypPathToNinja, - self.GypPathToUniqueOutput, - self.obj_ext, - ) - else: - pch = gyp.xcode_emulation.MacPrefixHeader( - self.xcode_settings, - self.GypPathToNinja, - lambda path, lang: self.GypPathToUniqueOutput(path + "-" + lang), - ) - link_deps = self.WriteSources( - self.ninja, - config_name, - config, - sources, - compile_depends_stamp, - pch, - spec, - ) - # Some actions/rules output 'sources' that are already object files. - obj_outputs = [f for f in sources if f.endswith(self.obj_ext)] - if obj_outputs: - if self.flavor != "mac" or len(self.archs) == 1: - link_deps += [self.GypPathToNinja(o) for o in obj_outputs] - else: - print( - "Warning: Actions/rules writing object files don't work with " - "multiarch targets, dropping. (target %s)" % spec["target_name"] - ) - elif self.flavor == "mac" and len(self.archs) > 1: - link_deps = collections.defaultdict(list) - - compile_deps = self.target.actions_stamp or actions_depends - if self.flavor == "win" and self.target.type == "static_library": - self.target.component_objs = link_deps - self.target.compile_deps = compile_deps - - # Write out a link step, if needed. - output = None - is_empty_bundle = not link_deps and not mac_bundle_depends - if link_deps or self.target.actions_stamp or actions_depends: - output = self.WriteTarget( - spec, config_name, config, link_deps, compile_deps - ) - if self.is_mac_bundle: - mac_bundle_depends.append(output) - - # Bundle all of the above together, if needed. - if self.is_mac_bundle: - output = self.WriteMacBundle(spec, mac_bundle_depends, is_empty_bundle) - - if not output: - return None - - assert self.target.FinalOutput(), output - return self.target - - def _WinIdlRule(self, source, prebuild, outputs): - """Handle the implicit VS .idl rule for one source file. Fills |outputs| - with files that are generated.""" - outdir, output, vars, flags = self.msvs_settings.GetIdlBuildData( - source, self.config_name - ) - outdir = self.GypPathToNinja(outdir) - - def fix_path(path, rel=None): - path = os.path.join(outdir, path) - dirname, basename = os.path.split(source) - root, ext = os.path.splitext(basename) - path = self.ExpandRuleVariables(path, root, dirname, source, ext, basename) - if rel: - path = os.path.relpath(path, rel) - return path - - vars = [(name, fix_path(value, outdir)) for name, value in vars] - output = [fix_path(p) for p in output] - vars.append(("outdir", outdir)) - vars.append(("idlflags", flags)) - input = self.GypPathToNinja(source) - self.ninja.build(output, "idl", input, variables=vars, order_only=prebuild) - outputs.extend(output) - - def WriteWinIdlFiles(self, spec, prebuild): - """Writes rules to match MSVS's implicit idl handling.""" - assert self.flavor == "win" - if self.msvs_settings.HasExplicitIdlRulesOrActions(spec): - return [] - outputs = [] - for source in filter(lambda x: x.endswith(".idl"), spec["sources"]): - self._WinIdlRule(source, prebuild, outputs) - return outputs - - def WriteActionsRulesCopies( - self, spec, extra_sources, prebuild, mac_bundle_depends - ): - """Write out the Actions, Rules, and Copies steps. Return a path - representing the outputs of these steps.""" - outputs = [] - if self.is_mac_bundle: - mac_bundle_resources = spec.get("mac_bundle_resources", [])[:] - else: - mac_bundle_resources = [] - extra_mac_bundle_resources = [] - - if "actions" in spec: - outputs += self.WriteActions( - spec["actions"], extra_sources, prebuild, extra_mac_bundle_resources - ) - if "rules" in spec: - outputs += self.WriteRules( - spec["rules"], - extra_sources, - prebuild, - mac_bundle_resources, - extra_mac_bundle_resources, - ) - if "copies" in spec: - outputs += self.WriteCopies(spec["copies"], prebuild, mac_bundle_depends) - - if "sources" in spec and self.flavor == "win": - outputs += self.WriteWinIdlFiles(spec, prebuild) - - if self.xcode_settings and self.xcode_settings.IsIosFramework(): - self.WriteiOSFrameworkHeaders(spec, outputs, prebuild) - - stamp = self.WriteCollapsedDependencies("actions_rules_copies", outputs) - - if self.is_mac_bundle: - xcassets = self.WriteMacBundleResources( - extra_mac_bundle_resources + mac_bundle_resources, mac_bundle_depends - ) - partial_info_plist = self.WriteMacXCassets(xcassets, mac_bundle_depends) - self.WriteMacInfoPlist(partial_info_plist, mac_bundle_depends) - - return stamp - - def GenerateDescription(self, verb, message, fallback): - """Generate and return a description of a build step. - - |verb| is the short summary, e.g. ACTION or RULE. - |message| is a hand-written description, or None if not available. - |fallback| is the gyp-level name of the step, usable as a fallback. - """ - if self.toolset != "target": - verb += "(%s)" % self.toolset - if message: - return f"{verb} {self.ExpandSpecial(message)}" - else: - return f"{verb} {self.name}: {fallback}" - - def WriteActions( - self, actions, extra_sources, prebuild, extra_mac_bundle_resources - ): - # Actions cd into the base directory. - env = self.GetToolchainEnv() - all_outputs = [] - for action in actions: - # First write out a rule for the action. - name = "{}_{}".format(action["action_name"], self.hash_for_rules) - description = self.GenerateDescription( - "ACTION", action.get("message", None), name - ) - win_shell_flags = ( - self.msvs_settings.GetRuleShellFlags(action) - if self.flavor == "win" - else None - ) - args = action["action"] - depfile = action.get("depfile", None) - if depfile: - depfile = self.ExpandSpecial(depfile, self.base_to_build) - pool = "console" if int(action.get("ninja_use_console", 0)) else None - rule_name, _ = self.WriteNewNinjaRule( - name, args, description, win_shell_flags, env, pool, depfile=depfile - ) - - inputs = [self.GypPathToNinja(i, env) for i in action["inputs"]] - if int(action.get("process_outputs_as_sources", False)): - extra_sources += action["outputs"] - if int(action.get("process_outputs_as_mac_bundle_resources", False)): - extra_mac_bundle_resources += action["outputs"] - outputs = [self.GypPathToNinja(o, env) for o in action["outputs"]] - - # Then write out an edge using the rule. - self.ninja.build(outputs, rule_name, inputs, order_only=prebuild) - all_outputs += outputs - - self.ninja.newline() - - return all_outputs - - def WriteRules( - self, - rules, - extra_sources, - prebuild, - mac_bundle_resources, - extra_mac_bundle_resources, - ): - env = self.GetToolchainEnv() - all_outputs = [] - for rule in rules: - # Skip a rule with no action and no inputs. - if "action" not in rule and not rule.get("rule_sources", []): - continue - - # First write out a rule for the rule action. - name = "{}_{}".format(rule["rule_name"], self.hash_for_rules) - - args = rule["action"] - description = self.GenerateDescription( - "RULE", - rule.get("message", None), - ("%s " + generator_default_variables["RULE_INPUT_PATH"]) % name, - ) - win_shell_flags = ( - self.msvs_settings.GetRuleShellFlags(rule) - if self.flavor == "win" - else None - ) - pool = "console" if int(rule.get("ninja_use_console", 0)) else None - rule_name, args = self.WriteNewNinjaRule( - name, args, description, win_shell_flags, env, pool - ) - - # TODO: if the command references the outputs directly, we should - # simplify it to just use $out. - - # Rules can potentially make use of some special variables which - # must vary per source file. - # Compute the list of variables we'll need to provide. - special_locals = ("source", "root", "dirname", "ext", "name") - needed_variables = {"source"} - for argument in args: - for var in special_locals: - if "${%s}" % var in argument: - needed_variables.add(var) - needed_variables = sorted(needed_variables) - - def cygwin_munge(path): - # pylint: disable=cell-var-from-loop - if win_shell_flags and win_shell_flags.cygwin: - return path.replace("\\", "/") - return path - - inputs = [self.GypPathToNinja(i, env) for i in rule.get("inputs", [])] - - # If there are n source files matching the rule, and m additional rule - # inputs, then adding 'inputs' to each build edge written below will - # write m * n inputs. Collapsing reduces this to m + n. - sources = rule.get("rule_sources", []) - num_inputs = len(inputs) - if prebuild: - num_inputs += 1 - if num_inputs > 2 and len(sources) > 2: - inputs = [ - self.WriteCollapsedDependencies( - rule["rule_name"], inputs, order_only=prebuild - ) - ] - prebuild = [] - - # For each source file, write an edge that generates all the outputs. - for source in sources: - source = os.path.normpath(source) - dirname, basename = os.path.split(source) - root, ext = os.path.splitext(basename) - - # Gather the list of inputs and outputs, expanding $vars if possible. - outputs = [ - self.ExpandRuleVariables(o, root, dirname, source, ext, basename) - for o in rule["outputs"] - ] - - if int(rule.get("process_outputs_as_sources", False)): - extra_sources += outputs - - was_mac_bundle_resource = source in mac_bundle_resources - if was_mac_bundle_resource or int( - rule.get("process_outputs_as_mac_bundle_resources", False) - ): - extra_mac_bundle_resources += outputs - # Note: This is n_resources * n_outputs_in_rule. - # Put to-be-removed items in a set and - # remove them all in a single pass - # if this becomes a performance issue. - if was_mac_bundle_resource: - mac_bundle_resources.remove(source) - - extra_bindings = [] - for var in needed_variables: - if var == "root": - extra_bindings.append(("root", cygwin_munge(root))) - elif var == "dirname": - # '$dirname' is a parameter to the rule action, which means - # it shouldn't be converted to a Ninja path. But we don't - # want $!PRODUCT_DIR in there either. - dirname_expanded = self.ExpandSpecial( - dirname, self.base_to_build - ) - extra_bindings.append( - ("dirname", cygwin_munge(dirname_expanded)) - ) - elif var == "source": - # '$source' is a parameter to the rule action, which means - # it shouldn't be converted to a Ninja path. But we don't - # want $!PRODUCT_DIR in there either. - source_expanded = self.ExpandSpecial(source, self.base_to_build) - extra_bindings.append(("source", cygwin_munge(source_expanded))) - elif var == "ext": - extra_bindings.append(("ext", ext)) - elif var == "name": - extra_bindings.append(("name", cygwin_munge(basename))) - else: - assert var is None, repr(var) - - outputs = [self.GypPathToNinja(o, env) for o in outputs] - if self.flavor == "win": - # WriteNewNinjaRule uses unique_name to create a rsp file on win. - extra_bindings.append( - ("unique_name", hashlib.md5(outputs[0]).hexdigest()) - ) - - self.ninja.build( - outputs, - rule_name, - self.GypPathToNinja(source), - implicit=inputs, - order_only=prebuild, - variables=extra_bindings, - ) - - all_outputs.extend(outputs) - - return all_outputs - - def WriteCopies(self, copies, prebuild, mac_bundle_depends): - outputs = [] - if self.xcode_settings: - extra_env = self.xcode_settings.GetPerTargetSettings() - env = self.GetToolchainEnv(additional_settings=extra_env) - else: - env = self.GetToolchainEnv() - for to_copy in copies: - for path in to_copy["files"]: - # Normalize the path so trailing slashes don't confuse us. - path = os.path.normpath(path) - basename = os.path.split(path)[1] - src = self.GypPathToNinja(path, env) - dst = self.GypPathToNinja( - os.path.join(to_copy["destination"], basename), env - ) - outputs += self.ninja.build(dst, "copy", src, order_only=prebuild) - if self.is_mac_bundle: - # gyp has mac_bundle_resources to copy things into a bundle's - # Resources folder, but there's no built-in way to copy files - # to other places in the bundle. - # Hence, some targets use copies for this. - # Check if this file is copied into the current bundle, - # and if so add it to the bundle depends so - # that dependent targets get rebuilt if the copy input changes. - if dst.startswith( - self.xcode_settings.GetBundleContentsFolderPath() - ): - mac_bundle_depends.append(dst) - - return outputs - - def WriteiOSFrameworkHeaders(self, spec, outputs, prebuild): - """Prebuild steps to generate hmap files and copy headers to destination.""" - framework = self.ComputeMacBundleOutput() - all_sources = spec["sources"] - copy_headers = spec["mac_framework_headers"] - output = self.GypPathToUniqueOutput("headers.hmap") - self.xcode_settings.header_map_path = output - all_headers = map( - self.GypPathToNinja, filter(lambda x: x.endswith(".h"), all_sources) - ) - variables = [ - ("framework", framework), - ("copy_headers", map(self.GypPathToNinja, copy_headers)), - ] - outputs.extend( - self.ninja.build( - output, - "compile_ios_framework_headers", - all_headers, - variables=variables, - order_only=prebuild, - ) - ) - - def WriteMacBundleResources(self, resources, bundle_depends): - """Writes ninja edges for 'mac_bundle_resources'.""" - xcassets = [] - - extra_env = self.xcode_settings.GetPerTargetSettings() - env = self.GetSortedXcodeEnv(additional_settings=extra_env) - env = self.ComputeExportEnvString(env) - isBinary = self.xcode_settings.IsBinaryOutputFormat(self.config_name) - - for output, res in gyp.xcode_emulation.GetMacBundleResources( - generator_default_variables["PRODUCT_DIR"], - self.xcode_settings, - map(self.GypPathToNinja, resources), - ): - output = self.ExpandSpecial(output) - if os.path.splitext(output)[-1] != ".xcassets": - self.ninja.build( - output, - "mac_tool", - res, - variables=[ - ("mactool_cmd", "copy-bundle-resource"), - ("env", env), - ("binary", isBinary), - ], - ) - bundle_depends.append(output) - else: - xcassets.append(res) - return xcassets - - def WriteMacXCassets(self, xcassets, bundle_depends): - """Writes ninja edges for 'mac_bundle_resources' .xcassets files. - - This add an invocation of 'actool' via the 'mac_tool.py' helper script. - It assumes that the assets catalogs define at least one imageset and - thus an Assets.car file will be generated in the application resources - directory. If this is not the case, then the build will probably be done - at each invocation of ninja.""" - if not xcassets: - return - - extra_arguments = {} - settings_to_arg = { - "XCASSETS_APP_ICON": "app-icon", - "XCASSETS_LAUNCH_IMAGE": "launch-image", - } - settings = self.xcode_settings.xcode_settings[self.config_name] - for settings_key, arg_name in settings_to_arg.items(): - value = settings.get(settings_key) - if value: - extra_arguments[arg_name] = value - - partial_info_plist = None - if extra_arguments: - partial_info_plist = self.GypPathToUniqueOutput( - "assetcatalog_generated_info.plist" - ) - extra_arguments["output-partial-info-plist"] = partial_info_plist - - outputs = [] - outputs.append( - os.path.join(self.xcode_settings.GetBundleResourceFolder(), "Assets.car") - ) - if partial_info_plist: - outputs.append(partial_info_plist) - - keys = QuoteShellArgument(json.dumps(extra_arguments), self.flavor) - extra_env = self.xcode_settings.GetPerTargetSettings() - env = self.GetSortedXcodeEnv(additional_settings=extra_env) - env = self.ComputeExportEnvString(env) - - bundle_depends.extend( - self.ninja.build( - outputs, - "compile_xcassets", - xcassets, - variables=[("env", env), ("keys", keys)], - ) - ) - return partial_info_plist - - def WriteMacInfoPlist(self, partial_info_plist, bundle_depends): - """Write build rules for bundle Info.plist files.""" - info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist( - generator_default_variables["PRODUCT_DIR"], - self.xcode_settings, - self.GypPathToNinja, - ) - if not info_plist: - return - out = self.ExpandSpecial(out) - if defines: - # Create an intermediate file to store preprocessed results. - intermediate_plist = self.GypPathToUniqueOutput( - os.path.basename(info_plist) - ) - defines = " ".join([Define(d, self.flavor) for d in defines]) - info_plist = self.ninja.build( - intermediate_plist, - "preprocess_infoplist", - info_plist, - variables=[("defines", defines)], - ) - - env = self.GetSortedXcodeEnv(additional_settings=extra_env) - env = self.ComputeExportEnvString(env) - - if partial_info_plist: - intermediate_plist = self.GypPathToUniqueOutput("merged_info.plist") - info_plist = self.ninja.build( - intermediate_plist, "merge_infoplist", [partial_info_plist, info_plist] - ) - - keys = self.xcode_settings.GetExtraPlistItems(self.config_name) - keys = QuoteShellArgument(json.dumps(keys), self.flavor) - isBinary = self.xcode_settings.IsBinaryOutputFormat(self.config_name) - self.ninja.build( - out, - "copy_infoplist", - info_plist, - variables=[("env", env), ("keys", keys), ("binary", isBinary)], - ) - bundle_depends.append(out) - - def WriteSources( - self, - ninja_file, - config_name, - config, - sources, - predepends, - precompiled_header, - spec, - ): - """Write build rules to compile all of |sources|.""" - if self.toolset == "host": - self.ninja.variable("ar", "$ar_host") - self.ninja.variable("cc", "$cc_host") - self.ninja.variable("cxx", "$cxx_host") - self.ninja.variable("ld", "$ld_host") - self.ninja.variable("ldxx", "$ldxx_host") - self.ninja.variable("nm", "$nm_host") - self.ninja.variable("readelf", "$readelf_host") - - if self.flavor != "mac" or len(self.archs) == 1: - return self.WriteSourcesForArch( - self.ninja, - config_name, - config, - sources, - predepends, - precompiled_header, - spec, - ) - else: - return { - arch: self.WriteSourcesForArch( - self.arch_subninjas[arch], - config_name, - config, - sources, - predepends, - precompiled_header, - spec, - arch=arch, - ) - for arch in self.archs - } - - def WriteSourcesForArch( - self, - ninja_file, - config_name, - config, - sources, - predepends, - precompiled_header, - spec, - arch=None, - ): - """Write build rules to compile all of |sources|.""" - - extra_defines = [] - if self.flavor == "mac": - cflags = self.xcode_settings.GetCflags(config_name, arch=arch) - cflags_c = self.xcode_settings.GetCflagsC(config_name) - cflags_cc = self.xcode_settings.GetCflagsCC(config_name) - cflags_objc = ["$cflags_c"] + self.xcode_settings.GetCflagsObjC(config_name) - cflags_objcc = ["$cflags_cc"] + self.xcode_settings.GetCflagsObjCC( - config_name - ) - elif self.flavor == "win": - asmflags = self.msvs_settings.GetAsmflags(config_name) - cflags = self.msvs_settings.GetCflags(config_name) - cflags_c = self.msvs_settings.GetCflagsC(config_name) - cflags_cc = self.msvs_settings.GetCflagsCC(config_name) - extra_defines = self.msvs_settings.GetComputedDefines(config_name) - # See comment at cc_command for why there's two .pdb files. - pdbpath_c = pdbpath_cc = self.msvs_settings.GetCompilerPdbName( - config_name, self.ExpandSpecial - ) - if not pdbpath_c: - obj = "obj" - if self.toolset != "target": - obj += "." + self.toolset - pdbpath = os.path.normpath(os.path.join(obj, self.base_dir, self.name)) - pdbpath_c = pdbpath + ".c.pdb" - pdbpath_cc = pdbpath + ".cc.pdb" - self.WriteVariableList(ninja_file, "pdbname_c", [pdbpath_c]) - self.WriteVariableList(ninja_file, "pdbname_cc", [pdbpath_cc]) - self.WriteVariableList(ninja_file, "pchprefix", [self.name]) - else: - cflags = config.get("cflags", []) - cflags_c = config.get("cflags_c", []) - cflags_cc = config.get("cflags_cc", []) - - # Respect environment variables related to build, but target-specific - # flags can still override them. - if self.toolset == "target": - cflags_c = ( - os.environ.get("CPPFLAGS", "").split() - + os.environ.get("CFLAGS", "").split() - + cflags_c - ) - cflags_cc = ( - os.environ.get("CPPFLAGS", "").split() - + os.environ.get("CXXFLAGS", "").split() - + cflags_cc - ) - elif self.toolset == "host": - cflags_c = ( - os.environ.get("CPPFLAGS_host", "").split() - + os.environ.get("CFLAGS_host", "").split() - + cflags_c - ) - cflags_cc = ( - os.environ.get("CPPFLAGS_host", "").split() - + os.environ.get("CXXFLAGS_host", "").split() - + cflags_cc - ) - - defines = config.get("defines", []) + extra_defines - self.WriteVariableList( - ninja_file, "defines", [Define(d, self.flavor) for d in defines] - ) - if self.flavor == "win": - self.WriteVariableList( - ninja_file, "asmflags", map(self.ExpandSpecial, asmflags) - ) - self.WriteVariableList( - ninja_file, - "rcflags", - [ - QuoteShellArgument(self.ExpandSpecial(f), self.flavor) - for f in self.msvs_settings.GetRcflags( - config_name, self.GypPathToNinja - ) - ], - ) - - include_dirs = config.get("include_dirs", []) - - env = self.GetToolchainEnv() - if self.flavor == "win": - include_dirs = self.msvs_settings.AdjustIncludeDirs( - include_dirs, config_name - ) - self.WriteVariableList( - ninja_file, - "includes", - [ - QuoteShellArgument("-I" + self.GypPathToNinja(i, env), self.flavor) - for i in include_dirs - ], - ) - - if self.flavor == "win": - midl_include_dirs = config.get("midl_include_dirs", []) - midl_include_dirs = self.msvs_settings.AdjustMidlIncludeDirs( - midl_include_dirs, config_name - ) - self.WriteVariableList( - ninja_file, - "midl_includes", - [ - QuoteShellArgument("-I" + self.GypPathToNinja(i, env), self.flavor) - for i in midl_include_dirs - ], - ) - - pch_commands = precompiled_header.GetPchBuildCommands(arch) - if self.flavor == "mac": - # Most targets use no precompiled headers, so only write these if needed. - for ext, var in [ - ("c", "cflags_pch_c"), - ("cc", "cflags_pch_cc"), - ("m", "cflags_pch_objc"), - ("mm", "cflags_pch_objcc"), - ]: - include = precompiled_header.GetInclude(ext, arch) - if include: - ninja_file.variable(var, include) - - arflags = config.get("arflags", []) - - self.WriteVariableList(ninja_file, "cflags", map(self.ExpandSpecial, cflags)) - self.WriteVariableList( - ninja_file, "cflags_c", map(self.ExpandSpecial, cflags_c) - ) - self.WriteVariableList( - ninja_file, "cflags_cc", map(self.ExpandSpecial, cflags_cc) - ) - if self.flavor == "mac": - self.WriteVariableList( - ninja_file, "cflags_objc", map(self.ExpandSpecial, cflags_objc) - ) - self.WriteVariableList( - ninja_file, "cflags_objcc", map(self.ExpandSpecial, cflags_objcc) - ) - self.WriteVariableList(ninja_file, "arflags", map(self.ExpandSpecial, arflags)) - ninja_file.newline() - outputs = [] - has_rc_source = False - for source in sources: - filename, ext = os.path.splitext(source) - ext = ext[1:] - obj_ext = self.obj_ext - if ext in ("cc", "cpp", "cxx"): - command = "cxx" - self.target.uses_cpp = True - elif ext == "c" or (ext == "S" and self.flavor != "win"): - command = "cc" - elif ext == "s" and self.flavor != "win": # Doesn't generate .o.d files. - command = "cc_s" - elif ( - self.flavor == "win" - and ext in ("asm", "S") - and not self.msvs_settings.HasExplicitAsmRules(spec) - ): - command = "asm" - # Add the _asm suffix as msvs is capable of handling .cc and - # .asm files of the same name without collision. - obj_ext = "_asm.obj" - elif self.flavor == "mac" and ext == "m": - command = "objc" - elif self.flavor == "mac" and ext == "mm": - command = "objcxx" - self.target.uses_cpp = True - elif self.flavor == "win" and ext == "rc": - command = "rc" - obj_ext = ".res" - has_rc_source = True - else: - # Ignore unhandled extensions. - continue - input = self.GypPathToNinja(source) - output = self.GypPathToUniqueOutput(filename + obj_ext) - if arch is not None: - output = AddArch(output, arch) - implicit = precompiled_header.GetObjDependencies([input], [output], arch) - variables = [] - if self.flavor == "win": - variables, output, implicit = precompiled_header.GetFlagsModifications( - input, - output, - implicit, - command, - cflags_c, - cflags_cc, - self.ExpandSpecial, - ) - ninja_file.build( - output, - command, - input, - implicit=[gch for _, _, gch in implicit], - order_only=predepends, - variables=variables, - ) - outputs.append(output) - - if has_rc_source: - resource_include_dirs = config.get("resource_include_dirs", include_dirs) - self.WriteVariableList( - ninja_file, - "resource_includes", - [ - QuoteShellArgument("-I" + self.GypPathToNinja(i, env), self.flavor) - for i in resource_include_dirs - ], - ) - - self.WritePchTargets(ninja_file, pch_commands) - - ninja_file.newline() - return outputs - - def WritePchTargets(self, ninja_file, pch_commands): - """Writes ninja rules to compile prefix headers.""" - if not pch_commands: - return - - for gch, lang_flag, lang, input in pch_commands: - var_name = { - "c": "cflags_pch_c", - "cc": "cflags_pch_cc", - "m": "cflags_pch_objc", - "mm": "cflags_pch_objcc", - }[lang] - - map = { - "c": "cc", - "cc": "cxx", - "m": "objc", - "mm": "objcxx", - } - cmd = map.get(lang) - ninja_file.build(gch, cmd, input, variables=[(var_name, lang_flag)]) - - def WriteLink(self, spec, config_name, config, link_deps, compile_deps): - """Write out a link step. Fills out target.binary. """ - if self.flavor != "mac" or len(self.archs) == 1: - return self.WriteLinkForArch( - self.ninja, spec, config_name, config, link_deps, compile_deps - ) - else: - output = self.ComputeOutput(spec) - inputs = [ - self.WriteLinkForArch( - self.arch_subninjas[arch], - spec, - config_name, - config, - link_deps[arch], - compile_deps, - arch=arch, - ) - for arch in self.archs - ] - extra_bindings = [] - build_output = output - if not self.is_mac_bundle: - self.AppendPostbuildVariable(extra_bindings, spec, output, output) - - # TODO(yyanagisawa): more work needed to fix: - # https://code.google.com/p/gyp/issues/detail?id=411 - if ( - spec["type"] in ("shared_library", "loadable_module") - and not self.is_mac_bundle - ): - extra_bindings.append(("lib", output)) - self.ninja.build( - [output, output + ".TOC"], - "solipo", - inputs, - variables=extra_bindings, - ) - else: - self.ninja.build(build_output, "lipo", inputs, variables=extra_bindings) - return output - - def WriteLinkForArch( - self, ninja_file, spec, config_name, config, link_deps, compile_deps, arch=None - ): - """Write out a link step. Fills out target.binary. """ - command = { - "executable": "link", - "loadable_module": "solink_module", - "shared_library": "solink", - }[spec["type"]] - command_suffix = "" - - implicit_deps = set() - solibs = set() - order_deps = set() - - if compile_deps: - # Normally, the compiles of the target already depend on compile_deps, - # but a shared_library target might have no sources and only link together - # a few static_library deps, so the link step also needs to depend - # on compile_deps to make sure actions in the shared_library target - # get run before the link. - order_deps.add(compile_deps) - - if "dependencies" in spec: - # Two kinds of dependencies: - # - Linkable dependencies (like a .a or a .so): add them to the link line. - # - Non-linkable dependencies (like a rule that generates a file - # and writes a stamp file): add them to implicit_deps - extra_link_deps = set() - for dep in spec["dependencies"]: - target = self.target_outputs.get(dep) - if not target: - continue - linkable = target.Linkable() - if linkable: - new_deps = [] - if ( - self.flavor == "win" - and target.component_objs - and self.msvs_settings.IsUseLibraryDependencyInputs(config_name) - ): - new_deps = target.component_objs - if target.compile_deps: - order_deps.add(target.compile_deps) - elif self.flavor == "win" and target.import_lib: - new_deps = [target.import_lib] - elif target.UsesToc(self.flavor): - solibs.add(target.binary) - implicit_deps.add(target.binary + ".TOC") - else: - new_deps = [target.binary] - for new_dep in new_deps: - if new_dep not in extra_link_deps: - extra_link_deps.add(new_dep) - link_deps.append(new_dep) - - final_output = target.FinalOutput() - if not linkable or final_output != target.binary: - implicit_deps.add(final_output) - - extra_bindings = [] - if self.target.uses_cpp and self.flavor != "win": - extra_bindings.append(("ld", "$ldxx")) - - output = self.ComputeOutput(spec, arch) - if arch is None and not self.is_mac_bundle: - self.AppendPostbuildVariable(extra_bindings, spec, output, output) - - is_executable = spec["type"] == "executable" - # The ldflags config key is not used on mac or win. On those platforms - # linker flags are set via xcode_settings and msvs_settings, respectively. - if self.toolset == "target": - env_ldflags = os.environ.get("LDFLAGS", "").split() - elif self.toolset == "host": - env_ldflags = os.environ.get("LDFLAGS_host", "").split() - - if self.flavor == "mac": - ldflags = self.xcode_settings.GetLdflags( - config_name, - self.ExpandSpecial(generator_default_variables["PRODUCT_DIR"]), - self.GypPathToNinja, - arch, - ) - ldflags = env_ldflags + ldflags - elif self.flavor == "win": - manifest_base_name = self.GypPathToUniqueOutput( - self.ComputeOutputFileName(spec) - ) - ( - ldflags, - intermediate_manifest, - manifest_files, - ) = self.msvs_settings.GetLdflags( - config_name, - self.GypPathToNinja, - self.ExpandSpecial, - manifest_base_name, - output, - is_executable, - self.toplevel_build, - ) - ldflags = env_ldflags + ldflags - self.WriteVariableList(ninja_file, "manifests", manifest_files) - implicit_deps = implicit_deps.union(manifest_files) - if intermediate_manifest: - self.WriteVariableList( - ninja_file, "intermediatemanifest", [intermediate_manifest] - ) - command_suffix = _GetWinLinkRuleNameSuffix( - self.msvs_settings.IsEmbedManifest(config_name) - ) - def_file = self.msvs_settings.GetDefFile(self.GypPathToNinja) - if def_file: - implicit_deps.add(def_file) - else: - # Respect environment variables related to build, but target-specific - # flags can still override them. - ldflags = env_ldflags + config.get("ldflags", []) - if is_executable and len(solibs): - rpath = "lib/" - if self.toolset != "target": - rpath += self.toolset - ldflags.append(r"-Wl,-rpath=\$$ORIGIN/%s" % rpath) - else: - ldflags.append("-Wl,-rpath=%s" % self.target_rpath) - ldflags.append("-Wl,-rpath-link=%s" % rpath) - self.WriteVariableList(ninja_file, "ldflags", map(self.ExpandSpecial, ldflags)) - - library_dirs = config.get("library_dirs", []) - if self.flavor == "win": - library_dirs = [ - self.msvs_settings.ConvertVSMacros(library_dir, config_name) - for library_dir in library_dirs - ] - library_dirs = [ - "/LIBPATH:" - + QuoteShellArgument(self.GypPathToNinja(library_dir), self.flavor) - for library_dir in library_dirs - ] - else: - library_dirs = [ - QuoteShellArgument("-L" + self.GypPathToNinja(library_dir), self.flavor) - for library_dir in library_dirs - ] - - libraries = gyp.common.uniquer( - map(self.ExpandSpecial, spec.get("libraries", [])) - ) - if self.flavor == "mac": - libraries = self.xcode_settings.AdjustLibraries(libraries, config_name) - elif self.flavor == "win": - libraries = self.msvs_settings.AdjustLibraries(libraries) - - self.WriteVariableList(ninja_file, "libs", library_dirs + libraries) - - linked_binary = output - - if command in ("solink", "solink_module"): - extra_bindings.append(("soname", os.path.split(output)[1])) - extra_bindings.append(("lib", gyp.common.EncodePOSIXShellArgument(output))) - if self.flavor != "win": - link_file_list = output - if self.is_mac_bundle: - # 'Dependency Framework.framework/Versions/A/Dependency Framework' - # -> 'Dependency Framework.framework.rsp' - link_file_list = self.xcode_settings.GetWrapperName() - if arch: - link_file_list += "." + arch - link_file_list += ".rsp" - # If an rspfile contains spaces, ninja surrounds the filename with - # quotes around it and then passes it to open(), creating a file with - # quotes in its name (and when looking for the rsp file, the name - # makes it through bash which strips the quotes) :-/ - link_file_list = link_file_list.replace(" ", "_") - extra_bindings.append( - ( - "link_file_list", - gyp.common.EncodePOSIXShellArgument(link_file_list), - ) - ) - if self.flavor == "win": - extra_bindings.append(("binary", output)) - if ( - "/NOENTRY" not in ldflags - and not self.msvs_settings.GetNoImportLibrary(config_name) - ): - self.target.import_lib = output + ".lib" - extra_bindings.append( - ("implibflag", "/IMPLIB:%s" % self.target.import_lib) - ) - pdbname = self.msvs_settings.GetPDBName( - config_name, self.ExpandSpecial, output + ".pdb" - ) - output = [output, self.target.import_lib] - if pdbname: - output.append(pdbname) - elif not self.is_mac_bundle: - output = [output, output + ".TOC"] - else: - command = command + "_notoc" - elif self.flavor == "win": - extra_bindings.append(("binary", output)) - pdbname = self.msvs_settings.GetPDBName( - config_name, self.ExpandSpecial, output + ".pdb" - ) - if pdbname: - output = [output, pdbname] - - if len(solibs): - extra_bindings.append( - ("solibs", gyp.common.EncodePOSIXShellList(sorted(solibs))) - ) - - ninja_file.build( - output, - command + command_suffix, - link_deps, - implicit=sorted(implicit_deps), - order_only=list(order_deps), - variables=extra_bindings, - ) - return linked_binary - - def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): - extra_link_deps = any( - self.target_outputs.get(dep).Linkable() - for dep in spec.get("dependencies", []) - if dep in self.target_outputs - ) - if spec["type"] == "none" or (not link_deps and not extra_link_deps): - # TODO(evan): don't call this function for 'none' target types, as - # it doesn't do anything, and we fake out a 'binary' with a stamp file. - self.target.binary = compile_deps - self.target.type = "none" - elif spec["type"] == "static_library": - self.target.binary = self.ComputeOutput(spec) - if ( - self.flavor not in ("ios", "mac", "netbsd", "openbsd", "win") - and not self.is_standalone_static_library - ): - self.ninja.build( - self.target.binary, "alink_thin", link_deps, order_only=compile_deps - ) - else: - variables = [] - if self.xcode_settings: - libtool_flags = self.xcode_settings.GetLibtoolflags(config_name) - if libtool_flags: - variables.append(("libtool_flags", libtool_flags)) - if self.msvs_settings: - libflags = self.msvs_settings.GetLibFlags( - config_name, self.GypPathToNinja - ) - variables.append(("libflags", libflags)) - - if self.flavor != "mac" or len(self.archs) == 1: - self.AppendPostbuildVariable( - variables, spec, self.target.binary, self.target.binary - ) - self.ninja.build( - self.target.binary, - "alink", - link_deps, - order_only=compile_deps, - variables=variables, - ) - else: - inputs = [] - for arch in self.archs: - output = self.ComputeOutput(spec, arch) - self.arch_subninjas[arch].build( - output, - "alink", - link_deps[arch], - order_only=compile_deps, - variables=variables, - ) - inputs.append(output) - # TODO: It's not clear if - # libtool_flags should be passed to the alink - # call that combines single-arch .a files into a fat .a file. - self.AppendPostbuildVariable( - variables, spec, self.target.binary, self.target.binary - ) - self.ninja.build( - self.target.binary, - "alink", - inputs, - # FIXME: test proving order_only=compile_deps isn't - # needed. - variables=variables, - ) - else: - self.target.binary = self.WriteLink( - spec, config_name, config, link_deps, compile_deps - ) - return self.target.binary - - def WriteMacBundle(self, spec, mac_bundle_depends, is_empty): - assert self.is_mac_bundle - package_framework = spec["type"] in ("shared_library", "loadable_module") - output = self.ComputeMacBundleOutput() - if is_empty: - output += ".stamp" - variables = [] - self.AppendPostbuildVariable( - variables, - spec, - output, - self.target.binary, - is_command_start=not package_framework, - ) - if package_framework and not is_empty: - if spec["type"] == "shared_library" and self.xcode_settings.isIOS: - self.ninja.build( - output, - "package_ios_framework", - mac_bundle_depends, - variables=variables, - ) - else: - variables.append(("version", self.xcode_settings.GetFrameworkVersion())) - self.ninja.build( - output, "package_framework", mac_bundle_depends, variables=variables - ) - else: - self.ninja.build(output, "stamp", mac_bundle_depends, variables=variables) - self.target.bundle = output - return output - - def GetToolchainEnv(self, additional_settings=None): - """Returns the variables toolchain would set for build steps.""" - env = self.GetSortedXcodeEnv(additional_settings=additional_settings) - if self.flavor == "win": - env = self.GetMsvsToolchainEnv(additional_settings=additional_settings) - return env - - def GetMsvsToolchainEnv(self, additional_settings=None): - """Returns the variables Visual Studio would set for build steps.""" - return self.msvs_settings.GetVSMacroEnv( - "$!PRODUCT_DIR", config=self.config_name - ) - - def GetSortedXcodeEnv(self, additional_settings=None): - """Returns the variables Xcode would set for build steps.""" - assert self.abs_build_dir - abs_build_dir = self.abs_build_dir - return gyp.xcode_emulation.GetSortedXcodeEnv( - self.xcode_settings, - abs_build_dir, - os.path.join(abs_build_dir, self.build_to_base), - self.config_name, - additional_settings, - ) - - def GetSortedXcodePostbuildEnv(self): - """Returns the variables Xcode would set for postbuild steps.""" - postbuild_settings = {} - # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack. - # TODO(thakis): It would be nice to have some general mechanism instead. - strip_save_file = self.xcode_settings.GetPerTargetSetting( - "CHROMIUM_STRIP_SAVE_FILE" - ) - if strip_save_file: - postbuild_settings["CHROMIUM_STRIP_SAVE_FILE"] = strip_save_file - return self.GetSortedXcodeEnv(additional_settings=postbuild_settings) - - def AppendPostbuildVariable( - self, variables, spec, output, binary, is_command_start=False - ): - """Adds a 'postbuild' variable if there is a postbuild for |output|.""" - postbuild = self.GetPostbuildCommand(spec, output, binary, is_command_start) - if postbuild: - variables.append(("postbuilds", postbuild)) - - def GetPostbuildCommand(self, spec, output, output_binary, is_command_start): - """Returns a shell command that runs all the postbuilds, and removes - |output| if any of them fails. If |is_command_start| is False, then the - returned string will start with ' && '.""" - if not self.xcode_settings or spec["type"] == "none" or not output: - return "" - output = QuoteShellArgument(output, self.flavor) - postbuilds = gyp.xcode_emulation.GetSpecPostbuildCommands(spec, quiet=True) - if output_binary is not None: - postbuilds = self.xcode_settings.AddImplicitPostbuilds( - self.config_name, - os.path.normpath(os.path.join(self.base_to_build, output)), - QuoteShellArgument( - os.path.normpath(os.path.join(self.base_to_build, output_binary)), - self.flavor, - ), - postbuilds, - quiet=True, - ) - - if not postbuilds: - return "" - # Postbuilds expect to be run in the gyp file's directory, so insert an - # implicit postbuild to cd to there. - postbuilds.insert( - 0, gyp.common.EncodePOSIXShellList(["cd", self.build_to_base]) - ) - env = self.ComputeExportEnvString(self.GetSortedXcodePostbuildEnv()) - # G will be non-null if any postbuild fails. Run all postbuilds in a - # subshell. - commands = ( - env - + " (" - + " && ".join([ninja_syntax.escape(command) for command in postbuilds]) - ) - command_string = ( - commands - + "); G=$$?; " - # Remove the final output if any postbuild failed. - "((exit $$G) || rm -rf %s) " % output - + "&& exit $$G)" - ) - if is_command_start: - return "(" + command_string + " && " - else: - return "$ && (" + command_string - - def ComputeExportEnvString(self, env): - """Given an environment, returns a string looking like - 'export FOO=foo; export BAR="${FOO} bar;' - that exports |env| to the shell.""" - export_str = [] - for k, v in env: - export_str.append( - "export %s=%s;" - % (k, ninja_syntax.escape(gyp.common.EncodePOSIXShellArgument(v))) - ) - return " ".join(export_str) - - def ComputeMacBundleOutput(self): - """Return the 'output' (full output path) to a bundle output directory.""" - assert self.is_mac_bundle - path = generator_default_variables["PRODUCT_DIR"] - return self.ExpandSpecial( - os.path.join(path, self.xcode_settings.GetWrapperName()) - ) - - def ComputeOutputFileName(self, spec, type=None): - """Compute the filename of the final output for the current target.""" - if not type: - type = spec["type"] - - default_variables = copy.copy(generator_default_variables) - CalculateVariables(default_variables, {"flavor": self.flavor}) - - # Compute filename prefix: the product prefix, or a default for - # the product type. - DEFAULT_PREFIX = { - "loadable_module": default_variables["SHARED_LIB_PREFIX"], - "shared_library": default_variables["SHARED_LIB_PREFIX"], - "static_library": default_variables["STATIC_LIB_PREFIX"], - "executable": default_variables["EXECUTABLE_PREFIX"], - } - prefix = spec.get("product_prefix", DEFAULT_PREFIX.get(type, "")) - - # Compute filename extension: the product extension, or a default - # for the product type. - DEFAULT_EXTENSION = { - "loadable_module": default_variables["SHARED_LIB_SUFFIX"], - "shared_library": default_variables["SHARED_LIB_SUFFIX"], - "static_library": default_variables["STATIC_LIB_SUFFIX"], - "executable": default_variables["EXECUTABLE_SUFFIX"], - } - extension = spec.get("product_extension") - if extension: - extension = "." + extension - else: - extension = DEFAULT_EXTENSION.get(type, "") - - if "product_name" in spec: - # If we were given an explicit name, use that. - target = spec["product_name"] - else: - # Otherwise, derive a name from the target name. - target = spec["target_name"] - if prefix == "lib": - # Snip out an extra 'lib' from libs if appropriate. - target = StripPrefix(target, "lib") - - if type in ( - "static_library", - "loadable_module", - "shared_library", - "executable", - ): - return f"{prefix}{target}{extension}" - elif type == "none": - return "%s.stamp" % target - else: - raise Exception("Unhandled output type %s" % type) - - def ComputeOutput(self, spec, arch=None): - """Compute the path for the final output of the spec.""" - type = spec["type"] - - if self.flavor == "win": - override = self.msvs_settings.GetOutputName( - self.config_name, self.ExpandSpecial - ) - if override: - return override - - if ( - arch is None - and self.flavor == "mac" - and type - in ("static_library", "executable", "shared_library", "loadable_module") - ): - filename = self.xcode_settings.GetExecutablePath() - else: - filename = self.ComputeOutputFileName(spec, type) - - if arch is None and "product_dir" in spec: - path = os.path.join(spec["product_dir"], filename) - return self.ExpandSpecial(path) - - # Some products go into the output root, libraries go into shared library - # dir, and everything else goes into the normal place. - type_in_output_root = ["executable", "loadable_module"] - if self.flavor == "mac" and self.toolset == "target": - type_in_output_root += ["shared_library", "static_library"] - elif self.flavor == "win" and self.toolset == "target": - type_in_output_root += ["shared_library"] - - if arch is not None: - # Make sure partial executables don't end up in a bundle or the regular - # output directory. - archdir = "arch" - if self.toolset != "target": - archdir = os.path.join("arch", "%s" % self.toolset) - return os.path.join(archdir, AddArch(filename, arch)) - elif type in type_in_output_root or self.is_standalone_static_library: - return filename - elif type == "shared_library": - libdir = "lib" - if self.toolset != "target": - libdir = os.path.join("lib", "%s" % self.toolset) - return os.path.join(libdir, filename) - else: - return self.GypPathToUniqueOutput(filename, qualified=False) - - def WriteVariableList(self, ninja_file, var, values): - assert not isinstance(values, str) - if values is None: - values = [] - ninja_file.variable(var, " ".join(values)) - - def WriteNewNinjaRule( - self, name, args, description, win_shell_flags, env, pool, depfile=None - ): - """Write out a new ninja "rule" statement for a given command. - - Returns the name of the new rule, and a copy of |args| with variables - expanded.""" - - if self.flavor == "win": - args = [ - self.msvs_settings.ConvertVSMacros( - arg, self.base_to_build, config=self.config_name - ) - for arg in args - ] - description = self.msvs_settings.ConvertVSMacros( - description, config=self.config_name - ) - elif self.flavor == "mac": - # |env| is an empty list on non-mac. - args = [gyp.xcode_emulation.ExpandEnvVars(arg, env) for arg in args] - description = gyp.xcode_emulation.ExpandEnvVars(description, env) - - # TODO: we shouldn't need to qualify names; we do it because - # currently the ninja rule namespace is global, but it really - # should be scoped to the subninja. - rule_name = self.name - if self.toolset == "target": - rule_name += "." + self.toolset - rule_name += "." + name - rule_name = re.sub("[^a-zA-Z0-9_]", "_", rule_name) - - # Remove variable references, but not if they refer to the magic rule - # variables. This is not quite right, as it also protects these for - # actions, not just for rules where they are valid. Good enough. - protect = ["${root}", "${dirname}", "${source}", "${ext}", "${name}"] - protect = "(?!" + "|".join(map(re.escape, protect)) + ")" - description = re.sub(protect + r"\$", "_", description) - - # gyp dictates that commands are run from the base directory. - # cd into the directory before running, and adjust paths in - # the arguments to point to the proper locations. - rspfile = None - rspfile_content = None - args = [self.ExpandSpecial(arg, self.base_to_build) for arg in args] - if self.flavor == "win": - rspfile = rule_name + ".$unique_name.rsp" - # The cygwin case handles this inside the bash sub-shell. - run_in = "" if win_shell_flags.cygwin else " " + self.build_to_base - if win_shell_flags.cygwin: - rspfile_content = self.msvs_settings.BuildCygwinBashCommandLine( - args, self.build_to_base - ) - else: - rspfile_content = gyp.msvs_emulation.EncodeRspFileList( - args, win_shell_flags.quote) - command = ( - "%s gyp-win-tool action-wrapper $arch " % sys.executable - + rspfile - + run_in - ) - else: - env = self.ComputeExportEnvString(env) - command = gyp.common.EncodePOSIXShellList(args) - command = "cd %s; " % self.build_to_base + env + command - - # GYP rules/actions express being no-ops by not touching their outputs. - # Avoid executing downstream dependencies in this case by specifying - # restat=1 to ninja. - self.ninja.rule( - rule_name, - command, - description, - depfile=depfile, - restat=True, - pool=pool, - rspfile=rspfile, - rspfile_content=rspfile_content, - ) - self.ninja.newline() - - return rule_name, args - - -def CalculateVariables(default_variables, params): - """Calculate additional variables for use in the build (called by gyp).""" - global generator_additional_non_configuration_keys - global generator_additional_path_sections - flavor = gyp.common.GetFlavor(params) - if flavor == "mac": - default_variables.setdefault("OS", "mac") - default_variables.setdefault("SHARED_LIB_SUFFIX", ".dylib") - default_variables.setdefault( - "SHARED_LIB_DIR", generator_default_variables["PRODUCT_DIR"] - ) - default_variables.setdefault( - "LIB_DIR", generator_default_variables["PRODUCT_DIR"] - ) - - # Copy additional generator configuration data from Xcode, which is shared - # by the Mac Ninja generator. - import gyp.generator.xcode as xcode_generator - - generator_additional_non_configuration_keys = getattr( - xcode_generator, "generator_additional_non_configuration_keys", [] - ) - generator_additional_path_sections = getattr( - xcode_generator, "generator_additional_path_sections", [] - ) - global generator_extra_sources_for_rules - generator_extra_sources_for_rules = getattr( - xcode_generator, "generator_extra_sources_for_rules", [] - ) - elif flavor == "win": - exts = gyp.MSVSUtil.TARGET_TYPE_EXT - default_variables.setdefault("OS", "win") - default_variables["EXECUTABLE_SUFFIX"] = "." + exts["executable"] - default_variables["STATIC_LIB_PREFIX"] = "" - default_variables["STATIC_LIB_SUFFIX"] = "." + exts["static_library"] - default_variables["SHARED_LIB_PREFIX"] = "" - default_variables["SHARED_LIB_SUFFIX"] = "." + exts["shared_library"] - - # Copy additional generator configuration data from VS, which is shared - # by the Windows Ninja generator. - import gyp.generator.msvs as msvs_generator - - generator_additional_non_configuration_keys = getattr( - msvs_generator, "generator_additional_non_configuration_keys", [] - ) - generator_additional_path_sections = getattr( - msvs_generator, "generator_additional_path_sections", [] - ) - - gyp.msvs_emulation.CalculateCommonVariables(default_variables, params) - else: - operating_system = flavor - if flavor == "android": - operating_system = "linux" # Keep this legacy behavior for now. - default_variables.setdefault("OS", operating_system) - default_variables.setdefault("SHARED_LIB_SUFFIX", ".so") - default_variables.setdefault( - "SHARED_LIB_DIR", os.path.join("$!PRODUCT_DIR", "lib") - ) - default_variables.setdefault("LIB_DIR", os.path.join("$!PRODUCT_DIR", "obj")) - - -def ComputeOutputDir(params): - """Returns the path from the toplevel_dir to the build output directory.""" - # generator_dir: relative path from pwd to where make puts build files. - # Makes migrating from make to ninja easier, ninja doesn't put anything here. - generator_dir = os.path.relpath(params["options"].generator_output or ".") - - # output_dir: relative path from generator_dir to the build directory. - output_dir = params.get("generator_flags", {}).get("output_dir", "out") - - # Relative path from source root to our output files. e.g. "out" - return os.path.normpath(os.path.join(generator_dir, output_dir)) - - -def CalculateGeneratorInputInfo(params): - """Called by __init__ to initialize generator values based on params.""" - # E.g. "out/gypfiles" - toplevel = params["options"].toplevel_dir - qualified_out_dir = os.path.normpath( - os.path.join(toplevel, ComputeOutputDir(params), "gypfiles") - ) - - global generator_filelist_paths - generator_filelist_paths = { - "toplevel": toplevel, - "qualified_out_dir": qualified_out_dir, - } - - -def OpenOutput(path, mode="w"): - """Open |path| for writing, creating directories if necessary.""" - gyp.common.EnsureDirExists(path) - return open(path, mode) - - -def CommandWithWrapper(cmd, wrappers, prog): - wrapper = wrappers.get(cmd, "") - if wrapper: - return wrapper + " " + prog - return prog - - -def GetDefaultConcurrentLinks(): - """Returns a best-guess for a number of concurrent links.""" - pool_size = int(os.environ.get("GYP_LINK_CONCURRENCY", 0)) - if pool_size: - return pool_size - - if sys.platform in ("win32", "cygwin"): - import ctypes - - class MEMORYSTATUSEX(ctypes.Structure): - _fields_ = [ - ("dwLength", ctypes.c_ulong), - ("dwMemoryLoad", ctypes.c_ulong), - ("ullTotalPhys", ctypes.c_ulonglong), - ("ullAvailPhys", ctypes.c_ulonglong), - ("ullTotalPageFile", ctypes.c_ulonglong), - ("ullAvailPageFile", ctypes.c_ulonglong), - ("ullTotalVirtual", ctypes.c_ulonglong), - ("ullAvailVirtual", ctypes.c_ulonglong), - ("sullAvailExtendedVirtual", ctypes.c_ulonglong), - ] - - stat = MEMORYSTATUSEX() - stat.dwLength = ctypes.sizeof(stat) - ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) - - # VS 2015 uses 20% more working set than VS 2013 and can consume all RAM - # on a 64 GiB machine. - mem_limit = max(1, stat.ullTotalPhys // (5 * (2 ** 30))) # total / 5GiB - hard_cap = max(1, int(os.environ.get("GYP_LINK_CONCURRENCY_MAX", 2 ** 32))) - return min(mem_limit, hard_cap) - elif sys.platform.startswith("linux"): - if os.path.exists("/proc/meminfo"): - with open("/proc/meminfo") as meminfo: - memtotal_re = re.compile(r"^MemTotal:\s*(\d*)\s*kB") - for line in meminfo: - match = memtotal_re.match(line) - if not match: - continue - # Allow 8Gb per link on Linux because Gold is quite memory hungry - return max(1, int(match.group(1)) // (8 * (2 ** 20))) - return 1 - elif sys.platform == "darwin": - try: - avail_bytes = int(subprocess.check_output(["sysctl", "-n", "hw.memsize"])) - # A static library debug build of Chromium's unit_tests takes ~2.7GB, so - # 4GB per ld process allows for some more bloat. - return max(1, avail_bytes // (4 * (2 ** 30))) # total / 4GB - except subprocess.CalledProcessError: - return 1 - else: - # TODO(scottmg): Implement this for other platforms. - return 1 - - -def _GetWinLinkRuleNameSuffix(embed_manifest): - """Returns the suffix used to select an appropriate linking rule depending on - whether the manifest embedding is enabled.""" - return "_embed" if embed_manifest else "" - - -def _AddWinLinkRules(master_ninja, embed_manifest): - """Adds link rules for Windows platform to |master_ninja|.""" - - def FullLinkCommand(ldcmd, out, binary_type): - resource_name = {"exe": "1", "dll": "2"}[binary_type] - return ( - "%(python)s gyp-win-tool link-with-manifests $arch %(embed)s " - '%(out)s "%(ldcmd)s" %(resname)s $mt $rc "$intermediatemanifest" ' - "$manifests" - % { - "python": sys.executable, - "out": out, - "ldcmd": ldcmd, - "resname": resource_name, - "embed": embed_manifest, - } - ) - - rule_name_suffix = _GetWinLinkRuleNameSuffix(embed_manifest) - use_separate_mspdbsrv = int(os.environ.get("GYP_USE_SEPARATE_MSPDBSRV", "0")) != 0 - dlldesc = "LINK%s(DLL) $binary" % rule_name_suffix.upper() - dllcmd = ( - "%s gyp-win-tool link-wrapper $arch %s " - "$ld /nologo $implibflag /DLL /OUT:$binary " - "@$binary.rsp" % (sys.executable, use_separate_mspdbsrv) - ) - dllcmd = FullLinkCommand(dllcmd, "$binary", "dll") - master_ninja.rule( - "solink" + rule_name_suffix, - description=dlldesc, - command=dllcmd, - rspfile="$binary.rsp", - rspfile_content="$libs $in_newline $ldflags", - restat=True, - pool="link_pool", - ) - master_ninja.rule( - "solink_module" + rule_name_suffix, - description=dlldesc, - command=dllcmd, - rspfile="$binary.rsp", - rspfile_content="$libs $in_newline $ldflags", - restat=True, - pool="link_pool", - ) - # Note that ldflags goes at the end so that it has the option of - # overriding default settings earlier in the command line. - exe_cmd = ( - "%s gyp-win-tool link-wrapper $arch %s " - "$ld /nologo /OUT:$binary @$binary.rsp" - % (sys.executable, use_separate_mspdbsrv) - ) - exe_cmd = FullLinkCommand(exe_cmd, "$binary", "exe") - master_ninja.rule( - "link" + rule_name_suffix, - description="LINK%s $binary" % rule_name_suffix.upper(), - command=exe_cmd, - rspfile="$binary.rsp", - rspfile_content="$in_newline $libs $ldflags", - pool="link_pool", - ) - - -def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name): - options = params["options"] - flavor = gyp.common.GetFlavor(params) - generator_flags = params.get("generator_flags", {}) - - # build_dir: relative path from source root to our output files. - # e.g. "out/Debug" - build_dir = os.path.normpath(os.path.join(ComputeOutputDir(params), config_name)) - - toplevel_build = os.path.join(options.toplevel_dir, build_dir) - - master_ninja_file = OpenOutput(os.path.join(toplevel_build, "build.ninja")) - master_ninja = ninja_syntax.Writer(master_ninja_file, width=120) - - # Put build-time support tools in out/{config_name}. - gyp.common.CopyTool(flavor, toplevel_build, generator_flags) - - # Grab make settings for CC/CXX. - # The rules are - # - The priority from low to high is gcc/g++, the 'make_global_settings' in - # gyp, the environment variable. - # - If there is no 'make_global_settings' for CC.host/CXX.host or - # 'CC_host'/'CXX_host' environment variable, cc_host/cxx_host should be set - # to cc/cxx. - if flavor == "win": - ar = "lib.exe" - # cc and cxx must be set to the correct architecture by overriding with one - # of cl_x86 or cl_x64 below. - cc = "UNSET" - cxx = "UNSET" - ld = "link.exe" - ld_host = "$ld" - else: - ar = "ar" - cc = "cc" - cxx = "c++" - ld = "$cc" - ldxx = "$cxx" - ld_host = "$cc_host" - ldxx_host = "$cxx_host" - - ar_host = ar - cc_host = None - cxx_host = None - cc_host_global_setting = None - cxx_host_global_setting = None - clang_cl = None - nm = "nm" - nm_host = "nm" - readelf = "readelf" - readelf_host = "readelf" - - build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) - make_global_settings = data[build_file].get("make_global_settings", []) - build_to_root = gyp.common.InvertRelativePath(build_dir, options.toplevel_dir) - wrappers = {} - for key, value in make_global_settings: - if key == "AR": - ar = os.path.join(build_to_root, value) - if key == "AR.host": - ar_host = os.path.join(build_to_root, value) - if key == "CC": - cc = os.path.join(build_to_root, value) - if cc.endswith("clang-cl"): - clang_cl = cc - if key == "CXX": - cxx = os.path.join(build_to_root, value) - if key == "CC.host": - cc_host = os.path.join(build_to_root, value) - cc_host_global_setting = value - if key == "CXX.host": - cxx_host = os.path.join(build_to_root, value) - cxx_host_global_setting = value - if key == "LD": - ld = os.path.join(build_to_root, value) - if key == "LD.host": - ld_host = os.path.join(build_to_root, value) - if key == "LDXX": - ldxx = os.path.join(build_to_root, value) - if key == "LDXX.host": - ldxx_host = os.path.join(build_to_root, value) - if key == "NM": - nm = os.path.join(build_to_root, value) - if key == "NM.host": - nm_host = os.path.join(build_to_root, value) - if key == "READELF": - readelf = os.path.join(build_to_root, value) - if key == "READELF.host": - readelf_host = os.path.join(build_to_root, value) - if key.endswith("_wrapper"): - wrappers[key[: -len("_wrapper")]] = os.path.join(build_to_root, value) - - # Support wrappers from environment variables too. - for key, value in os.environ.items(): - if key.lower().endswith("_wrapper"): - key_prefix = key[: -len("_wrapper")] - key_prefix = re.sub(r"\.HOST$", ".host", key_prefix) - wrappers[key_prefix] = os.path.join(build_to_root, value) - - mac_toolchain_dir = generator_flags.get("mac_toolchain_dir", None) - if mac_toolchain_dir: - wrappers["LINK"] = "export DEVELOPER_DIR='%s' &&" % mac_toolchain_dir - - if flavor == "win": - configs = [ - target_dicts[qualified_target]["configurations"][config_name] - for qualified_target in target_list - ] - shared_system_includes = None - if not generator_flags.get("ninja_use_custom_environment_files", 0): - shared_system_includes = gyp.msvs_emulation.ExtractSharedMSVSSystemIncludes( - configs, generator_flags - ) - cl_paths = gyp.msvs_emulation.GenerateEnvironmentFiles( - toplevel_build, generator_flags, shared_system_includes, OpenOutput - ) - for arch, path in sorted(cl_paths.items()): - if clang_cl: - # If we have selected clang-cl, use that instead. - path = clang_cl - command = CommandWithWrapper( - "CC", wrappers, QuoteShellArgument(path, "win") - ) - if clang_cl: - # Use clang-cl to cross-compile for x86 or x86_64. - command += " -m32" if arch == "x86" else " -m64" - master_ninja.variable("cl_" + arch, command) - - cc = GetEnvironFallback(["CC_target", "CC"], cc) - master_ninja.variable("cc", CommandWithWrapper("CC", wrappers, cc)) - cxx = GetEnvironFallback(["CXX_target", "CXX"], cxx) - master_ninja.variable("cxx", CommandWithWrapper("CXX", wrappers, cxx)) - - if flavor == "win": - master_ninja.variable("ld", ld) - master_ninja.variable("idl", "midl.exe") - master_ninja.variable("ar", ar) - master_ninja.variable("rc", "rc.exe") - master_ninja.variable("ml_x86", "ml.exe") - master_ninja.variable("ml_x64", "ml64.exe") - master_ninja.variable("mt", "mt.exe") - else: - master_ninja.variable("ld", CommandWithWrapper("LINK", wrappers, ld)) - master_ninja.variable("ldxx", CommandWithWrapper("LINK", wrappers, ldxx)) - master_ninja.variable("ar", GetEnvironFallback(["AR_target", "AR"], ar)) - if flavor != "mac": - # Mac does not use readelf/nm for .TOC generation, so avoiding polluting - # the master ninja with extra unused variables. - master_ninja.variable("nm", GetEnvironFallback(["NM_target", "NM"], nm)) - master_ninja.variable( - "readelf", GetEnvironFallback(["READELF_target", "READELF"], readelf) - ) - - if generator_supports_multiple_toolsets: - if not cc_host: - cc_host = cc - if not cxx_host: - cxx_host = cxx - - master_ninja.variable("ar_host", GetEnvironFallback(["AR_host"], ar_host)) - master_ninja.variable("nm_host", GetEnvironFallback(["NM_host"], nm_host)) - master_ninja.variable( - "readelf_host", GetEnvironFallback(["READELF_host"], readelf_host) - ) - cc_host = GetEnvironFallback(["CC_host"], cc_host) - cxx_host = GetEnvironFallback(["CXX_host"], cxx_host) - - # The environment variable could be used in 'make_global_settings', like - # ['CC.host', '$(CC)'] or ['CXX.host', '$(CXX)'], transform them here. - if "$(CC)" in cc_host and cc_host_global_setting: - cc_host = cc_host_global_setting.replace("$(CC)", cc) - if "$(CXX)" in cxx_host and cxx_host_global_setting: - cxx_host = cxx_host_global_setting.replace("$(CXX)", cxx) - master_ninja.variable( - "cc_host", CommandWithWrapper("CC.host", wrappers, cc_host) - ) - master_ninja.variable( - "cxx_host", CommandWithWrapper("CXX.host", wrappers, cxx_host) - ) - if flavor == "win": - master_ninja.variable("ld_host", ld_host) - else: - master_ninja.variable( - "ld_host", CommandWithWrapper("LINK", wrappers, ld_host) - ) - master_ninja.variable( - "ldxx_host", CommandWithWrapper("LINK", wrappers, ldxx_host) - ) - - master_ninja.newline() - - master_ninja.pool("link_pool", depth=GetDefaultConcurrentLinks()) - master_ninja.newline() - - deps = "msvc" if flavor == "win" else "gcc" - - if flavor != "win": - master_ninja.rule( - "cc", - description="CC $out", - command=( - "$cc -MMD -MF $out.d $defines $includes $cflags $cflags_c " - "$cflags_pch_c -c $in -o $out" - ), - depfile="$out.d", - deps=deps, - ) - master_ninja.rule( - "cc_s", - description="CC $out", - command=( - "$cc $defines $includes $cflags $cflags_c " - "$cflags_pch_c -c $in -o $out" - ), - ) - master_ninja.rule( - "cxx", - description="CXX $out", - command=( - "$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc " - "$cflags_pch_cc -c $in -o $out" - ), - depfile="$out.d", - deps=deps, - ) - else: - # TODO(scottmg) Separate pdb names is a test to see if it works around - # http://crbug.com/142362. It seems there's a race between the creation of - # the .pdb by the precompiled header step for .cc and the compilation of - # .c files. This should be handled by mspdbsrv, but rarely errors out with - # c1xx : fatal error C1033: cannot open program database - # By making the rules target separate pdb files this might be avoided. - cc_command = ( - "ninja -t msvc -e $arch " + "-- " - "$cc /nologo /showIncludes /FC " - "@$out.rsp /c $in /Fo$out /Fd$pdbname_c " - ) - cxx_command = ( - "ninja -t msvc -e $arch " + "-- " - "$cxx /nologo /showIncludes /FC " - "@$out.rsp /c $in /Fo$out /Fd$pdbname_cc " - ) - master_ninja.rule( - "cc", - description="CC $out", - command=cc_command, - rspfile="$out.rsp", - rspfile_content="$defines $includes $cflags $cflags_c", - deps=deps, - ) - master_ninja.rule( - "cxx", - description="CXX $out", - command=cxx_command, - rspfile="$out.rsp", - rspfile_content="$defines $includes $cflags $cflags_cc", - deps=deps, - ) - master_ninja.rule( - "idl", - description="IDL $in", - command=( - "%s gyp-win-tool midl-wrapper $arch $outdir " - "$tlb $h $dlldata $iid $proxy $in " - "$midl_includes $idlflags" % sys.executable - ), - ) - master_ninja.rule( - "rc", - description="RC $in", - # Note: $in must be last otherwise rc.exe complains. - command=( - "%s gyp-win-tool rc-wrapper " - "$arch $rc $defines $resource_includes $rcflags /fo$out $in" - % sys.executable - ), - ) - master_ninja.rule( - "asm", - description="ASM $out", - command=( - "%s gyp-win-tool asm-wrapper " - "$arch $asm $defines $includes $asmflags /c /Fo $out $in" - % sys.executable - ), - ) - - if flavor not in ("ios", "mac", "win"): - master_ninja.rule( - "alink", - description="AR $out", - command="rm -f $out && $ar rcs $arflags $out $in", - ) - master_ninja.rule( - "alink_thin", - description="AR $out", - command="rm -f $out && $ar rcsT $arflags $out $in", - ) - - # This allows targets that only need to depend on $lib's API to declare an - # order-only dependency on $lib.TOC and avoid relinking such downstream - # dependencies when $lib changes only in non-public ways. - # The resulting string leaves an uninterpolated %{suffix} which - # is used in the final substitution below. - mtime_preserving_solink_base = ( - "if [ ! -e $lib -o ! -e $lib.TOC ]; then " - "%(solink)s && %(extract_toc)s > $lib.TOC; else " - "%(solink)s && %(extract_toc)s > $lib.tmp && " - "if ! cmp -s $lib.tmp $lib.TOC; then mv $lib.tmp $lib.TOC ; " - "fi; fi" - % { - "solink": "$ld -shared $ldflags -o $lib -Wl,-soname=$soname %(suffix)s", - "extract_toc": ( - "{ $readelf -d $lib | grep SONAME ; " - "$nm -gD -f p $lib | cut -f1-2 -d' '; }" - ), - } - ) - - master_ninja.rule( - "solink", - description="SOLINK $lib", - restat=True, - command=mtime_preserving_solink_base - % {"suffix": "@$link_file_list"}, # noqa: E501 - rspfile="$link_file_list", - rspfile_content=( - "-Wl,--whole-archive $in $solibs -Wl," "--no-whole-archive $libs" - ), - pool="link_pool", - ) - master_ninja.rule( - "solink_module", - description="SOLINK(module) $lib", - restat=True, - command=mtime_preserving_solink_base % {"suffix": "@$link_file_list"}, - rspfile="$link_file_list", - rspfile_content="-Wl,--start-group $in $solibs $libs -Wl,--end-group", - pool="link_pool", - ) - master_ninja.rule( - "link", - description="LINK $out", - command=( - "$ld $ldflags -o $out " - "-Wl,--start-group $in $solibs $libs -Wl,--end-group" - ), - pool="link_pool", - ) - elif flavor == "win": - master_ninja.rule( - "alink", - description="LIB $out", - command=( - "%s gyp-win-tool link-wrapper $arch False " - "$ar /nologo /ignore:4221 /OUT:$out @$out.rsp" % sys.executable - ), - rspfile="$out.rsp", - rspfile_content="$in_newline $libflags", - ) - _AddWinLinkRules(master_ninja, embed_manifest=True) - _AddWinLinkRules(master_ninja, embed_manifest=False) - else: - master_ninja.rule( - "objc", - description="OBJC $out", - command=( - "$cc -MMD -MF $out.d $defines $includes $cflags $cflags_objc " - "$cflags_pch_objc -c $in -o $out" - ), - depfile="$out.d", - deps=deps, - ) - master_ninja.rule( - "objcxx", - description="OBJCXX $out", - command=( - "$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_objcc " - "$cflags_pch_objcc -c $in -o $out" - ), - depfile="$out.d", - deps=deps, - ) - master_ninja.rule( - "alink", - description="LIBTOOL-STATIC $out, POSTBUILDS", - command="rm -f $out && " - "./gyp-mac-tool filter-libtool libtool $libtool_flags " - "-static -o $out $in" - "$postbuilds", - ) - master_ninja.rule( - "lipo", - description="LIPO $out, POSTBUILDS", - command="rm -f $out && lipo -create $in -output $out$postbuilds", - ) - master_ninja.rule( - "solipo", - description="SOLIPO $out, POSTBUILDS", - command=( - "rm -f $lib $lib.TOC && lipo -create $in -output $lib$postbuilds &&" - "%(extract_toc)s > $lib.TOC" - % { - "extract_toc": "{ otool -l $lib | grep LC_ID_DYLIB -A 5; " - "nm -gP $lib | cut -f1-2 -d' ' | grep -v U$$; true; }" - } - ), - ) - - # Record the public interface of $lib in $lib.TOC. See the corresponding - # comment in the posix section above for details. - solink_base = "$ld %(type)s $ldflags -o $lib %(suffix)s" - mtime_preserving_solink_base = ( - "if [ ! -e $lib -o ! -e $lib.TOC ] || " - # Always force dependent targets to relink if this library - # reexports something. Handling this correctly would require - # recursive TOC dumping but this is rare in practice, so punt. - "otool -l $lib | grep -q LC_REEXPORT_DYLIB ; then " - "%(solink)s && %(extract_toc)s > $lib.TOC; " - "else " - "%(solink)s && %(extract_toc)s > $lib.tmp && " - "if ! cmp -s $lib.tmp $lib.TOC; then " - "mv $lib.tmp $lib.TOC ; " - "fi; " - "fi" - % { - "solink": solink_base, - "extract_toc": "{ otool -l $lib | grep LC_ID_DYLIB -A 5; " - "nm -gP $lib | cut -f1-2 -d' ' | grep -v U$$; true; }", - } - ) - - solink_suffix = "@$link_file_list$postbuilds" - master_ninja.rule( - "solink", - description="SOLINK $lib, POSTBUILDS", - restat=True, - command=mtime_preserving_solink_base - % {"suffix": solink_suffix, "type": "-shared"}, - rspfile="$link_file_list", - rspfile_content="$in $solibs $libs", - pool="link_pool", - ) - master_ninja.rule( - "solink_notoc", - description="SOLINK $lib, POSTBUILDS", - restat=True, - command=solink_base % {"suffix": solink_suffix, "type": "-shared"}, - rspfile="$link_file_list", - rspfile_content="$in $solibs $libs", - pool="link_pool", - ) - - master_ninja.rule( - "solink_module", - description="SOLINK(module) $lib, POSTBUILDS", - restat=True, - command=mtime_preserving_solink_base - % {"suffix": solink_suffix, "type": "-bundle"}, - rspfile="$link_file_list", - rspfile_content="$in $solibs $libs", - pool="link_pool", - ) - master_ninja.rule( - "solink_module_notoc", - description="SOLINK(module) $lib, POSTBUILDS", - restat=True, - command=solink_base % {"suffix": solink_suffix, "type": "-bundle"}, - rspfile="$link_file_list", - rspfile_content="$in $solibs $libs", - pool="link_pool", - ) - - master_ninja.rule( - "link", - description="LINK $out, POSTBUILDS", - command=("$ld $ldflags -o $out " "$in $solibs $libs$postbuilds"), - pool="link_pool", - ) - master_ninja.rule( - "preprocess_infoplist", - description="PREPROCESS INFOPLIST $out", - command=( - "$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && " - "plutil -convert xml1 $out $out" - ), - ) - master_ninja.rule( - "copy_infoplist", - description="COPY INFOPLIST $in", - command="$env ./gyp-mac-tool copy-info-plist $in $out $binary $keys", - ) - master_ninja.rule( - "merge_infoplist", - description="MERGE INFOPLISTS $in", - command="$env ./gyp-mac-tool merge-info-plist $out $in", - ) - master_ninja.rule( - "compile_xcassets", - description="COMPILE XCASSETS $in", - command="$env ./gyp-mac-tool compile-xcassets $keys $in", - ) - master_ninja.rule( - "compile_ios_framework_headers", - description="COMPILE HEADER MAPS AND COPY FRAMEWORK HEADERS $in", - command="$env ./gyp-mac-tool compile-ios-framework-header-map $out " - "$framework $in && $env ./gyp-mac-tool " - "copy-ios-framework-headers $framework $copy_headers", - ) - master_ninja.rule( - "mac_tool", - description="MACTOOL $mactool_cmd $in", - command="$env ./gyp-mac-tool $mactool_cmd $in $out $binary", - ) - master_ninja.rule( - "package_framework", - description="PACKAGE FRAMEWORK $out, POSTBUILDS", - command="./gyp-mac-tool package-framework $out $version$postbuilds " - "&& touch $out", - ) - master_ninja.rule( - "package_ios_framework", - description="PACKAGE IOS FRAMEWORK $out, POSTBUILDS", - command="./gyp-mac-tool package-ios-framework $out $postbuilds " - "&& touch $out", - ) - if flavor == "win": - master_ninja.rule( - "stamp", - description="STAMP $out", - command="%s gyp-win-tool stamp $out" % sys.executable, - ) - else: - master_ninja.rule( - "stamp", description="STAMP $out", command="${postbuilds}touch $out" - ) - if flavor == "win": - master_ninja.rule( - "copy", - description="COPY $in $out", - command="%s gyp-win-tool recursive-mirror $in $out" % sys.executable, - ) - elif flavor == "zos": - master_ninja.rule( - "copy", - description="COPY $in $out", - command="rm -rf $out && cp -fRP $in $out", - ) - else: - master_ninja.rule( - "copy", - description="COPY $in $out", - command="ln -f $in $out 2>/dev/null || (rm -rf $out && cp -af $in $out)", - ) - master_ninja.newline() - - all_targets = set() - for build_file in params["build_files"]: - for target in gyp.common.AllTargets( - target_list, target_dicts, os.path.normpath(build_file) - ): - all_targets.add(target) - all_outputs = set() - - # target_outputs is a map from qualified target name to a Target object. - target_outputs = {} - # target_short_names is a map from target short name to a list of Target - # objects. - target_short_names = {} - - # short name of targets that were skipped because they didn't contain anything - # interesting. - # NOTE: there may be overlap between this an non_empty_target_names. - empty_target_names = set() - - # Set of non-empty short target names. - # NOTE: there may be overlap between this an empty_target_names. - non_empty_target_names = set() - - for qualified_target in target_list: - # qualified_target is like: third_party/icu/icu.gyp:icui18n#target - build_file, name, toolset = gyp.common.ParseQualifiedTarget(qualified_target) - - this_make_global_settings = data[build_file].get("make_global_settings", []) - assert make_global_settings == this_make_global_settings, ( - "make_global_settings needs to be the same for all targets. " - f"{this_make_global_settings} vs. {make_global_settings}" - ) - - spec = target_dicts[qualified_target] - if flavor == "mac": - gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec) - - # If build_file is a symlink, we must not follow it because there's a chance - # it could point to a path above toplevel_dir, and we cannot correctly deal - # with that case at the moment. - build_file = gyp.common.RelativePath(build_file, options.toplevel_dir, False) - - qualified_target_for_hash = gyp.common.QualifiedTarget( - build_file, name, toolset - ) - qualified_target_for_hash = qualified_target_for_hash.encode("utf-8") - hash_for_rules = hashlib.md5(qualified_target_for_hash).hexdigest() - - base_path = os.path.dirname(build_file) - obj = "obj" - if toolset != "target": - obj += "." + toolset - output_file = os.path.join(obj, base_path, name + ".ninja") - - ninja_output = StringIO() - writer = NinjaWriter( - hash_for_rules, - target_outputs, - base_path, - build_dir, - ninja_output, - toplevel_build, - output_file, - flavor, - toplevel_dir=options.toplevel_dir, - ) - - target = writer.WriteSpec(spec, config_name, generator_flags) - - if ninja_output.tell() > 0: - # Only create files for ninja files that actually have contents. - with OpenOutput(os.path.join(toplevel_build, output_file)) as ninja_file: - ninja_file.write(ninja_output.getvalue()) - ninja_output.close() - master_ninja.subninja(output_file) - - if target: - if name != target.FinalOutput() and spec["toolset"] == "target": - target_short_names.setdefault(name, []).append(target) - target_outputs[qualified_target] = target - if qualified_target in all_targets: - all_outputs.add(target.FinalOutput()) - non_empty_target_names.add(name) - else: - empty_target_names.add(name) - - if target_short_names: - # Write a short name to build this target. This benefits both the - # "build chrome" case as well as the gyp tests, which expect to be - # able to run actions and build libraries by their short name. - master_ninja.newline() - master_ninja.comment("Short names for targets.") - for short_name in sorted(target_short_names): - master_ninja.build( - short_name, - "phony", - [x.FinalOutput() for x in target_short_names[short_name]], - ) - - # Write phony targets for any empty targets that weren't written yet. As - # short names are not necessarily unique only do this for short names that - # haven't already been output for another target. - empty_target_names = empty_target_names - non_empty_target_names - if empty_target_names: - master_ninja.newline() - master_ninja.comment("Empty targets (output for completeness).") - for name in sorted(empty_target_names): - master_ninja.build(name, "phony") - - if all_outputs: - master_ninja.newline() - master_ninja.build("all", "phony", sorted(all_outputs)) - master_ninja.default(generator_flags.get("default_target", "all")) - - master_ninja_file.close() - - -def PerformBuild(data, configurations, params): - options = params["options"] - for config in configurations: - builddir = os.path.join(options.toplevel_dir, "out", config) - arguments = ["ninja", "-C", builddir] - print(f"Building [{config}]: {arguments}") - subprocess.check_call(arguments) - - -def CallGenerateOutputForConfig(arglist): - # Ignore the interrupt signal so that the parent process catches it and - # kills all multiprocessing children. - signal.signal(signal.SIGINT, signal.SIG_IGN) - - (target_list, target_dicts, data, params, config_name) = arglist - GenerateOutputForConfig(target_list, target_dicts, data, params, config_name) - - -def GenerateOutput(target_list, target_dicts, data, params): - # Update target_dicts for iOS device builds. - target_dicts = gyp.xcode_emulation.CloneConfigurationForDeviceAndEmulator( - target_dicts - ) - - user_config = params.get("generator_flags", {}).get("config", None) - if gyp.common.GetFlavor(params) == "win": - target_list, target_dicts = MSVSUtil.ShardTargets(target_list, target_dicts) - target_list, target_dicts = MSVSUtil.InsertLargePdbShims( - target_list, target_dicts, generator_default_variables - ) - - if user_config: - GenerateOutputForConfig(target_list, target_dicts, data, params, user_config) - else: - config_names = target_dicts[target_list[0]]["configurations"] - if params["parallel"]: - try: - pool = multiprocessing.Pool(len(config_names)) - arglists = [] - for config_name in config_names: - arglists.append( - (target_list, target_dicts, data, params, config_name) - ) - pool.map(CallGenerateOutputForConfig, arglists) - except KeyboardInterrupt as e: - pool.terminate() - raise e - else: - for config_name in config_names: - GenerateOutputForConfig( - target_list, target_dicts, data, params, config_name - ) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py deleted file mode 100644 index 7d180685b21cf..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" Unit tests for the ninja.py file. """ - -import sys -import unittest - -import gyp.generator.ninja as ninja - - -class TestPrefixesAndSuffixes(unittest.TestCase): - def test_BinaryNamesWindows(self): - # These cannot run on non-Windows as they require a VS installation to - # correctly handle variable expansion. - if sys.platform.startswith("win"): - writer = ninja.NinjaWriter( - "foo", "wee", ".", ".", "build.ninja", ".", "build.ninja", "win" - ) - spec = {"target_name": "wee"} - self.assertTrue( - writer.ComputeOutputFileName(spec, "executable").endswith(".exe") - ) - self.assertTrue( - writer.ComputeOutputFileName(spec, "shared_library").endswith(".dll") - ) - self.assertTrue( - writer.ComputeOutputFileName(spec, "static_library").endswith(".lib") - ) - - def test_BinaryNamesLinux(self): - writer = ninja.NinjaWriter( - "foo", "wee", ".", ".", "build.ninja", ".", "build.ninja", "linux" - ) - spec = {"target_name": "wee"} - self.assertTrue("." not in writer.ComputeOutputFileName(spec, "executable")) - self.assertTrue( - writer.ComputeOutputFileName(spec, "shared_library").startswith("lib") - ) - self.assertTrue( - writer.ComputeOutputFileName(spec, "static_library").startswith("lib") - ) - self.assertTrue( - writer.ComputeOutputFileName(spec, "shared_library").endswith(".so") - ) - self.assertTrue( - writer.ComputeOutputFileName(spec, "static_library").endswith(".a") - ) - - -if __name__ == "__main__": - unittest.main() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py deleted file mode 100644 index 2f4d17e514e43..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +++ /dev/null @@ -1,1394 +0,0 @@ -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - - -import filecmp -import gyp.common -import gyp.xcodeproj_file -import gyp.xcode_ninja -import errno -import os -import sys -import posixpath -import re -import shutil -import subprocess -import tempfile - - -# Project files generated by this module will use _intermediate_var as a -# custom Xcode setting whose value is a DerivedSources-like directory that's -# project-specific and configuration-specific. The normal choice, -# DERIVED_FILE_DIR, is target-specific, which is thought to be too restrictive -# as it is likely that multiple targets within a single project file will want -# to access the same set of generated files. The other option, -# PROJECT_DERIVED_FILE_DIR, is unsuitable because while it is project-specific, -# it is not configuration-specific. INTERMEDIATE_DIR is defined as -# $(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION). -_intermediate_var = "INTERMEDIATE_DIR" - -# SHARED_INTERMEDIATE_DIR is the same, except that it is shared among all -# targets that share the same BUILT_PRODUCTS_DIR. -_shared_intermediate_var = "SHARED_INTERMEDIATE_DIR" - -_library_search_paths_var = "LIBRARY_SEARCH_PATHS" - -generator_default_variables = { - "EXECUTABLE_PREFIX": "", - "EXECUTABLE_SUFFIX": "", - "STATIC_LIB_PREFIX": "lib", - "SHARED_LIB_PREFIX": "lib", - "STATIC_LIB_SUFFIX": ".a", - "SHARED_LIB_SUFFIX": ".dylib", - # INTERMEDIATE_DIR is a place for targets to build up intermediate products. - # It is specific to each build environment. It is only guaranteed to exist - # and be constant within the context of a project, corresponding to a single - # input file. Some build environments may allow their intermediate directory - # to be shared on a wider scale, but this is not guaranteed. - "INTERMEDIATE_DIR": "$(%s)" % _intermediate_var, - "OS": "mac", - "PRODUCT_DIR": "$(BUILT_PRODUCTS_DIR)", - "LIB_DIR": "$(BUILT_PRODUCTS_DIR)", - "RULE_INPUT_ROOT": "$(INPUT_FILE_BASE)", - "RULE_INPUT_EXT": "$(INPUT_FILE_SUFFIX)", - "RULE_INPUT_NAME": "$(INPUT_FILE_NAME)", - "RULE_INPUT_PATH": "$(INPUT_FILE_PATH)", - "RULE_INPUT_DIRNAME": "$(INPUT_FILE_DIRNAME)", - "SHARED_INTERMEDIATE_DIR": "$(%s)" % _shared_intermediate_var, - "CONFIGURATION_NAME": "$(CONFIGURATION)", -} - -# The Xcode-specific sections that hold paths. -generator_additional_path_sections = [ - "mac_bundle_resources", - "mac_framework_headers", - "mac_framework_private_headers", - # 'mac_framework_dirs', input already handles _dirs endings. -] - -# The Xcode-specific keys that exist on targets and aren't moved down to -# configurations. -generator_additional_non_configuration_keys = [ - "ios_app_extension", - "ios_watch_app", - "ios_watchkit_extension", - "mac_bundle", - "mac_bundle_resources", - "mac_framework_headers", - "mac_framework_private_headers", - "mac_xctest_bundle", - "mac_xcuitest_bundle", - "xcode_create_dependents_test_runner", -] - -# We want to let any rules apply to files that are resources also. -generator_extra_sources_for_rules = [ - "mac_bundle_resources", - "mac_framework_headers", - "mac_framework_private_headers", -] - -generator_filelist_paths = None - -# Xcode's standard set of library directories, which don't need to be duplicated -# in LIBRARY_SEARCH_PATHS. This list is not exhaustive, but that's okay. -xcode_standard_library_dirs = frozenset( - ["$(SDKROOT)/usr/lib", "$(SDKROOT)/usr/local/lib"] -) - - -def CreateXCConfigurationList(configuration_names): - xccl = gyp.xcodeproj_file.XCConfigurationList({"buildConfigurations": []}) - if len(configuration_names) == 0: - configuration_names = ["Default"] - for configuration_name in configuration_names: - xcbc = gyp.xcodeproj_file.XCBuildConfiguration({"name": configuration_name}) - xccl.AppendProperty("buildConfigurations", xcbc) - xccl.SetProperty("defaultConfigurationName", configuration_names[0]) - return xccl - - -class XcodeProject: - def __init__(self, gyp_path, path, build_file_dict): - self.gyp_path = gyp_path - self.path = path - self.project = gyp.xcodeproj_file.PBXProject(path=path) - projectDirPath = gyp.common.RelativePath( - os.path.dirname(os.path.abspath(self.gyp_path)), - os.path.dirname(path) or ".", - ) - self.project.SetProperty("projectDirPath", projectDirPath) - self.project_file = gyp.xcodeproj_file.XCProjectFile( - {"rootObject": self.project} - ) - self.build_file_dict = build_file_dict - - # TODO(mark): add destructor that cleans up self.path if created_dir is - # True and things didn't complete successfully. Or do something even - # better with "try"? - self.created_dir = False - try: - os.makedirs(self.path) - self.created_dir = True - except OSError as e: - if e.errno != errno.EEXIST: - raise - - def Finalize1(self, xcode_targets, serialize_all_tests): - # Collect a list of all of the build configuration names used by the - # various targets in the file. It is very heavily advised to keep each - # target in an entire project (even across multiple project files) using - # the same set of configuration names. - configurations = [] - for xct in self.project.GetProperty("targets"): - xccl = xct.GetProperty("buildConfigurationList") - xcbcs = xccl.GetProperty("buildConfigurations") - for xcbc in xcbcs: - name = xcbc.GetProperty("name") - if name not in configurations: - configurations.append(name) - - # Replace the XCConfigurationList attached to the PBXProject object with - # a new one specifying all of the configuration names used by the various - # targets. - try: - xccl = CreateXCConfigurationList(configurations) - self.project.SetProperty("buildConfigurationList", xccl) - except Exception: - sys.stderr.write("Problem with gyp file %s\n" % self.gyp_path) - raise - - # The need for this setting is explained above where _intermediate_var is - # defined. The comments below about wanting to avoid project-wide build - # settings apply here too, but this needs to be set on a project-wide basis - # so that files relative to the _intermediate_var setting can be displayed - # properly in the Xcode UI. - # - # Note that for configuration-relative files such as anything relative to - # _intermediate_var, for the purposes of UI tree view display, Xcode will - # only resolve the configuration name once, when the project file is - # opened. If the active build configuration is changed, the project file - # must be closed and reopened if it is desired for the tree view to update. - # This is filed as Apple radar 6588391. - xccl.SetBuildSetting( - _intermediate_var, "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)" - ) - xccl.SetBuildSetting( - _shared_intermediate_var, "$(SYMROOT)/DerivedSources/$(CONFIGURATION)" - ) - - # Set user-specified project-wide build settings and config files. This - # is intended to be used very sparingly. Really, almost everything should - # go into target-specific build settings sections. The project-wide - # settings are only intended to be used in cases where Xcode attempts to - # resolve variable references in a project context as opposed to a target - # context, such as when resolving sourceTree references while building up - # the tree tree view for UI display. - # Any values set globally are applied to all configurations, then any - # per-configuration values are applied. - for xck, xcv in self.build_file_dict.get("xcode_settings", {}).items(): - xccl.SetBuildSetting(xck, xcv) - if "xcode_config_file" in self.build_file_dict: - config_ref = self.project.AddOrGetFileInRootGroup( - self.build_file_dict["xcode_config_file"] - ) - xccl.SetBaseConfiguration(config_ref) - build_file_configurations = self.build_file_dict.get("configurations", {}) - if build_file_configurations: - for config_name in configurations: - build_file_configuration_named = build_file_configurations.get( - config_name, {} - ) - if build_file_configuration_named: - xcc = xccl.ConfigurationNamed(config_name) - for xck, xcv in build_file_configuration_named.get( - "xcode_settings", {} - ).items(): - xcc.SetBuildSetting(xck, xcv) - if "xcode_config_file" in build_file_configuration_named: - config_ref = self.project.AddOrGetFileInRootGroup( - build_file_configurations[config_name]["xcode_config_file"] - ) - xcc.SetBaseConfiguration(config_ref) - - # Sort the targets based on how they appeared in the input. - # TODO(mark): Like a lot of other things here, this assumes internal - # knowledge of PBXProject - in this case, of its "targets" property. - - # ordinary_targets are ordinary targets that are already in the project - # file. run_test_targets are the targets that run unittests and should be - # used for the Run All Tests target. support_targets are the action/rule - # targets used by GYP file targets, just kept for the assert check. - ordinary_targets = [] - run_test_targets = [] - support_targets = [] - - # targets is full list of targets in the project. - targets = [] - - # does the it define it's own "all"? - has_custom_all = False - - # targets_for_all is the list of ordinary_targets that should be listed - # in this project's "All" target. It includes each non_runtest_target - # that does not have suppress_wildcard set. - targets_for_all = [] - - for target in self.build_file_dict["targets"]: - target_name = target["target_name"] - toolset = target["toolset"] - qualified_target = gyp.common.QualifiedTarget( - self.gyp_path, target_name, toolset - ) - xcode_target = xcode_targets[qualified_target] - # Make sure that the target being added to the sorted list is already in - # the unsorted list. - assert xcode_target in self.project._properties["targets"] - targets.append(xcode_target) - ordinary_targets.append(xcode_target) - if xcode_target.support_target: - support_targets.append(xcode_target.support_target) - targets.append(xcode_target.support_target) - - if not int(target.get("suppress_wildcard", False)): - targets_for_all.append(xcode_target) - - if target_name.lower() == "all": - has_custom_all = True - - # If this target has a 'run_as' attribute, add its target to the - # targets, and add it to the test targets. - if target.get("run_as"): - # Make a target to run something. It should have one - # dependency, the parent xcode target. - xccl = CreateXCConfigurationList(configurations) - run_target = gyp.xcodeproj_file.PBXAggregateTarget( - { - "name": "Run " + target_name, - "productName": xcode_target.GetProperty("productName"), - "buildConfigurationList": xccl, - }, - parent=self.project, - ) - run_target.AddDependency(xcode_target) - - command = target["run_as"] - script = "" - if command.get("working_directory"): - script = ( - script - + 'cd "%s"\n' - % gyp.xcodeproj_file.ConvertVariablesToShellSyntax( - command.get("working_directory") - ) - ) - - if command.get("environment"): - script = ( - script - + "\n".join( - [ - 'export %s="%s"' - % ( - key, - gyp.xcodeproj_file.ConvertVariablesToShellSyntax( - val - ), - ) - for (key, val) in command.get("environment").items() - ] - ) - + "\n" - ) - - # Some test end up using sockets, files on disk, etc. and can get - # confused if more then one test runs at a time. The generator - # flag 'xcode_serialize_all_test_runs' controls the forcing of all - # tests serially. It defaults to True. To get serial runs this - # little bit of python does the same as the linux flock utility to - # make sure only one runs at a time. - command_prefix = "" - if serialize_all_tests: - command_prefix = """python -c "import fcntl, subprocess, sys -file = open('$TMPDIR/GYP_serialize_test_runs', 'a') -fcntl.flock(file.fileno(), fcntl.LOCK_EX) -sys.exit(subprocess.call(sys.argv[1:]))" """ - - # If we were unable to exec for some reason, we want to exit - # with an error, and fixup variable references to be shell - # syntax instead of xcode syntax. - script = ( - script - + "exec " - + command_prefix - + "%s\nexit 1\n" - % gyp.xcodeproj_file.ConvertVariablesToShellSyntax( - gyp.common.EncodePOSIXShellList(command.get("action")) - ) - ) - - ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase( - {"shellScript": script, "showEnvVarsInLog": 0} - ) - run_target.AppendProperty("buildPhases", ssbp) - - # Add the run target to the project file. - targets.append(run_target) - run_test_targets.append(run_target) - xcode_target.test_runner = run_target - - # Make sure that the list of targets being replaced is the same length as - # the one replacing it, but allow for the added test runner targets. - assert len(self.project._properties["targets"]) == len(ordinary_targets) + len( - support_targets - ) - - self.project._properties["targets"] = targets - - # Get rid of unnecessary levels of depth in groups like the Source group. - self.project.RootGroupsTakeOverOnlyChildren(True) - - # Sort the groups nicely. Do this after sorting the targets, because the - # Products group is sorted based on the order of the targets. - self.project.SortGroups() - - # Create an "All" target if there's more than one target in this project - # file and the project didn't define its own "All" target. Put a generated - # "All" target first so that people opening up the project for the first - # time will build everything by default. - if len(targets_for_all) > 1 and not has_custom_all: - xccl = CreateXCConfigurationList(configurations) - all_target = gyp.xcodeproj_file.PBXAggregateTarget( - {"buildConfigurationList": xccl, "name": "All"}, parent=self.project - ) - - for target in targets_for_all: - all_target.AddDependency(target) - - # TODO(mark): This is evil because it relies on internal knowledge of - # PBXProject._properties. It's important to get the "All" target first, - # though. - self.project._properties["targets"].insert(0, all_target) - - # The same, but for run_test_targets. - if len(run_test_targets) > 1: - xccl = CreateXCConfigurationList(configurations) - run_all_tests_target = gyp.xcodeproj_file.PBXAggregateTarget( - {"buildConfigurationList": xccl, "name": "Run All Tests"}, - parent=self.project, - ) - for run_test_target in run_test_targets: - run_all_tests_target.AddDependency(run_test_target) - - # Insert after the "All" target, which must exist if there is more than - # one run_test_target. - self.project._properties["targets"].insert(1, run_all_tests_target) - - def Finalize2(self, xcode_targets, xcode_target_to_target_dict): - # Finalize2 needs to happen in a separate step because the process of - # updating references to other projects depends on the ordering of targets - # within remote project files. Finalize1 is responsible for sorting duty, - # and once all project files are sorted, Finalize2 can come in and update - # these references. - - # To support making a "test runner" target that will run all the tests - # that are direct dependents of any given target, we look for - # xcode_create_dependents_test_runner being set on an Aggregate target, - # and generate a second target that will run the tests runners found under - # the marked target. - for bf_tgt in self.build_file_dict["targets"]: - if int(bf_tgt.get("xcode_create_dependents_test_runner", 0)): - tgt_name = bf_tgt["target_name"] - toolset = bf_tgt["toolset"] - qualified_target = gyp.common.QualifiedTarget( - self.gyp_path, tgt_name, toolset - ) - xcode_target = xcode_targets[qualified_target] - if isinstance(xcode_target, gyp.xcodeproj_file.PBXAggregateTarget): - # Collect all the run test targets. - all_run_tests = [] - pbxtds = xcode_target.GetProperty("dependencies") - for pbxtd in pbxtds: - pbxcip = pbxtd.GetProperty("targetProxy") - dependency_xct = pbxcip.GetProperty("remoteGlobalIDString") - if hasattr(dependency_xct, "test_runner"): - all_run_tests.append(dependency_xct.test_runner) - - # Directly depend on all the runners as they depend on the target - # that builds them. - if len(all_run_tests) > 0: - run_all_target = gyp.xcodeproj_file.PBXAggregateTarget( - { - "name": "Run %s Tests" % tgt_name, - "productName": tgt_name, - }, - parent=self.project, - ) - for run_test_target in all_run_tests: - run_all_target.AddDependency(run_test_target) - - # Insert the test runner after the related target. - idx = self.project._properties["targets"].index(xcode_target) - self.project._properties["targets"].insert( - idx + 1, run_all_target - ) - - # Update all references to other projects, to make sure that the lists of - # remote products are complete. Otherwise, Xcode will fill them in when - # it opens the project file, which will result in unnecessary diffs. - # TODO(mark): This is evil because it relies on internal knowledge of - # PBXProject._other_pbxprojects. - for other_pbxproject in self.project._other_pbxprojects.keys(): - self.project.AddOrGetProjectReference(other_pbxproject) - - self.project.SortRemoteProductReferences() - - # Give everything an ID. - self.project_file.ComputeIDs() - - # Make sure that no two objects in the project file have the same ID. If - # multiple objects wind up with the same ID, upon loading the file, Xcode - # will only recognize one object (the last one in the file?) and the - # results are unpredictable. - self.project_file.EnsureNoIDCollisions() - - def Write(self): - # Write the project file to a temporary location first. Xcode watches for - # changes to the project file and presents a UI sheet offering to reload - # the project when it does change. However, in some cases, especially when - # multiple projects are open or when Xcode is busy, things don't work so - # seamlessly. Sometimes, Xcode is able to detect that a project file has - # changed but can't unload it because something else is referencing it. - # To mitigate this problem, and to avoid even having Xcode present the UI - # sheet when an open project is rewritten for inconsequential changes, the - # project file is written to a temporary file in the xcodeproj directory - # first. The new temporary file is then compared to the existing project - # file, if any. If they differ, the new file replaces the old; otherwise, - # the new project file is simply deleted. Xcode properly detects a file - # being renamed over an open project file as a change and so it remains - # able to present the "project file changed" sheet under this system. - # Writing to a temporary file first also avoids the possible problem of - # Xcode rereading an incomplete project file. - (output_fd, new_pbxproj_path) = tempfile.mkstemp( - suffix=".tmp", prefix="project.pbxproj.gyp.", dir=self.path - ) - - try: - output_file = os.fdopen(output_fd, "w") - - self.project_file.Print(output_file) - output_file.close() - - pbxproj_path = os.path.join(self.path, "project.pbxproj") - - same = False - try: - same = filecmp.cmp(pbxproj_path, new_pbxproj_path, False) - except OSError as e: - if e.errno != errno.ENOENT: - raise - - if same: - # The new file is identical to the old one, just get rid of the new - # one. - os.unlink(new_pbxproj_path) - else: - # The new file is different from the old one, or there is no old one. - # Rename the new file to the permanent name. - # - # tempfile.mkstemp uses an overly restrictive mode, resulting in a - # file that can only be read by the owner, regardless of the umask. - # There's no reason to not respect the umask here, which means that - # an extra hoop is required to fetch it and reset the new file's mode. - # - # No way to get the umask without setting a new one? Set a safe one - # and then set it back to the old value. - umask = os.umask(0o77) - os.umask(umask) - - os.chmod(new_pbxproj_path, 0o666 & ~umask) - os.rename(new_pbxproj_path, pbxproj_path) - - except Exception: - # Don't leave turds behind. In fact, if this code was responsible for - # creating the xcodeproj directory, get rid of that too. - os.unlink(new_pbxproj_path) - if self.created_dir: - shutil.rmtree(self.path, True) - raise - - -def AddSourceToTarget(source, type, pbxp, xct): - # TODO(mark): Perhaps source_extensions and library_extensions can be made a - # little bit fancier. - source_extensions = ["c", "cc", "cpp", "cxx", "m", "mm", "s", "swift"] - - # .o is conceptually more of a "source" than a "library," but Xcode thinks - # of "sources" as things to compile and "libraries" (or "frameworks") as - # things to link with. Adding an object file to an Xcode target's frameworks - # phase works properly. - library_extensions = ["a", "dylib", "framework", "o"] - - basename = posixpath.basename(source) - (root, ext) = posixpath.splitext(basename) - if ext: - ext = ext[1:].lower() - - if ext in source_extensions and type != "none": - xct.SourcesPhase().AddFile(source) - elif ext in library_extensions and type != "none": - xct.FrameworksPhase().AddFile(source) - else: - # Files that aren't added to a sources or frameworks build phase can still - # go into the project file, just not as part of a build phase. - pbxp.AddOrGetFileInRootGroup(source) - - -def AddResourceToTarget(resource, pbxp, xct): - # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call - # where it's used. - xct.ResourcesPhase().AddFile(resource) - - -def AddHeaderToTarget(header, pbxp, xct, is_public): - # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call - # where it's used. - settings = "{ATTRIBUTES = (%s, ); }" % ("Private", "Public")[is_public] - xct.HeadersPhase().AddFile(header, settings) - - -_xcode_variable_re = re.compile(r"(\$\((.*?)\))") - - -def ExpandXcodeVariables(string, expansions): - """Expands Xcode-style $(VARIABLES) in string per the expansions dict. - - In some rare cases, it is appropriate to expand Xcode variables when a - project file is generated. For any substring $(VAR) in string, if VAR is a - key in the expansions dict, $(VAR) will be replaced with expansions[VAR]. - Any $(VAR) substring in string for which VAR is not a key in the expansions - dict will remain in the returned string. - """ - - matches = _xcode_variable_re.findall(string) - if matches is None: - return string - - matches.reverse() - for match in matches: - (to_replace, variable) = match - if variable not in expansions: - continue - - replacement = expansions[variable] - string = re.sub(re.escape(to_replace), replacement, string) - - return string - - -_xcode_define_re = re.compile(r"([\\\"\' ])") - - -def EscapeXcodeDefine(s): - """We must escape the defines that we give to XCode so that it knows not to - split on spaces and to respect backslash and quote literals. However, we - must not quote the define, or Xcode will incorrectly interpret variables - especially $(inherited).""" - return re.sub(_xcode_define_re, r"\\\1", s) - - -def PerformBuild(data, configurations, params): - options = params["options"] - - for build_file, build_file_dict in data.items(): - (build_file_root, build_file_ext) = os.path.splitext(build_file) - if build_file_ext != ".gyp": - continue - xcodeproj_path = build_file_root + options.suffix + ".xcodeproj" - if options.generator_output: - xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path) - - for config in configurations: - arguments = ["xcodebuild", "-project", xcodeproj_path] - arguments += ["-configuration", config] - print(f"Building [{config}]: {arguments}") - subprocess.check_call(arguments) - - -def CalculateGeneratorInputInfo(params): - toplevel = params["options"].toplevel_dir - if params.get("flavor") == "ninja": - generator_dir = os.path.relpath(params["options"].generator_output or ".") - output_dir = params.get("generator_flags", {}).get("output_dir", "out") - output_dir = os.path.normpath(os.path.join(generator_dir, output_dir)) - qualified_out_dir = os.path.normpath( - os.path.join(toplevel, output_dir, "gypfiles-xcode-ninja") - ) - else: - output_dir = os.path.normpath(os.path.join(toplevel, "xcodebuild")) - qualified_out_dir = os.path.normpath( - os.path.join(toplevel, output_dir, "gypfiles") - ) - - global generator_filelist_paths - generator_filelist_paths = { - "toplevel": toplevel, - "qualified_out_dir": qualified_out_dir, - } - - -def GenerateOutput(target_list, target_dicts, data, params): - # Optionally configure each spec to use ninja as the external builder. - ninja_wrapper = params.get("flavor") == "ninja" - if ninja_wrapper: - (target_list, target_dicts, data) = gyp.xcode_ninja.CreateWrapper( - target_list, target_dicts, data, params - ) - - options = params["options"] - generator_flags = params.get("generator_flags", {}) - parallel_builds = generator_flags.get("xcode_parallel_builds", True) - serialize_all_tests = generator_flags.get("xcode_serialize_all_test_runs", True) - upgrade_check_project_version = generator_flags.get( - "xcode_upgrade_check_project_version", None - ) - - # Format upgrade_check_project_version with leading zeros as needed. - if upgrade_check_project_version: - upgrade_check_project_version = str(upgrade_check_project_version) - while len(upgrade_check_project_version) < 4: - upgrade_check_project_version = "0" + upgrade_check_project_version - - skip_excluded_files = not generator_flags.get("xcode_list_excluded_files", True) - xcode_projects = {} - for build_file, build_file_dict in data.items(): - (build_file_root, build_file_ext) = os.path.splitext(build_file) - if build_file_ext != ".gyp": - continue - xcodeproj_path = build_file_root + options.suffix + ".xcodeproj" - if options.generator_output: - xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path) - xcp = XcodeProject(build_file, xcodeproj_path, build_file_dict) - xcode_projects[build_file] = xcp - pbxp = xcp.project - - # Set project-level attributes from multiple options - project_attributes = {} - if parallel_builds: - project_attributes["BuildIndependentTargetsInParallel"] = "YES" - if upgrade_check_project_version: - project_attributes["LastUpgradeCheck"] = upgrade_check_project_version - project_attributes[ - "LastTestingUpgradeCheck" - ] = upgrade_check_project_version - project_attributes["LastSwiftUpdateCheck"] = upgrade_check_project_version - pbxp.SetProperty("attributes", project_attributes) - - # Add gyp/gypi files to project - if not generator_flags.get("standalone"): - main_group = pbxp.GetProperty("mainGroup") - build_group = gyp.xcodeproj_file.PBXGroup({"name": "Build"}) - main_group.AppendChild(build_group) - for included_file in build_file_dict["included_files"]: - build_group.AddOrGetFileByPath(included_file, False) - - xcode_targets = {} - xcode_target_to_target_dict = {} - for qualified_target in target_list: - [build_file, target_name, toolset] = gyp.common.ParseQualifiedTarget( - qualified_target - ) - - spec = target_dicts[qualified_target] - if spec["toolset"] != "target": - raise Exception( - "Multiple toolsets not supported in xcode build (target %s)" - % qualified_target - ) - configuration_names = [spec["default_configuration"]] - for configuration_name in sorted(spec["configurations"].keys()): - if configuration_name not in configuration_names: - configuration_names.append(configuration_name) - xcp = xcode_projects[build_file] - pbxp = xcp.project - - # Set up the configurations for the target according to the list of names - # supplied. - xccl = CreateXCConfigurationList(configuration_names) - - # Create an XCTarget subclass object for the target. The type with - # "+bundle" appended will be used if the target has "mac_bundle" set. - # loadable_modules not in a mac_bundle are mapped to - # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets - # to create a single-file mh_bundle. - _types = { - "executable": "com.apple.product-type.tool", - "loadable_module": "com.googlecode.gyp.xcode.bundle", - "shared_library": "com.apple.product-type.library.dynamic", - "static_library": "com.apple.product-type.library.static", - "mac_kernel_extension": "com.apple.product-type.kernel-extension", - "executable+bundle": "com.apple.product-type.application", - "loadable_module+bundle": "com.apple.product-type.bundle", - "loadable_module+xctest": "com.apple.product-type.bundle.unit-test", - "loadable_module+xcuitest": "com.apple.product-type.bundle.ui-testing", - "shared_library+bundle": "com.apple.product-type.framework", - "executable+extension+bundle": "com.apple.product-type.app-extension", - "executable+watch+extension+bundle": - "com.apple.product-type.watchkit-extension", - "executable+watch+bundle": "com.apple.product-type.application.watchapp", - "mac_kernel_extension+bundle": "com.apple.product-type.kernel-extension", - } - - target_properties = { - "buildConfigurationList": xccl, - "name": target_name, - } - - type = spec["type"] - is_xctest = int(spec.get("mac_xctest_bundle", 0)) - is_xcuitest = int(spec.get("mac_xcuitest_bundle", 0)) - is_bundle = int(spec.get("mac_bundle", 0)) or is_xctest - is_app_extension = int(spec.get("ios_app_extension", 0)) - is_watchkit_extension = int(spec.get("ios_watchkit_extension", 0)) - is_watch_app = int(spec.get("ios_watch_app", 0)) - if type != "none": - type_bundle_key = type - if is_xcuitest: - type_bundle_key += "+xcuitest" - assert type == "loadable_module", ( - "mac_xcuitest_bundle targets must have type loadable_module " - "(target %s)" % target_name - ) - elif is_xctest: - type_bundle_key += "+xctest" - assert type == "loadable_module", ( - "mac_xctest_bundle targets must have type loadable_module " - "(target %s)" % target_name - ) - elif is_app_extension: - assert is_bundle, ( - "ios_app_extension flag requires mac_bundle " - "(target %s)" % target_name - ) - type_bundle_key += "+extension+bundle" - elif is_watchkit_extension: - assert is_bundle, ( - "ios_watchkit_extension flag requires mac_bundle " - "(target %s)" % target_name - ) - type_bundle_key += "+watch+extension+bundle" - elif is_watch_app: - assert is_bundle, ( - "ios_watch_app flag requires mac_bundle " - "(target %s)" % target_name - ) - type_bundle_key += "+watch+bundle" - elif is_bundle: - type_bundle_key += "+bundle" - - xctarget_type = gyp.xcodeproj_file.PBXNativeTarget - try: - target_properties["productType"] = _types[type_bundle_key] - except KeyError as e: - gyp.common.ExceptionAppend( - e, - "-- unknown product type while " "writing target %s" % target_name, - ) - raise - else: - xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget - assert not is_bundle, ( - 'mac_bundle targets cannot have type none (target "%s")' % target_name - ) - assert not is_xcuitest, ( - 'mac_xcuitest_bundle targets cannot have type none (target "%s")' - % target_name - ) - assert not is_xctest, ( - 'mac_xctest_bundle targets cannot have type none (target "%s")' - % target_name - ) - - target_product_name = spec.get("product_name") - if target_product_name is not None: - target_properties["productName"] = target_product_name - - xct = xctarget_type( - target_properties, - parent=pbxp, - force_outdir=spec.get("product_dir"), - force_prefix=spec.get("product_prefix"), - force_extension=spec.get("product_extension"), - ) - pbxp.AppendProperty("targets", xct) - xcode_targets[qualified_target] = xct - xcode_target_to_target_dict[xct] = spec - - spec_actions = spec.get("actions", []) - spec_rules = spec.get("rules", []) - - # Xcode has some "issues" with checking dependencies for the "Compile - # sources" step with any source files/headers generated by actions/rules. - # To work around this, if a target is building anything directly (not - # type "none"), then a second target is used to run the GYP actions/rules - # and is made a dependency of this target. This way the work is done - # before the dependency checks for what should be recompiled. - support_xct = None - # The Xcode "issues" don't affect xcode-ninja builds, since the dependency - # logic all happens in ninja. Don't bother creating the extra targets in - # that case. - if type != "none" and (spec_actions or spec_rules) and not ninja_wrapper: - support_xccl = CreateXCConfigurationList(configuration_names) - support_target_suffix = generator_flags.get( - "support_target_suffix", " Support" - ) - support_target_properties = { - "buildConfigurationList": support_xccl, - "name": target_name + support_target_suffix, - } - if target_product_name: - support_target_properties["productName"] = ( - target_product_name + " Support" - ) - support_xct = gyp.xcodeproj_file.PBXAggregateTarget( - support_target_properties, parent=pbxp - ) - pbxp.AppendProperty("targets", support_xct) - xct.AddDependency(support_xct) - # Hang the support target off the main target so it can be tested/found - # by the generator during Finalize. - xct.support_target = support_xct - - prebuild_index = 0 - - # Add custom shell script phases for "actions" sections. - for action in spec_actions: - # There's no need to write anything into the script to ensure that the - # output directories already exist, because Xcode will look at the - # declared outputs and automatically ensure that they exist for us. - - # Do we have a message to print when this action runs? - message = action.get("message") - if message: - message = "echo note: " + gyp.common.EncodePOSIXShellArgument(message) - else: - message = "" - - # Turn the list into a string that can be passed to a shell. - action_string = gyp.common.EncodePOSIXShellList(action["action"]) - - # Convert Xcode-type variable references to sh-compatible environment - # variable references. - message_sh = gyp.xcodeproj_file.ConvertVariablesToShellSyntax(message) - action_string_sh = gyp.xcodeproj_file.ConvertVariablesToShellSyntax( - action_string - ) - - script = "" - # Include the optional message - if message_sh: - script += message_sh + "\n" - # Be sure the script runs in exec, and that if exec fails, the script - # exits signalling an error. - script += "exec " + action_string_sh + "\nexit 1\n" - ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase( - { - "inputPaths": action["inputs"], - "name": 'Action "' + action["action_name"] + '"', - "outputPaths": action["outputs"], - "shellScript": script, - "showEnvVarsInLog": 0, - } - ) - - if support_xct: - support_xct.AppendProperty("buildPhases", ssbp) - else: - # TODO(mark): this assumes too much knowledge of the internals of - # xcodeproj_file; some of these smarts should move into xcodeproj_file - # itself. - xct._properties["buildPhases"].insert(prebuild_index, ssbp) - prebuild_index = prebuild_index + 1 - - # TODO(mark): Should verify that at most one of these is specified. - if int(action.get("process_outputs_as_sources", False)): - for output in action["outputs"]: - AddSourceToTarget(output, type, pbxp, xct) - - if int(action.get("process_outputs_as_mac_bundle_resources", False)): - for output in action["outputs"]: - AddResourceToTarget(output, pbxp, xct) - - # tgt_mac_bundle_resources holds the list of bundle resources so - # the rule processing can check against it. - if is_bundle: - tgt_mac_bundle_resources = spec.get("mac_bundle_resources", []) - else: - tgt_mac_bundle_resources = [] - - # Add custom shell script phases driving "make" for "rules" sections. - # - # Xcode's built-in rule support is almost powerful enough to use directly, - # but there are a few significant deficiencies that render them unusable. - # There are workarounds for some of its inadequacies, but in aggregate, - # the workarounds added complexity to the generator, and some workarounds - # actually require input files to be crafted more carefully than I'd like. - # Consequently, until Xcode rules are made more capable, "rules" input - # sections will be handled in Xcode output by shell script build phases - # performed prior to the compilation phase. - # - # The following problems with Xcode rules were found. The numbers are - # Apple radar IDs. I hope that these shortcomings are addressed, I really - # liked having the rules handled directly in Xcode during the period that - # I was prototyping this. - # - # 6588600 Xcode compiles custom script rule outputs too soon, compilation - # fails. This occurs when rule outputs from distinct inputs are - # interdependent. The only workaround is to put rules and their - # inputs in a separate target from the one that compiles the rule - # outputs. This requires input file cooperation and it means that - # process_outputs_as_sources is unusable. - # 6584932 Need to declare that custom rule outputs should be excluded from - # compilation. A possible workaround is to lie to Xcode about a - # rule's output, giving it a dummy file it doesn't know how to - # compile. The rule action script would need to touch the dummy. - # 6584839 I need a way to declare additional inputs to a custom rule. - # A possible workaround is a shell script phase prior to - # compilation that touches a rule's primary input files if any - # would-be additional inputs are newer than the output. Modifying - # the source tree - even just modification times - feels dirty. - # 6564240 Xcode "custom script" build rules always dump all environment - # variables. This is a low-prioroty problem and is not a - # show-stopper. - rules_by_ext = {} - for rule in spec_rules: - rules_by_ext[rule["extension"]] = rule - - # First, some definitions: - # - # A "rule source" is a file that was listed in a target's "sources" - # list and will have a rule applied to it on the basis of matching the - # rule's "extensions" attribute. Rule sources are direct inputs to - # rules. - # - # Rule definitions may specify additional inputs in their "inputs" - # attribute. These additional inputs are used for dependency tracking - # purposes. - # - # A "concrete output" is a rule output with input-dependent variables - # resolved. For example, given a rule with: - # 'extension': 'ext', 'outputs': ['$(INPUT_FILE_BASE).cc'], - # if the target's "sources" list contained "one.ext" and "two.ext", - # the "concrete output" for rule input "two.ext" would be "two.cc". If - # a rule specifies multiple outputs, each input file that the rule is - # applied to will have the same number of concrete outputs. - # - # If any concrete outputs are outdated or missing relative to their - # corresponding rule_source or to any specified additional input, the - # rule action must be performed to generate the concrete outputs. - - # concrete_outputs_by_rule_source will have an item at the same index - # as the rule['rule_sources'] that it corresponds to. Each item is a - # list of all of the concrete outputs for the rule_source. - concrete_outputs_by_rule_source = [] - - # concrete_outputs_all is a flat list of all concrete outputs that this - # rule is able to produce, given the known set of input files - # (rule_sources) that apply to it. - concrete_outputs_all = [] - - # messages & actions are keyed by the same indices as rule['rule_sources'] - # and concrete_outputs_by_rule_source. They contain the message and - # action to perform after resolving input-dependent variables. The - # message is optional, in which case None is stored for each rule source. - messages = [] - actions = [] - - for rule_source in rule.get("rule_sources", []): - rule_source_dirname, rule_source_basename = posixpath.split(rule_source) - (rule_source_root, rule_source_ext) = posixpath.splitext( - rule_source_basename - ) - - # These are the same variable names that Xcode uses for its own native - # rule support. Because Xcode's rule engine is not being used, they - # need to be expanded as they are written to the makefile. - rule_input_dict = { - "INPUT_FILE_BASE": rule_source_root, - "INPUT_FILE_SUFFIX": rule_source_ext, - "INPUT_FILE_NAME": rule_source_basename, - "INPUT_FILE_PATH": rule_source, - "INPUT_FILE_DIRNAME": rule_source_dirname, - } - - concrete_outputs_for_this_rule_source = [] - for output in rule.get("outputs", []): - # Fortunately, Xcode and make both use $(VAR) format for their - # variables, so the expansion is the only transformation necessary. - # Any remaining $(VAR)-type variables in the string can be given - # directly to make, which will pick up the correct settings from - # what Xcode puts into the environment. - concrete_output = ExpandXcodeVariables(output, rule_input_dict) - concrete_outputs_for_this_rule_source.append(concrete_output) - - # Add all concrete outputs to the project. - pbxp.AddOrGetFileInRootGroup(concrete_output) - - concrete_outputs_by_rule_source.append( - concrete_outputs_for_this_rule_source - ) - concrete_outputs_all.extend(concrete_outputs_for_this_rule_source) - - # TODO(mark): Should verify that at most one of these is specified. - if int(rule.get("process_outputs_as_sources", False)): - for output in concrete_outputs_for_this_rule_source: - AddSourceToTarget(output, type, pbxp, xct) - - # If the file came from the mac_bundle_resources list or if the rule - # is marked to process outputs as bundle resource, do so. - was_mac_bundle_resource = rule_source in tgt_mac_bundle_resources - if was_mac_bundle_resource or int( - rule.get("process_outputs_as_mac_bundle_resources", False) - ): - for output in concrete_outputs_for_this_rule_source: - AddResourceToTarget(output, pbxp, xct) - - # Do we have a message to print when this rule runs? - message = rule.get("message") - if message: - message = gyp.common.EncodePOSIXShellArgument(message) - message = ExpandXcodeVariables(message, rule_input_dict) - messages.append(message) - - # Turn the list into a string that can be passed to a shell. - action_string = gyp.common.EncodePOSIXShellList(rule["action"]) - - action = ExpandXcodeVariables(action_string, rule_input_dict) - actions.append(action) - - if len(concrete_outputs_all) > 0: - # TODO(mark): There's a possibility for collision here. Consider - # target "t" rule "A_r" and target "t_A" rule "r". - makefile_name = "%s.make" % re.sub( - "[^a-zA-Z0-9_]", "_", "{}_{}".format(target_name, rule["rule_name"]) - ) - makefile_path = os.path.join( - xcode_projects[build_file].path, makefile_name - ) - # TODO(mark): try/close? Write to a temporary file and swap it only - # if it's got changes? - makefile = open(makefile_path, "w") - - # make will build the first target in the makefile by default. By - # convention, it's called "all". List all (or at least one) - # concrete output for each rule source as a prerequisite of the "all" - # target. - makefile.write("all: \\\n") - for concrete_output_index, concrete_output_by_rule_source in enumerate( - concrete_outputs_by_rule_source - ): - # Only list the first (index [0]) concrete output of each input - # in the "all" target. Otherwise, a parallel make (-j > 1) would - # attempt to process each input multiple times simultaneously. - # Otherwise, "all" could just contain the entire list of - # concrete_outputs_all. - concrete_output = concrete_output_by_rule_source[0] - if ( - concrete_output_index - == len(concrete_outputs_by_rule_source) - 1 - ): - eol = "" - else: - eol = " \\" - makefile.write(f" {concrete_output}{eol}\n") - - for (rule_source, concrete_outputs, message, action) in zip( - rule["rule_sources"], - concrete_outputs_by_rule_source, - messages, - actions, - ): - makefile.write("\n") - - # Add a rule that declares it can build each concrete output of a - # rule source. Collect the names of the directories that are - # required. - concrete_output_dirs = [] - for concrete_output_index, concrete_output in enumerate( - concrete_outputs - ): - if concrete_output_index == 0: - bol = "" - else: - bol = " " - makefile.write(f"{bol}{concrete_output} \\\n") - - concrete_output_dir = posixpath.dirname(concrete_output) - if ( - concrete_output_dir - and concrete_output_dir not in concrete_output_dirs - ): - concrete_output_dirs.append(concrete_output_dir) - - makefile.write(" : \\\n") - - # The prerequisites for this rule are the rule source itself and - # the set of additional rule inputs, if any. - prerequisites = [rule_source] - prerequisites.extend(rule.get("inputs", [])) - for prerequisite_index, prerequisite in enumerate(prerequisites): - if prerequisite_index == len(prerequisites) - 1: - eol = "" - else: - eol = " \\" - makefile.write(f" {prerequisite}{eol}\n") - - # Make sure that output directories exist before executing the rule - # action. - if len(concrete_output_dirs) > 0: - makefile.write( - '\t@mkdir -p "%s"\n' % '" "'.join(concrete_output_dirs) - ) - - # The rule message and action have already had - # the necessary variable substitutions performed. - if message: - # Mark it with note: so Xcode picks it up in build output. - makefile.write("\t@echo note: %s\n" % message) - makefile.write("\t%s\n" % action) - - makefile.close() - - # It might be nice to ensure that needed output directories exist - # here rather than in each target in the Makefile, but that wouldn't - # work if there ever was a concrete output that had an input-dependent - # variable anywhere other than in the leaf position. - - # Don't declare any inputPaths or outputPaths. If they're present, - # Xcode will provide a slight optimization by only running the script - # phase if any output is missing or outdated relative to any input. - # Unfortunately, it will also assume that all outputs are touched by - # the script, and if the outputs serve as files in a compilation - # phase, they will be unconditionally rebuilt. Since make might not - # rebuild everything that could be declared here as an output, this - # extra compilation activity is unnecessary. With inputPaths and - # outputPaths not supplied, make will always be called, but it knows - # enough to not do anything when everything is up-to-date. - - # To help speed things up, pass -j COUNT to make so it does some work - # in parallel. Don't use ncpus because Xcode will build ncpus targets - # in parallel and if each target happens to have a rules step, there - # would be ncpus^2 things going. With a machine that has 2 quad-core - # Xeons, a build can quickly run out of processes based on - # scheduling/other tasks, and randomly failing builds are no good. - script = ( - """JOB_COUNT="$(/usr/sbin/sysctl -n hw.ncpu)" -if [ "${JOB_COUNT}" -gt 4 ]; then - JOB_COUNT=4 -fi -exec xcrun make -f "${PROJECT_FILE_PATH}/%s" -j "${JOB_COUNT}" -exit 1 -""" - % makefile_name - ) - ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase( - { - "name": 'Rule "' + rule["rule_name"] + '"', - "shellScript": script, - "showEnvVarsInLog": 0, - } - ) - - if support_xct: - support_xct.AppendProperty("buildPhases", ssbp) - else: - # TODO(mark): this assumes too much knowledge of the internals of - # xcodeproj_file; some of these smarts should move - # into xcodeproj_file itself. - xct._properties["buildPhases"].insert(prebuild_index, ssbp) - prebuild_index = prebuild_index + 1 - - # Extra rule inputs also go into the project file. Concrete outputs were - # already added when they were computed. - groups = ["inputs", "inputs_excluded"] - if skip_excluded_files: - groups = [x for x in groups if not x.endswith("_excluded")] - for group in groups: - for item in rule.get(group, []): - pbxp.AddOrGetFileInRootGroup(item) - - # Add "sources". - for source in spec.get("sources", []): - (source_root, source_extension) = posixpath.splitext(source) - if source_extension[1:] not in rules_by_ext: - # AddSourceToTarget will add the file to a root group if it's not - # already there. - AddSourceToTarget(source, type, pbxp, xct) - else: - pbxp.AddOrGetFileInRootGroup(source) - - # Add "mac_bundle_resources" and "mac_framework_private_headers" if - # it's a bundle of any type. - if is_bundle: - for resource in tgt_mac_bundle_resources: - (resource_root, resource_extension) = posixpath.splitext(resource) - if resource_extension[1:] not in rules_by_ext: - AddResourceToTarget(resource, pbxp, xct) - else: - pbxp.AddOrGetFileInRootGroup(resource) - - for header in spec.get("mac_framework_private_headers", []): - AddHeaderToTarget(header, pbxp, xct, False) - - # Add "mac_framework_headers". These can be valid for both frameworks - # and static libraries. - if is_bundle or type == "static_library": - for header in spec.get("mac_framework_headers", []): - AddHeaderToTarget(header, pbxp, xct, True) - - # Add "copies". - pbxcp_dict = {} - for copy_group in spec.get("copies", []): - dest = copy_group["destination"] - if dest[0] not in ("/", "$"): - # Relative paths are relative to $(SRCROOT). - dest = "$(SRCROOT)/" + dest - - code_sign = int(copy_group.get("xcode_code_sign", 0)) - settings = (None, "{ATTRIBUTES = (CodeSignOnCopy, ); }")[code_sign] - - # Coalesce multiple "copies" sections in the same target with the same - # "destination" property into the same PBXCopyFilesBuildPhase, otherwise - # they'll wind up with ID collisions. - pbxcp = pbxcp_dict.get(dest, None) - if pbxcp is None: - pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase( - {"name": "Copy to " + copy_group["destination"]}, parent=xct - ) - pbxcp.SetDestination(dest) - - # TODO(mark): The usual comment about this knowing too much about - # gyp.xcodeproj_file internals applies. - xct._properties["buildPhases"].insert(prebuild_index, pbxcp) - - pbxcp_dict[dest] = pbxcp - - for file in copy_group["files"]: - pbxcp.AddFile(file, settings) - - # Excluded files can also go into the project file. - if not skip_excluded_files: - for key in [ - "sources", - "mac_bundle_resources", - "mac_framework_headers", - "mac_framework_private_headers", - ]: - excluded_key = key + "_excluded" - for item in spec.get(excluded_key, []): - pbxp.AddOrGetFileInRootGroup(item) - - # So can "inputs" and "outputs" sections of "actions" groups. - groups = ["inputs", "inputs_excluded", "outputs", "outputs_excluded"] - if skip_excluded_files: - groups = [x for x in groups if not x.endswith("_excluded")] - for action in spec.get("actions", []): - for group in groups: - for item in action.get(group, []): - # Exclude anything in BUILT_PRODUCTS_DIR. They're products, not - # sources. - if not item.startswith("$(BUILT_PRODUCTS_DIR)/"): - pbxp.AddOrGetFileInRootGroup(item) - - for postbuild in spec.get("postbuilds", []): - action_string_sh = gyp.common.EncodePOSIXShellList(postbuild["action"]) - script = "exec " + action_string_sh + "\nexit 1\n" - - # Make the postbuild step depend on the output of ld or ar from this - # target. Apparently putting the script step after the link step isn't - # sufficient to ensure proper ordering in all cases. With an input - # declared but no outputs, the script step should run every time, as - # desired. - ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase( - { - "inputPaths": ["$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)"], - "name": 'Postbuild "' + postbuild["postbuild_name"] + '"', - "shellScript": script, - "showEnvVarsInLog": 0, - } - ) - xct.AppendProperty("buildPhases", ssbp) - - # Add dependencies before libraries, because adding a dependency may imply - # adding a library. It's preferable to keep dependencies listed first - # during a link phase so that they can override symbols that would - # otherwise be provided by libraries, which will usually include system - # libraries. On some systems, ld is finicky and even requires the - # libraries to be ordered in such a way that unresolved symbols in - # earlier-listed libraries may only be resolved by later-listed libraries. - # The Mac linker doesn't work that way, but other platforms do, and so - # their linker invocations need to be constructed in this way. There's - # no compelling reason for Xcode's linker invocations to differ. - - if "dependencies" in spec: - for dependency in spec["dependencies"]: - xct.AddDependency(xcode_targets[dependency]) - # The support project also gets the dependencies (in case they are - # needed for the actions/rules to work). - if support_xct: - support_xct.AddDependency(xcode_targets[dependency]) - - if "libraries" in spec: - for library in spec["libraries"]: - xct.FrameworksPhase().AddFile(library) - # Add the library's directory to LIBRARY_SEARCH_PATHS if necessary. - # I wish Xcode handled this automatically. - library_dir = posixpath.dirname(library) - if library_dir not in xcode_standard_library_dirs and ( - not xct.HasBuildSetting(_library_search_paths_var) - or library_dir not in xct.GetBuildSetting(_library_search_paths_var) - ): - xct.AppendBuildSetting(_library_search_paths_var, library_dir) - - for configuration_name in configuration_names: - configuration = spec["configurations"][configuration_name] - xcbc = xct.ConfigurationNamed(configuration_name) - for include_dir in configuration.get("mac_framework_dirs", []): - xcbc.AppendBuildSetting("FRAMEWORK_SEARCH_PATHS", include_dir) - for include_dir in configuration.get("include_dirs", []): - xcbc.AppendBuildSetting("HEADER_SEARCH_PATHS", include_dir) - for library_dir in configuration.get("library_dirs", []): - if library_dir not in xcode_standard_library_dirs and ( - not xcbc.HasBuildSetting(_library_search_paths_var) - or library_dir - not in xcbc.GetBuildSetting(_library_search_paths_var) - ): - xcbc.AppendBuildSetting(_library_search_paths_var, library_dir) - - if "defines" in configuration: - for define in configuration["defines"]: - set_define = EscapeXcodeDefine(define) - xcbc.AppendBuildSetting("GCC_PREPROCESSOR_DEFINITIONS", set_define) - if "xcode_settings" in configuration: - for xck, xcv in configuration["xcode_settings"].items(): - xcbc.SetBuildSetting(xck, xcv) - if "xcode_config_file" in configuration: - config_ref = pbxp.AddOrGetFileInRootGroup( - configuration["xcode_config_file"] - ) - xcbc.SetBaseConfiguration(config_ref) - - build_files = [] - for build_file, build_file_dict in data.items(): - if build_file.endswith(".gyp"): - build_files.append(build_file) - - for build_file in build_files: - xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) - - for build_file in build_files: - xcode_projects[build_file].Finalize2(xcode_targets, xcode_target_to_target_dict) - - for build_file in build_files: - xcode_projects[build_file].Write() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py deleted file mode 100644 index 49772d1f4d810..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2013 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" Unit tests for the xcode.py file. """ - -import gyp.generator.xcode as xcode -import unittest -import sys - - -class TestEscapeXcodeDefine(unittest.TestCase): - if sys.platform == "darwin": - - def test_InheritedRemainsUnescaped(self): - self.assertEqual(xcode.EscapeXcodeDefine("$(inherited)"), "$(inherited)") - - def test_Escaping(self): - self.assertEqual(xcode.EscapeXcodeDefine('a b"c\\'), 'a\\ b\\"c\\\\') - - -if __name__ == "__main__": - unittest.main() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input.py deleted file mode 100644 index d9699a0a50218..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input.py +++ /dev/null @@ -1,3130 +0,0 @@ -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - - -import ast - -import gyp.common -import gyp.simple_copy -import multiprocessing -import os.path -import re -import shlex -import signal -import subprocess -import sys -import threading -import traceback -from distutils.version import StrictVersion -from gyp.common import GypError -from gyp.common import OrderedSet - -# A list of types that are treated as linkable. -linkable_types = [ - "executable", - "shared_library", - "loadable_module", - "mac_kernel_extension", - "windows_driver", -] - -# A list of sections that contain links to other targets. -dependency_sections = ["dependencies", "export_dependent_settings"] - -# base_path_sections is a list of sections defined by GYP that contain -# pathnames. The generators can provide more keys, the two lists are merged -# into path_sections, but you should call IsPathSection instead of using either -# list directly. -base_path_sections = [ - "destination", - "files", - "include_dirs", - "inputs", - "libraries", - "outputs", - "sources", -] -path_sections = set() - -# These per-process dictionaries are used to cache build file data when loading -# in parallel mode. -per_process_data = {} -per_process_aux_data = {} - - -def IsPathSection(section): - # If section ends in one of the '=+?!' characters, it's applied to a section - # without the trailing characters. '/' is notably absent from this list, - # because there's no way for a regular expression to be treated as a path. - while section and section[-1:] in "=+?!": - section = section[:-1] - - if section in path_sections: - return True - - # Sections matching the regexp '_(dir|file|path)s?$' are also - # considered PathSections. Using manual string matching since that - # is much faster than the regexp and this can be called hundreds of - # thousands of times so micro performance matters. - if "_" in section: - tail = section[-6:] - if tail[-1] == "s": - tail = tail[:-1] - if tail[-5:] in ("_file", "_path"): - return True - return tail[-4:] == "_dir" - - return False - - -# base_non_configuration_keys is a list of key names that belong in the target -# itself and should not be propagated into its configurations. It is merged -# with a list that can come from the generator to -# create non_configuration_keys. -base_non_configuration_keys = [ - # Sections that must exist inside targets and not configurations. - "actions", - "configurations", - "copies", - "default_configuration", - "dependencies", - "dependencies_original", - "libraries", - "postbuilds", - "product_dir", - "product_extension", - "product_name", - "product_prefix", - "rules", - "run_as", - "sources", - "standalone_static_library", - "suppress_wildcard", - "target_name", - "toolset", - "toolsets", - "type", - # Sections that can be found inside targets or configurations, but that - # should not be propagated from targets into their configurations. - "variables", -] -non_configuration_keys = [] - -# Keys that do not belong inside a configuration dictionary. -invalid_configuration_keys = [ - "actions", - "all_dependent_settings", - "configurations", - "dependencies", - "direct_dependent_settings", - "libraries", - "link_settings", - "sources", - "standalone_static_library", - "target_name", - "type", -] - -# Controls whether or not the generator supports multiple toolsets. -multiple_toolsets = False - -# Paths for converting filelist paths to output paths: { -# toplevel, -# qualified_output_dir, -# } -generator_filelist_paths = None - - -def GetIncludedBuildFiles(build_file_path, aux_data, included=None): - """Return a list of all build files included into build_file_path. - - The returned list will contain build_file_path as well as all other files - that it included, either directly or indirectly. Note that the list may - contain files that were included into a conditional section that evaluated - to false and was not merged into build_file_path's dict. - - aux_data is a dict containing a key for each build file or included build - file. Those keys provide access to dicts whose "included" keys contain - lists of all other files included by the build file. - - included should be left at its default None value by external callers. It - is used for recursion. - - The returned list will not contain any duplicate entries. Each build file - in the list will be relative to the current directory. - """ - - if included is None: - included = [] - - if build_file_path in included: - return included - - included.append(build_file_path) - - for included_build_file in aux_data[build_file_path].get("included", []): - GetIncludedBuildFiles(included_build_file, aux_data, included) - - return included - - -def CheckedEval(file_contents): - """Return the eval of a gyp file. - The gyp file is restricted to dictionaries and lists only, and - repeated keys are not allowed. - Note that this is slower than eval() is. - """ - - syntax_tree = ast.parse(file_contents) - assert isinstance(syntax_tree, ast.Module) - c1 = syntax_tree.body - assert len(c1) == 1 - c2 = c1[0] - assert isinstance(c2, ast.Expr) - return CheckNode(c2.value, []) - - -def CheckNode(node, keypath): - if isinstance(node, ast.Dict): - dict = {} - for key, value in zip(node.keys, node.values): - assert isinstance(key, ast.Str) - key = key.s - if key in dict: - raise GypError( - "Key '" - + key - + "' repeated at level " - + repr(len(keypath) + 1) - + " with key path '" - + ".".join(keypath) - + "'" - ) - kp = list(keypath) # Make a copy of the list for descending this node. - kp.append(key) - dict[key] = CheckNode(value, kp) - return dict - elif isinstance(node, ast.List): - children = [] - for index, child in enumerate(node.elts): - kp = list(keypath) # Copy list. - kp.append(repr(index)) - children.append(CheckNode(child, kp)) - return children - elif isinstance(node, ast.Str): - return node.s - else: - raise TypeError( - "Unknown AST node at key path '" + ".".join(keypath) + "': " + repr(node) - ) - - -def LoadOneBuildFile(build_file_path, data, aux_data, includes, is_target, check): - if build_file_path in data: - return data[build_file_path] - - if os.path.exists(build_file_path): - build_file_contents = open(build_file_path, encoding='utf-8').read() - else: - raise GypError(f"{build_file_path} not found (cwd: {os.getcwd()})") - - build_file_data = None - try: - if check: - build_file_data = CheckedEval(build_file_contents) - else: - build_file_data = eval(build_file_contents, {"__builtins__": {}}, None) - except SyntaxError as e: - e.filename = build_file_path - raise - except Exception as e: - gyp.common.ExceptionAppend(e, "while reading " + build_file_path) - raise - - if type(build_file_data) is not dict: - raise GypError("%s does not evaluate to a dictionary." % build_file_path) - - data[build_file_path] = build_file_data - aux_data[build_file_path] = {} - - # Scan for includes and merge them in. - if "skip_includes" not in build_file_data or not build_file_data["skip_includes"]: - try: - if is_target: - LoadBuildFileIncludesIntoDict( - build_file_data, build_file_path, data, aux_data, includes, check - ) - else: - LoadBuildFileIncludesIntoDict( - build_file_data, build_file_path, data, aux_data, None, check - ) - except Exception as e: - gyp.common.ExceptionAppend( - e, "while reading includes of " + build_file_path - ) - raise - - return build_file_data - - -def LoadBuildFileIncludesIntoDict( - subdict, subdict_path, data, aux_data, includes, check -): - includes_list = [] - if includes is not None: - includes_list.extend(includes) - if "includes" in subdict: - for include in subdict["includes"]: - # "include" is specified relative to subdict_path, so compute the real - # path to include by appending the provided "include" to the directory - # in which subdict_path resides. - relative_include = os.path.normpath( - os.path.join(os.path.dirname(subdict_path), include) - ) - includes_list.append(relative_include) - # Unhook the includes list, it's no longer needed. - del subdict["includes"] - - # Merge in the included files. - for include in includes_list: - if "included" not in aux_data[subdict_path]: - aux_data[subdict_path]["included"] = [] - aux_data[subdict_path]["included"].append(include) - - gyp.DebugOutput(gyp.DEBUG_INCLUDES, "Loading Included File: '%s'", include) - - MergeDicts( - subdict, - LoadOneBuildFile(include, data, aux_data, None, False, check), - subdict_path, - include, - ) - - # Recurse into subdictionaries. - for k, v in subdict.items(): - if type(v) is dict: - LoadBuildFileIncludesIntoDict(v, subdict_path, data, aux_data, None, check) - elif type(v) is list: - LoadBuildFileIncludesIntoList(v, subdict_path, data, aux_data, check) - - -# This recurses into lists so that it can look for dicts. -def LoadBuildFileIncludesIntoList(sublist, sublist_path, data, aux_data, check): - for item in sublist: - if type(item) is dict: - LoadBuildFileIncludesIntoDict( - item, sublist_path, data, aux_data, None, check - ) - elif type(item) is list: - LoadBuildFileIncludesIntoList(item, sublist_path, data, aux_data, check) - - -# Processes toolsets in all the targets. This recurses into condition entries -# since they can contain toolsets as well. -def ProcessToolsetsInDict(data): - if "targets" in data: - target_list = data["targets"] - new_target_list = [] - for target in target_list: - # If this target already has an explicit 'toolset', and no 'toolsets' - # list, don't modify it further. - if "toolset" in target and "toolsets" not in target: - new_target_list.append(target) - continue - if multiple_toolsets: - toolsets = target.get("toolsets", ["target"]) - else: - toolsets = ["target"] - # Make sure this 'toolsets' definition is only processed once. - if "toolsets" in target: - del target["toolsets"] - if len(toolsets) > 0: - # Optimization: only do copies if more than one toolset is specified. - for build in toolsets[1:]: - new_target = gyp.simple_copy.deepcopy(target) - new_target["toolset"] = build - new_target_list.append(new_target) - target["toolset"] = toolsets[0] - new_target_list.append(target) - data["targets"] = new_target_list - if "conditions" in data: - for condition in data["conditions"]: - if type(condition) is list: - for condition_dict in condition[1:]: - if type(condition_dict) is dict: - ProcessToolsetsInDict(condition_dict) - - -# TODO(mark): I don't love this name. It just means that it's going to load -# a build file that contains targets and is expected to provide a targets dict -# that contains the targets... -def LoadTargetBuildFile( - build_file_path, - data, - aux_data, - variables, - includes, - depth, - check, - load_dependencies, -): - # If depth is set, predefine the DEPTH variable to be a relative path from - # this build file's directory to the directory identified by depth. - if depth: - # TODO(dglazkov) The backslash/forward-slash replacement at the end is a - # temporary measure. This should really be addressed by keeping all paths - # in POSIX until actual project generation. - d = gyp.common.RelativePath(depth, os.path.dirname(build_file_path)) - if d == "": - variables["DEPTH"] = "." - else: - variables["DEPTH"] = d.replace("\\", "/") - - # The 'target_build_files' key is only set when loading target build files in - # the non-parallel code path, where LoadTargetBuildFile is called - # recursively. In the parallel code path, we don't need to check whether the - # |build_file_path| has already been loaded, because the 'scheduled' set in - # ParallelState guarantees that we never load the same |build_file_path| - # twice. - if "target_build_files" in data: - if build_file_path in data["target_build_files"]: - # Already loaded. - return False - data["target_build_files"].add(build_file_path) - - gyp.DebugOutput( - gyp.DEBUG_INCLUDES, "Loading Target Build File '%s'", build_file_path - ) - - build_file_data = LoadOneBuildFile( - build_file_path, data, aux_data, includes, True, check - ) - - # Store DEPTH for later use in generators. - build_file_data["_DEPTH"] = depth - - # Set up the included_files key indicating which .gyp files contributed to - # this target dict. - if "included_files" in build_file_data: - raise GypError(build_file_path + " must not contain included_files key") - - included = GetIncludedBuildFiles(build_file_path, aux_data) - build_file_data["included_files"] = [] - for included_file in included: - # included_file is relative to the current directory, but it needs to - # be made relative to build_file_path's directory. - included_relative = gyp.common.RelativePath( - included_file, os.path.dirname(build_file_path) - ) - build_file_data["included_files"].append(included_relative) - - # Do a first round of toolsets expansion so that conditions can be defined - # per toolset. - ProcessToolsetsInDict(build_file_data) - - # Apply "pre"/"early" variable expansions and condition evaluations. - ProcessVariablesAndConditionsInDict( - build_file_data, PHASE_EARLY, variables, build_file_path - ) - - # Since some toolsets might have been defined conditionally, perform - # a second round of toolsets expansion now. - ProcessToolsetsInDict(build_file_data) - - # Look at each project's target_defaults dict, and merge settings into - # targets. - if "target_defaults" in build_file_data: - if "targets" not in build_file_data: - raise GypError("Unable to find targets in build file %s" % build_file_path) - - index = 0 - while index < len(build_file_data["targets"]): - # This procedure needs to give the impression that target_defaults is - # used as defaults, and the individual targets inherit from that. - # The individual targets need to be merged into the defaults. Make - # a deep copy of the defaults for each target, merge the target dict - # as found in the input file into that copy, and then hook up the - # copy with the target-specific data merged into it as the replacement - # target dict. - old_target_dict = build_file_data["targets"][index] - new_target_dict = gyp.simple_copy.deepcopy( - build_file_data["target_defaults"] - ) - MergeDicts( - new_target_dict, old_target_dict, build_file_path, build_file_path - ) - build_file_data["targets"][index] = new_target_dict - index += 1 - - # No longer needed. - del build_file_data["target_defaults"] - - # Look for dependencies. This means that dependency resolution occurs - # after "pre" conditionals and variable expansion, but before "post" - - # in other words, you can't put a "dependencies" section inside a "post" - # conditional within a target. - - dependencies = [] - if "targets" in build_file_data: - for target_dict in build_file_data["targets"]: - if "dependencies" not in target_dict: - continue - for dependency in target_dict["dependencies"]: - dependencies.append( - gyp.common.ResolveTarget(build_file_path, dependency, None)[0] - ) - - if load_dependencies: - for dependency in dependencies: - try: - LoadTargetBuildFile( - dependency, - data, - aux_data, - variables, - includes, - depth, - check, - load_dependencies, - ) - except Exception as e: - gyp.common.ExceptionAppend( - e, "while loading dependencies of %s" % build_file_path - ) - raise - else: - return (build_file_path, dependencies) - - -def CallLoadTargetBuildFile( - global_flags, - build_file_path, - variables, - includes, - depth, - check, - generator_input_info, -): - """Wrapper around LoadTargetBuildFile for parallel processing. - - This wrapper is used when LoadTargetBuildFile is executed in - a worker process. - """ - - try: - signal.signal(signal.SIGINT, signal.SIG_IGN) - - # Apply globals so that the worker process behaves the same. - for key, value in global_flags.items(): - globals()[key] = value - - SetGeneratorGlobals(generator_input_info) - result = LoadTargetBuildFile( - build_file_path, - per_process_data, - per_process_aux_data, - variables, - includes, - depth, - check, - False, - ) - if not result: - return result - - (build_file_path, dependencies) = result - - # We can safely pop the build_file_data from per_process_data because it - # will never be referenced by this process again, so we don't need to keep - # it in the cache. - build_file_data = per_process_data.pop(build_file_path) - - # This gets serialized and sent back to the main process via a pipe. - # It's handled in LoadTargetBuildFileCallback. - return (build_file_path, build_file_data, dependencies) - except GypError as e: - sys.stderr.write("gyp: %s\n" % e) - return None - except Exception as e: - print("Exception:", e, file=sys.stderr) - print(traceback.format_exc(), file=sys.stderr) - return None - - -class ParallelProcessingError(Exception): - pass - - -class ParallelState: - """Class to keep track of state when processing input files in parallel. - - If build files are loaded in parallel, use this to keep track of - state during farming out and processing parallel jobs. It's stored - in a global so that the callback function can have access to it. - """ - - def __init__(self): - # The multiprocessing pool. - self.pool = None - # The condition variable used to protect this object and notify - # the main loop when there might be more data to process. - self.condition = None - # The "data" dict that was passed to LoadTargetBuildFileParallel - self.data = None - # The number of parallel calls outstanding; decremented when a response - # was received. - self.pending = 0 - # The set of all build files that have been scheduled, so we don't - # schedule the same one twice. - self.scheduled = set() - # A list of dependency build file paths that haven't been scheduled yet. - self.dependencies = [] - # Flag to indicate if there was an error in a child process. - self.error = False - - def LoadTargetBuildFileCallback(self, result): - """Handle the results of running LoadTargetBuildFile in another process. - """ - self.condition.acquire() - if not result: - self.error = True - self.condition.notify() - self.condition.release() - return - (build_file_path0, build_file_data0, dependencies0) = result - self.data[build_file_path0] = build_file_data0 - self.data["target_build_files"].add(build_file_path0) - for new_dependency in dependencies0: - if new_dependency not in self.scheduled: - self.scheduled.add(new_dependency) - self.dependencies.append(new_dependency) - self.pending -= 1 - self.condition.notify() - self.condition.release() - - -def LoadTargetBuildFilesParallel( - build_files, data, variables, includes, depth, check, generator_input_info -): - parallel_state = ParallelState() - parallel_state.condition = threading.Condition() - # Make copies of the build_files argument that we can modify while working. - parallel_state.dependencies = list(build_files) - parallel_state.scheduled = set(build_files) - parallel_state.pending = 0 - parallel_state.data = data - - try: - parallel_state.condition.acquire() - while parallel_state.dependencies or parallel_state.pending: - if parallel_state.error: - break - if not parallel_state.dependencies: - parallel_state.condition.wait() - continue - - dependency = parallel_state.dependencies.pop() - - parallel_state.pending += 1 - global_flags = { - "path_sections": globals()["path_sections"], - "non_configuration_keys": globals()["non_configuration_keys"], - "multiple_toolsets": globals()["multiple_toolsets"], - } - - if not parallel_state.pool: - parallel_state.pool = multiprocessing.Pool(multiprocessing.cpu_count()) - parallel_state.pool.apply_async( - CallLoadTargetBuildFile, - args=( - global_flags, - dependency, - variables, - includes, - depth, - check, - generator_input_info, - ), - callback=parallel_state.LoadTargetBuildFileCallback, - ) - except KeyboardInterrupt as e: - parallel_state.pool.terminate() - raise e - - parallel_state.condition.release() - - parallel_state.pool.close() - parallel_state.pool.join() - parallel_state.pool = None - - if parallel_state.error: - sys.exit(1) - - -# Look for the bracket that matches the first bracket seen in a -# string, and return the start and end as a tuple. For example, if -# the input is something like "<(foo <(bar)) blah", then it would -# return (1, 13), indicating the entire string except for the leading -# "<" and trailing " blah". -LBRACKETS = set("{[(") -BRACKETS = {"}": "{", "]": "[", ")": "("} - - -def FindEnclosingBracketGroup(input_str): - stack = [] - start = -1 - for index, char in enumerate(input_str): - if char in LBRACKETS: - stack.append(char) - if start == -1: - start = index - elif char in BRACKETS: - if not stack: - return (-1, -1) - if stack.pop() != BRACKETS[char]: - return (-1, -1) - if not stack: - return (start, index + 1) - return (-1, -1) - - -def IsStrCanonicalInt(string): - """Returns True if |string| is in its canonical integer form. - - The canonical form is such that str(int(string)) == string. - """ - if type(string) is str: - # This function is called a lot so for maximum performance, avoid - # involving regexps which would otherwise make the code much - # shorter. Regexps would need twice the time of this function. - if string: - if string == "0": - return True - if string[0] == "-": - string = string[1:] - if not string: - return False - if "1" <= string[0] <= "9": - return string.isdigit() - - return False - - -# This matches things like "<(asdf)", "(?P<(?:(?:!?@?)|\|)?)" - r"(?P[-a-zA-Z0-9_.]+)?" - r"\((?P\s*\[?)" - r"(?P.*?)(\]?)\))" -) - -# This matches the same as early_variable_re, but with '>' instead of '<'. -late_variable_re = re.compile( - r"(?P(?P>(?:(?:!?@?)|\|)?)" - r"(?P[-a-zA-Z0-9_.]+)?" - r"\((?P\s*\[?)" - r"(?P.*?)(\]?)\))" -) - -# This matches the same as early_variable_re, but with '^' instead of '<'. -latelate_variable_re = re.compile( - r"(?P(?P[\^](?:(?:!?@?)|\|)?)" - r"(?P[-a-zA-Z0-9_.]+)?" - r"\((?P\s*\[?)" - r"(?P.*?)(\]?)\))" -) - -# Global cache of results from running commands so they don't have to be run -# more then once. -cached_command_results = {} - - -def FixupPlatformCommand(cmd): - if sys.platform == "win32": - if type(cmd) is list: - cmd = [re.sub("^cat ", "type ", cmd[0])] + cmd[1:] - else: - cmd = re.sub("^cat ", "type ", cmd) - return cmd - - -PHASE_EARLY = 0 -PHASE_LATE = 1 -PHASE_LATELATE = 2 - - -def ExpandVariables(input, phase, variables, build_file): - # Look for the pattern that gets expanded into variables - if phase == PHASE_EARLY: - variable_re = early_variable_re - expansion_symbol = "<" - elif phase == PHASE_LATE: - variable_re = late_variable_re - expansion_symbol = ">" - elif phase == PHASE_LATELATE: - variable_re = latelate_variable_re - expansion_symbol = "^" - else: - assert False - - input_str = str(input) - if IsStrCanonicalInt(input_str): - return int(input_str) - - # Do a quick scan to determine if an expensive regex search is warranted. - if expansion_symbol not in input_str: - return input_str - - # Get the entire list of matches as a list of MatchObject instances. - # (using findall here would return strings instead of MatchObjects). - matches = list(variable_re.finditer(input_str)) - if not matches: - return input_str - - output = input_str - # Reverse the list of matches so that replacements are done right-to-left. - # That ensures that earlier replacements won't mess up the string in a - # way that causes later calls to find the earlier substituted text instead - # of what's intended for replacement. - matches.reverse() - for match_group in matches: - match = match_group.groupdict() - gyp.DebugOutput(gyp.DEBUG_VARIABLES, "Matches: %r", match) - # match['replace'] is the substring to look for, match['type'] - # is the character code for the replacement type (< > ! <| >| <@ - # >@ !@), match['is_array'] contains a '[' for command - # arrays, and match['content'] is the name of the variable (< >) - # or command to run (!). match['command_string'] is an optional - # command string. Currently, only 'pymod_do_main' is supported. - - # run_command is true if a ! variant is used. - run_command = "!" in match["type"] - command_string = match["command_string"] - - # file_list is true if a | variant is used. - file_list = "|" in match["type"] - - # Capture these now so we can adjust them later. - replace_start = match_group.start("replace") - replace_end = match_group.end("replace") - - # Find the ending paren, and re-evaluate the contained string. - (c_start, c_end) = FindEnclosingBracketGroup(input_str[replace_start:]) - - # Adjust the replacement range to match the entire command - # found by FindEnclosingBracketGroup (since the variable_re - # probably doesn't match the entire command if it contained - # nested variables). - replace_end = replace_start + c_end - - # Find the "real" replacement, matching the appropriate closing - # paren, and adjust the replacement start and end. - replacement = input_str[replace_start:replace_end] - - # Figure out what the contents of the variable parens are. - contents_start = replace_start + c_start + 1 - contents_end = replace_end - 1 - contents = input_str[contents_start:contents_end] - - # Do filter substitution now for <|(). - # Admittedly, this is different than the evaluation order in other - # contexts. However, since filtration has no chance to run on <|(), - # this seems like the only obvious way to give them access to filters. - if file_list: - processed_variables = gyp.simple_copy.deepcopy(variables) - ProcessListFiltersInDict(contents, processed_variables) - # Recurse to expand variables in the contents - contents = ExpandVariables(contents, phase, processed_variables, build_file) - else: - # Recurse to expand variables in the contents - contents = ExpandVariables(contents, phase, variables, build_file) - - # Strip off leading/trailing whitespace so that variable matches are - # simpler below (and because they are rarely needed). - contents = contents.strip() - - # expand_to_list is true if an @ variant is used. In that case, - # the expansion should result in a list. Note that the caller - # is to be expecting a list in return, and not all callers do - # because not all are working in list context. Also, for list - # expansions, there can be no other text besides the variable - # expansion in the input string. - expand_to_list = "@" in match["type"] and input_str == replacement - - if run_command or file_list: - # Find the build file's directory, so commands can be run or file lists - # generated relative to it. - build_file_dir = os.path.dirname(build_file) - if build_file_dir == "" and not file_list: - # If build_file is just a leaf filename indicating a file in the - # current directory, build_file_dir might be an empty string. Set - # it to None to signal to subprocess.Popen that it should run the - # command in the current directory. - build_file_dir = None - - # Support <|(listfile.txt ...) which generates a file - # containing items from a gyp list, generated at gyp time. - # This works around actions/rules which have more inputs than will - # fit on the command line. - if file_list: - if type(contents) is list: - contents_list = contents - else: - contents_list = contents.split(" ") - replacement = contents_list[0] - if os.path.isabs(replacement): - raise GypError('| cannot handle absolute paths, got "%s"' % replacement) - - if not generator_filelist_paths: - path = os.path.join(build_file_dir, replacement) - else: - if os.path.isabs(build_file_dir): - toplevel = generator_filelist_paths["toplevel"] - rel_build_file_dir = gyp.common.RelativePath( - build_file_dir, toplevel - ) - else: - rel_build_file_dir = build_file_dir - qualified_out_dir = generator_filelist_paths["qualified_out_dir"] - path = os.path.join(qualified_out_dir, rel_build_file_dir, replacement) - gyp.common.EnsureDirExists(path) - - replacement = gyp.common.RelativePath(path, build_file_dir) - f = gyp.common.WriteOnDiff(path) - for i in contents_list[1:]: - f.write("%s\n" % i) - f.close() - - elif run_command: - use_shell = True - if match["is_array"]: - contents = eval(contents) - use_shell = False - - # Check for a cached value to avoid executing commands, or generating - # file lists more than once. The cache key contains the command to be - # run as well as the directory to run it from, to account for commands - # that depend on their current directory. - # TODO(http://code.google.com/p/gyp/issues/detail?id=111): In theory, - # someone could author a set of GYP files where each time the command - # is invoked it produces different output by design. When the need - # arises, the syntax should be extended to support no caching off a - # command's output so it is run every time. - cache_key = (str(contents), build_file_dir) - cached_value = cached_command_results.get(cache_key, None) - if cached_value is None: - gyp.DebugOutput( - gyp.DEBUG_VARIABLES, - "Executing command '%s' in directory '%s'", - contents, - build_file_dir, - ) - - replacement = "" - - if command_string == "pymod_do_main": - # 0: - raise GypError( - "Call to '%s' returned exit status %d while in %s." - % (contents, result.returncode, build_file) - ) - replacement = result.stdout.decode("utf-8").rstrip() - - cached_command_results[cache_key] = replacement - else: - gyp.DebugOutput( - gyp.DEBUG_VARIABLES, - "Had cache value for command '%s' in directory '%s'", - contents, - build_file_dir, - ) - replacement = cached_value - - else: - if contents not in variables: - if contents[-1] in ["!", "/"]: - # In order to allow cross-compiles (nacl) to happen more naturally, - # we will allow references to >(sources/) etc. to resolve to - # and empty list if undefined. This allows actions to: - # 'action!': [ - # '>@(_sources!)', - # ], - # 'action/': [ - # '>@(_sources/)', - # ], - replacement = [] - else: - raise GypError( - "Undefined variable " + contents + " in " + build_file - ) - else: - replacement = variables[contents] - - if isinstance(replacement, bytes) and not isinstance(replacement, str): - replacement = replacement.decode("utf-8") # done on Python 3 only - if type(replacement) is list: - for item in replacement: - if isinstance(item, bytes) and not isinstance(item, str): - item = item.decode("utf-8") # done on Python 3 only - if not contents[-1] == "/" and type(item) not in (str, int): - raise GypError( - "Variable " - + contents - + " must expand to a string or list of strings; " - + "list contains a " - + item.__class__.__name__ - ) - # Run through the list and handle variable expansions in it. Since - # the list is guaranteed not to contain dicts, this won't do anything - # with conditions sections. - ProcessVariablesAndConditionsInList( - replacement, phase, variables, build_file - ) - elif type(replacement) not in (str, int): - raise GypError( - "Variable " - + contents - + " must expand to a string or list of strings; " - + "found a " - + replacement.__class__.__name__ - ) - - if expand_to_list: - # Expanding in list context. It's guaranteed that there's only one - # replacement to do in |input_str| and that it's this replacement. See - # above. - if type(replacement) is list: - # If it's already a list, make a copy. - output = replacement[:] - else: - # Split it the same way sh would split arguments. - output = shlex.split(str(replacement)) - else: - # Expanding in string context. - encoded_replacement = "" - if type(replacement) is list: - # When expanding a list into string context, turn the list items - # into a string in a way that will work with a subprocess call. - # - # TODO(mark): This isn't completely correct. This should - # call a generator-provided function that observes the - # proper list-to-argument quoting rules on a specific - # platform instead of just calling the POSIX encoding - # routine. - encoded_replacement = gyp.common.EncodePOSIXShellList(replacement) - else: - encoded_replacement = replacement - - output = ( - output[:replace_start] + str(encoded_replacement) + output[replace_end:] - ) - # Prepare for the next match iteration. - input_str = output - - if output == input: - gyp.DebugOutput( - gyp.DEBUG_VARIABLES, - "Found only identity matches on %r, avoiding infinite " "recursion.", - output, - ) - else: - # Look for more matches now that we've replaced some, to deal with - # expanding local variables (variables defined in the same - # variables block as this one). - gyp.DebugOutput(gyp.DEBUG_VARIABLES, "Found output %r, recursing.", output) - if type(output) is list: - if output and type(output[0]) is list: - # Leave output alone if it's a list of lists. - # We don't want such lists to be stringified. - pass - else: - new_output = [] - for item in output: - new_output.append( - ExpandVariables(item, phase, variables, build_file) - ) - output = new_output - else: - output = ExpandVariables(output, phase, variables, build_file) - - # Convert all strings that are canonically-represented integers into integers. - if type(output) is list: - for index, outstr in enumerate(output): - if IsStrCanonicalInt(outstr): - output[index] = int(outstr) - elif IsStrCanonicalInt(output): - output = int(output) - - return output - - -# The same condition is often evaluated over and over again so it -# makes sense to cache as much as possible between evaluations. -cached_conditions_asts = {} - - -def EvalCondition(condition, conditions_key, phase, variables, build_file): - """Returns the dict that should be used or None if the result was - that nothing should be used.""" - if type(condition) is not list: - raise GypError(conditions_key + " must be a list") - if len(condition) < 2: - # It's possible that condition[0] won't work in which case this - # attempt will raise its own IndexError. That's probably fine. - raise GypError( - conditions_key - + " " - + condition[0] - + " must be at least length 2, not " - + str(len(condition)) - ) - - i = 0 - result = None - while i < len(condition): - cond_expr = condition[i] - true_dict = condition[i + 1] - if type(true_dict) is not dict: - raise GypError( - "{} {} must be followed by a dictionary, not {}".format( - conditions_key, cond_expr, type(true_dict) - ) - ) - if len(condition) > i + 2 and type(condition[i + 2]) is dict: - false_dict = condition[i + 2] - i = i + 3 - if i != len(condition): - raise GypError( - "{} {} has {} unexpected trailing items".format( - conditions_key, cond_expr, len(condition) - i - ) - ) - else: - false_dict = None - i = i + 2 - if result is None: - result = EvalSingleCondition( - cond_expr, true_dict, false_dict, phase, variables, build_file - ) - - return result - - -def EvalSingleCondition(cond_expr, true_dict, false_dict, phase, variables, build_file): - """Returns true_dict if cond_expr evaluates to true, and false_dict - otherwise.""" - # Do expansions on the condition itself. Since the condition can naturally - # contain variable references without needing to resort to GYP expansion - # syntax, this is of dubious value for variables, but someone might want to - # use a command expansion directly inside a condition. - cond_expr_expanded = ExpandVariables(cond_expr, phase, variables, build_file) - if type(cond_expr_expanded) not in (str, int): - raise ValueError( - "Variable expansion in this context permits str and int " - + "only, found " - + cond_expr_expanded.__class__.__name__ - ) - - try: - if cond_expr_expanded in cached_conditions_asts: - ast_code = cached_conditions_asts[cond_expr_expanded] - else: - ast_code = compile(cond_expr_expanded, "", "eval") - cached_conditions_asts[cond_expr_expanded] = ast_code - env = {"__builtins__": {}, "v": StrictVersion} - if eval(ast_code, env, variables): - return true_dict - return false_dict - except SyntaxError as e: - syntax_error = SyntaxError( - "%s while evaluating condition '%s' in %s " - "at character %d." % (str(e.args[0]), e.text, build_file, e.offset), - e.filename, - e.lineno, - e.offset, - e.text, - ) - raise syntax_error - except NameError as e: - gyp.common.ExceptionAppend( - e, - f"while evaluating condition '{cond_expr_expanded}' in {build_file}", - ) - raise GypError(e) - - -def ProcessConditionsInDict(the_dict, phase, variables, build_file): - # Process a 'conditions' or 'target_conditions' section in the_dict, - # depending on phase. - # early -> conditions - # late -> target_conditions - # latelate -> no conditions - # - # Each item in a conditions list consists of cond_expr, a string expression - # evaluated as the condition, and true_dict, a dict that will be merged into - # the_dict if cond_expr evaluates to true. Optionally, a third item, - # false_dict, may be present. false_dict is merged into the_dict if - # cond_expr evaluates to false. - # - # Any dict merged into the_dict will be recursively processed for nested - # conditionals and other expansions, also according to phase, immediately - # prior to being merged. - - if phase == PHASE_EARLY: - conditions_key = "conditions" - elif phase == PHASE_LATE: - conditions_key = "target_conditions" - elif phase == PHASE_LATELATE: - return - else: - assert False - - if conditions_key not in the_dict: - return - - conditions_list = the_dict[conditions_key] - # Unhook the conditions list, it's no longer needed. - del the_dict[conditions_key] - - for condition in conditions_list: - merge_dict = EvalCondition( - condition, conditions_key, phase, variables, build_file - ) - - if merge_dict is not None: - # Expand variables and nested conditinals in the merge_dict before - # merging it. - ProcessVariablesAndConditionsInDict( - merge_dict, phase, variables, build_file - ) - - MergeDicts(the_dict, merge_dict, build_file, build_file) - - -def LoadAutomaticVariablesFromDict(variables, the_dict): - # Any keys with plain string values in the_dict become automatic variables. - # The variable name is the key name with a "_" character prepended. - for key, value in the_dict.items(): - if type(value) in (str, int, list): - variables["_" + key] = value - - -def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key): - # Any keys in the_dict's "variables" dict, if it has one, becomes a - # variable. The variable name is the key name in the "variables" dict. - # Variables that end with the % character are set only if they are unset in - # the variables dict. the_dict_key is the name of the key that accesses - # the_dict in the_dict's parent dict. If the_dict's parent is not a dict - # (it could be a list or it could be parentless because it is a root dict), - # the_dict_key will be None. - for key, value in the_dict.get("variables", {}).items(): - if type(value) not in (str, int, list): - continue - - if key.endswith("%"): - variable_name = key[:-1] - if variable_name in variables: - # If the variable is already set, don't set it. - continue - if the_dict_key == "variables" and variable_name in the_dict: - # If the variable is set without a % in the_dict, and the_dict is a - # variables dict (making |variables| a variables sub-dict of a - # variables dict), use the_dict's definition. - value = the_dict[variable_name] - else: - variable_name = key - - variables[variable_name] = value - - -def ProcessVariablesAndConditionsInDict( - the_dict, phase, variables_in, build_file, the_dict_key=None -): - """Handle all variable and command expansion and conditional evaluation. - - This function is the public entry point for all variable expansions and - conditional evaluations. The variables_in dictionary will not be modified - by this function. - """ - - # Make a copy of the variables_in dict that can be modified during the - # loading of automatics and the loading of the variables dict. - variables = variables_in.copy() - LoadAutomaticVariablesFromDict(variables, the_dict) - - if "variables" in the_dict: - # Make sure all the local variables are added to the variables - # list before we process them so that you can reference one - # variable from another. They will be fully expanded by recursion - # in ExpandVariables. - for key, value in the_dict["variables"].items(): - variables[key] = value - - # Handle the associated variables dict first, so that any variable - # references within can be resolved prior to using them as variables. - # Pass a copy of the variables dict to avoid having it be tainted. - # Otherwise, it would have extra automatics added for everything that - # should just be an ordinary variable in this scope. - ProcessVariablesAndConditionsInDict( - the_dict["variables"], phase, variables, build_file, "variables" - ) - - LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key) - - for key, value in the_dict.items(): - # Skip "variables", which was already processed if present. - if key != "variables" and type(value) is str: - expanded = ExpandVariables(value, phase, variables, build_file) - if type(expanded) not in (str, int): - raise ValueError( - "Variable expansion in this context permits str and int " - + "only, found " - + expanded.__class__.__name__ - + " for " - + key - ) - the_dict[key] = expanded - - # Variable expansion may have resulted in changes to automatics. Reload. - # TODO(mark): Optimization: only reload if no changes were made. - variables = variables_in.copy() - LoadAutomaticVariablesFromDict(variables, the_dict) - LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key) - - # Process conditions in this dict. This is done after variable expansion - # so that conditions may take advantage of expanded variables. For example, - # if the_dict contains: - # {'type': '<(library_type)', - # 'conditions': [['_type=="static_library"', { ... }]]}, - # _type, as used in the condition, will only be set to the value of - # library_type if variable expansion is performed before condition - # processing. However, condition processing should occur prior to recursion - # so that variables (both automatic and "variables" dict type) may be - # adjusted by conditions sections, merged into the_dict, and have the - # intended impact on contained dicts. - # - # This arrangement means that a "conditions" section containing a "variables" - # section will only have those variables effective in subdicts, not in - # the_dict. The workaround is to put a "conditions" section within a - # "variables" section. For example: - # {'conditions': [['os=="mac"', {'variables': {'define': 'IS_MAC'}}]], - # 'defines': ['<(define)'], - # 'my_subdict': {'defines': ['<(define)']}}, - # will not result in "IS_MAC" being appended to the "defines" list in the - # current scope but would result in it being appended to the "defines" list - # within "my_subdict". By comparison: - # {'variables': {'conditions': [['os=="mac"', {'define': 'IS_MAC'}]]}, - # 'defines': ['<(define)'], - # 'my_subdict': {'defines': ['<(define)']}}, - # will append "IS_MAC" to both "defines" lists. - - # Evaluate conditions sections, allowing variable expansions within them - # as well as nested conditionals. This will process a 'conditions' or - # 'target_conditions' section, perform appropriate merging and recursive - # conditional and variable processing, and then remove the conditions section - # from the_dict if it is present. - ProcessConditionsInDict(the_dict, phase, variables, build_file) - - # Conditional processing may have resulted in changes to automatics or the - # variables dict. Reload. - variables = variables_in.copy() - LoadAutomaticVariablesFromDict(variables, the_dict) - LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key) - - # Recurse into child dicts, or process child lists which may result in - # further recursion into descendant dicts. - for key, value in the_dict.items(): - # Skip "variables" and string values, which were already processed if - # present. - if key == "variables" or type(value) is str: - continue - if type(value) is dict: - # Pass a copy of the variables dict so that subdicts can't influence - # parents. - ProcessVariablesAndConditionsInDict( - value, phase, variables, build_file, key - ) - elif type(value) is list: - # The list itself can't influence the variables dict, and - # ProcessVariablesAndConditionsInList will make copies of the variables - # dict if it needs to pass it to something that can influence it. No - # copy is necessary here. - ProcessVariablesAndConditionsInList(value, phase, variables, build_file) - elif type(value) is not int: - raise TypeError("Unknown type " + value.__class__.__name__ + " for " + key) - - -def ProcessVariablesAndConditionsInList(the_list, phase, variables, build_file): - # Iterate using an index so that new values can be assigned into the_list. - index = 0 - while index < len(the_list): - item = the_list[index] - if type(item) is dict: - # Make a copy of the variables dict so that it won't influence anything - # outside of its own scope. - ProcessVariablesAndConditionsInDict(item, phase, variables, build_file) - elif type(item) is list: - ProcessVariablesAndConditionsInList(item, phase, variables, build_file) - elif type(item) is str: - expanded = ExpandVariables(item, phase, variables, build_file) - if type(expanded) in (str, int): - the_list[index] = expanded - elif type(expanded) is list: - the_list[index : index + 1] = expanded - index += len(expanded) - - # index now identifies the next item to examine. Continue right now - # without falling into the index increment below. - continue - else: - raise ValueError( - "Variable expansion in this context permits strings and " - + "lists only, found " - + expanded.__class__.__name__ - + " at " - + index - ) - elif type(item) is not int: - raise TypeError( - "Unknown type " + item.__class__.__name__ + " at index " + index - ) - index = index + 1 - - -def BuildTargetsDict(data): - """Builds a dict mapping fully-qualified target names to their target dicts. - - |data| is a dict mapping loaded build files by pathname relative to the - current directory. Values in |data| are build file contents. For each - |data| value with a "targets" key, the value of the "targets" key is taken - as a list containing target dicts. Each target's fully-qualified name is - constructed from the pathname of the build file (|data| key) and its - "target_name" property. These fully-qualified names are used as the keys - in the returned dict. These keys provide access to the target dicts, - the dicts in the "targets" lists. - """ - - targets = {} - for build_file in data["target_build_files"]: - for target in data[build_file].get("targets", []): - target_name = gyp.common.QualifiedTarget( - build_file, target["target_name"], target["toolset"] - ) - if target_name in targets: - raise GypError("Duplicate target definitions for " + target_name) - targets[target_name] = target - - return targets - - -def QualifyDependencies(targets): - """Make dependency links fully-qualified relative to the current directory. - - |targets| is a dict mapping fully-qualified target names to their target - dicts. For each target in this dict, keys known to contain dependency - links are examined, and any dependencies referenced will be rewritten - so that they are fully-qualified and relative to the current directory. - All rewritten dependencies are suitable for use as keys to |targets| or a - similar dict. - """ - - all_dependency_sections = [ - dep + op for dep in dependency_sections for op in ("", "!", "/") - ] - - for target, target_dict in targets.items(): - target_build_file = gyp.common.BuildFile(target) - toolset = target_dict["toolset"] - for dependency_key in all_dependency_sections: - dependencies = target_dict.get(dependency_key, []) - for index, dep in enumerate(dependencies): - dep_file, dep_target, dep_toolset = gyp.common.ResolveTarget( - target_build_file, dep, toolset - ) - if not multiple_toolsets: - # Ignore toolset specification in the dependency if it is specified. - dep_toolset = toolset - dependency = gyp.common.QualifiedTarget( - dep_file, dep_target, dep_toolset - ) - dependencies[index] = dependency - - # Make sure anything appearing in a list other than "dependencies" also - # appears in the "dependencies" list. - if ( - dependency_key != "dependencies" - and dependency not in target_dict["dependencies"] - ): - raise GypError( - "Found " - + dependency - + " in " - + dependency_key - + " of " - + target - + ", but not in dependencies" - ) - - -def ExpandWildcardDependencies(targets, data): - """Expands dependencies specified as build_file:*. - - For each target in |targets|, examines sections containing links to other - targets. If any such section contains a link of the form build_file:*, it - is taken as a wildcard link, and is expanded to list each target in - build_file. The |data| dict provides access to build file dicts. - - Any target that does not wish to be included by wildcard can provide an - optional "suppress_wildcard" key in its target dict. When present and - true, a wildcard dependency link will not include such targets. - - All dependency names, including the keys to |targets| and the values in each - dependency list, must be qualified when this function is called. - """ - - for target, target_dict in targets.items(): - target_build_file = gyp.common.BuildFile(target) - for dependency_key in dependency_sections: - dependencies = target_dict.get(dependency_key, []) - - # Loop this way instead of "for dependency in" or "for index in range" - # because the dependencies list will be modified within the loop body. - index = 0 - while index < len(dependencies): - ( - dependency_build_file, - dependency_target, - dependency_toolset, - ) = gyp.common.ParseQualifiedTarget(dependencies[index]) - if dependency_target != "*" and dependency_toolset != "*": - # Not a wildcard. Keep it moving. - index = index + 1 - continue - - if dependency_build_file == target_build_file: - # It's an error for a target to depend on all other targets in - # the same file, because a target cannot depend on itself. - raise GypError( - "Found wildcard in " - + dependency_key - + " of " - + target - + " referring to same build file" - ) - - # Take the wildcard out and adjust the index so that the next - # dependency in the list will be processed the next time through the - # loop. - del dependencies[index] - index = index - 1 - - # Loop through the targets in the other build file, adding them to - # this target's list of dependencies in place of the removed - # wildcard. - dependency_target_dicts = data[dependency_build_file]["targets"] - for dependency_target_dict in dependency_target_dicts: - if int(dependency_target_dict.get("suppress_wildcard", False)): - continue - dependency_target_name = dependency_target_dict["target_name"] - if ( - dependency_target != "*" - and dependency_target != dependency_target_name - ): - continue - dependency_target_toolset = dependency_target_dict["toolset"] - if ( - dependency_toolset != "*" - and dependency_toolset != dependency_target_toolset - ): - continue - dependency = gyp.common.QualifiedTarget( - dependency_build_file, - dependency_target_name, - dependency_target_toolset, - ) - index = index + 1 - dependencies.insert(index, dependency) - - index = index + 1 - - -def Unify(items): - """Removes duplicate elements from items, keeping the first element.""" - seen = {} - return [seen.setdefault(e, e) for e in items if e not in seen] - - -def RemoveDuplicateDependencies(targets): - """Makes sure every dependency appears only once in all targets's dependency - lists.""" - for target_name, target_dict in targets.items(): - for dependency_key in dependency_sections: - dependencies = target_dict.get(dependency_key, []) - if dependencies: - target_dict[dependency_key] = Unify(dependencies) - - -def Filter(items, item): - """Removes item from items.""" - res = {} - return [res.setdefault(e, e) for e in items if e != item] - - -def RemoveSelfDependencies(targets): - """Remove self dependencies from targets that have the prune_self_dependency - variable set.""" - for target_name, target_dict in targets.items(): - for dependency_key in dependency_sections: - dependencies = target_dict.get(dependency_key, []) - if dependencies: - for t in dependencies: - if t == target_name: - if ( - targets[t] - .get("variables", {}) - .get("prune_self_dependency", 0) - ): - target_dict[dependency_key] = Filter( - dependencies, target_name - ) - - -def RemoveLinkDependenciesFromNoneTargets(targets): - """Remove dependencies having the 'link_dependency' attribute from the 'none' - targets.""" - for target_name, target_dict in targets.items(): - for dependency_key in dependency_sections: - dependencies = target_dict.get(dependency_key, []) - if dependencies: - for t in dependencies: - if target_dict.get("type", None) == "none": - if targets[t].get("variables", {}).get("link_dependency", 0): - target_dict[dependency_key] = Filter( - target_dict[dependency_key], t - ) - - -class DependencyGraphNode: - """ - - Attributes: - ref: A reference to an object that this DependencyGraphNode represents. - dependencies: List of DependencyGraphNodes on which this one depends. - dependents: List of DependencyGraphNodes that depend on this one. - """ - - class CircularException(GypError): - pass - - def __init__(self, ref): - self.ref = ref - self.dependencies = [] - self.dependents = [] - - def __repr__(self): - return "" % self.ref - - def FlattenToList(self): - # flat_list is the sorted list of dependencies - actually, the list items - # are the "ref" attributes of DependencyGraphNodes. Every target will - # appear in flat_list after all of its dependencies, and before all of its - # dependents. - flat_list = OrderedSet() - - def ExtractNodeRef(node): - """Extracts the object that the node represents from the given node.""" - return node.ref - - # in_degree_zeros is the list of DependencyGraphNodes that have no - # dependencies not in flat_list. Initially, it is a copy of the children - # of this node, because when the graph was built, nodes with no - # dependencies were made implicit dependents of the root node. - in_degree_zeros = sorted(self.dependents[:], key=ExtractNodeRef) - - while in_degree_zeros: - # Nodes in in_degree_zeros have no dependencies not in flat_list, so they - # can be appended to flat_list. Take these nodes out of in_degree_zeros - # as work progresses, so that the next node to process from the list can - # always be accessed at a consistent position. - node = in_degree_zeros.pop() - flat_list.add(node.ref) - - # Look at dependents of the node just added to flat_list. Some of them - # may now belong in in_degree_zeros. - for node_dependent in sorted(node.dependents, key=ExtractNodeRef): - is_in_degree_zero = True - # TODO: We want to check through the - # node_dependent.dependencies list but if it's long and we - # always start at the beginning, then we get O(n^2) behaviour. - for node_dependent_dependency in sorted( - node_dependent.dependencies, key=ExtractNodeRef - ): - if node_dependent_dependency.ref not in flat_list: - # The dependent one or more dependencies not in flat_list. - # There will be more chances to add it to flat_list - # when examining it again as a dependent of those other - # dependencies, provided that there are no cycles. - is_in_degree_zero = False - break - - if is_in_degree_zero: - # All of the dependent's dependencies are already in flat_list. Add - # it to in_degree_zeros where it will be processed in a future - # iteration of the outer loop. - in_degree_zeros += [node_dependent] - - return list(flat_list) - - def FindCycles(self): - """ - Returns a list of cycles in the graph, where each cycle is its own list. - """ - results = [] - visited = set() - - def Visit(node, path): - for child in node.dependents: - if child in path: - results.append([child] + path[: path.index(child) + 1]) - elif child not in visited: - visited.add(child) - Visit(child, [child] + path) - - visited.add(self) - Visit(self, [self]) - - return results - - def DirectDependencies(self, dependencies=None): - """Returns a list of just direct dependencies.""" - if dependencies is None: - dependencies = [] - - for dependency in self.dependencies: - # Check for None, corresponding to the root node. - if dependency.ref and dependency.ref not in dependencies: - dependencies.append(dependency.ref) - - return dependencies - - def _AddImportedDependencies(self, targets, dependencies=None): - """Given a list of direct dependencies, adds indirect dependencies that - other dependencies have declared to export their settings. - - This method does not operate on self. Rather, it operates on the list - of dependencies in the |dependencies| argument. For each dependency in - that list, if any declares that it exports the settings of one of its - own dependencies, those dependencies whose settings are "passed through" - are added to the list. As new items are added to the list, they too will - be processed, so it is possible to import settings through multiple levels - of dependencies. - - This method is not terribly useful on its own, it depends on being - "primed" with a list of direct dependencies such as one provided by - DirectDependencies. DirectAndImportedDependencies is intended to be the - public entry point. - """ - - if dependencies is None: - dependencies = [] - - index = 0 - while index < len(dependencies): - dependency = dependencies[index] - dependency_dict = targets[dependency] - # Add any dependencies whose settings should be imported to the list - # if not already present. Newly-added items will be checked for - # their own imports when the list iteration reaches them. - # Rather than simply appending new items, insert them after the - # dependency that exported them. This is done to more closely match - # the depth-first method used by DeepDependencies. - add_index = 1 - for imported_dependency in dependency_dict.get( - "export_dependent_settings", [] - ): - if imported_dependency not in dependencies: - dependencies.insert(index + add_index, imported_dependency) - add_index = add_index + 1 - index = index + 1 - - return dependencies - - def DirectAndImportedDependencies(self, targets, dependencies=None): - """Returns a list of a target's direct dependencies and all indirect - dependencies that a dependency has advertised settings should be exported - through the dependency for. - """ - - dependencies = self.DirectDependencies(dependencies) - return self._AddImportedDependencies(targets, dependencies) - - def DeepDependencies(self, dependencies=None): - """Returns an OrderedSet of all of a target's dependencies, recursively.""" - if dependencies is None: - # Using a list to get ordered output and a set to do fast "is it - # already added" checks. - dependencies = OrderedSet() - - for dependency in self.dependencies: - # Check for None, corresponding to the root node. - if dependency.ref is None: - continue - if dependency.ref not in dependencies: - dependency.DeepDependencies(dependencies) - dependencies.add(dependency.ref) - - return dependencies - - def _LinkDependenciesInternal( - self, targets, include_shared_libraries, dependencies=None, initial=True - ): - """Returns an OrderedSet of dependency targets that are linked - into this target. - - This function has a split personality, depending on the setting of - |initial|. Outside callers should always leave |initial| at its default - setting. - - When adding a target to the list of dependencies, this function will - recurse into itself with |initial| set to False, to collect dependencies - that are linked into the linkable target for which the list is being built. - - If |include_shared_libraries| is False, the resulting dependencies will not - include shared_library targets that are linked into this target. - """ - if dependencies is None: - # Using a list to get ordered output and a set to do fast "is it - # already added" checks. - dependencies = OrderedSet() - - # Check for None, corresponding to the root node. - if self.ref is None: - return dependencies - - # It's kind of sucky that |targets| has to be passed into this function, - # but that's presently the easiest way to access the target dicts so that - # this function can find target types. - - if "target_name" not in targets[self.ref]: - raise GypError("Missing 'target_name' field in target.") - - if "type" not in targets[self.ref]: - raise GypError( - "Missing 'type' field in target %s" % targets[self.ref]["target_name"] - ) - - target_type = targets[self.ref]["type"] - - is_linkable = target_type in linkable_types - - if initial and not is_linkable: - # If this is the first target being examined and it's not linkable, - # return an empty list of link dependencies, because the link - # dependencies are intended to apply to the target itself (initial is - # True) and this target won't be linked. - return dependencies - - # Don't traverse 'none' targets if explicitly excluded. - if target_type == "none" and not targets[self.ref].get( - "dependencies_traverse", True - ): - dependencies.add(self.ref) - return dependencies - - # Executables, mac kernel extensions, windows drivers and loadable modules - # are already fully and finally linked. Nothing else can be a link - # dependency of them, there can only be dependencies in the sense that a - # dependent target might run an executable or load the loadable_module. - if not initial and target_type in ( - "executable", - "loadable_module", - "mac_kernel_extension", - "windows_driver", - ): - return dependencies - - # Shared libraries are already fully linked. They should only be included - # in |dependencies| when adjusting static library dependencies (in order to - # link against the shared_library's import lib), but should not be included - # in |dependencies| when propagating link_settings. - # The |include_shared_libraries| flag controls which of these two cases we - # are handling. - if ( - not initial - and target_type == "shared_library" - and not include_shared_libraries - ): - return dependencies - - # The target is linkable, add it to the list of link dependencies. - if self.ref not in dependencies: - dependencies.add(self.ref) - if initial or not is_linkable: - # If this is a subsequent target and it's linkable, don't look any - # further for linkable dependencies, as they'll already be linked into - # this target linkable. Always look at dependencies of the initial - # target, and always look at dependencies of non-linkables. - for dependency in self.dependencies: - dependency._LinkDependenciesInternal( - targets, include_shared_libraries, dependencies, False - ) - - return dependencies - - def DependenciesForLinkSettings(self, targets): - """ - Returns a list of dependency targets whose link_settings should be merged - into this target. - """ - - # TODO(sbaig) Currently, chrome depends on the bug that shared libraries' - # link_settings are propagated. So for now, we will allow it, unless the - # 'allow_sharedlib_linksettings_propagation' flag is explicitly set to - # False. Once chrome is fixed, we can remove this flag. - include_shared_libraries = targets[self.ref].get( - "allow_sharedlib_linksettings_propagation", True - ) - return self._LinkDependenciesInternal(targets, include_shared_libraries) - - def DependenciesToLinkAgainst(self, targets): - """ - Returns a list of dependency targets that are linked into this target. - """ - return self._LinkDependenciesInternal(targets, True) - - -def BuildDependencyList(targets): - # Create a DependencyGraphNode for each target. Put it into a dict for easy - # access. - dependency_nodes = {} - for target, spec in targets.items(): - if target not in dependency_nodes: - dependency_nodes[target] = DependencyGraphNode(target) - - # Set up the dependency links. Targets that have no dependencies are treated - # as dependent on root_node. - root_node = DependencyGraphNode(None) - for target, spec in targets.items(): - target_node = dependency_nodes[target] - dependencies = spec.get("dependencies") - if not dependencies: - target_node.dependencies = [root_node] - root_node.dependents.append(target_node) - else: - for dependency in dependencies: - dependency_node = dependency_nodes.get(dependency) - if not dependency_node: - raise GypError( - "Dependency '%s' not found while " - "trying to load target %s" % (dependency, target) - ) - target_node.dependencies.append(dependency_node) - dependency_node.dependents.append(target_node) - - flat_list = root_node.FlattenToList() - - # If there's anything left unvisited, there must be a circular dependency - # (cycle). - if len(flat_list) != len(targets): - if not root_node.dependents: - # If all targets have dependencies, add the first target as a dependent - # of root_node so that the cycle can be discovered from root_node. - target = next(iter(targets)) - target_node = dependency_nodes[target] - target_node.dependencies.append(root_node) - root_node.dependents.append(target_node) - - cycles = [] - for cycle in root_node.FindCycles(): - paths = [node.ref for node in cycle] - cycles.append("Cycle: %s" % " -> ".join(paths)) - raise DependencyGraphNode.CircularException( - "Cycles in dependency graph detected:\n" + "\n".join(cycles) - ) - - return [dependency_nodes, flat_list] - - -def VerifyNoGYPFileCircularDependencies(targets): - # Create a DependencyGraphNode for each gyp file containing a target. Put - # it into a dict for easy access. - dependency_nodes = {} - for target in targets: - build_file = gyp.common.BuildFile(target) - if build_file not in dependency_nodes: - dependency_nodes[build_file] = DependencyGraphNode(build_file) - - # Set up the dependency links. - for target, spec in targets.items(): - build_file = gyp.common.BuildFile(target) - build_file_node = dependency_nodes[build_file] - target_dependencies = spec.get("dependencies", []) - for dependency in target_dependencies: - try: - dependency_build_file = gyp.common.BuildFile(dependency) - except GypError as e: - gyp.common.ExceptionAppend( - e, "while computing dependencies of .gyp file %s" % build_file - ) - raise - - if dependency_build_file == build_file: - # A .gyp file is allowed to refer back to itself. - continue - dependency_node = dependency_nodes.get(dependency_build_file) - if not dependency_node: - raise GypError("Dependency '%s' not found" % dependency_build_file) - if dependency_node not in build_file_node.dependencies: - build_file_node.dependencies.append(dependency_node) - dependency_node.dependents.append(build_file_node) - - # Files that have no dependencies are treated as dependent on root_node. - root_node = DependencyGraphNode(None) - for build_file_node in dependency_nodes.values(): - if len(build_file_node.dependencies) == 0: - build_file_node.dependencies.append(root_node) - root_node.dependents.append(build_file_node) - - flat_list = root_node.FlattenToList() - - # If there's anything left unvisited, there must be a circular dependency - # (cycle). - if len(flat_list) != len(dependency_nodes): - if not root_node.dependents: - # If all files have dependencies, add the first file as a dependent - # of root_node so that the cycle can be discovered from root_node. - file_node = next(iter(dependency_nodes.values())) - file_node.dependencies.append(root_node) - root_node.dependents.append(file_node) - cycles = [] - for cycle in root_node.FindCycles(): - paths = [node.ref for node in cycle] - cycles.append("Cycle: %s" % " -> ".join(paths)) - raise DependencyGraphNode.CircularException( - "Cycles in .gyp file dependency graph detected:\n" + "\n".join(cycles) - ) - - -def DoDependentSettings(key, flat_list, targets, dependency_nodes): - # key should be one of all_dependent_settings, direct_dependent_settings, - # or link_settings. - - for target in flat_list: - target_dict = targets[target] - build_file = gyp.common.BuildFile(target) - - if key == "all_dependent_settings": - dependencies = dependency_nodes[target].DeepDependencies() - elif key == "direct_dependent_settings": - dependencies = dependency_nodes[target].DirectAndImportedDependencies( - targets - ) - elif key == "link_settings": - dependencies = dependency_nodes[target].DependenciesForLinkSettings(targets) - else: - raise GypError( - "DoDependentSettings doesn't know how to determine " - "dependencies for " + key - ) - - for dependency in dependencies: - dependency_dict = targets[dependency] - if key not in dependency_dict: - continue - dependency_build_file = gyp.common.BuildFile(dependency) - MergeDicts( - target_dict, dependency_dict[key], build_file, dependency_build_file - ) - - -def AdjustStaticLibraryDependencies( - flat_list, targets, dependency_nodes, sort_dependencies -): - # Recompute target "dependencies" properties. For each static library - # target, remove "dependencies" entries referring to other static libraries, - # unless the dependency has the "hard_dependency" attribute set. For each - # linkable target, add a "dependencies" entry referring to all of the - # target's computed list of link dependencies (including static libraries - # if no such entry is already present. - for target in flat_list: - target_dict = targets[target] - target_type = target_dict["type"] - - if target_type == "static_library": - if "dependencies" not in target_dict: - continue - - target_dict["dependencies_original"] = target_dict.get("dependencies", [])[ - : - ] - - # A static library should not depend on another static library unless - # the dependency relationship is "hard," which should only be done when - # a dependent relies on some side effect other than just the build - # product, like a rule or action output. Further, if a target has a - # non-hard dependency, but that dependency exports a hard dependency, - # the non-hard dependency can safely be removed, but the exported hard - # dependency must be added to the target to keep the same dependency - # ordering. - dependencies = dependency_nodes[target].DirectAndImportedDependencies( - targets - ) - index = 0 - while index < len(dependencies): - dependency = dependencies[index] - dependency_dict = targets[dependency] - - # Remove every non-hard static library dependency and remove every - # non-static library dependency that isn't a direct dependency. - if ( - dependency_dict["type"] == "static_library" - and not dependency_dict.get("hard_dependency", False) - ) or ( - dependency_dict["type"] != "static_library" - and dependency not in target_dict["dependencies"] - ): - # Take the dependency out of the list, and don't increment index - # because the next dependency to analyze will shift into the index - # formerly occupied by the one being removed. - del dependencies[index] - else: - index = index + 1 - - # Update the dependencies. If the dependencies list is empty, it's not - # needed, so unhook it. - if len(dependencies) > 0: - target_dict["dependencies"] = dependencies - else: - del target_dict["dependencies"] - - elif target_type in linkable_types: - # Get a list of dependency targets that should be linked into this - # target. Add them to the dependencies list if they're not already - # present. - - link_dependencies = dependency_nodes[target].DependenciesToLinkAgainst( - targets - ) - for dependency in link_dependencies: - if dependency == target: - continue - if "dependencies" not in target_dict: - target_dict["dependencies"] = [] - if dependency not in target_dict["dependencies"]: - target_dict["dependencies"].append(dependency) - # Sort the dependencies list in the order from dependents to dependencies. - # e.g. If A and B depend on C and C depends on D, sort them in A, B, C, D. - # Note: flat_list is already sorted in the order from dependencies to - # dependents. - if sort_dependencies and "dependencies" in target_dict: - target_dict["dependencies"] = [ - dep - for dep in reversed(flat_list) - if dep in target_dict["dependencies"] - ] - - -# Initialize this here to speed up MakePathRelative. -exception_re = re.compile(r"""["']?[-/$<>^]""") - - -def MakePathRelative(to_file, fro_file, item): - # If item is a relative path, it's relative to the build file dict that it's - # coming from. Fix it up to make it relative to the build file dict that - # it's going into. - # Exception: any |item| that begins with these special characters is - # returned without modification. - # / Used when a path is already absolute (shortcut optimization; - # such paths would be returned as absolute anyway) - # $ Used for build environment variables - # - Used for some build environment flags (such as -lapr-1 in a - # "libraries" section) - # < Used for our own variable and command expansions (see ExpandVariables) - # > Used for our own variable and command expansions (see ExpandVariables) - # ^ Used for our own variable and command expansions (see ExpandVariables) - # - # "/' Used when a value is quoted. If these are present, then we - # check the second character instead. - # - if to_file == fro_file or exception_re.match(item): - return item - else: - # TODO(dglazkov) The backslash/forward-slash replacement at the end is a - # temporary measure. This should really be addressed by keeping all paths - # in POSIX until actual project generation. - ret = os.path.normpath( - os.path.join( - gyp.common.RelativePath( - os.path.dirname(fro_file), os.path.dirname(to_file) - ), - item, - ) - ).replace("\\", "/") - if item.endswith("/"): - ret += "/" - return ret - - -def MergeLists(to, fro, to_file, fro_file, is_paths=False, append=True): - # Python documentation recommends objects which do not support hash - # set this value to None. Python library objects follow this rule. - def is_hashable(val): - return val.__hash__ - - # If x is hashable, returns whether x is in s. Else returns whether x is in items. - def is_in_set_or_list(x, s, items): - if is_hashable(x): - return x in s - return x in items - - prepend_index = 0 - - # Make membership testing of hashables in |to| (in particular, strings) - # faster. - hashable_to_set = {x for x in to if is_hashable(x)} - for item in fro: - singleton = False - if type(item) in (str, int): - # The cheap and easy case. - if is_paths: - to_item = MakePathRelative(to_file, fro_file, item) - else: - to_item = item - - if not (type(item) is str and item.startswith("-")): - # Any string that doesn't begin with a "-" is a singleton - it can - # only appear once in a list, to be enforced by the list merge append - # or prepend. - singleton = True - elif type(item) is dict: - # Make a copy of the dictionary, continuing to look for paths to fix. - # The other intelligent aspects of merge processing won't apply because - # item is being merged into an empty dict. - to_item = {} - MergeDicts(to_item, item, to_file, fro_file) - elif type(item) is list: - # Recurse, making a copy of the list. If the list contains any - # descendant dicts, path fixing will occur. Note that here, custom - # values for is_paths and append are dropped; those are only to be - # applied to |to| and |fro|, not sublists of |fro|. append shouldn't - # matter anyway because the new |to_item| list is empty. - to_item = [] - MergeLists(to_item, item, to_file, fro_file) - else: - raise TypeError( - "Attempt to merge list item of unsupported type " - + item.__class__.__name__ - ) - - if append: - # If appending a singleton that's already in the list, don't append. - # This ensures that the earliest occurrence of the item will stay put. - if not singleton or not is_in_set_or_list(to_item, hashable_to_set, to): - to.append(to_item) - if is_hashable(to_item): - hashable_to_set.add(to_item) - else: - # If prepending a singleton that's already in the list, remove the - # existing instance and proceed with the prepend. This ensures that the - # item appears at the earliest possible position in the list. - while singleton and to_item in to: - to.remove(to_item) - - # Don't just insert everything at index 0. That would prepend the new - # items to the list in reverse order, which would be an unwelcome - # surprise. - to.insert(prepend_index, to_item) - if is_hashable(to_item): - hashable_to_set.add(to_item) - prepend_index = prepend_index + 1 - - -def MergeDicts(to, fro, to_file, fro_file): - # I wanted to name the parameter "from" but it's a Python keyword... - for k, v in fro.items(): - # It would be nice to do "if not k in to: to[k] = v" but that wouldn't give - # copy semantics. Something else may want to merge from the |fro| dict - # later, and having the same dict ref pointed to twice in the tree isn't - # what anyone wants considering that the dicts may subsequently be - # modified. - if k in to: - bad_merge = False - if type(v) in (str, int): - if type(to[k]) not in (str, int): - bad_merge = True - elif not isinstance(v, type(to[k])): - bad_merge = True - - if bad_merge: - raise TypeError( - "Attempt to merge dict value of type " - + v.__class__.__name__ - + " into incompatible type " - + to[k].__class__.__name__ - + " for key " - + k - ) - if type(v) in (str, int): - # Overwrite the existing value, if any. Cheap and easy. - is_path = IsPathSection(k) - if is_path: - to[k] = MakePathRelative(to_file, fro_file, v) - else: - to[k] = v - elif type(v) is dict: - # Recurse, guaranteeing copies will be made of objects that require it. - if k not in to: - to[k] = {} - MergeDicts(to[k], v, to_file, fro_file) - elif type(v) is list: - # Lists in dicts can be merged with different policies, depending on - # how the key in the "from" dict (k, the from-key) is written. - # - # If the from-key has ...the to-list will have this action - # this character appended:... applied when receiving the from-list: - # = replace - # + prepend - # ? set, only if to-list does not yet exist - # (none) append - # - # This logic is list-specific, but since it relies on the associated - # dict key, it's checked in this dict-oriented function. - ext = k[-1] - append = True - if ext == "=": - list_base = k[:-1] - lists_incompatible = [list_base, list_base + "?"] - to[list_base] = [] - elif ext == "+": - list_base = k[:-1] - lists_incompatible = [list_base + "=", list_base + "?"] - append = False - elif ext == "?": - list_base = k[:-1] - lists_incompatible = [list_base, list_base + "=", list_base + "+"] - else: - list_base = k - lists_incompatible = [list_base + "=", list_base + "?"] - - # Some combinations of merge policies appearing together are meaningless. - # It's stupid to replace and append simultaneously, for example. Append - # and prepend are the only policies that can coexist. - for list_incompatible in lists_incompatible: - if list_incompatible in fro: - raise GypError( - "Incompatible list policies " + k + " and " + list_incompatible - ) - - if list_base in to: - if ext == "?": - # If the key ends in "?", the list will only be merged if it doesn't - # already exist. - continue - elif type(to[list_base]) is not list: - # This may not have been checked above if merging in a list with an - # extension character. - raise TypeError( - "Attempt to merge dict value of type " - + v.__class__.__name__ - + " into incompatible type " - + to[list_base].__class__.__name__ - + " for key " - + list_base - + "(" - + k - + ")" - ) - else: - to[list_base] = [] - - # Call MergeLists, which will make copies of objects that require it. - # MergeLists can recurse back into MergeDicts, although this will be - # to make copies of dicts (with paths fixed), there will be no - # subsequent dict "merging" once entering a list because lists are - # always replaced, appended to, or prepended to. - is_paths = IsPathSection(list_base) - MergeLists(to[list_base], v, to_file, fro_file, is_paths, append) - else: - raise TypeError( - "Attempt to merge dict value of unsupported type " - + v.__class__.__name__ - + " for key " - + k - ) - - -def MergeConfigWithInheritance( - new_configuration_dict, build_file, target_dict, configuration, visited -): - # Skip if previously visited. - if configuration in visited: - return - - # Look at this configuration. - configuration_dict = target_dict["configurations"][configuration] - - # Merge in parents. - for parent in configuration_dict.get("inherit_from", []): - MergeConfigWithInheritance( - new_configuration_dict, - build_file, - target_dict, - parent, - visited + [configuration], - ) - - # Merge it into the new config. - MergeDicts(new_configuration_dict, configuration_dict, build_file, build_file) - - # Drop abstract. - if "abstract" in new_configuration_dict: - del new_configuration_dict["abstract"] - - -def SetUpConfigurations(target, target_dict): - # key_suffixes is a list of key suffixes that might appear on key names. - # These suffixes are handled in conditional evaluations (for =, +, and ?) - # and rules/exclude processing (for ! and /). Keys with these suffixes - # should be treated the same as keys without. - key_suffixes = ["=", "+", "?", "!", "/"] - - build_file = gyp.common.BuildFile(target) - - # Provide a single configuration by default if none exists. - # TODO(mark): Signal an error if default_configurations exists but - # configurations does not. - if "configurations" not in target_dict: - target_dict["configurations"] = {"Default": {}} - if "default_configuration" not in target_dict: - concrete = [ - i - for (i, config) in target_dict["configurations"].items() - if not config.get("abstract") - ] - target_dict["default_configuration"] = sorted(concrete)[0] - - merged_configurations = {} - configs = target_dict["configurations"] - for (configuration, old_configuration_dict) in configs.items(): - # Skip abstract configurations (saves work only). - if old_configuration_dict.get("abstract"): - continue - # Configurations inherit (most) settings from the enclosing target scope. - # Get the inheritance relationship right by making a copy of the target - # dict. - new_configuration_dict = {} - for (key, target_val) in target_dict.items(): - key_ext = key[-1:] - if key_ext in key_suffixes: - key_base = key[:-1] - else: - key_base = key - if key_base not in non_configuration_keys: - new_configuration_dict[key] = gyp.simple_copy.deepcopy(target_val) - - # Merge in configuration (with all its parents first). - MergeConfigWithInheritance( - new_configuration_dict, build_file, target_dict, configuration, [] - ) - - merged_configurations[configuration] = new_configuration_dict - - # Put the new configurations back into the target dict as a configuration. - for configuration in merged_configurations.keys(): - target_dict["configurations"][configuration] = merged_configurations[ - configuration - ] - - # Now drop all the abstract ones. - configs = target_dict["configurations"] - target_dict["configurations"] = { - k: v for k, v in configs.items() if not v.get("abstract") - } - - # Now that all of the target's configurations have been built, go through - # the target dict's keys and remove everything that's been moved into a - # "configurations" section. - delete_keys = [] - for key in target_dict: - key_ext = key[-1:] - if key_ext in key_suffixes: - key_base = key[:-1] - else: - key_base = key - if key_base not in non_configuration_keys: - delete_keys.append(key) - for key in delete_keys: - del target_dict[key] - - # Check the configurations to see if they contain invalid keys. - for configuration in target_dict["configurations"].keys(): - configuration_dict = target_dict["configurations"][configuration] - for key in configuration_dict.keys(): - if key in invalid_configuration_keys: - raise GypError( - "%s not allowed in the %s configuration, found in " - "target %s" % (key, configuration, target) - ) - - -def ProcessListFiltersInDict(name, the_dict): - """Process regular expression and exclusion-based filters on lists. - - An exclusion list is in a dict key named with a trailing "!", like - "sources!". Every item in such a list is removed from the associated - main list, which in this example, would be "sources". Removed items are - placed into a "sources_excluded" list in the dict. - - Regular expression (regex) filters are contained in dict keys named with a - trailing "/", such as "sources/" to operate on the "sources" list. Regex - filters in a dict take the form: - 'sources/': [ ['exclude', '_(linux|mac|win)\\.cc$'], - ['include', '_mac\\.cc$'] ], - The first filter says to exclude all files ending in _linux.cc, _mac.cc, and - _win.cc. The second filter then includes all files ending in _mac.cc that - are now or were once in the "sources" list. Items matching an "exclude" - filter are subject to the same processing as would occur if they were listed - by name in an exclusion list (ending in "!"). Items matching an "include" - filter are brought back into the main list if previously excluded by an - exclusion list or exclusion regex filter. Subsequent matching "exclude" - patterns can still cause items to be excluded after matching an "include". - """ - - # Look through the dictionary for any lists whose keys end in "!" or "/". - # These are lists that will be treated as exclude lists and regular - # expression-based exclude/include lists. Collect the lists that are - # needed first, looking for the lists that they operate on, and assemble - # then into |lists|. This is done in a separate loop up front, because - # the _included and _excluded keys need to be added to the_dict, and that - # can't be done while iterating through it. - - lists = [] - del_lists = [] - for key, value in the_dict.items(): - operation = key[-1] - if operation != "!" and operation != "/": - continue - - if type(value) is not list: - raise ValueError( - name + " key " + key + " must be list, not " + value.__class__.__name__ - ) - - list_key = key[:-1] - if list_key not in the_dict: - # This happens when there's a list like "sources!" but no corresponding - # "sources" list. Since there's nothing for it to operate on, queue up - # the "sources!" list for deletion now. - del_lists.append(key) - continue - - if type(the_dict[list_key]) is not list: - value = the_dict[list_key] - raise ValueError( - name - + " key " - + list_key - + " must be list, not " - + value.__class__.__name__ - + " when applying " - + {"!": "exclusion", "/": "regex"}[operation] - ) - - if list_key not in lists: - lists.append(list_key) - - # Delete the lists that are known to be unneeded at this point. - for del_list in del_lists: - del the_dict[del_list] - - for list_key in lists: - the_list = the_dict[list_key] - - # Initialize the list_actions list, which is parallel to the_list. Each - # item in list_actions identifies whether the corresponding item in - # the_list should be excluded, unconditionally preserved (included), or - # whether no exclusion or inclusion has been applied. Items for which - # no exclusion or inclusion has been applied (yet) have value -1, items - # excluded have value 0, and items included have value 1. Includes and - # excludes override previous actions. All items in list_actions are - # initialized to -1 because no excludes or includes have been processed - # yet. - list_actions = list((-1,) * len(the_list)) - - exclude_key = list_key + "!" - if exclude_key in the_dict: - for exclude_item in the_dict[exclude_key]: - for index, list_item in enumerate(the_list): - if exclude_item == list_item: - # This item matches the exclude_item, so set its action to 0 - # (exclude). - list_actions[index] = 0 - - # The "whatever!" list is no longer needed, dump it. - del the_dict[exclude_key] - - regex_key = list_key + "/" - if regex_key in the_dict: - for regex_item in the_dict[regex_key]: - [action, pattern] = regex_item - pattern_re = re.compile(pattern) - - if action == "exclude": - # This item matches an exclude regex, set its value to 0 (exclude). - action_value = 0 - elif action == "include": - # This item matches an include regex, set its value to 1 (include). - action_value = 1 - else: - # This is an action that doesn't make any sense. - raise ValueError( - "Unrecognized action " - + action - + " in " - + name - + " key " - + regex_key - ) - - for index, list_item in enumerate(the_list): - if list_actions[index] == action_value: - # Even if the regex matches, nothing will change so continue - # (regex searches are expensive). - continue - if pattern_re.search(list_item): - # Regular expression match. - list_actions[index] = action_value - - # The "whatever/" list is no longer needed, dump it. - del the_dict[regex_key] - - # Add excluded items to the excluded list. - # - # Note that exclude_key ("sources!") is different from excluded_key - # ("sources_excluded"). The exclude_key list is input and it was already - # processed and deleted; the excluded_key list is output and it's about - # to be created. - excluded_key = list_key + "_excluded" - if excluded_key in the_dict: - raise GypError( - name + " key " + excluded_key + " must not be present prior " - " to applying exclusion/regex filters for " + list_key - ) - - excluded_list = [] - - # Go backwards through the list_actions list so that as items are deleted, - # the indices of items that haven't been seen yet don't shift. That means - # that things need to be prepended to excluded_list to maintain them in the - # same order that they existed in the_list. - for index in range(len(list_actions) - 1, -1, -1): - if list_actions[index] == 0: - # Dump anything with action 0 (exclude). Keep anything with action 1 - # (include) or -1 (no include or exclude seen for the item). - excluded_list.insert(0, the_list[index]) - del the_list[index] - - # If anything was excluded, put the excluded list into the_dict at - # excluded_key. - if len(excluded_list) > 0: - the_dict[excluded_key] = excluded_list - - # Now recurse into subdicts and lists that may contain dicts. - for key, value in the_dict.items(): - if type(value) is dict: - ProcessListFiltersInDict(key, value) - elif type(value) is list: - ProcessListFiltersInList(key, value) - - -def ProcessListFiltersInList(name, the_list): - for item in the_list: - if type(item) is dict: - ProcessListFiltersInDict(name, item) - elif type(item) is list: - ProcessListFiltersInList(name, item) - - -def ValidateTargetType(target, target_dict): - """Ensures the 'type' field on the target is one of the known types. - - Arguments: - target: string, name of target. - target_dict: dict, target spec. - - Raises an exception on error. - """ - VALID_TARGET_TYPES = ( - "executable", - "loadable_module", - "static_library", - "shared_library", - "mac_kernel_extension", - "none", - "windows_driver", - ) - target_type = target_dict.get("type", None) - if target_type not in VALID_TARGET_TYPES: - raise GypError( - "Target %s has an invalid target type '%s'. " - "Must be one of %s." % (target, target_type, "/".join(VALID_TARGET_TYPES)) - ) - if ( - target_dict.get("standalone_static_library", 0) - and not target_type == "static_library" - ): - raise GypError( - "Target %s has type %s but standalone_static_library flag is" - " only valid for static_library type." % (target, target_type) - ) - - -def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules): - """Ensures that the rules sections in target_dict are valid and consistent, - and determines which sources they apply to. - - Arguments: - target: string, name of target. - target_dict: dict, target spec containing "rules" and "sources" lists. - extra_sources_for_rules: a list of keys to scan for rule matches in - addition to 'sources'. - """ - - # Dicts to map between values found in rules' 'rule_name' and 'extension' - # keys and the rule dicts themselves. - rule_names = {} - rule_extensions = {} - - rules = target_dict.get("rules", []) - for rule in rules: - # Make sure that there's no conflict among rule names and extensions. - rule_name = rule["rule_name"] - if rule_name in rule_names: - raise GypError( - f"rule {rule_name} exists in duplicate, target {target}" - ) - rule_names[rule_name] = rule - - rule_extension = rule["extension"] - if rule_extension.startswith("."): - rule_extension = rule_extension[1:] - if rule_extension in rule_extensions: - raise GypError( - ( - "extension %s associated with multiple rules, " - + "target %s rules %s and %s" - ) - % ( - rule_extension, - target, - rule_extensions[rule_extension]["rule_name"], - rule_name, - ) - ) - rule_extensions[rule_extension] = rule - - # Make sure rule_sources isn't already there. It's going to be - # created below if needed. - if "rule_sources" in rule: - raise GypError( - "rule_sources must not exist in input, target %s rule %s" - % (target, rule_name) - ) - - rule_sources = [] - source_keys = ["sources"] - source_keys.extend(extra_sources_for_rules) - for source_key in source_keys: - for source in target_dict.get(source_key, []): - (source_root, source_extension) = os.path.splitext(source) - if source_extension.startswith("."): - source_extension = source_extension[1:] - if source_extension == rule_extension: - rule_sources.append(source) - - if len(rule_sources) > 0: - rule["rule_sources"] = rule_sources - - -def ValidateRunAsInTarget(target, target_dict, build_file): - target_name = target_dict.get("target_name") - run_as = target_dict.get("run_as") - if not run_as: - return - if type(run_as) is not dict: - raise GypError( - "The 'run_as' in target %s from file %s should be a " - "dictionary." % (target_name, build_file) - ) - action = run_as.get("action") - if not action: - raise GypError( - "The 'run_as' in target %s from file %s must have an " - "'action' section." % (target_name, build_file) - ) - if type(action) is not list: - raise GypError( - "The 'action' for 'run_as' in target %s from file %s " - "must be a list." % (target_name, build_file) - ) - working_directory = run_as.get("working_directory") - if working_directory and type(working_directory) is not str: - raise GypError( - "The 'working_directory' for 'run_as' in target %s " - "in file %s should be a string." % (target_name, build_file) - ) - environment = run_as.get("environment") - if environment and type(environment) is not dict: - raise GypError( - "The 'environment' for 'run_as' in target %s " - "in file %s should be a dictionary." % (target_name, build_file) - ) - - -def ValidateActionsInTarget(target, target_dict, build_file): - """Validates the inputs to the actions in a target.""" - target_name = target_dict.get("target_name") - actions = target_dict.get("actions", []) - for action in actions: - action_name = action.get("action_name") - if not action_name: - raise GypError( - "Anonymous action in target %s. " - "An action must have an 'action_name' field." % target_name - ) - inputs = action.get("inputs", None) - if inputs is None: - raise GypError("Action in target %s has no inputs." % target_name) - action_command = action.get("action") - if action_command and not action_command[0]: - raise GypError("Empty action as command in target %s." % target_name) - - -def TurnIntIntoStrInDict(the_dict): - """Given dict the_dict, recursively converts all integers into strings. - """ - # Use items instead of iteritems because there's no need to try to look at - # reinserted keys and their associated values. - for k, v in the_dict.items(): - if type(v) is int: - v = str(v) - the_dict[k] = v - elif type(v) is dict: - TurnIntIntoStrInDict(v) - elif type(v) is list: - TurnIntIntoStrInList(v) - - if type(k) is int: - del the_dict[k] - the_dict[str(k)] = v - - -def TurnIntIntoStrInList(the_list): - """Given list the_list, recursively converts all integers into strings. - """ - for index, item in enumerate(the_list): - if type(item) is int: - the_list[index] = str(item) - elif type(item) is dict: - TurnIntIntoStrInDict(item) - elif type(item) is list: - TurnIntIntoStrInList(item) - - -def PruneUnwantedTargets(targets, flat_list, dependency_nodes, root_targets, data): - """Return only the targets that are deep dependencies of |root_targets|.""" - qualified_root_targets = [] - for target in root_targets: - target = target.strip() - qualified_targets = gyp.common.FindQualifiedTargets(target, flat_list) - if not qualified_targets: - raise GypError("Could not find target %s" % target) - qualified_root_targets.extend(qualified_targets) - - wanted_targets = {} - for target in qualified_root_targets: - wanted_targets[target] = targets[target] - for dependency in dependency_nodes[target].DeepDependencies(): - wanted_targets[dependency] = targets[dependency] - - wanted_flat_list = [t for t in flat_list if t in wanted_targets] - - # Prune unwanted targets from each build_file's data dict. - for build_file in data["target_build_files"]: - if "targets" not in data[build_file]: - continue - new_targets = [] - for target in data[build_file]["targets"]: - qualified_name = gyp.common.QualifiedTarget( - build_file, target["target_name"], target["toolset"] - ) - if qualified_name in wanted_targets: - new_targets.append(target) - data[build_file]["targets"] = new_targets - - return wanted_targets, wanted_flat_list - - -def VerifyNoCollidingTargets(targets): - """Verify that no two targets in the same directory share the same name. - - Arguments: - targets: A list of targets in the form 'path/to/file.gyp:target_name'. - """ - # Keep a dict going from 'subdirectory:target_name' to 'foo.gyp'. - used = {} - for target in targets: - # Separate out 'path/to/file.gyp, 'target_name' from - # 'path/to/file.gyp:target_name'. - path, name = target.rsplit(":", 1) - # Separate out 'path/to', 'file.gyp' from 'path/to/file.gyp'. - subdir, gyp = os.path.split(path) - # Use '.' for the current directory '', so that the error messages make - # more sense. - if not subdir: - subdir = "." - # Prepare a key like 'path/to:target_name'. - key = subdir + ":" + name - if key in used: - # Complain if this target is already used. - raise GypError( - 'Duplicate target name "%s" in directory "%s" used both ' - 'in "%s" and "%s".' % (name, subdir, gyp, used[key]) - ) - used[key] = gyp - - -def SetGeneratorGlobals(generator_input_info): - # Set up path_sections and non_configuration_keys with the default data plus - # the generator-specific data. - global path_sections - path_sections = set(base_path_sections) - path_sections.update(generator_input_info["path_sections"]) - - global non_configuration_keys - non_configuration_keys = base_non_configuration_keys[:] - non_configuration_keys.extend(generator_input_info["non_configuration_keys"]) - - global multiple_toolsets - multiple_toolsets = generator_input_info["generator_supports_multiple_toolsets"] - - global generator_filelist_paths - generator_filelist_paths = generator_input_info["generator_filelist_paths"] - - -def Load( - build_files, - variables, - includes, - depth, - generator_input_info, - check, - circular_check, - parallel, - root_targets, -): - SetGeneratorGlobals(generator_input_info) - # A generator can have other lists (in addition to sources) be processed - # for rules. - extra_sources_for_rules = generator_input_info["extra_sources_for_rules"] - - # Load build files. This loads every target-containing build file into - # the |data| dictionary such that the keys to |data| are build file names, - # and the values are the entire build file contents after "early" or "pre" - # processing has been done and includes have been resolved. - # NOTE: data contains both "target" files (.gyp) and "includes" (.gypi), as - # well as meta-data (e.g. 'included_files' key). 'target_build_files' keeps - # track of the keys corresponding to "target" files. - data = {"target_build_files": set()} - # Normalize paths everywhere. This is important because paths will be - # used as keys to the data dict and for references between input files. - build_files = set(map(os.path.normpath, build_files)) - if parallel: - LoadTargetBuildFilesParallel( - build_files, data, variables, includes, depth, check, generator_input_info - ) - else: - aux_data = {} - for build_file in build_files: - try: - LoadTargetBuildFile( - build_file, data, aux_data, variables, includes, depth, check, True - ) - except Exception as e: - gyp.common.ExceptionAppend(e, "while trying to load %s" % build_file) - raise - - # Build a dict to access each target's subdict by qualified name. - targets = BuildTargetsDict(data) - - # Fully qualify all dependency links. - QualifyDependencies(targets) - - # Remove self-dependencies from targets that have 'prune_self_dependencies' - # set to 1. - RemoveSelfDependencies(targets) - - # Expand dependencies specified as build_file:*. - ExpandWildcardDependencies(targets, data) - - # Remove all dependencies marked as 'link_dependency' from the targets of - # type 'none'. - RemoveLinkDependenciesFromNoneTargets(targets) - - # Apply exclude (!) and regex (/) list filters only for dependency_sections. - for target_name, target_dict in targets.items(): - tmp_dict = {} - for key_base in dependency_sections: - for op in ("", "!", "/"): - key = key_base + op - if key in target_dict: - tmp_dict[key] = target_dict[key] - del target_dict[key] - ProcessListFiltersInDict(target_name, tmp_dict) - # Write the results back to |target_dict|. - for key in tmp_dict: - target_dict[key] = tmp_dict[key] - - # Make sure every dependency appears at most once. - RemoveDuplicateDependencies(targets) - - if circular_check: - # Make sure that any targets in a.gyp don't contain dependencies in other - # .gyp files that further depend on a.gyp. - VerifyNoGYPFileCircularDependencies(targets) - - [dependency_nodes, flat_list] = BuildDependencyList(targets) - - if root_targets: - # Remove, from |targets| and |flat_list|, the targets that are not deep - # dependencies of the targets specified in |root_targets|. - targets, flat_list = PruneUnwantedTargets( - targets, flat_list, dependency_nodes, root_targets, data - ) - - # Check that no two targets in the same directory have the same name. - VerifyNoCollidingTargets(flat_list) - - # Handle dependent settings of various types. - for settings_type in [ - "all_dependent_settings", - "direct_dependent_settings", - "link_settings", - ]: - DoDependentSettings(settings_type, flat_list, targets, dependency_nodes) - - # Take out the dependent settings now that they've been published to all - # of the targets that require them. - for target in flat_list: - if settings_type in targets[target]: - del targets[target][settings_type] - - # Make sure static libraries don't declare dependencies on other static - # libraries, but that linkables depend on all unlinked static libraries - # that they need so that their link steps will be correct. - gii = generator_input_info - if gii["generator_wants_static_library_dependencies_adjusted"]: - AdjustStaticLibraryDependencies( - flat_list, - targets, - dependency_nodes, - gii["generator_wants_sorted_dependencies"], - ) - - # Apply "post"/"late"/"target" variable expansions and condition evaluations. - for target in flat_list: - target_dict = targets[target] - build_file = gyp.common.BuildFile(target) - ProcessVariablesAndConditionsInDict( - target_dict, PHASE_LATE, variables, build_file - ) - - # Move everything that can go into a "configurations" section into one. - for target in flat_list: - target_dict = targets[target] - SetUpConfigurations(target, target_dict) - - # Apply exclude (!) and regex (/) list filters. - for target in flat_list: - target_dict = targets[target] - ProcessListFiltersInDict(target, target_dict) - - # Apply "latelate" variable expansions and condition evaluations. - for target in flat_list: - target_dict = targets[target] - build_file = gyp.common.BuildFile(target) - ProcessVariablesAndConditionsInDict( - target_dict, PHASE_LATELATE, variables, build_file - ) - - # Make sure that the rules make sense, and build up rule_sources lists as - # needed. Not all generators will need to use the rule_sources lists, but - # some may, and it seems best to build the list in a common spot. - # Also validate actions and run_as elements in targets. - for target in flat_list: - target_dict = targets[target] - build_file = gyp.common.BuildFile(target) - ValidateTargetType(target, target_dict) - ValidateRulesInTarget(target, target_dict, extra_sources_for_rules) - ValidateRunAsInTarget(target, target_dict, build_file) - ValidateActionsInTarget(target, target_dict, build_file) - - # Generators might not expect ints. Turn them into strs. - TurnIntIntoStrInDict(data) - - # TODO(mark): Return |data| for now because the generator needs a list of - # build files that came in. In the future, maybe it should just accept - # a list, and not the whole data dict. - return [flat_list, targets, data] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input_test.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input_test.py deleted file mode 100755 index a18f72e9ebb0a..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright 2013 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Unit tests for the input.py file.""" - -import gyp.input -import unittest - - -class TestFindCycles(unittest.TestCase): - def setUp(self): - self.nodes = {} - for x in ("a", "b", "c", "d", "e"): - self.nodes[x] = gyp.input.DependencyGraphNode(x) - - def _create_dependency(self, dependent, dependency): - dependent.dependencies.append(dependency) - dependency.dependents.append(dependent) - - def test_no_cycle_empty_graph(self): - for label, node in self.nodes.items(): - self.assertEqual([], node.FindCycles()) - - def test_no_cycle_line(self): - self._create_dependency(self.nodes["a"], self.nodes["b"]) - self._create_dependency(self.nodes["b"], self.nodes["c"]) - self._create_dependency(self.nodes["c"], self.nodes["d"]) - - for label, node in self.nodes.items(): - self.assertEqual([], node.FindCycles()) - - def test_no_cycle_dag(self): - self._create_dependency(self.nodes["a"], self.nodes["b"]) - self._create_dependency(self.nodes["a"], self.nodes["c"]) - self._create_dependency(self.nodes["b"], self.nodes["c"]) - - for label, node in self.nodes.items(): - self.assertEqual([], node.FindCycles()) - - def test_cycle_self_reference(self): - self._create_dependency(self.nodes["a"], self.nodes["a"]) - - self.assertEqual( - [[self.nodes["a"], self.nodes["a"]]], self.nodes["a"].FindCycles() - ) - - def test_cycle_two_nodes(self): - self._create_dependency(self.nodes["a"], self.nodes["b"]) - self._create_dependency(self.nodes["b"], self.nodes["a"]) - - self.assertEqual( - [[self.nodes["a"], self.nodes["b"], self.nodes["a"]]], - self.nodes["a"].FindCycles(), - ) - self.assertEqual( - [[self.nodes["b"], self.nodes["a"], self.nodes["b"]]], - self.nodes["b"].FindCycles(), - ) - - def test_two_cycles(self): - self._create_dependency(self.nodes["a"], self.nodes["b"]) - self._create_dependency(self.nodes["b"], self.nodes["a"]) - - self._create_dependency(self.nodes["b"], self.nodes["c"]) - self._create_dependency(self.nodes["c"], self.nodes["b"]) - - cycles = self.nodes["a"].FindCycles() - self.assertTrue([self.nodes["a"], self.nodes["b"], self.nodes["a"]] in cycles) - self.assertTrue([self.nodes["b"], self.nodes["c"], self.nodes["b"]] in cycles) - self.assertEqual(2, len(cycles)) - - def test_big_cycle(self): - self._create_dependency(self.nodes["a"], self.nodes["b"]) - self._create_dependency(self.nodes["b"], self.nodes["c"]) - self._create_dependency(self.nodes["c"], self.nodes["d"]) - self._create_dependency(self.nodes["d"], self.nodes["e"]) - self._create_dependency(self.nodes["e"], self.nodes["a"]) - - self.assertEqual( - [ - [ - self.nodes["a"], - self.nodes["b"], - self.nodes["c"], - self.nodes["d"], - self.nodes["e"], - self.nodes["a"], - ] - ], - self.nodes["a"].FindCycles(), - ) - - -if __name__ == "__main__": - unittest.main() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py deleted file mode 100755 index 59647c9a89034..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +++ /dev/null @@ -1,771 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Utility functions to perform Xcode-style build steps. - -These functions are executed via gyp-mac-tool when using the Makefile generator. -""" - - -import fcntl -import fnmatch -import glob -import json -import os -import plistlib -import re -import shutil -import struct -import subprocess -import sys -import tempfile - - -def main(args): - executor = MacTool() - exit_code = executor.Dispatch(args) - if exit_code is not None: - sys.exit(exit_code) - - -class MacTool: - """This class performs all the Mac tooling steps. The methods can either be - executed directly, or dispatched from an argument list.""" - - def Dispatch(self, args): - """Dispatches a string command to a method.""" - if len(args) < 1: - raise Exception("Not enough arguments") - - method = "Exec%s" % self._CommandifyName(args[0]) - return getattr(self, method)(*args[1:]) - - def _CommandifyName(self, name_string): - """Transforms a tool name like copy-info-plist to CopyInfoPlist""" - return name_string.title().replace("-", "") - - def ExecCopyBundleResource(self, source, dest, convert_to_binary): - """Copies a resource file to the bundle/Resources directory, performing any - necessary compilation on each resource.""" - convert_to_binary = convert_to_binary == "True" - extension = os.path.splitext(source)[1].lower() - if os.path.isdir(source): - # Copy tree. - # TODO(thakis): This copies file attributes like mtime, while the - # single-file branch below doesn't. This should probably be changed to - # be consistent with the single-file branch. - if os.path.exists(dest): - shutil.rmtree(dest) - shutil.copytree(source, dest) - elif extension == ".xib": - return self._CopyXIBFile(source, dest) - elif extension == ".storyboard": - return self._CopyXIBFile(source, dest) - elif extension == ".strings" and not convert_to_binary: - self._CopyStringsFile(source, dest) - else: - if os.path.exists(dest): - os.unlink(dest) - shutil.copy(source, dest) - - if convert_to_binary and extension in (".plist", ".strings"): - self._ConvertToBinary(dest) - - def _CopyXIBFile(self, source, dest): - """Compiles a XIB file with ibtool into a binary plist in the bundle.""" - - # ibtool sometimes crashes with relative paths. See crbug.com/314728. - base = os.path.dirname(os.path.realpath(__file__)) - if os.path.relpath(source): - source = os.path.join(base, source) - if os.path.relpath(dest): - dest = os.path.join(base, dest) - - args = ["xcrun", "ibtool", "--errors", "--warnings", "--notices"] - - if os.environ["XCODE_VERSION_ACTUAL"] > "0700": - args.extend(["--auto-activate-custom-fonts"]) - if "IPHONEOS_DEPLOYMENT_TARGET" in os.environ: - args.extend( - [ - "--target-device", - "iphone", - "--target-device", - "ipad", - "--minimum-deployment-target", - os.environ["IPHONEOS_DEPLOYMENT_TARGET"], - ] - ) - else: - args.extend( - [ - "--target-device", - "mac", - "--minimum-deployment-target", - os.environ["MACOSX_DEPLOYMENT_TARGET"], - ] - ) - - args.extend( - ["--output-format", "human-readable-text", "--compile", dest, source] - ) - - ibtool_section_re = re.compile(r"/\*.*\*/") - ibtool_re = re.compile(r".*note:.*is clipping its content") - try: - stdout = subprocess.check_output(args) - except subprocess.CalledProcessError as e: - print(e.output) - raise - current_section_header = None - for line in stdout.splitlines(): - if ibtool_section_re.match(line): - current_section_header = line - elif not ibtool_re.match(line): - if current_section_header: - print(current_section_header) - current_section_header = None - print(line) - return 0 - - def _ConvertToBinary(self, dest): - subprocess.check_call( - ["xcrun", "plutil", "-convert", "binary1", "-o", dest, dest] - ) - - def _CopyStringsFile(self, source, dest): - """Copies a .strings file using iconv to reconvert the input into UTF-16.""" - input_code = self._DetectInputEncoding(source) or "UTF-8" - - # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call - # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints - # CFPropertyListCreateFromXMLData(): Old-style plist parser: missing - # semicolon in dictionary. - # on invalid files. Do the same kind of validation. - import CoreFoundation - - with open(source, "rb") as in_file: - s = in_file.read() - d = CoreFoundation.CFDataCreate(None, s, len(s)) - _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None) - if error: - return - - with open(dest, "wb") as fp: - fp.write(s.decode(input_code).encode("UTF-16")) - - def _DetectInputEncoding(self, file_name): - """Reads the first few bytes from file_name and tries to guess the text - encoding. Returns None as a guess if it can't detect it.""" - with open(file_name, "rb") as fp: - try: - header = fp.read(3) - except Exception: - return None - if header.startswith(b"\xFE\xFF"): - return "UTF-16" - elif header.startswith(b"\xFF\xFE"): - return "UTF-16" - elif header.startswith(b"\xEF\xBB\xBF"): - return "UTF-8" - else: - return None - - def ExecCopyInfoPlist(self, source, dest, convert_to_binary, *keys): - """Copies the |source| Info.plist to the destination directory |dest|.""" - # Read the source Info.plist into memory. - with open(source) as fd: - lines = fd.read() - - # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild). - plist = plistlib.readPlistFromString(lines) - if keys: - plist.update(json.loads(keys[0])) - lines = plistlib.writePlistToString(plist) - - # Go through all the environment variables and replace them as variables in - # the file. - IDENT_RE = re.compile(r"[_/\s]") - for key in os.environ: - if key.startswith("_"): - continue - evar = "${%s}" % key - evalue = os.environ[key] - lines = lines.replace(lines, evar, evalue) - - # Xcode supports various suffices on environment variables, which are - # all undocumented. :rfc1034identifier is used in the standard project - # template these days, and :identifier was used earlier. They are used to - # convert non-url characters into things that look like valid urls -- - # except that the replacement character for :identifier, '_' isn't valid - # in a URL either -- oops, hence :rfc1034identifier was born. - evar = "${%s:identifier}" % key - evalue = IDENT_RE.sub("_", os.environ[key]) - lines = lines.replace(lines, evar, evalue) - - evar = "${%s:rfc1034identifier}" % key - evalue = IDENT_RE.sub("-", os.environ[key]) - lines = lines.replace(lines, evar, evalue) - - # Remove any keys with values that haven't been replaced. - lines = lines.splitlines() - for i in range(len(lines)): - if lines[i].strip().startswith("${"): - lines[i] = None - lines[i - 1] = None - lines = "\n".join(line for line in lines if line is not None) - - # Write out the file with variables replaced. - with open(dest, "w") as fd: - fd.write(lines) - - # Now write out PkgInfo file now that the Info.plist file has been - # "compiled". - self._WritePkgInfo(dest) - - if convert_to_binary == "True": - self._ConvertToBinary(dest) - - def _WritePkgInfo(self, info_plist): - """This writes the PkgInfo file from the data stored in Info.plist.""" - plist = plistlib.readPlist(info_plist) - if not plist: - return - - # Only create PkgInfo for executable types. - package_type = plist["CFBundlePackageType"] - if package_type != "APPL": - return - - # The format of PkgInfo is eight characters, representing the bundle type - # and bundle signature, each four characters. If that is missing, four - # '?' characters are used instead. - signature_code = plist.get("CFBundleSignature", "????") - if len(signature_code) != 4: # Wrong length resets everything, too. - signature_code = "?" * 4 - - dest = os.path.join(os.path.dirname(info_plist), "PkgInfo") - with open(dest, "w") as fp: - fp.write(f"{package_type}{signature_code}") - - def ExecFlock(self, lockfile, *cmd_list): - """Emulates the most basic behavior of Linux's flock(1).""" - # Rely on exception handling to report errors. - fd = os.open(lockfile, os.O_RDONLY | os.O_NOCTTY | os.O_CREAT, 0o666) - fcntl.flock(fd, fcntl.LOCK_EX) - return subprocess.call(cmd_list) - - def ExecFilterLibtool(self, *cmd_list): - """Calls libtool and filters out '/path/to/libtool: file: foo.o has no - symbols'.""" - libtool_re = re.compile( - r"^.*libtool: (?:for architecture: \S* )?" r"file: .* has no symbols$" - ) - libtool_re5 = re.compile( - r"^.*libtool: warning for library: " - + r".* the table of contents is empty " - + r"\(no object file members in the library define global symbols\)$" - ) - env = os.environ.copy() - # Ref: - # http://www.opensource.apple.com/source/cctools/cctools-809/misc/libtool.c - # The problem with this flag is that it resets the file mtime on the file to - # epoch=0, e.g. 1970-1-1 or 1969-12-31 depending on timezone. - env["ZERO_AR_DATE"] = "1" - libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env) - err = libtoolout.communicate()[1].decode("utf-8") - for line in err.splitlines(): - if not libtool_re.match(line) and not libtool_re5.match(line): - print(line, file=sys.stderr) - # Unconditionally touch the output .a file on the command line if present - # and the command succeeded. A bit hacky. - if not libtoolout.returncode: - for i in range(len(cmd_list) - 1): - if cmd_list[i] == "-o" and cmd_list[i + 1].endswith(".a"): - os.utime(cmd_list[i + 1], None) - break - return libtoolout.returncode - - def ExecPackageIosFramework(self, framework): - # Find the name of the binary based on the part before the ".framework". - binary = os.path.basename(framework).split(".")[0] - module_path = os.path.join(framework, "Modules") - if not os.path.exists(module_path): - os.mkdir(module_path) - module_template = ( - "framework module %s {\n" - ' umbrella header "%s.h"\n' - "\n" - " export *\n" - " module * { export * }\n" - "}\n" % (binary, binary) - ) - - with open(os.path.join(module_path, "module.modulemap"), "w") as module_file: - module_file.write(module_template) - - def ExecPackageFramework(self, framework, version): - """Takes a path to Something.framework and the Current version of that and - sets up all the symlinks.""" - # Find the name of the binary based on the part before the ".framework". - binary = os.path.basename(framework).split(".")[0] - - CURRENT = "Current" - RESOURCES = "Resources" - VERSIONS = "Versions" - - if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)): - # Binary-less frameworks don't seem to contain symlinks (see e.g. - # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle). - return - - # Move into the framework directory to set the symlinks correctly. - pwd = os.getcwd() - os.chdir(framework) - - # Set up the Current version. - self._Relink(version, os.path.join(VERSIONS, CURRENT)) - - # Set up the root symlinks. - self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary) - self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES) - - # Back to where we were before! - os.chdir(pwd) - - def _Relink(self, dest, link): - """Creates a symlink to |dest| named |link|. If |link| already exists, - it is overwritten.""" - if os.path.lexists(link): - os.remove(link) - os.symlink(dest, link) - - def ExecCompileIosFrameworkHeaderMap(self, out, framework, *all_headers): - framework_name = os.path.basename(framework).split(".")[0] - all_headers = [os.path.abspath(header) for header in all_headers] - filelist = {} - for header in all_headers: - filename = os.path.basename(header) - filelist[filename] = header - filelist[os.path.join(framework_name, filename)] = header - WriteHmap(out, filelist) - - def ExecCopyIosFrameworkHeaders(self, framework, *copy_headers): - header_path = os.path.join(framework, "Headers") - if not os.path.exists(header_path): - os.makedirs(header_path) - for header in copy_headers: - shutil.copy(header, os.path.join(header_path, os.path.basename(header))) - - def ExecCompileXcassets(self, keys, *inputs): - """Compiles multiple .xcassets files into a single .car file. - - This invokes 'actool' to compile all the inputs .xcassets files. The - |keys| arguments is a json-encoded dictionary of extra arguments to - pass to 'actool' when the asset catalogs contains an application icon - or a launch image. - - Note that 'actool' does not create the Assets.car file if the asset - catalogs does not contains imageset. - """ - command_line = [ - "xcrun", - "actool", - "--output-format", - "human-readable-text", - "--compress-pngs", - "--notices", - "--warnings", - "--errors", - ] - is_iphone_target = "IPHONEOS_DEPLOYMENT_TARGET" in os.environ - if is_iphone_target: - platform = os.environ["CONFIGURATION"].split("-")[-1] - if platform not in ("iphoneos", "iphonesimulator"): - platform = "iphonesimulator" - command_line.extend( - [ - "--platform", - platform, - "--target-device", - "iphone", - "--target-device", - "ipad", - "--minimum-deployment-target", - os.environ["IPHONEOS_DEPLOYMENT_TARGET"], - "--compile", - os.path.abspath(os.environ["CONTENTS_FOLDER_PATH"]), - ] - ) - else: - command_line.extend( - [ - "--platform", - "macosx", - "--target-device", - "mac", - "--minimum-deployment-target", - os.environ["MACOSX_DEPLOYMENT_TARGET"], - "--compile", - os.path.abspath(os.environ["UNLOCALIZED_RESOURCES_FOLDER_PATH"]), - ] - ) - if keys: - keys = json.loads(keys) - for key, value in keys.items(): - arg_name = "--" + key - if isinstance(value, bool): - if value: - command_line.append(arg_name) - elif isinstance(value, list): - for v in value: - command_line.append(arg_name) - command_line.append(str(v)) - else: - command_line.append(arg_name) - command_line.append(str(value)) - # Note: actool crashes if inputs path are relative, so use os.path.abspath - # to get absolute path name for inputs. - command_line.extend(map(os.path.abspath, inputs)) - subprocess.check_call(command_line) - - def ExecMergeInfoPlist(self, output, *inputs): - """Merge multiple .plist files into a single .plist file.""" - merged_plist = {} - for path in inputs: - plist = self._LoadPlistMaybeBinary(path) - self._MergePlist(merged_plist, plist) - plistlib.writePlist(merged_plist, output) - - def ExecCodeSignBundle(self, key, entitlements, provisioning, path, preserve): - """Code sign a bundle. - - This function tries to code sign an iOS bundle, following the same - algorithm as Xcode: - 1. pick the provisioning profile that best match the bundle identifier, - and copy it into the bundle as embedded.mobileprovision, - 2. copy Entitlements.plist from user or SDK next to the bundle, - 3. code sign the bundle. - """ - substitutions, overrides = self._InstallProvisioningProfile( - provisioning, self._GetCFBundleIdentifier() - ) - entitlements_path = self._InstallEntitlements( - entitlements, substitutions, overrides - ) - - args = ["codesign", "--force", "--sign", key] - if preserve == "True": - args.extend(["--deep", "--preserve-metadata=identifier,entitlements"]) - else: - args.extend(["--entitlements", entitlements_path]) - args.extend(["--timestamp=none", path]) - subprocess.check_call(args) - - def _InstallProvisioningProfile(self, profile, bundle_identifier): - """Installs embedded.mobileprovision into the bundle. - - Args: - profile: string, optional, short name of the .mobileprovision file - to use, if empty or the file is missing, the best file installed - will be used - bundle_identifier: string, value of CFBundleIdentifier from Info.plist - - Returns: - A tuple containing two dictionary: variables substitutions and values - to overrides when generating the entitlements file. - """ - source_path, provisioning_data, team_id = self._FindProvisioningProfile( - profile, bundle_identifier - ) - target_path = os.path.join( - os.environ["BUILT_PRODUCTS_DIR"], - os.environ["CONTENTS_FOLDER_PATH"], - "embedded.mobileprovision", - ) - shutil.copy2(source_path, target_path) - substitutions = self._GetSubstitutions(bundle_identifier, team_id + ".") - return substitutions, provisioning_data["Entitlements"] - - def _FindProvisioningProfile(self, profile, bundle_identifier): - """Finds the .mobileprovision file to use for signing the bundle. - - Checks all the installed provisioning profiles (or if the user specified - the PROVISIONING_PROFILE variable, only consult it) and select the most - specific that correspond to the bundle identifier. - - Args: - profile: string, optional, short name of the .mobileprovision file - to use, if empty or the file is missing, the best file installed - will be used - bundle_identifier: string, value of CFBundleIdentifier from Info.plist - - Returns: - A tuple of the path to the selected provisioning profile, the data of - the embedded plist in the provisioning profile and the team identifier - to use for code signing. - - Raises: - SystemExit: if no .mobileprovision can be used to sign the bundle. - """ - profiles_dir = os.path.join( - os.environ["HOME"], "Library", "MobileDevice", "Provisioning Profiles" - ) - if not os.path.isdir(profiles_dir): - print( - "cannot find mobile provisioning for %s" % (bundle_identifier), - file=sys.stderr, - ) - sys.exit(1) - provisioning_profiles = None - if profile: - profile_path = os.path.join(profiles_dir, profile + ".mobileprovision") - if os.path.exists(profile_path): - provisioning_profiles = [profile_path] - if not provisioning_profiles: - provisioning_profiles = glob.glob( - os.path.join(profiles_dir, "*.mobileprovision") - ) - valid_provisioning_profiles = {} - for profile_path in provisioning_profiles: - profile_data = self._LoadProvisioningProfile(profile_path) - app_id_pattern = profile_data.get("Entitlements", {}).get( - "application-identifier", "" - ) - for team_identifier in profile_data.get("TeamIdentifier", []): - app_id = f"{team_identifier}.{bundle_identifier}" - if fnmatch.fnmatch(app_id, app_id_pattern): - valid_provisioning_profiles[app_id_pattern] = ( - profile_path, - profile_data, - team_identifier, - ) - if not valid_provisioning_profiles: - print( - "cannot find mobile provisioning for %s" % (bundle_identifier), - file=sys.stderr, - ) - sys.exit(1) - # If the user has multiple provisioning profiles installed that can be - # used for ${bundle_identifier}, pick the most specific one (ie. the - # provisioning profile whose pattern is the longest). - selected_key = max(valid_provisioning_profiles, key=lambda v: len(v)) - return valid_provisioning_profiles[selected_key] - - def _LoadProvisioningProfile(self, profile_path): - """Extracts the plist embedded in a provisioning profile. - - Args: - profile_path: string, path to the .mobileprovision file - - Returns: - Content of the plist embedded in the provisioning profile as a dictionary. - """ - with tempfile.NamedTemporaryFile() as temp: - subprocess.check_call( - ["security", "cms", "-D", "-i", profile_path, "-o", temp.name] - ) - return self._LoadPlistMaybeBinary(temp.name) - - def _MergePlist(self, merged_plist, plist): - """Merge |plist| into |merged_plist|.""" - for key, value in plist.items(): - if isinstance(value, dict): - merged_value = merged_plist.get(key, {}) - if isinstance(merged_value, dict): - self._MergePlist(merged_value, value) - merged_plist[key] = merged_value - else: - merged_plist[key] = value - else: - merged_plist[key] = value - - def _LoadPlistMaybeBinary(self, plist_path): - """Loads into a memory a plist possibly encoded in binary format. - - This is a wrapper around plistlib.readPlist that tries to convert the - plist to the XML format if it can't be parsed (assuming that it is in - the binary format). - - Args: - plist_path: string, path to a plist file, in XML or binary format - - Returns: - Content of the plist as a dictionary. - """ - try: - # First, try to read the file using plistlib that only supports XML, - # and if an exception is raised, convert a temporary copy to XML and - # load that copy. - return plistlib.readPlist(plist_path) - except Exception: - pass - with tempfile.NamedTemporaryFile() as temp: - shutil.copy2(plist_path, temp.name) - subprocess.check_call(["plutil", "-convert", "xml1", temp.name]) - return plistlib.readPlist(temp.name) - - def _GetSubstitutions(self, bundle_identifier, app_identifier_prefix): - """Constructs a dictionary of variable substitutions for Entitlements.plist. - - Args: - bundle_identifier: string, value of CFBundleIdentifier from Info.plist - app_identifier_prefix: string, value for AppIdentifierPrefix - - Returns: - Dictionary of substitutions to apply when generating Entitlements.plist. - """ - return { - "CFBundleIdentifier": bundle_identifier, - "AppIdentifierPrefix": app_identifier_prefix, - } - - def _GetCFBundleIdentifier(self): - """Extracts CFBundleIdentifier value from Info.plist in the bundle. - - Returns: - Value of CFBundleIdentifier in the Info.plist located in the bundle. - """ - info_plist_path = os.path.join( - os.environ["TARGET_BUILD_DIR"], os.environ["INFOPLIST_PATH"] - ) - info_plist_data = self._LoadPlistMaybeBinary(info_plist_path) - return info_plist_data["CFBundleIdentifier"] - - def _InstallEntitlements(self, entitlements, substitutions, overrides): - """Generates and install the ${BundleName}.xcent entitlements file. - - Expands variables "$(variable)" pattern in the source entitlements file, - add extra entitlements defined in the .mobileprovision file and the copy - the generated plist to "${BundlePath}.xcent". - - Args: - entitlements: string, optional, path to the Entitlements.plist template - to use, defaults to "${SDKROOT}/Entitlements.plist" - substitutions: dictionary, variable substitutions - overrides: dictionary, values to add to the entitlements - - Returns: - Path to the generated entitlements file. - """ - source_path = entitlements - target_path = os.path.join( - os.environ["BUILT_PRODUCTS_DIR"], os.environ["PRODUCT_NAME"] + ".xcent" - ) - if not source_path: - source_path = os.path.join(os.environ["SDKROOT"], "Entitlements.plist") - shutil.copy2(source_path, target_path) - data = self._LoadPlistMaybeBinary(target_path) - data = self._ExpandVariables(data, substitutions) - if overrides: - for key in overrides: - if key not in data: - data[key] = overrides[key] - plistlib.writePlist(data, target_path) - return target_path - - def _ExpandVariables(self, data, substitutions): - """Expands variables "$(variable)" in data. - - Args: - data: object, can be either string, list or dictionary - substitutions: dictionary, variable substitutions to perform - - Returns: - Copy of data where each references to "$(variable)" has been replaced - by the corresponding value found in substitutions, or left intact if - the key was not found. - """ - if isinstance(data, str): - for key, value in substitutions.items(): - data = data.replace("$(%s)" % key, value) - return data - if isinstance(data, list): - return [self._ExpandVariables(v, substitutions) for v in data] - if isinstance(data, dict): - return {k: self._ExpandVariables(data[k], substitutions) for k in data} - return data - - -def NextGreaterPowerOf2(x): - return 2 ** (x).bit_length() - - -def WriteHmap(output_name, filelist): - """Generates a header map based on |filelist|. - - Per Mark Mentovai: - A header map is structured essentially as a hash table, keyed by names used - in #includes, and providing pathnames to the actual files. - - The implementation below and the comment above comes from inspecting: - http://www.opensource.apple.com/source/distcc/distcc-2503/distcc_dist/include_server/headermap.py?txt - while also looking at the implementation in clang in: - https://llvm.org/svn/llvm-project/cfe/trunk/lib/Lex/HeaderMap.cpp - """ - magic = 1751998832 - version = 1 - _reserved = 0 - count = len(filelist) - capacity = NextGreaterPowerOf2(count) - strings_offset = 24 + (12 * capacity) - max_value_length = max(len(value) for value in filelist.values()) - - out = open(output_name, "wb") - out.write( - struct.pack( - " 0 or arg.count("/") > 1: - arg = os.path.normpath(arg) - - # For a literal quote, CommandLineToArgvW requires 2n+1 backslashes - # preceding it, and results in n backslashes + the quote. So we substitute - # in 2* what we match, +1 more, plus the quote. - if quote_cmd: - arg = windows_quoter_regex.sub(lambda mo: 2 * mo.group(1) + '\\"', arg) - - # %'s also need to be doubled otherwise they're interpreted as batch - # positional arguments. Also make sure to escape the % so that they're - # passed literally through escaping so they can be singled to just the - # original %. Otherwise, trying to pass the literal representation that - # looks like an environment variable to the shell (e.g. %PATH%) would fail. - arg = arg.replace("%", "%%") - - # These commands are used in rsp files, so no escaping for the shell (via ^) - # is necessary. - - # As a workaround for programs that don't use CommandLineToArgvW, gyp - # supports msvs_quote_cmd=0, which simply disables all quoting. - if quote_cmd: - # Finally, wrap the whole thing in quotes so that the above quote rule - # applies and whitespace isn't a word break. - return f'"{arg}"' - - return arg - - -def EncodeRspFileList(args, quote_cmd): - """Process a list of arguments using QuoteCmdExeArgument.""" - # Note that the first argument is assumed to be the command. Don't add - # quotes around it because then built-ins like 'echo', etc. won't work. - # Take care to normpath only the path in the case of 'call ../x.bat' because - # otherwise the whole thing is incorrectly interpreted as a path and not - # normalized correctly. - if not args: - return "" - if args[0].startswith("call "): - call, program = args[0].split(" ", 1) - program = call + " " + os.path.normpath(program) - else: - program = os.path.normpath(args[0]) - return (program + " " - + " ".join(QuoteForRspFile(arg, quote_cmd) for arg in args[1:])) - - -def _GenericRetrieve(root, default, path): - """Given a list of dictionary keys |path| and a tree of dicts |root|, find - value at path, or return |default| if any of the path doesn't exist.""" - if not root: - return default - if not path: - return root - return _GenericRetrieve(root.get(path[0]), default, path[1:]) - - -def _AddPrefix(element, prefix): - """Add |prefix| to |element| or each subelement if element is iterable.""" - if element is None: - return element - # Note, not Iterable because we don't want to handle strings like that. - if isinstance(element, list) or isinstance(element, tuple): - return [prefix + e for e in element] - else: - return prefix + element - - -def _DoRemapping(element, map): - """If |element| then remap it through |map|. If |element| is iterable then - each item will be remapped. Any elements not found will be removed.""" - if map is not None and element is not None: - if not callable(map): - map = map.get # Assume it's a dict, otherwise a callable to do the remap. - if isinstance(element, list) or isinstance(element, tuple): - element = filter(None, [map(elem) for elem in element]) - else: - element = map(element) - return element - - -def _AppendOrReturn(append, element): - """If |append| is None, simply return |element|. If |append| is not None, - then add |element| to it, adding each item in |element| if it's a list or - tuple.""" - if append is not None and element is not None: - if isinstance(element, list) or isinstance(element, tuple): - append.extend(element) - else: - append.append(element) - else: - return element - - -def _FindDirectXInstallation(): - """Try to find an installation location for the DirectX SDK. Check for the - standard environment variable, and if that doesn't exist, try to find - via the registry. May return None if not found in either location.""" - # Return previously calculated value, if there is one - if hasattr(_FindDirectXInstallation, "dxsdk_dir"): - return _FindDirectXInstallation.dxsdk_dir - - dxsdk_dir = os.environ.get("DXSDK_DIR") - if not dxsdk_dir: - # Setup params to pass to and attempt to launch reg.exe. - cmd = ["reg.exe", "query", r"HKLM\Software\Microsoft\DirectX", "/s"] - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout = p.communicate()[0].decode("utf-8") - for line in stdout.splitlines(): - if "InstallPath" in line: - dxsdk_dir = line.split(" ")[3] + "\\" - - # Cache return value - _FindDirectXInstallation.dxsdk_dir = dxsdk_dir - return dxsdk_dir - - -def GetGlobalVSMacroEnv(vs_version): - """Get a dict of variables mapping internal VS macro names to their gyp - equivalents. Returns all variables that are independent of the target.""" - env = {} - # '$(VSInstallDir)' and '$(VCInstallDir)' are available when and only when - # Visual Studio is actually installed. - if vs_version.Path(): - env["$(VSInstallDir)"] = vs_version.Path() - env["$(VCInstallDir)"] = os.path.join(vs_version.Path(), "VC") + "\\" - # Chromium uses DXSDK_DIR in include/lib paths, but it may or may not be - # set. This happens when the SDK is sync'd via src-internal, rather than - # by typical end-user installation of the SDK. If it's not set, we don't - # want to leave the unexpanded variable in the path, so simply strip it. - dxsdk_dir = _FindDirectXInstallation() - env["$(DXSDK_DIR)"] = dxsdk_dir if dxsdk_dir else "" - # Try to find an installation location for the Windows DDK by checking - # the WDK_DIR environment variable, may be None. - env["$(WDK_DIR)"] = os.environ.get("WDK_DIR", "") - return env - - -def ExtractSharedMSVSSystemIncludes(configs, generator_flags): - """Finds msvs_system_include_dirs that are common to all targets, removes - them from all targets, and returns an OrderedSet containing them.""" - all_system_includes = OrderedSet(configs[0].get("msvs_system_include_dirs", [])) - for config in configs[1:]: - system_includes = config.get("msvs_system_include_dirs", []) - all_system_includes = all_system_includes & OrderedSet(system_includes) - if not all_system_includes: - return None - # Expand macros in all_system_includes. - env = GetGlobalVSMacroEnv(GetVSVersion(generator_flags)) - expanded_system_includes = OrderedSet( - [ExpandMacros(include, env) for include in all_system_includes] - ) - if any(["$" in include for include in expanded_system_includes]): - # Some path relies on target-specific variables, bail. - return None - - # Remove system includes shared by all targets from the targets. - for config in configs: - includes = config.get("msvs_system_include_dirs", []) - if includes: # Don't insert a msvs_system_include_dirs key if not needed. - # This must check the unexpanded includes list: - new_includes = [i for i in includes if i not in all_system_includes] - config["msvs_system_include_dirs"] = new_includes - return expanded_system_includes - - -class MsvsSettings: - """A class that understands the gyp 'msvs_...' values (especially the - msvs_settings field). They largely correpond to the VS2008 IDE DOM. This - class helps map those settings to command line options.""" - - def __init__(self, spec, generator_flags): - self.spec = spec - self.vs_version = GetVSVersion(generator_flags) - - supported_fields = [ - ("msvs_configuration_attributes", dict), - ("msvs_settings", dict), - ("msvs_system_include_dirs", list), - ("msvs_disabled_warnings", list), - ("msvs_precompiled_header", str), - ("msvs_precompiled_source", str), - ("msvs_configuration_platform", str), - ("msvs_target_platform", str), - ] - configs = spec["configurations"] - for field, default in supported_fields: - setattr(self, field, {}) - for configname, config in configs.items(): - getattr(self, field)[configname] = config.get(field, default()) - - self.msvs_cygwin_dirs = spec.get("msvs_cygwin_dirs", ["."]) - - unsupported_fields = [ - "msvs_prebuild", - "msvs_postbuild", - ] - unsupported = [] - for field in unsupported_fields: - for config in configs.values(): - if field in config: - unsupported += [ - "{} not supported (target {}).".format( - field, spec["target_name"] - ) - ] - if unsupported: - raise Exception("\n".join(unsupported)) - - def GetExtension(self): - """Returns the extension for the target, with no leading dot. - - Uses 'product_extension' if specified, otherwise uses MSVS defaults based on - the target type. - """ - ext = self.spec.get("product_extension", None) - if ext: - return ext - return gyp.MSVSUtil.TARGET_TYPE_EXT.get(self.spec["type"], "") - - def GetVSMacroEnv(self, base_to_build=None, config=None): - """Get a dict of variables mapping internal VS macro names to their gyp - equivalents.""" - target_arch = self.GetArch(config) - if target_arch == "x86": - target_platform = "Win32" - else: - target_platform = target_arch - target_name = self.spec.get("product_prefix", "") + self.spec.get( - "product_name", self.spec["target_name"] - ) - target_dir = base_to_build + "\\" if base_to_build else "" - target_ext = "." + self.GetExtension() - target_file_name = target_name + target_ext - - replacements = { - "$(InputName)": "${root}", - "$(InputPath)": "${source}", - "$(IntDir)": "$!INTERMEDIATE_DIR", - "$(OutDir)\\": target_dir, - "$(PlatformName)": target_platform, - "$(ProjectDir)\\": "", - "$(ProjectName)": self.spec["target_name"], - "$(TargetDir)\\": target_dir, - "$(TargetExt)": target_ext, - "$(TargetFileName)": target_file_name, - "$(TargetName)": target_name, - "$(TargetPath)": os.path.join(target_dir, target_file_name), - } - replacements.update(GetGlobalVSMacroEnv(self.vs_version)) - return replacements - - def ConvertVSMacros(self, s, base_to_build=None, config=None): - """Convert from VS macro names to something equivalent.""" - env = self.GetVSMacroEnv(base_to_build, config=config) - return ExpandMacros(s, env) - - def AdjustLibraries(self, libraries): - """Strip -l from library if it's specified with that.""" - libs = [lib[2:] if lib.startswith("-l") else lib for lib in libraries] - return [ - lib + ".lib" - if not lib.lower().endswith(".lib") and not lib.lower().endswith(".obj") - else lib - for lib in libs - ] - - def _GetAndMunge(self, field, path, default, prefix, append, map): - """Retrieve a value from |field| at |path| or return |default|. If - |append| is specified, and the item is found, it will be appended to that - object instead of returned. If |map| is specified, results will be - remapped through |map| before being returned or appended.""" - result = _GenericRetrieve(field, default, path) - result = _DoRemapping(result, map) - result = _AddPrefix(result, prefix) - return _AppendOrReturn(append, result) - - class _GetWrapper: - def __init__(self, parent, field, base_path, append=None): - self.parent = parent - self.field = field - self.base_path = [base_path] - self.append = append - - def __call__(self, name, map=None, prefix="", default=None): - return self.parent._GetAndMunge( - self.field, - self.base_path + [name], - default=default, - prefix=prefix, - append=self.append, - map=map, - ) - - def GetArch(self, config): - """Get architecture based on msvs_configuration_platform and - msvs_target_platform. Returns either 'x86' or 'x64'.""" - configuration_platform = self.msvs_configuration_platform.get(config, "") - platform = self.msvs_target_platform.get(config, "") - if not platform: # If no specific override, use the configuration's. - platform = configuration_platform - # Map from platform to architecture. - return {"Win32": "x86", "x64": "x64", "ARM64": "arm64"}.get(platform, "x86") - - def _TargetConfig(self, config): - """Returns the target-specific configuration.""" - # There's two levels of architecture/platform specification in VS. The - # first level is globally for the configuration (this is what we consider - # "the" config at the gyp level, which will be something like 'Debug' or - # 'Release'), VS2015 and later only use this level - if int(self.vs_version.short_name) >= 2015: - return config - # and a second target-specific configuration, which is an - # override for the global one. |config| is remapped here to take into - # account the local target-specific overrides to the global configuration. - arch = self.GetArch(config) - if arch == "x64" and not config.endswith("_x64"): - config += "_x64" - if arch == "x86" and config.endswith("_x64"): - config = config.rsplit("_", 1)[0] - return config - - def _Setting(self, path, config, default=None, prefix="", append=None, map=None): - """_GetAndMunge for msvs_settings.""" - return self._GetAndMunge( - self.msvs_settings[config], path, default, prefix, append, map - ) - - def _ConfigAttrib( - self, path, config, default=None, prefix="", append=None, map=None - ): - """_GetAndMunge for msvs_configuration_attributes.""" - return self._GetAndMunge( - self.msvs_configuration_attributes[config], - path, - default, - prefix, - append, - map, - ) - - def AdjustIncludeDirs(self, include_dirs, config): - """Updates include_dirs to expand VS specific paths, and adds the system - include dirs used for platform SDK and similar.""" - config = self._TargetConfig(config) - includes = include_dirs + self.msvs_system_include_dirs[config] - includes.extend( - self._Setting( - ("VCCLCompilerTool", "AdditionalIncludeDirectories"), config, default=[] - ) - ) - return [self.ConvertVSMacros(p, config=config) for p in includes] - - def AdjustMidlIncludeDirs(self, midl_include_dirs, config): - """Updates midl_include_dirs to expand VS specific paths, and adds the - system include dirs used for platform SDK and similar.""" - config = self._TargetConfig(config) - includes = midl_include_dirs + self.msvs_system_include_dirs[config] - includes.extend( - self._Setting( - ("VCMIDLTool", "AdditionalIncludeDirectories"), config, default=[] - ) - ) - return [self.ConvertVSMacros(p, config=config) for p in includes] - - def GetComputedDefines(self, config): - """Returns the set of defines that are injected to the defines list based - on other VS settings.""" - config = self._TargetConfig(config) - defines = [] - if self._ConfigAttrib(["CharacterSet"], config) == "1": - defines.extend(("_UNICODE", "UNICODE")) - if self._ConfigAttrib(["CharacterSet"], config) == "2": - defines.append("_MBCS") - defines.extend( - self._Setting( - ("VCCLCompilerTool", "PreprocessorDefinitions"), config, default=[] - ) - ) - return defines - - def GetCompilerPdbName(self, config, expand_special): - """Get the pdb file name that should be used for compiler invocations, or - None if there's no explicit name specified.""" - config = self._TargetConfig(config) - pdbname = self._Setting(("VCCLCompilerTool", "ProgramDataBaseFileName"), config) - if pdbname: - pdbname = expand_special(self.ConvertVSMacros(pdbname)) - return pdbname - - def GetMapFileName(self, config, expand_special): - """Gets the explicitly overridden map file name for a target or returns None - if it's not set.""" - config = self._TargetConfig(config) - map_file = self._Setting(("VCLinkerTool", "MapFileName"), config) - if map_file: - map_file = expand_special(self.ConvertVSMacros(map_file, config=config)) - return map_file - - def GetOutputName(self, config, expand_special): - """Gets the explicitly overridden output name for a target or returns None - if it's not overridden.""" - config = self._TargetConfig(config) - type = self.spec["type"] - root = "VCLibrarianTool" if type == "static_library" else "VCLinkerTool" - # TODO(scottmg): Handle OutputDirectory without OutputFile. - output_file = self._Setting((root, "OutputFile"), config) - if output_file: - output_file = expand_special( - self.ConvertVSMacros(output_file, config=config) - ) - return output_file - - def GetPDBName(self, config, expand_special, default): - """Gets the explicitly overridden pdb name for a target or returns - default if it's not overridden, or if no pdb will be generated.""" - config = self._TargetConfig(config) - output_file = self._Setting(("VCLinkerTool", "ProgramDatabaseFile"), config) - generate_debug_info = self._Setting( - ("VCLinkerTool", "GenerateDebugInformation"), config - ) - if generate_debug_info == "true": - if output_file: - return expand_special(self.ConvertVSMacros(output_file, config=config)) - else: - return default - else: - return None - - def GetNoImportLibrary(self, config): - """If NoImportLibrary: true, ninja will not expect the output to include - an import library.""" - config = self._TargetConfig(config) - noimplib = self._Setting(("NoImportLibrary",), config) - return noimplib == "true" - - def GetAsmflags(self, config): - """Returns the flags that need to be added to ml invocations.""" - config = self._TargetConfig(config) - asmflags = [] - safeseh = self._Setting(("MASM", "UseSafeExceptionHandlers"), config) - if safeseh == "true": - asmflags.append("/safeseh") - return asmflags - - def GetCflags(self, config): - """Returns the flags that need to be added to .c and .cc compilations.""" - config = self._TargetConfig(config) - cflags = [] - cflags.extend(["/wd" + w for w in self.msvs_disabled_warnings[config]]) - cl = self._GetWrapper( - self, self.msvs_settings[config], "VCCLCompilerTool", append=cflags - ) - cl( - "Optimization", - map={"0": "d", "1": "1", "2": "2", "3": "x"}, - prefix="/O", - default="2", - ) - cl("InlineFunctionExpansion", prefix="/Ob") - cl("DisableSpecificWarnings", prefix="/wd") - cl("StringPooling", map={"true": "/GF"}) - cl("EnableFiberSafeOptimizations", map={"true": "/GT"}) - cl("OmitFramePointers", map={"false": "-", "true": ""}, prefix="/Oy") - cl("EnableIntrinsicFunctions", map={"false": "-", "true": ""}, prefix="/Oi") - cl("FavorSizeOrSpeed", map={"1": "t", "2": "s"}, prefix="/O") - cl( - "FloatingPointModel", - map={"0": "precise", "1": "strict", "2": "fast"}, - prefix="/fp:", - default="0", - ) - cl("CompileAsManaged", map={"false": "", "true": "/clr"}) - cl("WholeProgramOptimization", map={"true": "/GL"}) - cl("WarningLevel", prefix="/W") - cl("WarnAsError", map={"true": "/WX"}) - cl( - "CallingConvention", - map={"0": "d", "1": "r", "2": "z", "3": "v"}, - prefix="/G", - ) - cl("DebugInformationFormat", map={"1": "7", "3": "i", "4": "I"}, prefix="/Z") - cl("RuntimeTypeInfo", map={"true": "/GR", "false": "/GR-"}) - cl("EnableFunctionLevelLinking", map={"true": "/Gy", "false": "/Gy-"}) - cl("MinimalRebuild", map={"true": "/Gm"}) - cl("BufferSecurityCheck", map={"true": "/GS", "false": "/GS-"}) - cl("BasicRuntimeChecks", map={"1": "s", "2": "u", "3": "1"}, prefix="/RTC") - cl( - "RuntimeLibrary", - map={"0": "T", "1": "Td", "2": "D", "3": "Dd"}, - prefix="/M", - ) - cl("ExceptionHandling", map={"1": "sc", "2": "a"}, prefix="/EH") - cl("DefaultCharIsUnsigned", map={"true": "/J"}) - cl( - "TreatWChar_tAsBuiltInType", - map={"false": "-", "true": ""}, - prefix="/Zc:wchar_t", - ) - cl("EnablePREfast", map={"true": "/analyze"}) - cl("AdditionalOptions", prefix="") - cl( - "EnableEnhancedInstructionSet", - map={"1": "SSE", "2": "SSE2", "3": "AVX", "4": "IA32", "5": "AVX2"}, - prefix="/arch:", - ) - cflags.extend( - [ - "/FI" + f - for f in self._Setting( - ("VCCLCompilerTool", "ForcedIncludeFiles"), config, default=[] - ) - ] - ) - if float(self.vs_version.project_version) >= 12.0: - # New flag introduced in VS2013 (project version 12.0) Forces writes to - # the program database (PDB) to be serialized through MSPDBSRV.EXE. - # https://msdn.microsoft.com/en-us/library/dn502518.aspx - cflags.append("/FS") - # ninja handles parallelism by itself, don't have the compiler do it too. - cflags = [x for x in cflags if not x.startswith("/MP")] - return cflags - - def _GetPchFlags(self, config, extension): - """Get the flags to be added to the cflags for precompiled header support.""" - config = self._TargetConfig(config) - # The PCH is only built once by a particular source file. Usage of PCH must - # only be for the same language (i.e. C vs. C++), so only include the pch - # flags when the language matches. - if self.msvs_precompiled_header[config]: - source_ext = os.path.splitext(self.msvs_precompiled_source[config])[1] - if _LanguageMatchesForPch(source_ext, extension): - pch = self.msvs_precompiled_header[config] - pchbase = os.path.split(pch)[1] - return ["/Yu" + pch, "/FI" + pch, "/Fp${pchprefix}." + pchbase + ".pch"] - return [] - - def GetCflagsC(self, config): - """Returns the flags that need to be added to .c compilations.""" - config = self._TargetConfig(config) - return self._GetPchFlags(config, ".c") - - def GetCflagsCC(self, config): - """Returns the flags that need to be added to .cc compilations.""" - config = self._TargetConfig(config) - return ["/TP"] + self._GetPchFlags(config, ".cc") - - def _GetAdditionalLibraryDirectories(self, root, config, gyp_to_build_path): - """Get and normalize the list of paths in AdditionalLibraryDirectories - setting.""" - config = self._TargetConfig(config) - libpaths = self._Setting( - (root, "AdditionalLibraryDirectories"), config, default=[] - ) - libpaths = [ - os.path.normpath(gyp_to_build_path(self.ConvertVSMacros(p, config=config))) - for p in libpaths - ] - return ['/LIBPATH:"' + p + '"' for p in libpaths] - - def GetLibFlags(self, config, gyp_to_build_path): - """Returns the flags that need to be added to lib commands.""" - config = self._TargetConfig(config) - libflags = [] - lib = self._GetWrapper( - self, self.msvs_settings[config], "VCLibrarianTool", append=libflags - ) - libflags.extend( - self._GetAdditionalLibraryDirectories( - "VCLibrarianTool", config, gyp_to_build_path - ) - ) - lib("LinkTimeCodeGeneration", map={"true": "/LTCG"}) - lib( - "TargetMachine", - map={"1": "X86", "17": "X64", "3": "ARM"}, - prefix="/MACHINE:", - ) - lib("AdditionalOptions") - return libflags - - def GetDefFile(self, gyp_to_build_path): - """Returns the .def file from sources, if any. Otherwise returns None.""" - spec = self.spec - if spec["type"] in ("shared_library", "loadable_module", "executable"): - def_files = [ - s for s in spec.get("sources", []) if s.lower().endswith(".def") - ] - if len(def_files) == 1: - return gyp_to_build_path(def_files[0]) - elif len(def_files) > 1: - raise Exception("Multiple .def files") - return None - - def _GetDefFileAsLdflags(self, ldflags, gyp_to_build_path): - """.def files get implicitly converted to a ModuleDefinitionFile for the - linker in the VS generator. Emulate that behaviour here.""" - def_file = self.GetDefFile(gyp_to_build_path) - if def_file: - ldflags.append('/DEF:"%s"' % def_file) - - def GetPGDName(self, config, expand_special): - """Gets the explicitly overridden pgd name for a target or returns None - if it's not overridden.""" - config = self._TargetConfig(config) - output_file = self._Setting(("VCLinkerTool", "ProfileGuidedDatabase"), config) - if output_file: - output_file = expand_special( - self.ConvertVSMacros(output_file, config=config) - ) - return output_file - - def GetLdflags( - self, - config, - gyp_to_build_path, - expand_special, - manifest_base_name, - output_name, - is_executable, - build_dir, - ): - """Returns the flags that need to be added to link commands, and the - manifest files.""" - config = self._TargetConfig(config) - ldflags = [] - ld = self._GetWrapper( - self, self.msvs_settings[config], "VCLinkerTool", append=ldflags - ) - self._GetDefFileAsLdflags(ldflags, gyp_to_build_path) - ld("GenerateDebugInformation", map={"true": "/DEBUG"}) - # TODO: These 'map' values come from machineTypeOption enum, - # and does not have an official value for ARM64 in VS2017 (yet). - # It needs to verify the ARM64 value when machineTypeOption is updated. - ld( - "TargetMachine", - map={"1": "X86", "17": "X64", "3": "ARM", "18": "ARM64"}, - prefix="/MACHINE:", - ) - ldflags.extend( - self._GetAdditionalLibraryDirectories( - "VCLinkerTool", config, gyp_to_build_path - ) - ) - ld("DelayLoadDLLs", prefix="/DELAYLOAD:") - ld("TreatLinkerWarningAsErrors", prefix="/WX", map={"true": "", "false": ":NO"}) - out = self.GetOutputName(config, expand_special) - if out: - ldflags.append("/OUT:" + out) - pdb = self.GetPDBName(config, expand_special, output_name + ".pdb") - if pdb: - ldflags.append("/PDB:" + pdb) - pgd = self.GetPGDName(config, expand_special) - if pgd: - ldflags.append("/PGD:" + pgd) - map_file = self.GetMapFileName(config, expand_special) - ld("GenerateMapFile", map={"true": "/MAP:" + map_file if map_file else "/MAP"}) - ld("MapExports", map={"true": "/MAPINFO:EXPORTS"}) - ld("AdditionalOptions", prefix="") - - minimum_required_version = self._Setting( - ("VCLinkerTool", "MinimumRequiredVersion"), config, default="" - ) - if minimum_required_version: - minimum_required_version = "," + minimum_required_version - ld( - "SubSystem", - map={ - "1": "CONSOLE%s" % minimum_required_version, - "2": "WINDOWS%s" % minimum_required_version, - }, - prefix="/SUBSYSTEM:", - ) - - stack_reserve_size = self._Setting( - ("VCLinkerTool", "StackReserveSize"), config, default="" - ) - if stack_reserve_size: - stack_commit_size = self._Setting( - ("VCLinkerTool", "StackCommitSize"), config, default="" - ) - if stack_commit_size: - stack_commit_size = "," + stack_commit_size - ldflags.append(f"/STACK:{stack_reserve_size}{stack_commit_size}") - - ld("TerminalServerAware", map={"1": ":NO", "2": ""}, prefix="/TSAWARE") - ld("LinkIncremental", map={"1": ":NO", "2": ""}, prefix="/INCREMENTAL") - ld("BaseAddress", prefix="/BASE:") - ld("FixedBaseAddress", map={"1": ":NO", "2": ""}, prefix="/FIXED") - ld("RandomizedBaseAddress", map={"1": ":NO", "2": ""}, prefix="/DYNAMICBASE") - ld("DataExecutionPrevention", map={"1": ":NO", "2": ""}, prefix="/NXCOMPAT") - ld("OptimizeReferences", map={"1": "NOREF", "2": "REF"}, prefix="/OPT:") - ld("ForceSymbolReferences", prefix="/INCLUDE:") - ld("EnableCOMDATFolding", map={"1": "NOICF", "2": "ICF"}, prefix="/OPT:") - ld( - "LinkTimeCodeGeneration", - map={"1": "", "2": ":PGINSTRUMENT", "3": ":PGOPTIMIZE", "4": ":PGUPDATE"}, - prefix="/LTCG", - ) - ld("IgnoreDefaultLibraryNames", prefix="/NODEFAULTLIB:") - ld("ResourceOnlyDLL", map={"true": "/NOENTRY"}) - ld("EntryPointSymbol", prefix="/ENTRY:") - ld("Profile", map={"true": "/PROFILE"}) - ld("LargeAddressAware", map={"1": ":NO", "2": ""}, prefix="/LARGEADDRESSAWARE") - # TODO(scottmg): This should sort of be somewhere else (not really a flag). - ld("AdditionalDependencies", prefix="") - - if self.GetArch(config) == "x86": - safeseh_default = "true" - else: - safeseh_default = None - ld( - "ImageHasSafeExceptionHandlers", - map={"false": ":NO", "true": ""}, - prefix="/SAFESEH", - default=safeseh_default, - ) - - # If the base address is not specifically controlled, DYNAMICBASE should - # be on by default. - if not any("DYNAMICBASE" in flag or flag == "/FIXED" for flag in ldflags): - ldflags.append("/DYNAMICBASE") - - # If the NXCOMPAT flag has not been specified, default to on. Despite the - # documentation that says this only defaults to on when the subsystem is - # Vista or greater (which applies to the linker), the IDE defaults it on - # unless it's explicitly off. - if not any("NXCOMPAT" in flag for flag in ldflags): - ldflags.append("/NXCOMPAT") - - have_def_file = any(flag.startswith("/DEF:") for flag in ldflags) - ( - manifest_flags, - intermediate_manifest, - manifest_files, - ) = self._GetLdManifestFlags( - config, - manifest_base_name, - gyp_to_build_path, - is_executable and not have_def_file, - build_dir, - ) - ldflags.extend(manifest_flags) - return ldflags, intermediate_manifest, manifest_files - - def _GetLdManifestFlags( - self, config, name, gyp_to_build_path, allow_isolation, build_dir - ): - """Returns a 3-tuple: - - the set of flags that need to be added to the link to generate - a default manifest - - the intermediate manifest that the linker will generate that should be - used to assert it doesn't add anything to the merged one. - - the list of all the manifest files to be merged by the manifest tool and - included into the link.""" - generate_manifest = self._Setting( - ("VCLinkerTool", "GenerateManifest"), config, default="true" - ) - if generate_manifest != "true": - # This means not only that the linker should not generate the intermediate - # manifest but also that the manifest tool should do nothing even when - # additional manifests are specified. - return ["/MANIFEST:NO"], [], [] - - output_name = name + ".intermediate.manifest" - flags = [ - "/MANIFEST", - "/ManifestFile:" + output_name, - ] - - # Instead of using the MANIFESTUAC flags, we generate a .manifest to - # include into the list of manifests. This allows us to avoid the need to - # do two passes during linking. The /MANIFEST flag and /ManifestFile are - # still used, and the intermediate manifest is used to assert that the - # final manifest we get from merging all the additional manifest files - # (plus the one we generate here) isn't modified by merging the - # intermediate into it. - - # Always NO, because we generate a manifest file that has what we want. - flags.append("/MANIFESTUAC:NO") - - config = self._TargetConfig(config) - enable_uac = self._Setting( - ("VCLinkerTool", "EnableUAC"), config, default="true" - ) - manifest_files = [] - generated_manifest_outer = ( - "" - "" - "%s" - ) - if enable_uac == "true": - execution_level = self._Setting( - ("VCLinkerTool", "UACExecutionLevel"), config, default="0" - ) - execution_level_map = { - "0": "asInvoker", - "1": "highestAvailable", - "2": "requireAdministrator", - } - - ui_access = self._Setting( - ("VCLinkerTool", "UACUIAccess"), config, default="false" - ) - - inner = """ - - - - - - -""".format( - execution_level_map[execution_level], - ui_access, - ) - else: - inner = "" - - generated_manifest_contents = generated_manifest_outer % inner - generated_name = name + ".generated.manifest" - # Need to join with the build_dir here as we're writing it during - # generation time, but we return the un-joined version because the build - # will occur in that directory. We only write the file if the contents - # have changed so that simply regenerating the project files doesn't - # cause a relink. - build_dir_generated_name = os.path.join(build_dir, generated_name) - gyp.common.EnsureDirExists(build_dir_generated_name) - f = gyp.common.WriteOnDiff(build_dir_generated_name) - f.write(generated_manifest_contents) - f.close() - manifest_files = [generated_name] - - if allow_isolation: - flags.append("/ALLOWISOLATION") - - manifest_files += self._GetAdditionalManifestFiles(config, gyp_to_build_path) - return flags, output_name, manifest_files - - def _GetAdditionalManifestFiles(self, config, gyp_to_build_path): - """Gets additional manifest files that are added to the default one - generated by the linker.""" - files = self._Setting( - ("VCManifestTool", "AdditionalManifestFiles"), config, default=[] - ) - if isinstance(files, str): - files = files.split(";") - return [ - os.path.normpath(gyp_to_build_path(self.ConvertVSMacros(f, config=config))) - for f in files - ] - - def IsUseLibraryDependencyInputs(self, config): - """Returns whether the target should be linked via Use Library Dependency - Inputs (using component .objs of a given .lib).""" - config = self._TargetConfig(config) - uldi = self._Setting(("VCLinkerTool", "UseLibraryDependencyInputs"), config) - return uldi == "true" - - def IsEmbedManifest(self, config): - """Returns whether manifest should be linked into binary.""" - config = self._TargetConfig(config) - embed = self._Setting( - ("VCManifestTool", "EmbedManifest"), config, default="true" - ) - return embed == "true" - - def IsLinkIncremental(self, config): - """Returns whether the target should be linked incrementally.""" - config = self._TargetConfig(config) - link_inc = self._Setting(("VCLinkerTool", "LinkIncremental"), config) - return link_inc != "1" - - def GetRcflags(self, config, gyp_to_ninja_path): - """Returns the flags that need to be added to invocations of the resource - compiler.""" - config = self._TargetConfig(config) - rcflags = [] - rc = self._GetWrapper( - self, self.msvs_settings[config], "VCResourceCompilerTool", append=rcflags - ) - rc("AdditionalIncludeDirectories", map=gyp_to_ninja_path, prefix="/I") - rcflags.append("/I" + gyp_to_ninja_path(".")) - rc("PreprocessorDefinitions", prefix="/d") - # /l arg must be in hex without leading '0x' - rc("Culture", prefix="/l", map=lambda x: hex(int(x))[2:]) - return rcflags - - def BuildCygwinBashCommandLine(self, args, path_to_base): - """Build a command line that runs args via cygwin bash. We assume that all - incoming paths are in Windows normpath'd form, so they need to be - converted to posix style for the part of the command line that's passed to - bash. We also have to do some Visual Studio macro emulation here because - various rules use magic VS names for things. Also note that rules that - contain ninja variables cannot be fixed here (for example ${source}), so - the outer generator needs to make sure that the paths that are written out - are in posix style, if the command line will be used here.""" - cygwin_dir = os.path.normpath( - os.path.join(path_to_base, self.msvs_cygwin_dirs[0]) - ) - cd = ("cd %s" % path_to_base).replace("\\", "/") - args = [a.replace("\\", "/").replace('"', '\\"') for a in args] - args = ["'%s'" % a.replace("'", "'\\''") for a in args] - bash_cmd = " ".join(args) - cmd = ( - 'call "%s\\setup_env.bat" && set CYGWIN=nontsec && ' % cygwin_dir - + f'bash -c "{cd} ; {bash_cmd}"' - ) - return cmd - - RuleShellFlags = collections.namedtuple("RuleShellFlags", ["cygwin", "quote"]) - - def GetRuleShellFlags(self, rule): - """Return RuleShellFlags about how the given rule should be run. This - includes whether it should run under cygwin (msvs_cygwin_shell), and - whether the commands should be quoted (msvs_quote_cmd).""" - # If the variable is unset, or set to 1 we use cygwin - cygwin = int(rule.get("msvs_cygwin_shell", - self.spec.get("msvs_cygwin_shell", 1))) != 0 - # Default to quoting. There's only a few special instances where the - # target command uses non-standard command line parsing and handle quotes - # and quote escaping differently. - quote_cmd = int(rule.get("msvs_quote_cmd", 1)) - assert quote_cmd != 0 or cygwin != 1, \ - "msvs_quote_cmd=0 only applicable for msvs_cygwin_shell=0" - return MsvsSettings.RuleShellFlags(cygwin, quote_cmd) - - def _HasExplicitRuleForExtension(self, spec, extension): - """Determine if there's an explicit rule for a particular extension.""" - for rule in spec.get("rules", []): - if rule["extension"] == extension: - return True - return False - - def _HasExplicitIdlActions(self, spec): - """Determine if an action should not run midl for .idl files.""" - return any( - [action.get("explicit_idl_action", 0) for action in spec.get("actions", [])] - ) - - def HasExplicitIdlRulesOrActions(self, spec): - """Determine if there's an explicit rule or action for idl files. When - there isn't we need to generate implicit rules to build MIDL .idl files.""" - return self._HasExplicitRuleForExtension( - spec, "idl" - ) or self._HasExplicitIdlActions(spec) - - def HasExplicitAsmRules(self, spec): - """Determine if there's an explicit rule for asm files. When there isn't we - need to generate implicit rules to assemble .asm files.""" - return self._HasExplicitRuleForExtension(spec, "asm") - - def GetIdlBuildData(self, source, config): - """Determine the implicit outputs for an idl file. Returns output - directory, outputs, and variables and flags that are required.""" - config = self._TargetConfig(config) - midl_get = self._GetWrapper(self, self.msvs_settings[config], "VCMIDLTool") - - def midl(name, default=None): - return self.ConvertVSMacros(midl_get(name, default=default), config=config) - - tlb = midl("TypeLibraryName", default="${root}.tlb") - header = midl("HeaderFileName", default="${root}.h") - dlldata = midl("DLLDataFileName", default="dlldata.c") - iid = midl("InterfaceIdentifierFileName", default="${root}_i.c") - proxy = midl("ProxyFileName", default="${root}_p.c") - # Note that .tlb is not included in the outputs as it is not always - # generated depending on the content of the input idl file. - outdir = midl("OutputDirectory", default="") - output = [header, dlldata, iid, proxy] - variables = [ - ("tlb", tlb), - ("h", header), - ("dlldata", dlldata), - ("iid", iid), - ("proxy", proxy), - ] - # TODO(scottmg): Are there configuration settings to set these flags? - target_platform = self.GetArch(config) - if target_platform == "x86": - target_platform = "win32" - flags = ["/char", "signed", "/env", target_platform, "/Oicf"] - return outdir, output, variables, flags - - -def _LanguageMatchesForPch(source_ext, pch_source_ext): - c_exts = (".c",) - cc_exts = (".cc", ".cxx", ".cpp") - return (source_ext in c_exts and pch_source_ext in c_exts) or ( - source_ext in cc_exts and pch_source_ext in cc_exts - ) - - -class PrecompiledHeader: - """Helper to generate dependencies and build rules to handle generation of - precompiled headers. Interface matches the GCH handler in xcode_emulation.py. - """ - - def __init__( - self, settings, config, gyp_to_build_path, gyp_to_unique_output, obj_ext - ): - self.settings = settings - self.config = config - pch_source = self.settings.msvs_precompiled_source[self.config] - self.pch_source = gyp_to_build_path(pch_source) - filename, _ = os.path.splitext(pch_source) - self.output_obj = gyp_to_unique_output(filename + obj_ext).lower() - - def _PchHeader(self): - """Get the header that will appear in an #include line for all source - files.""" - return self.settings.msvs_precompiled_header[self.config] - - def GetObjDependencies(self, sources, objs, arch): - """Given a list of sources files and the corresponding object files, - returns a list of the pch files that should be depended upon. The - additional wrapping in the return value is for interface compatibility - with make.py on Mac, and xcode_emulation.py.""" - assert arch is None - if not self._PchHeader(): - return [] - pch_ext = os.path.splitext(self.pch_source)[1] - for source in sources: - if _LanguageMatchesForPch(os.path.splitext(source)[1], pch_ext): - return [(None, None, self.output_obj)] - return [] - - def GetPchBuildCommands(self, arch): - """Not used on Windows as there are no additional build steps required - (instead, existing steps are modified in GetFlagsModifications below).""" - return [] - - def GetFlagsModifications( - self, input, output, implicit, command, cflags_c, cflags_cc, expand_special - ): - """Get the modified cflags and implicit dependencies that should be used - for the pch compilation step.""" - if input == self.pch_source: - pch_output = ["/Yc" + self._PchHeader()] - if command == "cxx": - return ( - [("cflags_cc", map(expand_special, cflags_cc + pch_output))], - self.output_obj, - [], - ) - elif command == "cc": - return ( - [("cflags_c", map(expand_special, cflags_c + pch_output))], - self.output_obj, - [], - ) - return [], output, implicit - - -vs_version = None - - -def GetVSVersion(generator_flags): - global vs_version - if not vs_version: - vs_version = gyp.MSVSVersion.SelectVisualStudioVersion( - generator_flags.get("msvs_version", "auto"), allow_fallback=False - ) - return vs_version - - -def _GetVsvarsSetupArgs(generator_flags, arch): - vs = GetVSVersion(generator_flags) - return vs.SetupScript() - - -def ExpandMacros(string, expansions): - """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv - for the canonical way to retrieve a suitable dict.""" - if "$" in string: - for old, new in expansions.items(): - assert "$(" not in new, new - string = string.replace(old, new) - return string - - -def _ExtractImportantEnvironment(output_of_set): - """Extracts environment variables required for the toolchain to run from - a textual dump output by the cmd.exe 'set' command.""" - envvars_to_save = ( - "goma_.*", # TODO(scottmg): This is ugly, but needed for goma. - "include", - "lib", - "libpath", - "path", - "pathext", - "systemroot", - "temp", - "tmp", - ) - env = {} - # This occasionally happens and leads to misleading SYSTEMROOT error messages - # if not caught here. - if output_of_set.count("=") == 0: - raise Exception("Invalid output_of_set. Value is:\n%s" % output_of_set) - for line in output_of_set.splitlines(): - for envvar in envvars_to_save: - if re.match(envvar + "=", line.lower()): - var, setting = line.split("=", 1) - if envvar == "path": - # Our own rules (for running gyp-win-tool) and other actions in - # Chromium rely on python being in the path. Add the path to this - # python here so that if it's not in the path when ninja is run - # later, python will still be found. - setting = os.path.dirname(sys.executable) + os.pathsep + setting - env[var.upper()] = setting - break - for required in ("SYSTEMROOT", "TEMP", "TMP"): - if required not in env: - raise Exception( - 'Environment variable "%s" ' - "required to be set to valid path" % required - ) - return env - - -def _FormatAsEnvironmentBlock(envvar_dict): - """Format as an 'environment block' directly suitable for CreateProcess. - Briefly this is a list of key=value\0, terminated by an additional \0. See - CreateProcess documentation for more details.""" - block = "" - nul = "\0" - for key, value in envvar_dict.items(): - block += key + "=" + value + nul - block += nul - return block - - -def _ExtractCLPath(output_of_where): - """Gets the path to cl.exe based on the output of calling the environment - setup batch file, followed by the equivalent of `where`.""" - # Take the first line, as that's the first found in the PATH. - for line in output_of_where.strip().splitlines(): - if line.startswith("LOC:"): - return line[len("LOC:") :].strip() - - -def GenerateEnvironmentFiles( - toplevel_build_dir, generator_flags, system_includes, open_out -): - """It's not sufficient to have the absolute path to the compiler, linker, - etc. on Windows, as those tools rely on .dlls being in the PATH. We also - need to support both x86 and x64 compilers within the same build (to support - msvs_target_platform hackery). Different architectures require a different - compiler binary, and different supporting environment variables (INCLUDE, - LIB, LIBPATH). So, we extract the environment here, wrap all invocations - of compiler tools (cl, link, lib, rc, midl, etc.) via win_tool.py which - sets up the environment, and then we do not prefix the compiler with - an absolute path, instead preferring something like "cl.exe" in the rule - which will then run whichever the environment setup has put in the path. - When the following procedure to generate environment files does not - meet your requirement (e.g. for custom toolchains), you can pass - "-G ninja_use_custom_environment_files" to the gyp to suppress file - generation and use custom environment files prepared by yourself.""" - archs = ("x86", "x64") - if generator_flags.get("ninja_use_custom_environment_files", 0): - cl_paths = {} - for arch in archs: - cl_paths[arch] = "cl.exe" - return cl_paths - vs = GetVSVersion(generator_flags) - cl_paths = {} - for arch in archs: - # Extract environment variables for subprocesses. - args = vs.SetupScript(arch) - args.extend(("&&", "set")) - popen = subprocess.Popen( - args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT - ) - variables = popen.communicate()[0].decode("utf-8") - if popen.returncode != 0: - raise Exception('"%s" failed with error %d' % (args, popen.returncode)) - env = _ExtractImportantEnvironment(variables) - - # Inject system includes from gyp files into INCLUDE. - if system_includes: - system_includes = system_includes | OrderedSet( - env.get("INCLUDE", "").split(";") - ) - env["INCLUDE"] = ";".join(system_includes) - - env_block = _FormatAsEnvironmentBlock(env) - f = open_out(os.path.join(toplevel_build_dir, "environment." + arch), "w") - f.write(env_block) - f.close() - - # Find cl.exe location for this architecture. - args = vs.SetupScript(arch) - args.extend( - ("&&", "for", "%i", "in", "(cl.exe)", "do", "@echo", "LOC:%~$PATH:i") - ) - popen = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE) - output = popen.communicate()[0].decode("utf-8") - cl_paths[arch] = _ExtractCLPath(output) - return cl_paths - - -def VerifyMissingSources(sources, build_dir, generator_flags, gyp_to_ninja): - """Emulate behavior of msvs_error_on_missing_sources present in the msvs - generator: Check that all regular source files, i.e. not created at run time, - exist on disk. Missing files cause needless recompilation when building via - VS, and we want this check to match for people/bots that build using ninja, - so they're not surprised when the VS build fails.""" - if int(generator_flags.get("msvs_error_on_missing_sources", 0)): - no_specials = filter(lambda x: "$" not in x, sources) - relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials] - missing = [x for x in relative if not os.path.exists(x)] - if missing: - # They'll look like out\Release\..\..\stuff\things.cc, so normalize the - # path for a slightly less crazy looking output. - cleaned_up = [os.path.normpath(x) for x in missing] - raise Exception("Missing input files:\n%s" % "\n".join(cleaned_up)) - - -# Sets some values in default_variables, which are required for many -# generators, run on Windows. -def CalculateCommonVariables(default_variables, params): - generator_flags = params.get("generator_flags", {}) - - # Set a variable so conditions can be based on msvs_version. - msvs_version = gyp.msvs_emulation.GetVSVersion(generator_flags) - default_variables["MSVS_VERSION"] = msvs_version.ShortName() - - # To determine processor word size on Windows, in addition to checking - # PROCESSOR_ARCHITECTURE (which reflects the word size of the current - # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which - # contains the actual word size of the system when running thru WOW64). - if "64" in os.environ.get("PROCESSOR_ARCHITECTURE", "") or "64" in os.environ.get( - "PROCESSOR_ARCHITEW6432", "" - ): - default_variables["MSVS_OS_BITS"] = 64 - else: - default_variables["MSVS_OS_BITS"] = 32 diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py deleted file mode 100644 index 0e3e86c7430d0..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +++ /dev/null @@ -1,174 +0,0 @@ -# This file comes from -# https://github.com/martine/ninja/blob/master/misc/ninja_syntax.py -# Do not edit! Edit the upstream one instead. - -"""Python module for generating .ninja files. - -Note that this is emphatically not a required piece of Ninja; it's -just a helpful utility for build-file-generation systems that already -use Python. -""" - -import textwrap - - -def escape_path(word): - return word.replace("$ ", "$$ ").replace(" ", "$ ").replace(":", "$:") - - -class Writer: - def __init__(self, output, width=78): - self.output = output - self.width = width - - def newline(self): - self.output.write("\n") - - def comment(self, text): - for line in textwrap.wrap(text, self.width - 2): - self.output.write("# " + line + "\n") - - def variable(self, key, value, indent=0): - if value is None: - return - if isinstance(value, list): - value = " ".join(filter(None, value)) # Filter out empty strings. - self._line(f"{key} = {value}", indent) - - def pool(self, name, depth): - self._line("pool %s" % name) - self.variable("depth", depth, indent=1) - - def rule( - self, - name, - command, - description=None, - depfile=None, - generator=False, - pool=None, - restat=False, - rspfile=None, - rspfile_content=None, - deps=None, - ): - self._line("rule %s" % name) - self.variable("command", command, indent=1) - if description: - self.variable("description", description, indent=1) - if depfile: - self.variable("depfile", depfile, indent=1) - if generator: - self.variable("generator", "1", indent=1) - if pool: - self.variable("pool", pool, indent=1) - if restat: - self.variable("restat", "1", indent=1) - if rspfile: - self.variable("rspfile", rspfile, indent=1) - if rspfile_content: - self.variable("rspfile_content", rspfile_content, indent=1) - if deps: - self.variable("deps", deps, indent=1) - - def build( - self, outputs, rule, inputs=None, implicit=None, order_only=None, variables=None - ): - outputs = self._as_list(outputs) - all_inputs = self._as_list(inputs)[:] - out_outputs = list(map(escape_path, outputs)) - all_inputs = list(map(escape_path, all_inputs)) - - if implicit: - implicit = map(escape_path, self._as_list(implicit)) - all_inputs.append("|") - all_inputs.extend(implicit) - if order_only: - order_only = map(escape_path, self._as_list(order_only)) - all_inputs.append("||") - all_inputs.extend(order_only) - - self._line( - "build {}: {}".format(" ".join(out_outputs), " ".join([rule] + all_inputs)) - ) - - if variables: - if isinstance(variables, dict): - iterator = iter(variables.items()) - else: - iterator = iter(variables) - - for key, val in iterator: - self.variable(key, val, indent=1) - - return outputs - - def include(self, path): - self._line("include %s" % path) - - def subninja(self, path): - self._line("subninja %s" % path) - - def default(self, paths): - self._line("default %s" % " ".join(self._as_list(paths))) - - def _count_dollars_before_index(self, s, i): - """Returns the number of '$' characters right in front of s[i].""" - dollar_count = 0 - dollar_index = i - 1 - while dollar_index > 0 and s[dollar_index] == "$": - dollar_count += 1 - dollar_index -= 1 - return dollar_count - - def _line(self, text, indent=0): - """Write 'text' word-wrapped at self.width characters.""" - leading_space = " " * indent - while len(leading_space) + len(text) > self.width: - # The text is too wide; wrap if possible. - - # Find the rightmost space that would obey our width constraint and - # that's not an escaped space. - available_space = self.width - len(leading_space) - len(" $") - space = available_space - while True: - space = text.rfind(" ", 0, space) - if space < 0 or self._count_dollars_before_index(text, space) % 2 == 0: - break - - if space < 0: - # No such space; just use the first unescaped space we can find. - space = available_space - 1 - while True: - space = text.find(" ", space + 1) - if ( - space < 0 - or self._count_dollars_before_index(text, space) % 2 == 0 - ): - break - if space < 0: - # Give up on breaking. - break - - self.output.write(leading_space + text[0:space] + " $\n") - text = text[space + 1 :] - - # Subsequent lines are continuations, so indent them. - leading_space = " " * (indent + 2) - - self.output.write(leading_space + text + "\n") - - def _as_list(self, input): - if input is None: - return [] - if isinstance(input, list): - return input - return [input] - - -def escape(string): - """Escape a string such that it can be embedded into a Ninja file without - further interpretation.""" - assert "\n" not in string, "Ninja syntax does not allow newlines" - # We only have one special metacharacter: '$'. - return string.replace("$", "$$") diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py deleted file mode 100644 index 729cec0636273..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2014 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""A clone of the default copy.deepcopy that doesn't handle cyclic -structures or complex types except for dicts and lists. This is -because gyp copies so large structure that small copy overhead ends up -taking seconds in a project the size of Chromium.""" - - -class Error(Exception): - pass - - -__all__ = ["Error", "deepcopy"] - - -def deepcopy(x): - """Deep copy operation on gyp objects such as strings, ints, dicts - and lists. More than twice as fast as copy.deepcopy but much less - generic.""" - - try: - return _deepcopy_dispatch[type(x)](x) - except KeyError: - raise Error( - "Unsupported type %s for deepcopy. Use copy.deepcopy " - + "or expand simple_copy support." % type(x) - ) - - -_deepcopy_dispatch = d = {} - - -def _deepcopy_atomic(x): - return x - - -types = bool, float, int, str, type, type(None) - -for x in types: - d[x] = _deepcopy_atomic - - -def _deepcopy_list(x): - return [deepcopy(a) for a in x] - - -d[list] = _deepcopy_list - - -def _deepcopy_dict(x): - y = {} - for key, value in x.items(): - y[deepcopy(key)] = deepcopy(value) - return y - - -d[dict] = _deepcopy_dict - -del d diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py deleted file mode 100755 index 638eee4002941..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +++ /dev/null @@ -1,374 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Utility functions for Windows builds. - -These functions are executed via gyp-win-tool when using the ninja generator. -""" - - -import os -import re -import shutil -import subprocess -import stat -import string -import sys - -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) - -# A regex matching an argument corresponding to the output filename passed to -# link.exe. -_LINK_EXE_OUT_ARG = re.compile("/OUT:(?P.+)$", re.IGNORECASE) - - -def main(args): - executor = WinTool() - exit_code = executor.Dispatch(args) - if exit_code is not None: - sys.exit(exit_code) - - -class WinTool: - """This class performs all the Windows tooling steps. The methods can either - be executed directly, or dispatched from an argument list.""" - - def _UseSeparateMspdbsrv(self, env, args): - """Allows to use a unique instance of mspdbsrv.exe per linker instead of a - shared one.""" - if len(args) < 1: - raise Exception("Not enough arguments") - - if args[0] != "link.exe": - return - - # Use the output filename passed to the linker to generate an endpoint name - # for mspdbsrv.exe. - endpoint_name = None - for arg in args: - m = _LINK_EXE_OUT_ARG.match(arg) - if m: - endpoint_name = re.sub( - r"\W+", "", "%s_%d" % (m.group("out"), os.getpid()) - ) - break - - if endpoint_name is None: - return - - # Adds the appropriate environment variable. This will be read by link.exe - # to know which instance of mspdbsrv.exe it should connect to (if it's - # not set then the default endpoint is used). - env["_MSPDBSRV_ENDPOINT_"] = endpoint_name - - def Dispatch(self, args): - """Dispatches a string command to a method.""" - if len(args) < 1: - raise Exception("Not enough arguments") - - method = "Exec%s" % self._CommandifyName(args[0]) - return getattr(self, method)(*args[1:]) - - def _CommandifyName(self, name_string): - """Transforms a tool name like recursive-mirror to RecursiveMirror.""" - return name_string.title().replace("-", "") - - def _GetEnv(self, arch): - """Gets the saved environment from a file for a given architecture.""" - # The environment is saved as an "environment block" (see CreateProcess - # and msvs_emulation for details). We convert to a dict here. - # Drop last 2 NULs, one for list terminator, one for trailing vs. separator. - pairs = open(arch).read()[:-2].split("\0") - kvs = [item.split("=", 1) for item in pairs] - return dict(kvs) - - def ExecStamp(self, path): - """Simple stamp command.""" - open(path, "w").close() - - def ExecRecursiveMirror(self, source, dest): - """Emulation of rm -rf out && cp -af in out.""" - if os.path.exists(dest): - if os.path.isdir(dest): - - def _on_error(fn, path, excinfo): - # The operation failed, possibly because the file is set to - # read-only. If that's why, make it writable and try the op again. - if not os.access(path, os.W_OK): - os.chmod(path, stat.S_IWRITE) - fn(path) - - shutil.rmtree(dest, onerror=_on_error) - else: - if not os.access(dest, os.W_OK): - # Attempt to make the file writable before deleting it. - os.chmod(dest, stat.S_IWRITE) - os.unlink(dest) - - if os.path.isdir(source): - shutil.copytree(source, dest) - else: - shutil.copy2(source, dest) - - def ExecLinkWrapper(self, arch, use_separate_mspdbsrv, *args): - """Filter diagnostic output from link that looks like: - ' Creating library ui.dll.lib and object ui.dll.exp' - This happens when there are exports from the dll or exe. - """ - env = self._GetEnv(arch) - if use_separate_mspdbsrv == "True": - self._UseSeparateMspdbsrv(env, args) - if sys.platform == "win32": - args = list(args) # *args is a tuple by default, which is read-only. - args[0] = args[0].replace("/", "\\") - # https://docs.python.org/2/library/subprocess.html: - # "On Unix with shell=True [...] if args is a sequence, the first item - # specifies the command string, and any additional items will be treated as - # additional arguments to the shell itself. That is to say, Popen does the - # equivalent of: - # Popen(['/bin/sh', '-c', args[0], args[1], ...])" - # For that reason, since going through the shell doesn't seem necessary on - # non-Windows don't do that there. - link = subprocess.Popen( - args, - shell=sys.platform == "win32", - env=env, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - ) - out = link.communicate()[0].decode("utf-8") - for line in out.splitlines(): - if ( - not line.startswith(" Creating library ") - and not line.startswith("Generating code") - and not line.startswith("Finished generating code") - ): - print(line) - return link.returncode - - def ExecLinkWithManifests( - self, - arch, - embed_manifest, - out, - ldcmd, - resname, - mt, - rc, - intermediate_manifest, - *manifests - ): - """A wrapper for handling creating a manifest resource and then executing - a link command.""" - # The 'normal' way to do manifests is to have link generate a manifest - # based on gathering dependencies from the object files, then merge that - # manifest with other manifests supplied as sources, convert the merged - # manifest to a resource, and then *relink*, including the compiled - # version of the manifest resource. This breaks incremental linking, and - # is generally overly complicated. Instead, we merge all the manifests - # provided (along with one that includes what would normally be in the - # linker-generated one, see msvs_emulation.py), and include that into the - # first and only link. We still tell link to generate a manifest, but we - # only use that to assert that our simpler process did not miss anything. - variables = { - "python": sys.executable, - "arch": arch, - "out": out, - "ldcmd": ldcmd, - "resname": resname, - "mt": mt, - "rc": rc, - "intermediate_manifest": intermediate_manifest, - "manifests": " ".join(manifests), - } - add_to_ld = "" - if manifests: - subprocess.check_call( - "%(python)s gyp-win-tool manifest-wrapper %(arch)s %(mt)s -nologo " - "-manifest %(manifests)s -out:%(out)s.manifest" % variables - ) - if embed_manifest == "True": - subprocess.check_call( - "%(python)s gyp-win-tool manifest-to-rc %(arch)s %(out)s.manifest" - " %(out)s.manifest.rc %(resname)s" % variables - ) - subprocess.check_call( - "%(python)s gyp-win-tool rc-wrapper %(arch)s %(rc)s " - "%(out)s.manifest.rc" % variables - ) - add_to_ld = " %(out)s.manifest.res" % variables - subprocess.check_call(ldcmd + add_to_ld) - - # Run mt.exe on the theoretically complete manifest we generated, merging - # it with the one the linker generated to confirm that the linker - # generated one does not add anything. This is strictly unnecessary for - # correctness, it's only to verify that e.g. /MANIFESTDEPENDENCY was not - # used in a #pragma comment. - if manifests: - # Merge the intermediate one with ours to .assert.manifest, then check - # that .assert.manifest is identical to ours. - subprocess.check_call( - "%(python)s gyp-win-tool manifest-wrapper %(arch)s %(mt)s -nologo " - "-manifest %(out)s.manifest %(intermediate_manifest)s " - "-out:%(out)s.assert.manifest" % variables - ) - assert_manifest = "%(out)s.assert.manifest" % variables - our_manifest = "%(out)s.manifest" % variables - # Load and normalize the manifests. mt.exe sometimes removes whitespace, - # and sometimes doesn't unfortunately. - with open(our_manifest) as our_f: - with open(assert_manifest) as assert_f: - translator = str.maketrans('', '', string.whitespace) - our_data = our_f.read().translate(translator) - assert_data = assert_f.read().translate(translator) - if our_data != assert_data: - os.unlink(out) - - def dump(filename): - print(filename, file=sys.stderr) - print("-----", file=sys.stderr) - with open(filename) as f: - print(f.read(), file=sys.stderr) - print("-----", file=sys.stderr) - - dump(intermediate_manifest) - dump(our_manifest) - dump(assert_manifest) - sys.stderr.write( - 'Linker generated manifest "%s" added to final manifest "%s" ' - '(result in "%s"). ' - "Were /MANIFEST switches used in #pragma statements? " - % (intermediate_manifest, our_manifest, assert_manifest) - ) - return 1 - - def ExecManifestWrapper(self, arch, *args): - """Run manifest tool with environment set. Strip out undesirable warning - (some XML blocks are recognized by the OS loader, but not the manifest - tool).""" - env = self._GetEnv(arch) - popen = subprocess.Popen( - args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT - ) - out = popen.communicate()[0].decode("utf-8") - for line in out.splitlines(): - if line and "manifest authoring warning 81010002" not in line: - print(line) - return popen.returncode - - def ExecManifestToRc(self, arch, *args): - """Creates a resource file pointing a SxS assembly manifest. - |args| is tuple containing path to resource file, path to manifest file - and resource name which can be "1" (for executables) or "2" (for DLLs).""" - manifest_path, resource_path, resource_name = args - with open(resource_path, "w") as output: - output.write( - '#include \n%s RT_MANIFEST "%s"' - % (resource_name, os.path.abspath(manifest_path).replace("\\", "/")) - ) - - def ExecMidlWrapper(self, arch, outdir, tlb, h, dlldata, iid, proxy, idl, *flags): - """Filter noisy filenames output from MIDL compile step that isn't - quietable via command line flags. - """ - args = ( - ["midl", "/nologo"] - + list(flags) - + [ - "/out", - outdir, - "/tlb", - tlb, - "/h", - h, - "/dlldata", - dlldata, - "/iid", - iid, - "/proxy", - proxy, - idl, - ] - ) - env = self._GetEnv(arch) - popen = subprocess.Popen( - args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT - ) - out = popen.communicate()[0].decode("utf-8") - # Filter junk out of stdout, and write filtered versions. Output we want - # to filter is pairs of lines that look like this: - # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl - # objidl.idl - lines = out.splitlines() - prefixes = ("Processing ", "64 bit Processing ") - processing = {os.path.basename(x) for x in lines if x.startswith(prefixes)} - for line in lines: - if not line.startswith(prefixes) and line not in processing: - print(line) - return popen.returncode - - def ExecAsmWrapper(self, arch, *args): - """Filter logo banner from invocations of asm.exe.""" - env = self._GetEnv(arch) - popen = subprocess.Popen( - args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT - ) - out = popen.communicate()[0].decode("utf-8") - for line in out.splitlines(): - if ( - not line.startswith("Copyright (C) Microsoft Corporation") - and not line.startswith("Microsoft (R) Macro Assembler") - and not line.startswith(" Assembling: ") - and line - ): - print(line) - return popen.returncode - - def ExecRcWrapper(self, arch, *args): - """Filter logo banner from invocations of rc.exe. Older versions of RC - don't support the /nologo flag.""" - env = self._GetEnv(arch) - popen = subprocess.Popen( - args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT - ) - out = popen.communicate()[0].decode("utf-8") - for line in out.splitlines(): - if ( - not line.startswith("Microsoft (R) Windows (R) Resource Compiler") - and not line.startswith("Copyright (C) Microsoft Corporation") - and line - ): - print(line) - return popen.returncode - - def ExecActionWrapper(self, arch, rspfile, *dir): - """Runs an action command line from a response file using the environment - for |arch|. If |dir| is supplied, use that as the working directory.""" - env = self._GetEnv(arch) - # TODO(scottmg): This is a temporary hack to get some specific variables - # through to actions that are set after gyp-time. http://crbug.com/333738. - for k, v in os.environ.items(): - if k not in env: - env[k] = v - args = open(rspfile).read() - dir = dir[0] if dir else None - return subprocess.call(args, shell=True, env=env, cwd=dir) - - def ExecClCompile(self, project_dir, selected_files): - """Executed by msvs-ninja projects when the 'ClCompile' target is used to - build selected C/C++ files.""" - project_dir = os.path.relpath(project_dir, BASE_DIR) - selected_files = selected_files.split(";") - ninja_targets = [ - os.path.join(project_dir, filename) + "^^" for filename in selected_files - ] - cmd = ["ninja.exe"] - cmd.extend(ninja_targets) - return subprocess.call(cmd, shell=True, cwd=BASE_DIR) - - -if __name__ == "__main__": - sys.exit(main(sys.argv[1:])) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py deleted file mode 100644 index a75d8eeab7bda..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +++ /dev/null @@ -1,1939 +0,0 @@ -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -This module contains classes that help to emulate xcodebuild behavior on top of -other build systems, such as make and ninja. -""" - - -import copy -import gyp.common -import os -import os.path -import re -import shlex -import subprocess -import sys -from gyp.common import GypError - -# Populated lazily by XcodeVersion, for efficiency, and to fix an issue when -# "xcodebuild" is called too quickly (it has been found to return incorrect -# version number). -XCODE_VERSION_CACHE = None - -# Populated lazily by GetXcodeArchsDefault, to an |XcodeArchsDefault| instance -# corresponding to the installed version of Xcode. -XCODE_ARCHS_DEFAULT_CACHE = None - - -def XcodeArchsVariableMapping(archs, archs_including_64_bit=None): - """Constructs a dictionary with expansion for $(ARCHS_STANDARD) variable, - and optionally for $(ARCHS_STANDARD_INCLUDING_64_BIT).""" - mapping = {"$(ARCHS_STANDARD)": archs} - if archs_including_64_bit: - mapping["$(ARCHS_STANDARD_INCLUDING_64_BIT)"] = archs_including_64_bit - return mapping - - -class XcodeArchsDefault: - """A class to resolve ARCHS variable from xcode_settings, resolving Xcode - macros and implementing filtering by VALID_ARCHS. The expansion of macros - depends on the SDKROOT used ("macosx", "iphoneos", "iphonesimulator") and - on the version of Xcode. - """ - - # Match variable like $(ARCHS_STANDARD). - variable_pattern = re.compile(r"\$\([a-zA-Z_][a-zA-Z0-9_]*\)$") - - def __init__(self, default, mac, iphonesimulator, iphoneos): - self._default = (default,) - self._archs = {"mac": mac, "ios": iphoneos, "iossim": iphonesimulator} - - def _VariableMapping(self, sdkroot): - """Returns the dictionary of variable mapping depending on the SDKROOT.""" - sdkroot = sdkroot.lower() - if "iphoneos" in sdkroot: - return self._archs["ios"] - elif "iphonesimulator" in sdkroot: - return self._archs["iossim"] - else: - return self._archs["mac"] - - def _ExpandArchs(self, archs, sdkroot): - """Expands variables references in ARCHS, and remove duplicates.""" - variable_mapping = self._VariableMapping(sdkroot) - expanded_archs = [] - for arch in archs: - if self.variable_pattern.match(arch): - variable = arch - try: - variable_expansion = variable_mapping[variable] - for arch in variable_expansion: - if arch not in expanded_archs: - expanded_archs.append(arch) - except KeyError: - print('Warning: Ignoring unsupported variable "%s".' % variable) - elif arch not in expanded_archs: - expanded_archs.append(arch) - return expanded_archs - - def ActiveArchs(self, archs, valid_archs, sdkroot): - """Expands variables references in ARCHS, and filter by VALID_ARCHS if it - is defined (if not set, Xcode accept any value in ARCHS, otherwise, only - values present in VALID_ARCHS are kept).""" - expanded_archs = self._ExpandArchs(archs or self._default, sdkroot or "") - if valid_archs: - filtered_archs = [] - for arch in expanded_archs: - if arch in valid_archs: - filtered_archs.append(arch) - expanded_archs = filtered_archs - return expanded_archs - - -def GetXcodeArchsDefault(): - """Returns the |XcodeArchsDefault| object to use to expand ARCHS for the - installed version of Xcode. The default values used by Xcode for ARCHS - and the expansion of the variables depends on the version of Xcode used. - - For all version anterior to Xcode 5.0 or posterior to Xcode 5.1 included - uses $(ARCHS_STANDARD) if ARCHS is unset, while Xcode 5.0 to 5.0.2 uses - $(ARCHS_STANDARD_INCLUDING_64_BIT). This variable was added to Xcode 5.0 - and deprecated with Xcode 5.1. - - For "macosx" SDKROOT, all version starting with Xcode 5.0 includes 64-bit - architecture as part of $(ARCHS_STANDARD) and default to only building it. - - For "iphoneos" and "iphonesimulator" SDKROOT, 64-bit architectures are part - of $(ARCHS_STANDARD_INCLUDING_64_BIT) from Xcode 5.0. From Xcode 5.1, they - are also part of $(ARCHS_STANDARD). - - All these rules are coded in the construction of the |XcodeArchsDefault| - object to use depending on the version of Xcode detected. The object is - for performance reason.""" - global XCODE_ARCHS_DEFAULT_CACHE - if XCODE_ARCHS_DEFAULT_CACHE: - return XCODE_ARCHS_DEFAULT_CACHE - xcode_version, _ = XcodeVersion() - if xcode_version < "0500": - XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault( - "$(ARCHS_STANDARD)", - XcodeArchsVariableMapping(["i386"]), - XcodeArchsVariableMapping(["i386"]), - XcodeArchsVariableMapping(["armv7"]), - ) - elif xcode_version < "0510": - XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault( - "$(ARCHS_STANDARD_INCLUDING_64_BIT)", - XcodeArchsVariableMapping(["x86_64"], ["x86_64"]), - XcodeArchsVariableMapping(["i386"], ["i386", "x86_64"]), - XcodeArchsVariableMapping( - ["armv7", "armv7s"], ["armv7", "armv7s", "arm64"] - ), - ) - else: - XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault( - "$(ARCHS_STANDARD)", - XcodeArchsVariableMapping(["x86_64"], ["x86_64"]), - XcodeArchsVariableMapping(["i386", "x86_64"], ["i386", "x86_64"]), - XcodeArchsVariableMapping( - ["armv7", "armv7s", "arm64"], ["armv7", "armv7s", "arm64"] - ), - ) - return XCODE_ARCHS_DEFAULT_CACHE - - -class XcodeSettings: - """A class that understands the gyp 'xcode_settings' object.""" - - # Populated lazily by _SdkPath(). Shared by all XcodeSettings, so cached - # at class-level for efficiency. - _sdk_path_cache = {} - _platform_path_cache = {} - _sdk_root_cache = {} - - # Populated lazily by GetExtraPlistItems(). Shared by all XcodeSettings, so - # cached at class-level for efficiency. - _plist_cache = {} - - # Populated lazily by GetIOSPostbuilds. Shared by all XcodeSettings, so - # cached at class-level for efficiency. - _codesigning_key_cache = {} - - def __init__(self, spec): - self.spec = spec - - self.isIOS = False - self.mac_toolchain_dir = None - self.header_map_path = None - - # Per-target 'xcode_settings' are pushed down into configs earlier by gyp. - # This means self.xcode_settings[config] always contains all settings - # for that config -- the per-target settings as well. Settings that are - # the same for all configs are implicitly per-target settings. - self.xcode_settings = {} - configs = spec["configurations"] - for configname, config in configs.items(): - self.xcode_settings[configname] = config.get("xcode_settings", {}) - self._ConvertConditionalKeys(configname) - if self.xcode_settings[configname].get("IPHONEOS_DEPLOYMENT_TARGET", None): - self.isIOS = True - - # This is only non-None temporarily during the execution of some methods. - self.configname = None - - # Used by _AdjustLibrary to match .a and .dylib entries in libraries. - self.library_re = re.compile(r"^lib([^/]+)\.(a|dylib)$") - - def _ConvertConditionalKeys(self, configname): - """Converts or warns on conditional keys. Xcode supports conditional keys, - such as CODE_SIGN_IDENTITY[sdk=iphoneos*]. This is a partial implementation - with some keys converted while the rest force a warning.""" - settings = self.xcode_settings[configname] - conditional_keys = [key for key in settings if key.endswith("]")] - for key in conditional_keys: - # If you need more, speak up at http://crbug.com/122592 - if key.endswith("[sdk=iphoneos*]"): - if configname.endswith("iphoneos"): - new_key = key.split("[")[0] - settings[new_key] = settings[key] - else: - print( - "Warning: Conditional keys not implemented, ignoring:", - " ".join(conditional_keys), - ) - del settings[key] - - def _Settings(self): - assert self.configname - return self.xcode_settings[self.configname] - - def _Test(self, test_key, cond_key, default): - return self._Settings().get(test_key, default) == cond_key - - def _Appendf(self, lst, test_key, format_str, default=None): - if test_key in self._Settings(): - lst.append(format_str % str(self._Settings()[test_key])) - elif default: - lst.append(format_str % str(default)) - - def _WarnUnimplemented(self, test_key): - if test_key in self._Settings(): - print('Warning: Ignoring not yet implemented key "%s".' % test_key) - - def IsBinaryOutputFormat(self, configname): - default = "binary" if self.isIOS else "xml" - format = self.xcode_settings[configname].get("INFOPLIST_OUTPUT_FORMAT", default) - return format == "binary" - - def IsIosFramework(self): - return self.spec["type"] == "shared_library" and self._IsBundle() and self.isIOS - - def _IsBundle(self): - return ( - int(self.spec.get("mac_bundle", 0)) != 0 - or self._IsXCTest() - or self._IsXCUiTest() - ) - - def _IsXCTest(self): - return int(self.spec.get("mac_xctest_bundle", 0)) != 0 - - def _IsXCUiTest(self): - return int(self.spec.get("mac_xcuitest_bundle", 0)) != 0 - - def _IsIosAppExtension(self): - return int(self.spec.get("ios_app_extension", 0)) != 0 - - def _IsIosWatchKitExtension(self): - return int(self.spec.get("ios_watchkit_extension", 0)) != 0 - - def _IsIosWatchApp(self): - return int(self.spec.get("ios_watch_app", 0)) != 0 - - def GetFrameworkVersion(self): - """Returns the framework version of the current target. Only valid for - bundles.""" - assert self._IsBundle() - return self.GetPerTargetSetting("FRAMEWORK_VERSION", default="A") - - def GetWrapperExtension(self): - """Returns the bundle extension (.app, .framework, .plugin, etc). Only - valid for bundles.""" - assert self._IsBundle() - if self.spec["type"] in ("loadable_module", "shared_library"): - default_wrapper_extension = { - "loadable_module": "bundle", - "shared_library": "framework", - }[self.spec["type"]] - wrapper_extension = self.GetPerTargetSetting( - "WRAPPER_EXTENSION", default=default_wrapper_extension - ) - return "." + self.spec.get("product_extension", wrapper_extension) - elif self.spec["type"] == "executable": - if self._IsIosAppExtension() or self._IsIosWatchKitExtension(): - return "." + self.spec.get("product_extension", "appex") - else: - return "." + self.spec.get("product_extension", "app") - else: - assert False, "Don't know extension for '{}', target '{}'".format( - self.spec["type"], - self.spec["target_name"], - ) - - def GetProductName(self): - """Returns PRODUCT_NAME.""" - return self.spec.get("product_name", self.spec["target_name"]) - - def GetFullProductName(self): - """Returns FULL_PRODUCT_NAME.""" - if self._IsBundle(): - return self.GetWrapperName() - else: - return self._GetStandaloneBinaryPath() - - def GetWrapperName(self): - """Returns the directory name of the bundle represented by this target. - Only valid for bundles.""" - assert self._IsBundle() - return self.GetProductName() + self.GetWrapperExtension() - - def GetBundleContentsFolderPath(self): - """Returns the qualified path to the bundle's contents folder. E.g. - Chromium.app/Contents or Foo.bundle/Versions/A. Only valid for bundles.""" - if self.isIOS: - return self.GetWrapperName() - assert self._IsBundle() - if self.spec["type"] == "shared_library": - return os.path.join( - self.GetWrapperName(), "Versions", self.GetFrameworkVersion() - ) - else: - # loadable_modules have a 'Contents' folder like executables. - return os.path.join(self.GetWrapperName(), "Contents") - - def GetBundleResourceFolder(self): - """Returns the qualified path to the bundle's resource folder. E.g. - Chromium.app/Contents/Resources. Only valid for bundles.""" - assert self._IsBundle() - if self.isIOS: - return self.GetBundleContentsFolderPath() - return os.path.join(self.GetBundleContentsFolderPath(), "Resources") - - def GetBundleExecutableFolderPath(self): - """Returns the qualified path to the bundle's executables folder. E.g. - Chromium.app/Contents/MacOS. Only valid for bundles.""" - assert self._IsBundle() - if self.spec["type"] in ("shared_library") or self.isIOS: - return self.GetBundleContentsFolderPath() - elif self.spec["type"] in ("executable", "loadable_module"): - return os.path.join(self.GetBundleContentsFolderPath(), "MacOS") - - def GetBundleJavaFolderPath(self): - """Returns the qualified path to the bundle's Java resource folder. - E.g. Chromium.app/Contents/Resources/Java. Only valid for bundles.""" - assert self._IsBundle() - return os.path.join(self.GetBundleResourceFolder(), "Java") - - def GetBundleFrameworksFolderPath(self): - """Returns the qualified path to the bundle's frameworks folder. E.g, - Chromium.app/Contents/Frameworks. Only valid for bundles.""" - assert self._IsBundle() - return os.path.join(self.GetBundleContentsFolderPath(), "Frameworks") - - def GetBundleSharedFrameworksFolderPath(self): - """Returns the qualified path to the bundle's frameworks folder. E.g, - Chromium.app/Contents/SharedFrameworks. Only valid for bundles.""" - assert self._IsBundle() - return os.path.join(self.GetBundleContentsFolderPath(), "SharedFrameworks") - - def GetBundleSharedSupportFolderPath(self): - """Returns the qualified path to the bundle's shared support folder. E.g, - Chromium.app/Contents/SharedSupport. Only valid for bundles.""" - assert self._IsBundle() - if self.spec["type"] == "shared_library": - return self.GetBundleResourceFolder() - else: - return os.path.join(self.GetBundleContentsFolderPath(), "SharedSupport") - - def GetBundlePlugInsFolderPath(self): - """Returns the qualified path to the bundle's plugins folder. E.g, - Chromium.app/Contents/PlugIns. Only valid for bundles.""" - assert self._IsBundle() - return os.path.join(self.GetBundleContentsFolderPath(), "PlugIns") - - def GetBundleXPCServicesFolderPath(self): - """Returns the qualified path to the bundle's XPC services folder. E.g, - Chromium.app/Contents/XPCServices. Only valid for bundles.""" - assert self._IsBundle() - return os.path.join(self.GetBundleContentsFolderPath(), "XPCServices") - - def GetBundlePlistPath(self): - """Returns the qualified path to the bundle's plist file. E.g. - Chromium.app/Contents/Info.plist. Only valid for bundles.""" - assert self._IsBundle() - if ( - self.spec["type"] in ("executable", "loadable_module") - or self.IsIosFramework() - ): - return os.path.join(self.GetBundleContentsFolderPath(), "Info.plist") - else: - return os.path.join( - self.GetBundleContentsFolderPath(), "Resources", "Info.plist" - ) - - def GetProductType(self): - """Returns the PRODUCT_TYPE of this target.""" - if self._IsIosAppExtension(): - assert self._IsBundle(), ( - "ios_app_extension flag requires mac_bundle " - "(target %s)" % self.spec["target_name"] - ) - return "com.apple.product-type.app-extension" - if self._IsIosWatchKitExtension(): - assert self._IsBundle(), ( - "ios_watchkit_extension flag requires " - "mac_bundle (target %s)" % self.spec["target_name"] - ) - return "com.apple.product-type.watchkit-extension" - if self._IsIosWatchApp(): - assert self._IsBundle(), ( - "ios_watch_app flag requires mac_bundle " - "(target %s)" % self.spec["target_name"] - ) - return "com.apple.product-type.application.watchapp" - if self._IsXCUiTest(): - assert self._IsBundle(), ( - "mac_xcuitest_bundle flag requires mac_bundle " - "(target %s)" % self.spec["target_name"] - ) - return "com.apple.product-type.bundle.ui-testing" - if self._IsBundle(): - return { - "executable": "com.apple.product-type.application", - "loadable_module": "com.apple.product-type.bundle", - "shared_library": "com.apple.product-type.framework", - }[self.spec["type"]] - else: - return { - "executable": "com.apple.product-type.tool", - "loadable_module": "com.apple.product-type.library.dynamic", - "shared_library": "com.apple.product-type.library.dynamic", - "static_library": "com.apple.product-type.library.static", - }[self.spec["type"]] - - def GetMachOType(self): - """Returns the MACH_O_TYPE of this target.""" - # Weird, but matches Xcode. - if not self._IsBundle() and self.spec["type"] == "executable": - return "" - return { - "executable": "mh_execute", - "static_library": "staticlib", - "shared_library": "mh_dylib", - "loadable_module": "mh_bundle", - }[self.spec["type"]] - - def _GetBundleBinaryPath(self): - """Returns the name of the bundle binary of by this target. - E.g. Chromium.app/Contents/MacOS/Chromium. Only valid for bundles.""" - assert self._IsBundle() - return os.path.join( - self.GetBundleExecutableFolderPath(), self.GetExecutableName() - ) - - def _GetStandaloneExecutableSuffix(self): - if "product_extension" in self.spec: - return "." + self.spec["product_extension"] - return { - "executable": "", - "static_library": ".a", - "shared_library": ".dylib", - "loadable_module": ".so", - }[self.spec["type"]] - - def _GetStandaloneExecutablePrefix(self): - return self.spec.get( - "product_prefix", - { - "executable": "", - "static_library": "lib", - "shared_library": "lib", - # Non-bundled loadable_modules are called foo.so for some reason - # (that is, .so and no prefix) with the xcode build -- match that. - "loadable_module": "", - }[self.spec["type"]], - ) - - def _GetStandaloneBinaryPath(self): - """Returns the name of the non-bundle binary represented by this target. - E.g. hello_world. Only valid for non-bundles.""" - assert not self._IsBundle() - assert self.spec["type"] in ( - "executable", - "shared_library", - "static_library", - "loadable_module", - ), ("Unexpected type %s" % self.spec["type"]) - target = self.spec["target_name"] - if self.spec["type"] == "static_library": - if target[:3] == "lib": - target = target[3:] - elif self.spec["type"] in ("loadable_module", "shared_library"): - if target[:3] == "lib": - target = target[3:] - - target_prefix = self._GetStandaloneExecutablePrefix() - target = self.spec.get("product_name", target) - target_ext = self._GetStandaloneExecutableSuffix() - return target_prefix + target + target_ext - - def GetExecutableName(self): - """Returns the executable name of the bundle represented by this target. - E.g. Chromium.""" - if self._IsBundle(): - return self.spec.get("product_name", self.spec["target_name"]) - else: - return self._GetStandaloneBinaryPath() - - def GetExecutablePath(self): - """Returns the qualified path to the primary executable of the bundle - represented by this target. E.g. Chromium.app/Contents/MacOS/Chromium.""" - if self._IsBundle(): - return self._GetBundleBinaryPath() - else: - return self._GetStandaloneBinaryPath() - - def GetActiveArchs(self, configname): - """Returns the architectures this target should be built for.""" - config_settings = self.xcode_settings[configname] - xcode_archs_default = GetXcodeArchsDefault() - return xcode_archs_default.ActiveArchs( - config_settings.get("ARCHS"), - config_settings.get("VALID_ARCHS"), - config_settings.get("SDKROOT"), - ) - - def _GetSdkVersionInfoItem(self, sdk, infoitem): - # xcodebuild requires Xcode and can't run on Command Line Tools-only - # systems from 10.7 onward. - # Since the CLT has no SDK paths anyway, returning None is the - # most sensible route and should still do the right thing. - try: - return GetStdoutQuiet(["xcrun", "--sdk", sdk, infoitem]) - except GypError: - pass - - def _SdkRoot(self, configname): - if configname is None: - configname = self.configname - return self.GetPerConfigSetting("SDKROOT", configname, default="") - - def _XcodePlatformPath(self, configname=None): - sdk_root = self._SdkRoot(configname) - if sdk_root not in XcodeSettings._platform_path_cache: - platform_path = self._GetSdkVersionInfoItem( - sdk_root, "--show-sdk-platform-path" - ) - XcodeSettings._platform_path_cache[sdk_root] = platform_path - return XcodeSettings._platform_path_cache[sdk_root] - - def _SdkPath(self, configname=None): - sdk_root = self._SdkRoot(configname) - if sdk_root.startswith("/"): - return sdk_root - return self._XcodeSdkPath(sdk_root) - - def _XcodeSdkPath(self, sdk_root): - if sdk_root not in XcodeSettings._sdk_path_cache: - sdk_path = self._GetSdkVersionInfoItem(sdk_root, "--show-sdk-path") - XcodeSettings._sdk_path_cache[sdk_root] = sdk_path - if sdk_root: - XcodeSettings._sdk_root_cache[sdk_path] = sdk_root - return XcodeSettings._sdk_path_cache[sdk_root] - - def _AppendPlatformVersionMinFlags(self, lst): - self._Appendf(lst, "MACOSX_DEPLOYMENT_TARGET", "-mmacosx-version-min=%s") - if "IPHONEOS_DEPLOYMENT_TARGET" in self._Settings(): - # TODO: Implement this better? - sdk_path_basename = os.path.basename(self._SdkPath()) - if sdk_path_basename.lower().startswith("iphonesimulator"): - self._Appendf( - lst, "IPHONEOS_DEPLOYMENT_TARGET", "-mios-simulator-version-min=%s" - ) - else: - self._Appendf( - lst, "IPHONEOS_DEPLOYMENT_TARGET", "-miphoneos-version-min=%s" - ) - - def GetCflags(self, configname, arch=None): - """Returns flags that need to be added to .c, .cc, .m, and .mm - compilations.""" - # This functions (and the similar ones below) do not offer complete - # emulation of all xcode_settings keys. They're implemented on demand. - - self.configname = configname - cflags = [] - - sdk_root = self._SdkPath() - if "SDKROOT" in self._Settings() and sdk_root: - cflags.append("-isysroot %s" % sdk_root) - - if self.header_map_path: - cflags.append("-I%s" % self.header_map_path) - - if self._Test("CLANG_WARN_CONSTANT_CONVERSION", "YES", default="NO"): - cflags.append("-Wconstant-conversion") - - if self._Test("GCC_CHAR_IS_UNSIGNED_CHAR", "YES", default="NO"): - cflags.append("-funsigned-char") - - if self._Test("GCC_CW_ASM_SYNTAX", "YES", default="YES"): - cflags.append("-fasm-blocks") - - if "GCC_DYNAMIC_NO_PIC" in self._Settings(): - if self._Settings()["GCC_DYNAMIC_NO_PIC"] == "YES": - cflags.append("-mdynamic-no-pic") - else: - pass - # TODO: In this case, it depends on the target. xcode passes - # mdynamic-no-pic by default for executable and possibly static lib - # according to mento - - if self._Test("GCC_ENABLE_PASCAL_STRINGS", "YES", default="YES"): - cflags.append("-mpascal-strings") - - self._Appendf(cflags, "GCC_OPTIMIZATION_LEVEL", "-O%s", default="s") - - if self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="YES"): - dbg_format = self._Settings().get("DEBUG_INFORMATION_FORMAT", "dwarf") - if dbg_format == "dwarf": - cflags.append("-gdwarf-2") - elif dbg_format == "stabs": - raise NotImplementedError("stabs debug format is not supported yet.") - elif dbg_format == "dwarf-with-dsym": - cflags.append("-gdwarf-2") - else: - raise NotImplementedError("Unknown debug format %s" % dbg_format) - - if self._Settings().get("GCC_STRICT_ALIASING") == "YES": - cflags.append("-fstrict-aliasing") - elif self._Settings().get("GCC_STRICT_ALIASING") == "NO": - cflags.append("-fno-strict-aliasing") - - if self._Test("GCC_SYMBOLS_PRIVATE_EXTERN", "YES", default="NO"): - cflags.append("-fvisibility=hidden") - - if self._Test("GCC_TREAT_WARNINGS_AS_ERRORS", "YES", default="NO"): - cflags.append("-Werror") - - if self._Test("GCC_WARN_ABOUT_MISSING_NEWLINE", "YES", default="NO"): - cflags.append("-Wnewline-eof") - - # In Xcode, this is only activated when GCC_COMPILER_VERSION is clang or - # llvm-gcc. It also requires a fairly recent libtool, and - # if the system clang isn't used, DYLD_LIBRARY_PATH needs to contain the - # path to the libLTO.dylib that matches the used clang. - if self._Test("LLVM_LTO", "YES", default="NO"): - cflags.append("-flto") - - self._AppendPlatformVersionMinFlags(cflags) - - # TODO: - if self._Test("COPY_PHASE_STRIP", "YES", default="NO"): - self._WarnUnimplemented("COPY_PHASE_STRIP") - self._WarnUnimplemented("GCC_DEBUGGING_SYMBOLS") - self._WarnUnimplemented("GCC_ENABLE_OBJC_EXCEPTIONS") - - # TODO: This is exported correctly, but assigning to it is not supported. - self._WarnUnimplemented("MACH_O_TYPE") - self._WarnUnimplemented("PRODUCT_TYPE") - - # If GYP_CROSSCOMPILE (--cross-compiling), disable architecture-specific - # additions and assume these will be provided as required via CC_host, - # CXX_host, CC_target and CXX_target. - if not gyp.common.CrossCompileRequested(): - if arch is not None: - archs = [arch] - else: - assert self.configname - archs = self.GetActiveArchs(self.configname) - if len(archs) != 1: - # TODO: Supporting fat binaries will be annoying. - self._WarnUnimplemented("ARCHS") - archs = ["i386"] - cflags.append("-arch " + archs[0]) - - if archs[0] in ("i386", "x86_64"): - if self._Test("GCC_ENABLE_SSE3_EXTENSIONS", "YES", default="NO"): - cflags.append("-msse3") - if self._Test( - "GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS", "YES", default="NO" - ): - cflags.append("-mssse3") # Note 3rd 's'. - if self._Test("GCC_ENABLE_SSE41_EXTENSIONS", "YES", default="NO"): - cflags.append("-msse4.1") - if self._Test("GCC_ENABLE_SSE42_EXTENSIONS", "YES", default="NO"): - cflags.append("-msse4.2") - - cflags += self._Settings().get("WARNING_CFLAGS", []) - - if self._IsXCTest(): - platform_root = self._XcodePlatformPath(configname) - if platform_root: - cflags.append("-F" + platform_root + "/Developer/Library/Frameworks/") - - if sdk_root: - framework_root = sdk_root - else: - framework_root = "" - config = self.spec["configurations"][self.configname] - framework_dirs = config.get("mac_framework_dirs", []) - for directory in framework_dirs: - cflags.append("-F" + directory.replace("$(SDKROOT)", framework_root)) - - self.configname = None - return cflags - - def GetCflagsC(self, configname): - """Returns flags that need to be added to .c, and .m compilations.""" - self.configname = configname - cflags_c = [] - if self._Settings().get("GCC_C_LANGUAGE_STANDARD", "") == "ansi": - cflags_c.append("-ansi") - else: - self._Appendf(cflags_c, "GCC_C_LANGUAGE_STANDARD", "-std=%s") - cflags_c += self._Settings().get("OTHER_CFLAGS", []) - self.configname = None - return cflags_c - - def GetCflagsCC(self, configname): - """Returns flags that need to be added to .cc, and .mm compilations.""" - self.configname = configname - cflags_cc = [] - - clang_cxx_language_standard = self._Settings().get( - "CLANG_CXX_LANGUAGE_STANDARD" - ) - # Note: Don't make c++0x to c++11 so that c++0x can be used with older - # clangs that don't understand c++11 yet (like Xcode 4.2's). - if clang_cxx_language_standard: - cflags_cc.append("-std=%s" % clang_cxx_language_standard) - - self._Appendf(cflags_cc, "CLANG_CXX_LIBRARY", "-stdlib=%s") - - if self._Test("GCC_ENABLE_CPP_RTTI", "NO", default="YES"): - cflags_cc.append("-fno-rtti") - if self._Test("GCC_ENABLE_CPP_EXCEPTIONS", "NO", default="YES"): - cflags_cc.append("-fno-exceptions") - if self._Test("GCC_INLINES_ARE_PRIVATE_EXTERN", "YES", default="NO"): - cflags_cc.append("-fvisibility-inlines-hidden") - if self._Test("GCC_THREADSAFE_STATICS", "NO", default="YES"): - cflags_cc.append("-fno-threadsafe-statics") - # Note: This flag is a no-op for clang, it only has an effect for gcc. - if self._Test("GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO", "NO", default="YES"): - cflags_cc.append("-Wno-invalid-offsetof") - - other_ccflags = [] - - for flag in self._Settings().get("OTHER_CPLUSPLUSFLAGS", ["$(inherited)"]): - # TODO: More general variable expansion. Missing in many other places too. - if flag in ("$inherited", "$(inherited)", "${inherited}"): - flag = "$OTHER_CFLAGS" - if flag in ("$OTHER_CFLAGS", "$(OTHER_CFLAGS)", "${OTHER_CFLAGS}"): - other_ccflags += self._Settings().get("OTHER_CFLAGS", []) - else: - other_ccflags.append(flag) - cflags_cc += other_ccflags - - self.configname = None - return cflags_cc - - def _AddObjectiveCGarbageCollectionFlags(self, flags): - gc_policy = self._Settings().get("GCC_ENABLE_OBJC_GC", "unsupported") - if gc_policy == "supported": - flags.append("-fobjc-gc") - elif gc_policy == "required": - flags.append("-fobjc-gc-only") - - def _AddObjectiveCARCFlags(self, flags): - if self._Test("CLANG_ENABLE_OBJC_ARC", "YES", default="NO"): - flags.append("-fobjc-arc") - - def _AddObjectiveCMissingPropertySynthesisFlags(self, flags): - if self._Test( - "CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS", "YES", default="NO" - ): - flags.append("-Wobjc-missing-property-synthesis") - - def GetCflagsObjC(self, configname): - """Returns flags that need to be added to .m compilations.""" - self.configname = configname - cflags_objc = [] - self._AddObjectiveCGarbageCollectionFlags(cflags_objc) - self._AddObjectiveCARCFlags(cflags_objc) - self._AddObjectiveCMissingPropertySynthesisFlags(cflags_objc) - self.configname = None - return cflags_objc - - def GetCflagsObjCC(self, configname): - """Returns flags that need to be added to .mm compilations.""" - self.configname = configname - cflags_objcc = [] - self._AddObjectiveCGarbageCollectionFlags(cflags_objcc) - self._AddObjectiveCARCFlags(cflags_objcc) - self._AddObjectiveCMissingPropertySynthesisFlags(cflags_objcc) - if self._Test("GCC_OBJC_CALL_CXX_CDTORS", "YES", default="NO"): - cflags_objcc.append("-fobjc-call-cxx-cdtors") - self.configname = None - return cflags_objcc - - def GetInstallNameBase(self): - """Return DYLIB_INSTALL_NAME_BASE for this target.""" - # Xcode sets this for shared_libraries, and for nonbundled loadable_modules. - if self.spec["type"] != "shared_library" and ( - self.spec["type"] != "loadable_module" or self._IsBundle() - ): - return None - install_base = self.GetPerTargetSetting( - "DYLIB_INSTALL_NAME_BASE", - default="/Library/Frameworks" if self._IsBundle() else "/usr/local/lib", - ) - return install_base - - def _StandardizePath(self, path): - """Do :standardizepath processing for path.""" - # I'm not quite sure what :standardizepath does. Just call normpath(), - # but don't let @executable_path/../foo collapse to foo. - if "/" in path: - prefix, rest = "", path - if path.startswith("@"): - prefix, rest = path.split("/", 1) - rest = os.path.normpath(rest) # :standardizepath - path = os.path.join(prefix, rest) - return path - - def GetInstallName(self): - """Return LD_DYLIB_INSTALL_NAME for this target.""" - # Xcode sets this for shared_libraries, and for nonbundled loadable_modules. - if self.spec["type"] != "shared_library" and ( - self.spec["type"] != "loadable_module" or self._IsBundle() - ): - return None - - default_install_name = ( - "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)" - ) - install_name = self.GetPerTargetSetting( - "LD_DYLIB_INSTALL_NAME", default=default_install_name - ) - - # Hardcode support for the variables used in chromium for now, to - # unblock people using the make build. - if "$" in install_name: - assert install_name in ( - "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/" - "$(WRAPPER_NAME)/$(PRODUCT_NAME)", - default_install_name, - ), ( - "Variables in LD_DYLIB_INSTALL_NAME are not generally supported " - "yet in target '%s' (got '%s')" - % (self.spec["target_name"], install_name) - ) - - install_name = install_name.replace( - "$(DYLIB_INSTALL_NAME_BASE:standardizepath)", - self._StandardizePath(self.GetInstallNameBase()), - ) - if self._IsBundle(): - # These are only valid for bundles, hence the |if|. - install_name = install_name.replace( - "$(WRAPPER_NAME)", self.GetWrapperName() - ) - install_name = install_name.replace( - "$(PRODUCT_NAME)", self.GetProductName() - ) - else: - assert "$(WRAPPER_NAME)" not in install_name - assert "$(PRODUCT_NAME)" not in install_name - - install_name = install_name.replace( - "$(EXECUTABLE_PATH)", self.GetExecutablePath() - ) - return install_name - - def _MapLinkerFlagFilename(self, ldflag, gyp_to_build_path): - """Checks if ldflag contains a filename and if so remaps it from - gyp-directory-relative to build-directory-relative.""" - # This list is expanded on demand. - # They get matched as: - # -exported_symbols_list file - # -Wl,exported_symbols_list file - # -Wl,exported_symbols_list,file - LINKER_FILE = r"(\S+)" - WORD = r"\S+" - linker_flags = [ - ["-exported_symbols_list", LINKER_FILE], # Needed for NaCl. - ["-unexported_symbols_list", LINKER_FILE], - ["-reexported_symbols_list", LINKER_FILE], - ["-sectcreate", WORD, WORD, LINKER_FILE], # Needed for remoting. - ] - for flag_pattern in linker_flags: - regex = re.compile("(?:-Wl,)?" + "[ ,]".join(flag_pattern)) - m = regex.match(ldflag) - if m: - ldflag = ( - ldflag[: m.start(1)] - + gyp_to_build_path(m.group(1)) - + ldflag[m.end(1) :] - ) - # Required for ffmpeg (no idea why they don't use LIBRARY_SEARCH_PATHS, - # TODO(thakis): Update ffmpeg.gyp): - if ldflag.startswith("-L"): - ldflag = "-L" + gyp_to_build_path(ldflag[len("-L") :]) - return ldflag - - def GetLdflags(self, configname, product_dir, gyp_to_build_path, arch=None): - """Returns flags that need to be passed to the linker. - - Args: - configname: The name of the configuration to get ld flags for. - product_dir: The directory where products such static and dynamic - libraries are placed. This is added to the library search path. - gyp_to_build_path: A function that converts paths relative to the - current gyp file to paths relative to the build directory. - """ - self.configname = configname - ldflags = [] - - # The xcode build is relative to a gyp file's directory, and OTHER_LDFLAGS - # can contain entries that depend on this. Explicitly absolutify these. - for ldflag in self._Settings().get("OTHER_LDFLAGS", []): - ldflags.append(self._MapLinkerFlagFilename(ldflag, gyp_to_build_path)) - - if self._Test("DEAD_CODE_STRIPPING", "YES", default="NO"): - ldflags.append("-Wl,-dead_strip") - - if self._Test("PREBINDING", "YES", default="NO"): - ldflags.append("-Wl,-prebind") - - self._Appendf( - ldflags, "DYLIB_COMPATIBILITY_VERSION", "-compatibility_version %s" - ) - self._Appendf(ldflags, "DYLIB_CURRENT_VERSION", "-current_version %s") - - self._AppendPlatformVersionMinFlags(ldflags) - - if "SDKROOT" in self._Settings() and self._SdkPath(): - ldflags.append("-isysroot " + self._SdkPath()) - - for library_path in self._Settings().get("LIBRARY_SEARCH_PATHS", []): - ldflags.append("-L" + gyp_to_build_path(library_path)) - - if "ORDER_FILE" in self._Settings(): - ldflags.append( - "-Wl,-order_file " - + "-Wl," - + gyp_to_build_path(self._Settings()["ORDER_FILE"]) - ) - - if not gyp.common.CrossCompileRequested(): - if arch is not None: - archs = [arch] - else: - assert self.configname - archs = self.GetActiveArchs(self.configname) - if len(archs) != 1: - # TODO: Supporting fat binaries will be annoying. - self._WarnUnimplemented("ARCHS") - archs = ["i386"] - ldflags.append("-arch " + archs[0]) - - # Xcode adds the product directory by default. - # Rewrite -L. to -L./ to work around http://www.openradar.me/25313838 - ldflags.append("-L" + (product_dir if product_dir != "." else "./")) - - install_name = self.GetInstallName() - if install_name and self.spec["type"] != "loadable_module": - ldflags.append("-install_name " + install_name.replace(" ", r"\ ")) - - for rpath in self._Settings().get("LD_RUNPATH_SEARCH_PATHS", []): - ldflags.append("-Wl,-rpath," + rpath) - - sdk_root = self._SdkPath() - if not sdk_root: - sdk_root = "" - config = self.spec["configurations"][self.configname] - framework_dirs = config.get("mac_framework_dirs", []) - for directory in framework_dirs: - ldflags.append("-F" + directory.replace("$(SDKROOT)", sdk_root)) - - if self._IsXCTest(): - platform_root = self._XcodePlatformPath(configname) - if sdk_root and platform_root: - ldflags.append("-F" + platform_root + "/Developer/Library/Frameworks/") - ldflags.append("-framework XCTest") - - is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension() - if sdk_root and is_extension: - # Adds the link flags for extensions. These flags are common for all - # extensions and provide loader and main function. - # These flags reflect the compilation options used by xcode to compile - # extensions. - xcode_version, _ = XcodeVersion() - if xcode_version < "0900": - ldflags.append("-lpkstart") - ldflags.append( - sdk_root - + "/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit" - ) - else: - ldflags.append("-e _NSExtensionMain") - ldflags.append("-fapplication-extension") - - self._Appendf(ldflags, "CLANG_CXX_LIBRARY", "-stdlib=%s") - - self.configname = None - return ldflags - - def GetLibtoolflags(self, configname): - """Returns flags that need to be passed to the static linker. - - Args: - configname: The name of the configuration to get ld flags for. - """ - self.configname = configname - libtoolflags = [] - - for libtoolflag in self._Settings().get("OTHER_LDFLAGS", []): - libtoolflags.append(libtoolflag) - # TODO(thakis): ARCHS? - - self.configname = None - return libtoolflags - - def GetPerTargetSettings(self): - """Gets a list of all the per-target settings. This will only fetch keys - whose values are the same across all configurations.""" - first_pass = True - result = {} - for configname in sorted(self.xcode_settings.keys()): - if first_pass: - result = dict(self.xcode_settings[configname]) - first_pass = False - else: - for key, value in self.xcode_settings[configname].items(): - if key not in result: - continue - elif result[key] != value: - del result[key] - return result - - def GetPerConfigSetting(self, setting, configname, default=None): - if configname in self.xcode_settings: - return self.xcode_settings[configname].get(setting, default) - else: - return self.GetPerTargetSetting(setting, default) - - def GetPerTargetSetting(self, setting, default=None): - """Tries to get xcode_settings.setting from spec. Assumes that the setting - has the same value in all configurations and throws otherwise.""" - is_first_pass = True - result = None - for configname in sorted(self.xcode_settings.keys()): - if is_first_pass: - result = self.xcode_settings[configname].get(setting, None) - is_first_pass = False - else: - assert result == self.xcode_settings[configname].get(setting, None), ( - "Expected per-target setting for '%s', got per-config setting " - "(target %s)" % (setting, self.spec["target_name"]) - ) - if result is None: - return default - return result - - def _GetStripPostbuilds(self, configname, output_binary, quiet): - """Returns a list of shell commands that contain the shell commands - necessary to strip this target's binary. These should be run as postbuilds - before the actual postbuilds run.""" - self.configname = configname - - result = [] - if self._Test("DEPLOYMENT_POSTPROCESSING", "YES", default="NO") and self._Test( - "STRIP_INSTALLED_PRODUCT", "YES", default="NO" - ): - - default_strip_style = "debugging" - if ( - self.spec["type"] == "loadable_module" or self._IsIosAppExtension() - ) and self._IsBundle(): - default_strip_style = "non-global" - elif self.spec["type"] == "executable": - default_strip_style = "all" - - strip_style = self._Settings().get("STRIP_STYLE", default_strip_style) - strip_flags = {"all": "", "non-global": "-x", "debugging": "-S"}[ - strip_style - ] - - explicit_strip_flags = self._Settings().get("STRIPFLAGS", "") - if explicit_strip_flags: - strip_flags += " " + _NormalizeEnvVarReferences(explicit_strip_flags) - - if not quiet: - result.append("echo STRIP\\(%s\\)" % self.spec["target_name"]) - result.append(f"strip {strip_flags} {output_binary}") - - self.configname = None - return result - - def _GetDebugInfoPostbuilds(self, configname, output, output_binary, quiet): - """Returns a list of shell commands that contain the shell commands - necessary to massage this target's debug information. These should be run - as postbuilds before the actual postbuilds run.""" - self.configname = configname - - # For static libraries, no dSYMs are created. - result = [] - if ( - self._Test("GCC_GENERATE_DEBUGGING_SYMBOLS", "YES", default="YES") - and self._Test( - "DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym", default="dwarf" - ) - and self.spec["type"] != "static_library" - ): - if not quiet: - result.append("echo DSYMUTIL\\(%s\\)" % self.spec["target_name"]) - result.append("dsymutil {} -o {}".format(output_binary, output + ".dSYM")) - - self.configname = None - return result - - def _GetTargetPostbuilds(self, configname, output, output_binary, quiet=False): - """Returns a list of shell commands that contain the shell commands - to run as postbuilds for this target, before the actual postbuilds.""" - # dSYMs need to build before stripping happens. - return self._GetDebugInfoPostbuilds( - configname, output, output_binary, quiet - ) + self._GetStripPostbuilds(configname, output_binary, quiet) - - def _GetIOSPostbuilds(self, configname, output_binary): - """Return a shell command to codesign the iOS output binary so it can - be deployed to a device. This should be run as the very last step of the - build.""" - if not ( - self.isIOS - and (self.spec["type"] == "executable" or self._IsXCTest()) - or self.IsIosFramework() - ): - return [] - - postbuilds = [] - product_name = self.GetFullProductName() - settings = self.xcode_settings[configname] - - # Xcode expects XCTests to be copied into the TEST_HOST dir. - if self._IsXCTest(): - source = os.path.join("${BUILT_PRODUCTS_DIR}", product_name) - test_host = os.path.dirname(settings.get("TEST_HOST")) - xctest_destination = os.path.join(test_host, "PlugIns", product_name) - postbuilds.extend([f"ditto {source} {xctest_destination}"]) - - key = self._GetIOSCodeSignIdentityKey(settings) - if not key: - return postbuilds - - # Warn for any unimplemented signing xcode keys. - unimpl = ["OTHER_CODE_SIGN_FLAGS"] - unimpl = set(unimpl) & set(self.xcode_settings[configname].keys()) - if unimpl: - print( - "Warning: Some codesign keys not implemented, ignoring: %s" - % ", ".join(sorted(unimpl)) - ) - - if self._IsXCTest(): - # For device xctests, Xcode copies two extra frameworks into $TEST_HOST. - test_host = os.path.dirname(settings.get("TEST_HOST")) - frameworks_dir = os.path.join(test_host, "Frameworks") - platform_root = self._XcodePlatformPath(configname) - frameworks = [ - "Developer/Library/PrivateFrameworks/IDEBundleInjection.framework", - "Developer/Library/Frameworks/XCTest.framework", - ] - for framework in frameworks: - source = os.path.join(platform_root, framework) - destination = os.path.join(frameworks_dir, os.path.basename(framework)) - postbuilds.extend([f"ditto {source} {destination}"]) - - # Then re-sign everything with 'preserve=True' - postbuilds.extend( - [ - '%s code-sign-bundle "%s" "%s" "%s" "%s" %s' - % ( - os.path.join("${TARGET_BUILD_DIR}", "gyp-mac-tool"), - key, - settings.get("CODE_SIGN_ENTITLEMENTS", ""), - settings.get("PROVISIONING_PROFILE", ""), - destination, - True, - ) - ] - ) - plugin_dir = os.path.join(test_host, "PlugIns") - targets = [os.path.join(plugin_dir, product_name), test_host] - for target in targets: - postbuilds.extend( - [ - '%s code-sign-bundle "%s" "%s" "%s" "%s" %s' - % ( - os.path.join("${TARGET_BUILD_DIR}", "gyp-mac-tool"), - key, - settings.get("CODE_SIGN_ENTITLEMENTS", ""), - settings.get("PROVISIONING_PROFILE", ""), - target, - True, - ) - ] - ) - - postbuilds.extend( - [ - '%s code-sign-bundle "%s" "%s" "%s" "%s" %s' - % ( - os.path.join("${TARGET_BUILD_DIR}", "gyp-mac-tool"), - key, - settings.get("CODE_SIGN_ENTITLEMENTS", ""), - settings.get("PROVISIONING_PROFILE", ""), - os.path.join("${BUILT_PRODUCTS_DIR}", product_name), - False, - ) - ] - ) - return postbuilds - - def _GetIOSCodeSignIdentityKey(self, settings): - identity = settings.get("CODE_SIGN_IDENTITY") - if not identity: - return None - if identity not in XcodeSettings._codesigning_key_cache: - output = subprocess.check_output( - ["security", "find-identity", "-p", "codesigning", "-v"] - ) - for line in output.splitlines(): - if identity in line: - fingerprint = line.split()[1] - cache = XcodeSettings._codesigning_key_cache - assert identity not in cache or fingerprint == cache[identity], ( - "Multiple codesigning fingerprints for identity: %s" % identity - ) - XcodeSettings._codesigning_key_cache[identity] = fingerprint - return XcodeSettings._codesigning_key_cache.get(identity, "") - - def AddImplicitPostbuilds( - self, configname, output, output_binary, postbuilds=[], quiet=False - ): - """Returns a list of shell commands that should run before and after - |postbuilds|.""" - assert output_binary is not None - pre = self._GetTargetPostbuilds(configname, output, output_binary, quiet) - post = self._GetIOSPostbuilds(configname, output_binary) - return pre + postbuilds + post - - def _AdjustLibrary(self, library, config_name=None): - if library.endswith(".framework"): - l_flag = "-framework " + os.path.splitext(os.path.basename(library))[0] - else: - m = self.library_re.match(library) - if m: - l_flag = "-l" + m.group(1) - else: - l_flag = library - - sdk_root = self._SdkPath(config_name) - if not sdk_root: - sdk_root = "" - # Xcode 7 started shipping with ".tbd" (text based stubs) files instead of - # ".dylib" without providing a real support for them. What it does, for - # "/usr/lib" libraries, is do "-L/usr/lib -lname" which is dependent on the - # library order and cause collision when building Chrome. - # - # Instead substitute ".tbd" to ".dylib" in the generated project when the - # following conditions are both true: - # - library is referenced in the gyp file as "$(SDKROOT)/**/*.dylib", - # - the ".dylib" file does not exists but a ".tbd" file do. - library = l_flag.replace("$(SDKROOT)", sdk_root) - if l_flag.startswith("$(SDKROOT)"): - basename, ext = os.path.splitext(library) - if ext == ".dylib" and not os.path.exists(library): - tbd_library = basename + ".tbd" - if os.path.exists(tbd_library): - library = tbd_library - return library - - def AdjustLibraries(self, libraries, config_name=None): - """Transforms entries like 'Cocoa.framework' in libraries into entries like - '-framework Cocoa', 'libcrypto.dylib' into '-lcrypto', etc. - """ - libraries = [self._AdjustLibrary(library, config_name) for library in libraries] - return libraries - - def _BuildMachineOSBuild(self): - return GetStdout(["sw_vers", "-buildVersion"]) - - def _XcodeIOSDeviceFamily(self, configname): - family = self.xcode_settings[configname].get("TARGETED_DEVICE_FAMILY", "1") - return [int(x) for x in family.split(",")] - - def GetExtraPlistItems(self, configname=None): - """Returns a dictionary with extra items to insert into Info.plist.""" - if configname not in XcodeSettings._plist_cache: - cache = {} - cache["BuildMachineOSBuild"] = self._BuildMachineOSBuild() - - xcode_version, xcode_build = XcodeVersion() - cache["DTXcode"] = xcode_version - cache["DTXcodeBuild"] = xcode_build - compiler = self.xcode_settings[configname].get("GCC_VERSION") - if compiler is not None: - cache["DTCompiler"] = compiler - - sdk_root = self._SdkRoot(configname) - if not sdk_root: - sdk_root = self._DefaultSdkRoot() - sdk_version = self._GetSdkVersionInfoItem(sdk_root, "--show-sdk-version") - cache["DTSDKName"] = sdk_root + (sdk_version or "") - if xcode_version >= "0720": - cache["DTSDKBuild"] = self._GetSdkVersionInfoItem( - sdk_root, "--show-sdk-build-version" - ) - elif xcode_version >= "0430": - cache["DTSDKBuild"] = sdk_version - else: - cache["DTSDKBuild"] = cache["BuildMachineOSBuild"] - - if self.isIOS: - cache["MinimumOSVersion"] = self.xcode_settings[configname].get( - "IPHONEOS_DEPLOYMENT_TARGET" - ) - cache["DTPlatformName"] = sdk_root - cache["DTPlatformVersion"] = sdk_version - - if configname.endswith("iphoneos"): - cache["CFBundleSupportedPlatforms"] = ["iPhoneOS"] - cache["DTPlatformBuild"] = cache["DTSDKBuild"] - else: - cache["CFBundleSupportedPlatforms"] = ["iPhoneSimulator"] - # This is weird, but Xcode sets DTPlatformBuild to an empty field - # for simulator builds. - cache["DTPlatformBuild"] = "" - XcodeSettings._plist_cache[configname] = cache - - # Include extra plist items that are per-target, not per global - # XcodeSettings. - items = dict(XcodeSettings._plist_cache[configname]) - if self.isIOS: - items["UIDeviceFamily"] = self._XcodeIOSDeviceFamily(configname) - return items - - def _DefaultSdkRoot(self): - """Returns the default SDKROOT to use. - - Prior to version 5.0.0, if SDKROOT was not explicitly set in the Xcode - project, then the environment variable was empty. Starting with this - version, Xcode uses the name of the newest SDK installed. - """ - xcode_version, _ = XcodeVersion() - if xcode_version < "0500": - return "" - default_sdk_path = self._XcodeSdkPath("") - default_sdk_root = XcodeSettings._sdk_root_cache.get(default_sdk_path) - if default_sdk_root: - return default_sdk_root - try: - all_sdks = GetStdout(["xcodebuild", "-showsdks"]) - except GypError: - # If xcodebuild fails, there will be no valid SDKs - return "" - for line in all_sdks.splitlines(): - items = line.split() - if len(items) >= 3 and items[-2] == "-sdk": - sdk_root = items[-1] - sdk_path = self._XcodeSdkPath(sdk_root) - if sdk_path == default_sdk_path: - return sdk_root - return "" - - -class MacPrefixHeader: - """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature. - - This feature consists of several pieces: - * If GCC_PREFIX_HEADER is present, all compilations in that project get an - additional |-include path_to_prefix_header| cflag. - * If GCC_PRECOMPILE_PREFIX_HEADER is present too, then the prefix header is - instead compiled, and all other compilations in the project get an - additional |-include path_to_compiled_header| instead. - + Compiled prefix headers have the extension gch. There is one gch file for - every language used in the project (c, cc, m, mm), since gch files for - different languages aren't compatible. - + gch files themselves are built with the target's normal cflags, but they - obviously don't get the |-include| flag. Instead, they need a -x flag that - describes their language. - + All o files in the target need to depend on the gch file, to make sure - it's built before any o file is built. - - This class helps with some of these tasks, but it needs help from the build - system for writing dependencies to the gch files, for writing build commands - for the gch files, and for figuring out the location of the gch files. - """ - - def __init__( - self, xcode_settings, gyp_path_to_build_path, gyp_path_to_build_output - ): - """If xcode_settings is None, all methods on this class are no-ops. - - Args: - gyp_path_to_build_path: A function that takes a gyp-relative path, - and returns a path relative to the build directory. - gyp_path_to_build_output: A function that takes a gyp-relative path and - a language code ('c', 'cc', 'm', or 'mm'), and that returns a path - to where the output of precompiling that path for that language - should be placed (without the trailing '.gch'). - """ - # This doesn't support per-configuration prefix headers. Good enough - # for now. - self.header = None - self.compile_headers = False - if xcode_settings: - self.header = xcode_settings.GetPerTargetSetting("GCC_PREFIX_HEADER") - self.compile_headers = ( - xcode_settings.GetPerTargetSetting( - "GCC_PRECOMPILE_PREFIX_HEADER", default="NO" - ) - != "NO" - ) - self.compiled_headers = {} - if self.header: - if self.compile_headers: - for lang in ["c", "cc", "m", "mm"]: - self.compiled_headers[lang] = gyp_path_to_build_output( - self.header, lang - ) - self.header = gyp_path_to_build_path(self.header) - - def _CompiledHeader(self, lang, arch): - assert self.compile_headers - h = self.compiled_headers[lang] - if arch: - h += "." + arch - return h - - def GetInclude(self, lang, arch=None): - """Gets the cflags to include the prefix header for language |lang|.""" - if self.compile_headers and lang in self.compiled_headers: - return "-include %s" % self._CompiledHeader(lang, arch) - elif self.header: - return "-include %s" % self.header - else: - return "" - - def _Gch(self, lang, arch): - """Returns the actual file name of the prefix header for language |lang|.""" - assert self.compile_headers - return self._CompiledHeader(lang, arch) + ".gch" - - def GetObjDependencies(self, sources, objs, arch=None): - """Given a list of source files and the corresponding object files, returns - a list of (source, object, gch) tuples, where |gch| is the build-directory - relative path to the gch file each object file depends on. |compilable[i]| - has to be the source file belonging to |objs[i]|.""" - if not self.header or not self.compile_headers: - return [] - - result = [] - for source, obj in zip(sources, objs): - ext = os.path.splitext(source)[1] - lang = { - ".c": "c", - ".cpp": "cc", - ".cc": "cc", - ".cxx": "cc", - ".m": "m", - ".mm": "mm", - }.get(ext, None) - if lang: - result.append((source, obj, self._Gch(lang, arch))) - return result - - def GetPchBuildCommands(self, arch=None): - """Returns [(path_to_gch, language_flag, language, header)]. - |path_to_gch| and |header| are relative to the build directory. - """ - if not self.header or not self.compile_headers: - return [] - return [ - (self._Gch("c", arch), "-x c-header", "c", self.header), - (self._Gch("cc", arch), "-x c++-header", "cc", self.header), - (self._Gch("m", arch), "-x objective-c-header", "m", self.header), - (self._Gch("mm", arch), "-x objective-c++-header", "mm", self.header), - ] - - -def XcodeVersion(): - """Returns a tuple of version and build version of installed Xcode.""" - # `xcodebuild -version` output looks like - # Xcode 4.6.3 - # Build version 4H1503 - # or like - # Xcode 3.2.6 - # Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0 - # BuildVersion: 10M2518 - # Convert that to ('0463', '4H1503') or ('0326', '10M2518'). - global XCODE_VERSION_CACHE - if XCODE_VERSION_CACHE: - return XCODE_VERSION_CACHE - version = "" - build = "" - try: - version_list = GetStdoutQuiet(["xcodebuild", "-version"]).splitlines() - # In some circumstances xcodebuild exits 0 but doesn't return - # the right results; for example, a user on 10.7 or 10.8 with - # a bogus path set via xcode-select - # In that case this may be a CLT-only install so fall back to - # checking that version. - if len(version_list) < 2: - raise GypError("xcodebuild returned unexpected results") - version = version_list[0].split()[-1] # Last word on first line - build = version_list[-1].split()[-1] # Last word on last line - except GypError: # Xcode not installed so look for XCode Command Line Tools - version = CLTVersion() # macOS Catalina returns 11.0.0.0.1.1567737322 - if not version: - raise GypError("No Xcode or CLT version detected!") - # Be careful to convert "4.2.3" to "0423" and "11.0.0" to "1100": - version = version.split(".")[:3] # Just major, minor, micro - version[0] = version[0].zfill(2) # Add a leading zero if major is one digit - version = ("".join(version) + "00")[:4] # Limit to exactly four characters - XCODE_VERSION_CACHE = (version, build) - return XCODE_VERSION_CACHE - - -# This function ported from the logic in Homebrew's CLT version check -def CLTVersion(): - """Returns the version of command-line tools from pkgutil.""" - # pkgutil output looks like - # package-id: com.apple.pkg.CLTools_Executables - # version: 5.0.1.0.1.1382131676 - # volume: / - # location: / - # install-time: 1382544035 - # groups: com.apple.FindSystemFiles.pkg-group - # com.apple.DevToolsBoth.pkg-group - # com.apple.DevToolsNonRelocatableShared.pkg-group - STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo" - FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI" - MAVERICKS_PKG_ID = "com.apple.pkg.CLTools_Executables" - - regex = re.compile("version: (?P.+)") - for key in [MAVERICKS_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID]: - try: - output = GetStdout(["/usr/sbin/pkgutil", "--pkg-info", key]) - return re.search(regex, output).groupdict()["version"] - except GypError: - continue - - regex = re.compile(r'Command Line Tools for Xcode\s+(?P\S+)') - try: - output = GetStdout(["/usr/sbin/softwareupdate", "--history"]) - return re.search(regex, output).groupdict()["version"] - except GypError: - return None - - -def GetStdoutQuiet(cmdlist): - """Returns the content of standard output returned by invoking |cmdlist|. - Ignores the stderr. - Raises |GypError| if the command return with a non-zero return code.""" - job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out = job.communicate()[0].decode("utf-8") - if job.returncode != 0: - raise GypError("Error %d running %s" % (job.returncode, cmdlist[0])) - return out.rstrip("\n") - - -def GetStdout(cmdlist): - """Returns the content of standard output returned by invoking |cmdlist|. - Raises |GypError| if the command return with a non-zero return code.""" - job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE) - out = job.communicate()[0].decode("utf-8") - if job.returncode != 0: - sys.stderr.write(out + "\n") - raise GypError("Error %d running %s" % (job.returncode, cmdlist[0])) - return out.rstrip("\n") - - -def MergeGlobalXcodeSettingsToSpec(global_dict, spec): - """Merges the global xcode_settings dictionary into each configuration of the - target represented by spec. For keys that are both in the global and the local - xcode_settings dict, the local key gets precedence. - """ - # The xcode generator special-cases global xcode_settings and does something - # that amounts to merging in the global xcode_settings into each local - # xcode_settings dict. - global_xcode_settings = global_dict.get("xcode_settings", {}) - for config in spec["configurations"].values(): - if "xcode_settings" in config: - new_settings = global_xcode_settings.copy() - new_settings.update(config["xcode_settings"]) - config["xcode_settings"] = new_settings - - -def IsMacBundle(flavor, spec): - """Returns if |spec| should be treated as a bundle. - - Bundles are directories with a certain subdirectory structure, instead of - just a single file. Bundle rules do not produce a binary but also package - resources into that directory.""" - is_mac_bundle = ( - int(spec.get("mac_xctest_bundle", 0)) != 0 - or int(spec.get("mac_xcuitest_bundle", 0)) != 0 - or (int(spec.get("mac_bundle", 0)) != 0 and flavor == "mac") - ) - - if is_mac_bundle: - assert spec["type"] != "none", ( - 'mac_bundle targets cannot have type none (target "%s")' - % spec["target_name"] - ) - return is_mac_bundle - - -def GetMacBundleResources(product_dir, xcode_settings, resources): - """Yields (output, resource) pairs for every resource in |resources|. - Only call this for mac bundle targets. - - Args: - product_dir: Path to the directory containing the output bundle, - relative to the build directory. - xcode_settings: The XcodeSettings of the current target. - resources: A list of bundle resources, relative to the build directory. - """ - dest = os.path.join(product_dir, xcode_settings.GetBundleResourceFolder()) - for res in resources: - output = dest - - # The make generator doesn't support it, so forbid it everywhere - # to keep the generators more interchangeable. - assert " " not in res, "Spaces in resource filenames not supported (%s)" % res - - # Split into (path,file). - res_parts = os.path.split(res) - - # Now split the path into (prefix,maybe.lproj). - lproj_parts = os.path.split(res_parts[0]) - # If the resource lives in a .lproj bundle, add that to the destination. - if lproj_parts[1].endswith(".lproj"): - output = os.path.join(output, lproj_parts[1]) - - output = os.path.join(output, res_parts[1]) - # Compiled XIB files are referred to by .nib. - if output.endswith(".xib"): - output = os.path.splitext(output)[0] + ".nib" - # Compiled storyboard files are referred to by .storyboardc. - if output.endswith(".storyboard"): - output = os.path.splitext(output)[0] + ".storyboardc" - - yield output, res - - -def GetMacInfoPlist(product_dir, xcode_settings, gyp_path_to_build_path): - """Returns (info_plist, dest_plist, defines, extra_env), where: - * |info_plist| is the source plist path, relative to the - build directory, - * |dest_plist| is the destination plist path, relative to the - build directory, - * |defines| is a list of preprocessor defines (empty if the plist - shouldn't be preprocessed, - * |extra_env| is a dict of env variables that should be exported when - invoking |mac_tool copy-info-plist|. - - Only call this for mac bundle targets. - - Args: - product_dir: Path to the directory containing the output bundle, - relative to the build directory. - xcode_settings: The XcodeSettings of the current target. - gyp_to_build_path: A function that converts paths relative to the - current gyp file to paths relative to the build directory. - """ - info_plist = xcode_settings.GetPerTargetSetting("INFOPLIST_FILE") - if not info_plist: - return None, None, [], {} - - # The make generator doesn't support it, so forbid it everywhere - # to keep the generators more interchangeable. - assert " " not in info_plist, ( - "Spaces in Info.plist filenames not supported (%s)" % info_plist - ) - - info_plist = gyp_path_to_build_path(info_plist) - - # If explicitly set to preprocess the plist, invoke the C preprocessor and - # specify any defines as -D flags. - if ( - xcode_settings.GetPerTargetSetting("INFOPLIST_PREPROCESS", default="NO") - == "YES" - ): - # Create an intermediate file based on the path. - defines = shlex.split( - xcode_settings.GetPerTargetSetting( - "INFOPLIST_PREPROCESSOR_DEFINITIONS", default="" - ) - ) - else: - defines = [] - - dest_plist = os.path.join(product_dir, xcode_settings.GetBundlePlistPath()) - extra_env = xcode_settings.GetPerTargetSettings() - - return info_plist, dest_plist, defines, extra_env - - -def _GetXcodeEnv( - xcode_settings, built_products_dir, srcroot, configuration, additional_settings=None -): - """Return the environment variables that Xcode would set. See - http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW153 - for a full list. - - Args: - xcode_settings: An XcodeSettings object. If this is None, this function - returns an empty dict. - built_products_dir: Absolute path to the built products dir. - srcroot: Absolute path to the source root. - configuration: The build configuration name. - additional_settings: An optional dict with more values to add to the - result. - """ - - if not xcode_settings: - return {} - - # This function is considered a friend of XcodeSettings, so let it reach into - # its implementation details. - spec = xcode_settings.spec - - # These are filled in on an as-needed basis. - env = { - "BUILT_FRAMEWORKS_DIR": built_products_dir, - "BUILT_PRODUCTS_DIR": built_products_dir, - "CONFIGURATION": configuration, - "PRODUCT_NAME": xcode_settings.GetProductName(), - # For FULL_PRODUCT_NAME see: - # /Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications/MacOSX\ Product\ Types.xcspec # noqa: E501 - "SRCROOT": srcroot, - "SOURCE_ROOT": "${SRCROOT}", - # This is not true for static libraries, but currently the env is only - # written for bundles: - "TARGET_BUILD_DIR": built_products_dir, - "TEMP_DIR": "${TMPDIR}", - "XCODE_VERSION_ACTUAL": XcodeVersion()[0], - } - if xcode_settings.GetPerConfigSetting("SDKROOT", configuration): - env["SDKROOT"] = xcode_settings._SdkPath(configuration) - else: - env["SDKROOT"] = "" - - if xcode_settings.mac_toolchain_dir: - env["DEVELOPER_DIR"] = xcode_settings.mac_toolchain_dir - - if spec["type"] in ( - "executable", - "static_library", - "shared_library", - "loadable_module", - ): - env["EXECUTABLE_NAME"] = xcode_settings.GetExecutableName() - env["EXECUTABLE_PATH"] = xcode_settings.GetExecutablePath() - env["FULL_PRODUCT_NAME"] = xcode_settings.GetFullProductName() - mach_o_type = xcode_settings.GetMachOType() - if mach_o_type: - env["MACH_O_TYPE"] = mach_o_type - env["PRODUCT_TYPE"] = xcode_settings.GetProductType() - if xcode_settings._IsBundle(): - # xcodeproj_file.py sets the same Xcode subfolder value for this as for - # FRAMEWORKS_FOLDER_PATH so Xcode builds will actually use FFP's value. - env["BUILT_FRAMEWORKS_DIR"] = os.path.join( - built_products_dir + os.sep + xcode_settings.GetBundleFrameworksFolderPath() - ) - env["CONTENTS_FOLDER_PATH"] = xcode_settings.GetBundleContentsFolderPath() - env["EXECUTABLE_FOLDER_PATH"] = xcode_settings.GetBundleExecutableFolderPath() - env[ - "UNLOCALIZED_RESOURCES_FOLDER_PATH" - ] = xcode_settings.GetBundleResourceFolder() - env["JAVA_FOLDER_PATH"] = xcode_settings.GetBundleJavaFolderPath() - env["FRAMEWORKS_FOLDER_PATH"] = xcode_settings.GetBundleFrameworksFolderPath() - env[ - "SHARED_FRAMEWORKS_FOLDER_PATH" - ] = xcode_settings.GetBundleSharedFrameworksFolderPath() - env[ - "SHARED_SUPPORT_FOLDER_PATH" - ] = xcode_settings.GetBundleSharedSupportFolderPath() - env["PLUGINS_FOLDER_PATH"] = xcode_settings.GetBundlePlugInsFolderPath() - env["XPCSERVICES_FOLDER_PATH"] = xcode_settings.GetBundleXPCServicesFolderPath() - env["INFOPLIST_PATH"] = xcode_settings.GetBundlePlistPath() - env["WRAPPER_NAME"] = xcode_settings.GetWrapperName() - - install_name = xcode_settings.GetInstallName() - if install_name: - env["LD_DYLIB_INSTALL_NAME"] = install_name - install_name_base = xcode_settings.GetInstallNameBase() - if install_name_base: - env["DYLIB_INSTALL_NAME_BASE"] = install_name_base - xcode_version, _ = XcodeVersion() - if xcode_version >= "0500" and not env.get("SDKROOT"): - sdk_root = xcode_settings._SdkRoot(configuration) - if not sdk_root: - sdk_root = xcode_settings._XcodeSdkPath("") - if sdk_root is None: - sdk_root = "" - env["SDKROOT"] = sdk_root - - if not additional_settings: - additional_settings = {} - else: - # Flatten lists to strings. - for k in additional_settings: - if not isinstance(additional_settings[k], str): - additional_settings[k] = " ".join(additional_settings[k]) - additional_settings.update(env) - - for k in additional_settings: - additional_settings[k] = _NormalizeEnvVarReferences(additional_settings[k]) - - return additional_settings - - -def _NormalizeEnvVarReferences(str): - """Takes a string containing variable references in the form ${FOO}, $(FOO), - or $FOO, and returns a string with all variable references in the form ${FOO}. - """ - # $FOO -> ${FOO} - str = re.sub(r"\$([a-zA-Z_][a-zA-Z0-9_]*)", r"${\1}", str) - - # $(FOO) -> ${FOO} - matches = re.findall(r"(\$\(([a-zA-Z0-9\-_]+)\))", str) - for match in matches: - to_replace, variable = match - assert "$(" not in match, "$($(FOO)) variables not supported: " + match - str = str.replace(to_replace, "${" + variable + "}") - - return str - - -def ExpandEnvVars(string, expansions): - """Expands ${VARIABLES}, $(VARIABLES), and $VARIABLES in string per the - expansions list. If the variable expands to something that references - another variable, this variable is expanded as well if it's in env -- - until no variables present in env are left.""" - for k, v in reversed(expansions): - string = string.replace("${" + k + "}", v) - string = string.replace("$(" + k + ")", v) - string = string.replace("$" + k, v) - return string - - -def _TopologicallySortedEnvVarKeys(env): - """Takes a dict |env| whose values are strings that can refer to other keys, - for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of - env such that key2 is after key1 in L if env[key2] refers to env[key1]. - - Throws an Exception in case of dependency cycles. - """ - # Since environment variables can refer to other variables, the evaluation - # order is important. Below is the logic to compute the dependency graph - # and sort it. - regex = re.compile(r"\$\{([a-zA-Z0-9\-_]+)\}") - - def GetEdges(node): - # Use a definition of edges such that user_of_variable -> used_varible. - # This happens to be easier in this case, since a variable's - # definition contains all variables it references in a single string. - # We can then reverse the result of the topological sort at the end. - # Since: reverse(topsort(DAG)) = topsort(reverse_edges(DAG)) - matches = {v for v in regex.findall(env[node]) if v in env} - for dependee in matches: - assert "${" not in dependee, "Nested variables not supported: " + dependee - return matches - - try: - # Topologically sort, and then reverse, because we used an edge definition - # that's inverted from the expected result of this function (see comment - # above). - order = gyp.common.TopologicallySorted(env.keys(), GetEdges) - order.reverse() - return order - except gyp.common.CycleError as e: - raise GypError( - "Xcode environment variables are cyclically dependent: " + str(e.nodes) - ) - - -def GetSortedXcodeEnv( - xcode_settings, built_products_dir, srcroot, configuration, additional_settings=None -): - env = _GetXcodeEnv( - xcode_settings, built_products_dir, srcroot, configuration, additional_settings - ) - return [(key, env[key]) for key in _TopologicallySortedEnvVarKeys(env)] - - -def GetSpecPostbuildCommands(spec, quiet=False): - """Returns the list of postbuilds explicitly defined on |spec|, in a form - executable by a shell.""" - postbuilds = [] - for postbuild in spec.get("postbuilds", []): - if not quiet: - postbuilds.append( - "echo POSTBUILD\\(%s\\) %s" - % (spec["target_name"], postbuild["postbuild_name"]) - ) - postbuilds.append(gyp.common.EncodePOSIXShellList(postbuild["action"])) - return postbuilds - - -def _HasIOSTarget(targets): - """Returns true if any target contains the iOS specific key - IPHONEOS_DEPLOYMENT_TARGET.""" - for target_dict in targets.values(): - for config in target_dict["configurations"].values(): - if config.get("xcode_settings", {}).get("IPHONEOS_DEPLOYMENT_TARGET"): - return True - return False - - -def _AddIOSDeviceConfigurations(targets): - """Clone all targets and append -iphoneos to the name. Configure these targets - to build for iOS devices and use correct architectures for those builds.""" - for target_dict in targets.values(): - toolset = target_dict["toolset"] - configs = target_dict["configurations"] - for config_name, simulator_config_dict in dict(configs).items(): - iphoneos_config_dict = copy.deepcopy(simulator_config_dict) - configs[config_name + "-iphoneos"] = iphoneos_config_dict - configs[config_name + "-iphonesimulator"] = simulator_config_dict - if toolset == "target": - simulator_config_dict["xcode_settings"]["SDKROOT"] = "iphonesimulator" - iphoneos_config_dict["xcode_settings"]["SDKROOT"] = "iphoneos" - return targets - - -def CloneConfigurationForDeviceAndEmulator(target_dicts): - """If |target_dicts| contains any iOS targets, automatically create -iphoneos - targets for iOS device builds.""" - if _HasIOSTarget(target_dicts): - return _AddIOSDeviceConfigurations(target_dicts) - return target_dicts diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py deleted file mode 100644 index bb74eacbeaf4a..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +++ /dev/null @@ -1,302 +0,0 @@ -# Copyright (c) 2014 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Xcode-ninja wrapper project file generator. - -This updates the data structures passed to the Xcode gyp generator to build -with ninja instead. The Xcode project itself is transformed into a list of -executable targets, each with a build step to build with ninja, and a target -with every source and resource file. This appears to sidestep some of the -major performance headaches experienced using complex projects and large number -of targets within Xcode. -""" - -import errno -import gyp.generator.ninja -import os -import re -import xml.sax.saxutils - - -def _WriteWorkspace(main_gyp, sources_gyp, params): - """ Create a workspace to wrap main and sources gyp paths. """ - (build_file_root, build_file_ext) = os.path.splitext(main_gyp) - workspace_path = build_file_root + ".xcworkspace" - options = params["options"] - if options.generator_output: - workspace_path = os.path.join(options.generator_output, workspace_path) - try: - os.makedirs(workspace_path) - except OSError as e: - if e.errno != errno.EEXIST: - raise - output_string = ( - '\n' + '\n' - ) - for gyp_name in [main_gyp, sources_gyp]: - name = os.path.splitext(os.path.basename(gyp_name))[0] + ".xcodeproj" - name = xml.sax.saxutils.quoteattr("group:" + name) - output_string += " \n" % name - output_string += "\n" - - workspace_file = os.path.join(workspace_path, "contents.xcworkspacedata") - - try: - with open(workspace_file) as input_file: - input_string = input_file.read() - if input_string == output_string: - return - except OSError: - # Ignore errors if the file doesn't exist. - pass - - with open(workspace_file, "w") as output_file: - output_file.write(output_string) - - -def _TargetFromSpec(old_spec, params): - """ Create fake target for xcode-ninja wrapper. """ - # Determine ninja top level build dir (e.g. /path/to/out). - ninja_toplevel = None - jobs = 0 - if params: - options = params["options"] - ninja_toplevel = os.path.join( - options.toplevel_dir, gyp.generator.ninja.ComputeOutputDir(params) - ) - jobs = params.get("generator_flags", {}).get("xcode_ninja_jobs", 0) - - target_name = old_spec.get("target_name") - product_name = old_spec.get("product_name", target_name) - product_extension = old_spec.get("product_extension") - - ninja_target = {} - ninja_target["target_name"] = target_name - ninja_target["product_name"] = product_name - if product_extension: - ninja_target["product_extension"] = product_extension - ninja_target["toolset"] = old_spec.get("toolset") - ninja_target["default_configuration"] = old_spec.get("default_configuration") - ninja_target["configurations"] = {} - - # Tell Xcode to look in |ninja_toplevel| for build products. - new_xcode_settings = {} - if ninja_toplevel: - new_xcode_settings["CONFIGURATION_BUILD_DIR"] = ( - "%s/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" % ninja_toplevel - ) - - if "configurations" in old_spec: - for config in old_spec["configurations"]: - old_xcode_settings = old_spec["configurations"][config].get( - "xcode_settings", {} - ) - if "IPHONEOS_DEPLOYMENT_TARGET" in old_xcode_settings: - new_xcode_settings["CODE_SIGNING_REQUIRED"] = "NO" - new_xcode_settings["IPHONEOS_DEPLOYMENT_TARGET"] = old_xcode_settings[ - "IPHONEOS_DEPLOYMENT_TARGET" - ] - for key in ["BUNDLE_LOADER", "TEST_HOST"]: - if key in old_xcode_settings: - new_xcode_settings[key] = old_xcode_settings[key] - - ninja_target["configurations"][config] = {} - ninja_target["configurations"][config][ - "xcode_settings" - ] = new_xcode_settings - - ninja_target["mac_bundle"] = old_spec.get("mac_bundle", 0) - ninja_target["mac_xctest_bundle"] = old_spec.get("mac_xctest_bundle", 0) - ninja_target["ios_app_extension"] = old_spec.get("ios_app_extension", 0) - ninja_target["ios_watchkit_extension"] = old_spec.get("ios_watchkit_extension", 0) - ninja_target["ios_watchkit_app"] = old_spec.get("ios_watchkit_app", 0) - ninja_target["type"] = old_spec["type"] - if ninja_toplevel: - ninja_target["actions"] = [ - { - "action_name": "Compile and copy %s via ninja" % target_name, - "inputs": [], - "outputs": [], - "action": [ - "env", - "PATH=%s" % os.environ["PATH"], - "ninja", - "-C", - new_xcode_settings["CONFIGURATION_BUILD_DIR"], - target_name, - ], - "message": "Compile and copy %s via ninja" % target_name, - }, - ] - if jobs > 0: - ninja_target["actions"][0]["action"].extend(("-j", jobs)) - return ninja_target - - -def IsValidTargetForWrapper(target_extras, executable_target_pattern, spec): - """Limit targets for Xcode wrapper. - - Xcode sometimes performs poorly with too many targets, so only include - proper executable targets, with filters to customize. - Arguments: - target_extras: Regular expression to always add, matching any target. - executable_target_pattern: Regular expression limiting executable targets. - spec: Specifications for target. - """ - target_name = spec.get("target_name") - # Always include targets matching target_extras. - if target_extras is not None and re.search(target_extras, target_name): - return True - - # Otherwise just show executable targets and xc_tests. - if int(spec.get("mac_xctest_bundle", 0)) != 0 or ( - spec.get("type", "") == "executable" - and spec.get("product_extension", "") != "bundle" - ): - - # If there is a filter and the target does not match, exclude the target. - if executable_target_pattern is not None: - if not re.search(executable_target_pattern, target_name): - return False - return True - return False - - -def CreateWrapper(target_list, target_dicts, data, params): - """Initialize targets for the ninja wrapper. - - This sets up the necessary variables in the targets to generate Xcode projects - that use ninja as an external builder. - Arguments: - target_list: List of target pairs: 'base/base.gyp:base'. - target_dicts: Dict of target properties keyed on target pair. - data: Dict of flattened build files keyed on gyp path. - params: Dict of global options for gyp. - """ - orig_gyp = params["build_files"][0] - for gyp_name, gyp_dict in data.items(): - if gyp_name == orig_gyp: - depth = gyp_dict["_DEPTH"] - - # Check for custom main gyp name, otherwise use the default CHROMIUM_GYP_FILE - # and prepend .ninja before the .gyp extension. - generator_flags = params.get("generator_flags", {}) - main_gyp = generator_flags.get("xcode_ninja_main_gyp", None) - if main_gyp is None: - (build_file_root, build_file_ext) = os.path.splitext(orig_gyp) - main_gyp = build_file_root + ".ninja" + build_file_ext - - # Create new |target_list|, |target_dicts| and |data| data structures. - new_target_list = [] - new_target_dicts = {} - new_data = {} - - # Set base keys needed for |data|. - new_data[main_gyp] = {} - new_data[main_gyp]["included_files"] = [] - new_data[main_gyp]["targets"] = [] - new_data[main_gyp]["xcode_settings"] = data[orig_gyp].get("xcode_settings", {}) - - # Normally the xcode-ninja generator includes only valid executable targets. - # If |xcode_ninja_executable_target_pattern| is set, that list is reduced to - # executable targets that match the pattern. (Default all) - executable_target_pattern = generator_flags.get( - "xcode_ninja_executable_target_pattern", None - ) - - # For including other non-executable targets, add the matching target name - # to the |xcode_ninja_target_pattern| regular expression. (Default none) - target_extras = generator_flags.get("xcode_ninja_target_pattern", None) - - for old_qualified_target in target_list: - spec = target_dicts[old_qualified_target] - if IsValidTargetForWrapper(target_extras, executable_target_pattern, spec): - # Add to new_target_list. - target_name = spec.get("target_name") - new_target_name = f"{main_gyp}:{target_name}#target" - new_target_list.append(new_target_name) - - # Add to new_target_dicts. - new_target_dicts[new_target_name] = _TargetFromSpec(spec, params) - - # Add to new_data. - for old_target in data[old_qualified_target.split(":")[0]]["targets"]: - if old_target["target_name"] == target_name: - new_data_target = {} - new_data_target["target_name"] = old_target["target_name"] - new_data_target["toolset"] = old_target["toolset"] - new_data[main_gyp]["targets"].append(new_data_target) - - # Create sources target. - sources_target_name = "sources_for_indexing" - sources_target = _TargetFromSpec( - { - "target_name": sources_target_name, - "toolset": "target", - "default_configuration": "Default", - "mac_bundle": "0", - "type": "executable", - }, - None, - ) - - # Tell Xcode to look everywhere for headers. - sources_target["configurations"] = {"Default": {"include_dirs": [depth]}} - - # Put excluded files into the sources target so they can be opened in Xcode. - skip_excluded_files = not generator_flags.get( - "xcode_ninja_list_excluded_files", True - ) - - sources = [] - for target, target_dict in target_dicts.items(): - base = os.path.dirname(target) - files = target_dict.get("sources", []) + target_dict.get( - "mac_bundle_resources", [] - ) - - if not skip_excluded_files: - files.extend( - target_dict.get("sources_excluded", []) - + target_dict.get("mac_bundle_resources_excluded", []) - ) - - for action in target_dict.get("actions", []): - files.extend(action.get("inputs", [])) - - if not skip_excluded_files: - files.extend(action.get("inputs_excluded", [])) - - # Remove files starting with $. These are mostly intermediate files for the - # build system. - files = [file for file in files if not file.startswith("$")] - - # Make sources relative to root build file. - relative_path = os.path.dirname(main_gyp) - sources += [ - os.path.relpath(os.path.join(base, file), relative_path) for file in files - ] - - sources_target["sources"] = sorted(set(sources)) - - # Put sources_to_index in it's own gyp. - sources_gyp = os.path.join(os.path.dirname(main_gyp), sources_target_name + ".gyp") - fully_qualified_target_name = f"{sources_gyp}:{sources_target_name}#target" - - # Add to new_target_list, new_target_dicts and new_data. - new_target_list.append(fully_qualified_target_name) - new_target_dicts[fully_qualified_target_name] = sources_target - new_data_target = {} - new_data_target["target_name"] = sources_target["target_name"] - new_data_target["_DEPTH"] = depth - new_data_target["toolset"] = "target" - new_data[sources_gyp] = {} - new_data[sources_gyp]["targets"] = [] - new_data[sources_gyp]["included_files"] = [] - new_data[sources_gyp]["xcode_settings"] = data[orig_gyp].get("xcode_settings", {}) - new_data[sources_gyp]["targets"].append(new_data_target) - - # Write workspace to file. - _WriteWorkspace(main_gyp, sources_gyp, params) - return (new_target_list, new_target_dicts, new_data) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py deleted file mode 100644 index 4e0ec5e8828f7..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +++ /dev/null @@ -1,3197 +0,0 @@ -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Xcode project file generator. - -This module is both an Xcode project file generator and a documentation of the -Xcode project file format. Knowledge of the project file format was gained -based on extensive experience with Xcode, and by making changes to projects in -Xcode.app and observing the resultant changes in the associated project files. - -XCODE PROJECT FILES - -The generator targets the file format as written by Xcode 3.2 (specifically, -3.2.6), but past experience has taught that the format has not changed -significantly in the past several years, and future versions of Xcode are able -to read older project files. - -Xcode project files are "bundled": the project "file" from an end-user's -perspective is actually a directory with an ".xcodeproj" extension. The -project file from this module's perspective is actually a file inside this -directory, always named "project.pbxproj". This file contains a complete -description of the project and is all that is needed to use the xcodeproj. -Other files contained in the xcodeproj directory are simply used to store -per-user settings, such as the state of various UI elements in the Xcode -application. - -The project.pbxproj file is a property list, stored in a format almost -identical to the NeXTstep property list format. The file is able to carry -Unicode data, and is encoded in UTF-8. The root element in the property list -is a dictionary that contains several properties of minimal interest, and two -properties of immense interest. The most important property is a dictionary -named "objects". The entire structure of the project is represented by the -children of this property. The objects dictionary is keyed by unique 96-bit -values represented by 24 uppercase hexadecimal characters. Each value in the -objects dictionary is itself a dictionary, describing an individual object. - -Each object in the dictionary is a member of a class, which is identified by -the "isa" property of each object. A variety of classes are represented in a -project file. Objects can refer to other objects by ID, using the 24-character -hexadecimal object key. A project's objects form a tree, with a root object -of class PBXProject at the root. As an example, the PBXProject object serves -as parent to an XCConfigurationList object defining the build configurations -used in the project, a PBXGroup object serving as a container for all files -referenced in the project, and a list of target objects, each of which defines -a target in the project. There are several different types of target object, -such as PBXNativeTarget and PBXAggregateTarget. In this module, this -relationship is expressed by having each target type derive from an abstract -base named XCTarget. - -The project.pbxproj file's root dictionary also contains a property, sibling to -the "objects" dictionary, named "rootObject". The value of rootObject is a -24-character object key referring to the root PBXProject object in the -objects dictionary. - -In Xcode, every file used as input to a target or produced as a final product -of a target must appear somewhere in the hierarchy rooted at the PBXGroup -object referenced by the PBXProject's mainGroup property. A PBXGroup is -generally represented as a folder in the Xcode application. PBXGroups can -contain other PBXGroups as well as PBXFileReferences, which are pointers to -actual files. - -Each XCTarget contains a list of build phases, represented in this module by -the abstract base XCBuildPhase. Examples of concrete XCBuildPhase derivations -are PBXSourcesBuildPhase and PBXFrameworksBuildPhase, which correspond to the -"Compile Sources" and "Link Binary With Libraries" phases displayed in the -Xcode application. Files used as input to these phases (for example, source -files in the former case and libraries and frameworks in the latter) are -represented by PBXBuildFile objects, referenced by elements of "files" lists -in XCTarget objects. Each PBXBuildFile object refers to a PBXBuildFile -object as a "weak" reference: it does not "own" the PBXBuildFile, which is -owned by the root object's mainGroup or a descendant group. In most cases, the -layer of indirection between an XCBuildPhase and a PBXFileReference via a -PBXBuildFile appears extraneous, but there's actually one reason for this: -file-specific compiler flags are added to the PBXBuildFile object so as to -allow a single file to be a member of multiple targets while having distinct -compiler flags for each. These flags can be modified in the Xcode applciation -in the "Build" tab of a File Info window. - -When a project is open in the Xcode application, Xcode will rewrite it. As -such, this module is careful to adhere to the formatting used by Xcode, to -avoid insignificant changes appearing in the file when it is used in the -Xcode application. This will keep version control repositories happy, and -makes it possible to compare a project file used in Xcode to one generated by -this module to determine if any significant changes were made in the -application. - -Xcode has its own way of assigning 24-character identifiers to each object, -which is not duplicated here. Because the identifier only is only generated -once, when an object is created, and is then left unchanged, there is no need -to attempt to duplicate Xcode's behavior in this area. The generator is free -to select any identifier, even at random, to refer to the objects it creates, -and Xcode will retain those identifiers and use them when subsequently -rewriting the project file. However, the generator would choose new random -identifiers each time the project files are generated, leading to difficulties -comparing "used" project files to "pristine" ones produced by this module, -and causing the appearance of changes as every object identifier is changed -when updated projects are checked in to a version control repository. To -mitigate this problem, this module chooses identifiers in a more deterministic -way, by hashing a description of each object as well as its parent and ancestor -objects. This strategy should result in minimal "shift" in IDs as successive -generations of project files are produced. - -THIS MODULE - -This module introduces several classes, all derived from the XCObject class. -Nearly all of the "brains" are built into the XCObject class, which understands -how to create and modify objects, maintain the proper tree structure, compute -identifiers, and print objects. For the most part, classes derived from -XCObject need only provide a _schema class object, a dictionary that -expresses what properties objects of the class may contain. - -Given this structure, it's possible to build a minimal project file by creating -objects of the appropriate types and making the proper connections: - - config_list = XCConfigurationList() - group = PBXGroup() - project = PBXProject({'buildConfigurationList': config_list, - 'mainGroup': group}) - -With the project object set up, it can be added to an XCProjectFile object. -XCProjectFile is a pseudo-class in the sense that it is a concrete XCObject -subclass that does not actually correspond to a class type found in a project -file. Rather, it is used to represent the project file's root dictionary. -Printing an XCProjectFile will print the entire project file, including the -full "objects" dictionary. - - project_file = XCProjectFile({'rootObject': project}) - project_file.ComputeIDs() - project_file.Print() - -Xcode project files are always encoded in UTF-8. This module will accept -strings of either the str class or the unicode class. Strings of class str -are assumed to already be encoded in UTF-8. Obviously, if you're just using -ASCII, you won't encounter difficulties because ASCII is a UTF-8 subset. -Strings of class unicode are handled properly and encoded in UTF-8 when -a project file is output. -""" - -import gyp.common -from functools import cmp_to_key -import hashlib -from operator import attrgetter -import posixpath -import re -import struct -import sys - - -def cmp(x, y): - return (x > y) - (x < y) - - -# See XCObject._EncodeString. This pattern is used to determine when a string -# can be printed unquoted. Strings that match this pattern may be printed -# unquoted. Strings that do not match must be quoted and may be further -# transformed to be properly encoded. Note that this expression matches the -# characters listed with "+", for 1 or more occurrences: if a string is empty, -# it must not match this pattern, because it needs to be encoded as "". -_unquoted = re.compile("^[A-Za-z0-9$./_]+$") - -# Strings that match this pattern are quoted regardless of what _unquoted says. -# Oddly, Xcode will quote any string with a run of three or more underscores. -_quoted = re.compile("___") - -# This pattern should match any character that needs to be escaped by -# XCObject._EncodeString. See that function. -_escaped = re.compile('[\\\\"]|[\x00-\x1f]') - - -# Used by SourceTreeAndPathFromPath -_path_leading_variable = re.compile(r"^\$\((.*?)\)(/(.*))?$") - - -def SourceTreeAndPathFromPath(input_path): - """Given input_path, returns a tuple with sourceTree and path values. - - Examples: - input_path (source_tree, output_path) - '$(VAR)/path' ('VAR', 'path') - '$(VAR)' ('VAR', None) - 'path' (None, 'path') - """ - - source_group_match = _path_leading_variable.match(input_path) - if source_group_match: - source_tree = source_group_match.group(1) - output_path = source_group_match.group(3) # This may be None. - else: - source_tree = None - output_path = input_path - - return (source_tree, output_path) - - -def ConvertVariablesToShellSyntax(input_string): - return re.sub(r"\$\((.*?)\)", "${\\1}", input_string) - - -class XCObject: - """The abstract base of all class types used in Xcode project files. - - Class variables: - _schema: A dictionary defining the properties of this class. The keys to - _schema are string property keys as used in project files. Values - are a list of four or five elements: - [ is_list, property_type, is_strong, is_required, default ] - is_list: True if the property described is a list, as opposed - to a single element. - property_type: The type to use as the value of the property, - or if is_list is True, the type to use for each - element of the value's list. property_type must - be an XCObject subclass, or one of the built-in - types str, int, or dict. - is_strong: If property_type is an XCObject subclass, is_strong - is True to assert that this class "owns," or serves - as parent, to the property value (or, if is_list is - True, values). is_strong must be False if - property_type is not an XCObject subclass. - is_required: True if the property is required for the class. - Note that is_required being True does not preclude - an empty string ("", in the case of property_type - str) or list ([], in the case of is_list True) from - being set for the property. - default: Optional. If is_required is True, default may be set - to provide a default value for objects that do not supply - their own value. If is_required is True and default - is not provided, users of the class must supply their own - value for the property. - Note that although the values of the array are expressed in - boolean terms, subclasses provide values as integers to conserve - horizontal space. - _should_print_single_line: False in XCObject. Subclasses whose objects - should be written to the project file in the - alternate single-line format, such as - PBXFileReference and PBXBuildFile, should - set this to True. - _encode_transforms: Used by _EncodeString to encode unprintable characters. - The index into this list is the ordinal of the - character to transform; each value is a string - used to represent the character in the output. XCObject - provides an _encode_transforms list suitable for most - XCObject subclasses. - _alternate_encode_transforms: Provided for subclasses that wish to use - the alternate encoding rules. Xcode seems - to use these rules when printing objects in - single-line format. Subclasses that desire - this behavior should set _encode_transforms - to _alternate_encode_transforms. - _hashables: A list of XCObject subclasses that can be hashed by ComputeIDs - to construct this object's ID. Most classes that need custom - hashing behavior should do it by overriding Hashables, - but in some cases an object's parent may wish to push a - hashable value into its child, and it can do so by appending - to _hashables. - Attributes: - id: The object's identifier, a 24-character uppercase hexadecimal string. - Usually, objects being created should not set id until the entire - project file structure is built. At that point, UpdateIDs() should - be called on the root object to assign deterministic values for id to - each object in the tree. - parent: The object's parent. This is set by a parent XCObject when a child - object is added to it. - _properties: The object's property dictionary. An object's properties are - described by its class' _schema variable. - """ - - _schema = {} - _should_print_single_line = False - - # See _EncodeString. - _encode_transforms = [] - i = 0 - while i < ord(" "): - _encode_transforms.append("\\U%04x" % i) - i = i + 1 - _encode_transforms[7] = "\\a" - _encode_transforms[8] = "\\b" - _encode_transforms[9] = "\\t" - _encode_transforms[10] = "\\n" - _encode_transforms[11] = "\\v" - _encode_transforms[12] = "\\f" - _encode_transforms[13] = "\\n" - - _alternate_encode_transforms = list(_encode_transforms) - _alternate_encode_transforms[9] = chr(9) - _alternate_encode_transforms[10] = chr(10) - _alternate_encode_transforms[11] = chr(11) - - def __init__(self, properties=None, id=None, parent=None): - self.id = id - self.parent = parent - self._properties = {} - self._hashables = [] - self._SetDefaultsFromSchema() - self.UpdateProperties(properties) - - def __repr__(self): - try: - name = self.Name() - except NotImplementedError: - return f"<{self.__class__.__name__} at 0x{id(self):x}>" - return f"<{self.__class__.__name__} {name!r} at 0x{id(self):x}>" - - def Copy(self): - """Make a copy of this object. - - The new object will have its own copy of lists and dicts. Any XCObject - objects owned by this object (marked "strong") will be copied in the - new object, even those found in lists. If this object has any weak - references to other XCObjects, the same references are added to the new - object without making a copy. - """ - - that = self.__class__(id=self.id, parent=self.parent) - for key, value in self._properties.items(): - is_strong = self._schema[key][2] - - if isinstance(value, XCObject): - if is_strong: - new_value = value.Copy() - new_value.parent = that - that._properties[key] = new_value - else: - that._properties[key] = value - elif isinstance(value, (str, int)): - that._properties[key] = value - elif isinstance(value, list): - if is_strong: - # If is_strong is True, each element is an XCObject, so it's safe to - # call Copy. - that._properties[key] = [] - for item in value: - new_item = item.Copy() - new_item.parent = that - that._properties[key].append(new_item) - else: - that._properties[key] = value[:] - elif isinstance(value, dict): - # dicts are never strong. - if is_strong: - raise TypeError( - "Strong dict for key " + key + " in " + self.__class__.__name__ - ) - else: - that._properties[key] = value.copy() - else: - raise TypeError( - "Unexpected type " - + value.__class__.__name__ - + " for key " - + key - + " in " - + self.__class__.__name__ - ) - - return that - - def Name(self): - """Return the name corresponding to an object. - - Not all objects necessarily need to be nameable, and not all that do have - a "name" property. Override as needed. - """ - - # If the schema indicates that "name" is required, try to access the - # property even if it doesn't exist. This will result in a KeyError - # being raised for the property that should be present, which seems more - # appropriate than NotImplementedError in this case. - if "name" in self._properties or ( - "name" in self._schema and self._schema["name"][3] - ): - return self._properties["name"] - - raise NotImplementedError(self.__class__.__name__ + " must implement Name") - - def Comment(self): - """Return a comment string for the object. - - Most objects just use their name as the comment, but PBXProject uses - different values. - - The returned comment is not escaped and does not have any comment marker - strings applied to it. - """ - - return self.Name() - - def Hashables(self): - hashables = [self.__class__.__name__] - - name = self.Name() - if name is not None: - hashables.append(name) - - hashables.extend(self._hashables) - - return hashables - - def HashablesForChild(self): - return None - - def ComputeIDs(self, recursive=True, overwrite=True, seed_hash=None): - """Set "id" properties deterministically. - - An object's "id" property is set based on a hash of its class type and - name, as well as the class type and name of all ancestor objects. As - such, it is only advisable to call ComputeIDs once an entire project file - tree is built. - - If recursive is True, recurse into all descendant objects and update their - hashes. - - If overwrite is True, any existing value set in the "id" property will be - replaced. - """ - - def _HashUpdate(hash, data): - """Update hash with data's length and contents. - - If the hash were updated only with the value of data, it would be - possible for clowns to induce collisions by manipulating the names of - their objects. By adding the length, it's exceedingly less likely that - ID collisions will be encountered, intentionally or not. - """ - - hash.update(struct.pack(">i", len(data))) - if isinstance(data, str): - data = data.encode("utf-8") - hash.update(data) - - if seed_hash is None: - seed_hash = hashlib.sha1() - - hash = seed_hash.copy() - - hashables = self.Hashables() - assert len(hashables) > 0 - for hashable in hashables: - _HashUpdate(hash, hashable) - - if recursive: - hashables_for_child = self.HashablesForChild() - if hashables_for_child is None: - child_hash = hash - else: - assert len(hashables_for_child) > 0 - child_hash = seed_hash.copy() - for hashable in hashables_for_child: - _HashUpdate(child_hash, hashable) - - for child in self.Children(): - child.ComputeIDs(recursive, overwrite, child_hash) - - if overwrite or self.id is None: - # Xcode IDs are only 96 bits (24 hex characters), but a SHA-1 digest is - # is 160 bits. Instead of throwing out 64 bits of the digest, xor them - # into the portion that gets used. - assert hash.digest_size % 4 == 0 - digest_int_count = hash.digest_size // 4 - digest_ints = struct.unpack(">" + "I" * digest_int_count, hash.digest()) - id_ints = [0, 0, 0] - for index in range(0, digest_int_count): - id_ints[index % 3] ^= digest_ints[index] - self.id = "%08X%08X%08X" % tuple(id_ints) - - def EnsureNoIDCollisions(self): - """Verifies that no two objects have the same ID. Checks all descendants. - """ - - ids = {} - descendants = self.Descendants() - for descendant in descendants: - if descendant.id in ids: - other = ids[descendant.id] - raise KeyError( - 'Duplicate ID %s, objects "%s" and "%s" in "%s"' - % ( - descendant.id, - str(descendant._properties), - str(other._properties), - self._properties["rootObject"].Name(), - ) - ) - ids[descendant.id] = descendant - - def Children(self): - """Returns a list of all of this object's owned (strong) children.""" - - children = [] - for property, attributes in self._schema.items(): - (is_list, property_type, is_strong) = attributes[0:3] - if is_strong and property in self._properties: - if not is_list: - children.append(self._properties[property]) - else: - children.extend(self._properties[property]) - return children - - def Descendants(self): - """Returns a list of all of this object's descendants, including this - object. - """ - - children = self.Children() - descendants = [self] - for child in children: - descendants.extend(child.Descendants()) - return descendants - - def PBXProjectAncestor(self): - # The base case for recursion is defined at PBXProject.PBXProjectAncestor. - if self.parent: - return self.parent.PBXProjectAncestor() - return None - - def _EncodeComment(self, comment): - """Encodes a comment to be placed in the project file output, mimicking - Xcode behavior. - """ - - # This mimics Xcode behavior by wrapping the comment in "/*" and "*/". If - # the string already contains a "*/", it is turned into "(*)/". This keeps - # the file writer from outputting something that would be treated as the - # end of a comment in the middle of something intended to be entirely a - # comment. - - return "/* " + comment.replace("*/", "(*)/") + " */" - - def _EncodeTransform(self, match): - # This function works closely with _EncodeString. It will only be called - # by re.sub with match.group(0) containing a character matched by the - # the _escaped expression. - char = match.group(0) - - # Backslashes (\) and quotation marks (") are always replaced with a - # backslash-escaped version of the same. Everything else gets its - # replacement from the class' _encode_transforms array. - if char == "\\": - return "\\\\" - if char == '"': - return '\\"' - return self._encode_transforms[ord(char)] - - def _EncodeString(self, value): - """Encodes a string to be placed in the project file output, mimicking - Xcode behavior. - """ - - # Use quotation marks when any character outside of the range A-Z, a-z, 0-9, - # $ (dollar sign), . (period), and _ (underscore) is present. Also use - # quotation marks to represent empty strings. - # - # Escape " (double-quote) and \ (backslash) by preceding them with a - # backslash. - # - # Some characters below the printable ASCII range are encoded specially: - # 7 ^G BEL is encoded as "\a" - # 8 ^H BS is encoded as "\b" - # 11 ^K VT is encoded as "\v" - # 12 ^L NP is encoded as "\f" - # 127 ^? DEL is passed through as-is without escaping - # - In PBXFileReference and PBXBuildFile objects: - # 9 ^I HT is passed through as-is without escaping - # 10 ^J NL is passed through as-is without escaping - # 13 ^M CR is passed through as-is without escaping - # - In other objects: - # 9 ^I HT is encoded as "\t" - # 10 ^J NL is encoded as "\n" - # 13 ^M CR is encoded as "\n" rendering it indistinguishable from - # 10 ^J NL - # All other characters within the ASCII control character range (0 through - # 31 inclusive) are encoded as "\U001f" referring to the Unicode code point - # in hexadecimal. For example, character 14 (^N SO) is encoded as "\U000e". - # Characters above the ASCII range are passed through to the output encoded - # as UTF-8 without any escaping. These mappings are contained in the - # class' _encode_transforms list. - - if _unquoted.search(value) and not _quoted.search(value): - return value - - return '"' + _escaped.sub(self._EncodeTransform, value) + '"' - - def _XCPrint(self, file, tabs, line): - file.write("\t" * tabs + line) - - def _XCPrintableValue(self, tabs, value, flatten_list=False): - """Returns a representation of value that may be printed in a project file, - mimicking Xcode's behavior. - - _XCPrintableValue can handle str and int values, XCObjects (which are - made printable by returning their id property), and list and dict objects - composed of any of the above types. When printing a list or dict, and - _should_print_single_line is False, the tabs parameter is used to determine - how much to indent the lines corresponding to the items in the list or - dict. - - If flatten_list is True, single-element lists will be transformed into - strings. - """ - - printable = "" - comment = None - - if self._should_print_single_line: - sep = " " - element_tabs = "" - end_tabs = "" - else: - sep = "\n" - element_tabs = "\t" * (tabs + 1) - end_tabs = "\t" * tabs - - if isinstance(value, XCObject): - printable += value.id - comment = value.Comment() - elif isinstance(value, str): - printable += self._EncodeString(value) - elif isinstance(value, str): - printable += self._EncodeString(value.encode("utf-8")) - elif isinstance(value, int): - printable += str(value) - elif isinstance(value, list): - if flatten_list and len(value) <= 1: - if len(value) == 0: - printable += self._EncodeString("") - else: - printable += self._EncodeString(value[0]) - else: - printable = "(" + sep - for item in value: - printable += ( - element_tabs - + self._XCPrintableValue(tabs + 1, item, flatten_list) - + "," - + sep - ) - printable += end_tabs + ")" - elif isinstance(value, dict): - printable = "{" + sep - for item_key, item_value in sorted(value.items()): - printable += ( - element_tabs - + self._XCPrintableValue(tabs + 1, item_key, flatten_list) - + " = " - + self._XCPrintableValue(tabs + 1, item_value, flatten_list) - + ";" - + sep - ) - printable += end_tabs + "}" - else: - raise TypeError("Can't make " + value.__class__.__name__ + " printable") - - if comment: - printable += " " + self._EncodeComment(comment) - - return printable - - def _XCKVPrint(self, file, tabs, key, value): - """Prints a key and value, members of an XCObject's _properties dictionary, - to file. - - tabs is an int identifying the indentation level. If the class' - _should_print_single_line variable is True, tabs is ignored and the - key-value pair will be followed by a space insead of a newline. - """ - - if self._should_print_single_line: - printable = "" - after_kv = " " - else: - printable = "\t" * tabs - after_kv = "\n" - - # Xcode usually prints remoteGlobalIDString values in PBXContainerItemProxy - # objects without comments. Sometimes it prints them with comments, but - # the majority of the time, it doesn't. To avoid unnecessary changes to - # the project file after Xcode opens it, don't write comments for - # remoteGlobalIDString. This is a sucky hack and it would certainly be - # cleaner to extend the schema to indicate whether or not a comment should - # be printed, but since this is the only case where the problem occurs and - # Xcode itself can't seem to make up its mind, the hack will suffice. - # - # Also see PBXContainerItemProxy._schema['remoteGlobalIDString']. - if key == "remoteGlobalIDString" and isinstance(self, PBXContainerItemProxy): - value_to_print = value.id - else: - value_to_print = value - - # PBXBuildFile's settings property is represented in the output as a dict, - # but a hack here has it represented as a string. Arrange to strip off the - # quotes so that it shows up in the output as expected. - if key == "settings" and isinstance(self, PBXBuildFile): - strip_value_quotes = True - else: - strip_value_quotes = False - - # In another one-off, let's set flatten_list on buildSettings properties - # of XCBuildConfiguration objects, because that's how Xcode treats them. - if key == "buildSettings" and isinstance(self, XCBuildConfiguration): - flatten_list = True - else: - flatten_list = False - - try: - printable_key = self._XCPrintableValue(tabs, key, flatten_list) - printable_value = self._XCPrintableValue(tabs, value_to_print, flatten_list) - if ( - strip_value_quotes - and len(printable_value) > 1 - and printable_value[0] == '"' - and printable_value[-1] == '"' - ): - printable_value = printable_value[1:-1] - printable += printable_key + " = " + printable_value + ";" + after_kv - except TypeError as e: - gyp.common.ExceptionAppend(e, 'while printing key "%s"' % key) - raise - - self._XCPrint(file, 0, printable) - - def Print(self, file=sys.stdout): - """Prints a reprentation of this object to file, adhering to Xcode output - formatting. - """ - - self.VerifyHasRequiredProperties() - - if self._should_print_single_line: - # When printing an object in a single line, Xcode doesn't put any space - # between the beginning of a dictionary (or presumably a list) and the - # first contained item, so you wind up with snippets like - # ...CDEF = {isa = PBXFileReference; fileRef = 0123... - # If it were me, I would have put a space in there after the opening - # curly, but I guess this is just another one of those inconsistencies - # between how Xcode prints PBXFileReference and PBXBuildFile objects as - # compared to other objects. Mimic Xcode's behavior here by using an - # empty string for sep. - sep = "" - end_tabs = 0 - else: - sep = "\n" - end_tabs = 2 - - # Start the object. For example, '\t\tPBXProject = {\n'. - self._XCPrint(file, 2, self._XCPrintableValue(2, self) + " = {" + sep) - - # "isa" isn't in the _properties dictionary, it's an intrinsic property - # of the class which the object belongs to. Xcode always outputs "isa" - # as the first element of an object dictionary. - self._XCKVPrint(file, 3, "isa", self.__class__.__name__) - - # The remaining elements of an object dictionary are sorted alphabetically. - for property, value in sorted(self._properties.items()): - self._XCKVPrint(file, 3, property, value) - - # End the object. - self._XCPrint(file, end_tabs, "};\n") - - def UpdateProperties(self, properties, do_copy=False): - """Merge the supplied properties into the _properties dictionary. - - The input properties must adhere to the class schema or a KeyError or - TypeError exception will be raised. If adding an object of an XCObject - subclass and the schema indicates a strong relationship, the object's - parent will be set to this object. - - If do_copy is True, then lists, dicts, strong-owned XCObjects, and - strong-owned XCObjects in lists will be copied instead of having their - references added. - """ - - if properties is None: - return - - for property, value in properties.items(): - # Make sure the property is in the schema. - if property not in self._schema: - raise KeyError(property + " not in " + self.__class__.__name__) - - # Make sure the property conforms to the schema. - (is_list, property_type, is_strong) = self._schema[property][0:3] - if is_list: - if value.__class__ != list: - raise TypeError( - property - + " of " - + self.__class__.__name__ - + " must be list, not " - + value.__class__.__name__ - ) - for item in value: - if not isinstance(item, property_type) and not ( - isinstance(item, str) and property_type == str - ): - # Accept unicode where str is specified. str is treated as - # UTF-8-encoded. - raise TypeError( - "item of " - + property - + " of " - + self.__class__.__name__ - + " must be " - + property_type.__name__ - + ", not " - + item.__class__.__name__ - ) - elif not isinstance(value, property_type) and not ( - isinstance(value, str) and property_type == str - ): - # Accept unicode where str is specified. str is treated as - # UTF-8-encoded. - raise TypeError( - property - + " of " - + self.__class__.__name__ - + " must be " - + property_type.__name__ - + ", not " - + value.__class__.__name__ - ) - - # Checks passed, perform the assignment. - if do_copy: - if isinstance(value, XCObject): - if is_strong: - self._properties[property] = value.Copy() - else: - self._properties[property] = value - elif isinstance(value, (str, int)): - self._properties[property] = value - elif isinstance(value, list): - if is_strong: - # If is_strong is True, each element is an XCObject, - # so it's safe to call Copy. - self._properties[property] = [] - for item in value: - self._properties[property].append(item.Copy()) - else: - self._properties[property] = value[:] - elif isinstance(value, dict): - self._properties[property] = value.copy() - else: - raise TypeError( - "Don't know how to copy a " - + value.__class__.__name__ - + " object for " - + property - + " in " - + self.__class__.__name__ - ) - else: - self._properties[property] = value - - # Set up the child's back-reference to this object. Don't use |value| - # any more because it may not be right if do_copy is true. - if is_strong: - if not is_list: - self._properties[property].parent = self - else: - for item in self._properties[property]: - item.parent = self - - def HasProperty(self, key): - return key in self._properties - - def GetProperty(self, key): - return self._properties[key] - - def SetProperty(self, key, value): - self.UpdateProperties({key: value}) - - def DelProperty(self, key): - if key in self._properties: - del self._properties[key] - - def AppendProperty(self, key, value): - # TODO(mark): Support ExtendProperty too (and make this call that)? - - # Schema validation. - if key not in self._schema: - raise KeyError(key + " not in " + self.__class__.__name__) - - (is_list, property_type, is_strong) = self._schema[key][0:3] - if not is_list: - raise TypeError(key + " of " + self.__class__.__name__ + " must be list") - if not isinstance(value, property_type): - raise TypeError( - "item of " - + key - + " of " - + self.__class__.__name__ - + " must be " - + property_type.__name__ - + ", not " - + value.__class__.__name__ - ) - - # If the property doesn't exist yet, create a new empty list to receive the - # item. - self._properties[key] = self._properties.get(key, []) - - # Set up the ownership link. - if is_strong: - value.parent = self - - # Store the item. - self._properties[key].append(value) - - def VerifyHasRequiredProperties(self): - """Ensure that all properties identified as required by the schema are - set. - """ - - # TODO(mark): A stronger verification mechanism is needed. Some - # subclasses need to perform validation beyond what the schema can enforce. - for property, attributes in self._schema.items(): - (is_list, property_type, is_strong, is_required) = attributes[0:4] - if is_required and property not in self._properties: - raise KeyError(self.__class__.__name__ + " requires " + property) - - def _SetDefaultsFromSchema(self): - """Assign object default values according to the schema. This will not - overwrite properties that have already been set.""" - - defaults = {} - for property, attributes in self._schema.items(): - (is_list, property_type, is_strong, is_required) = attributes[0:4] - if ( - is_required - and len(attributes) >= 5 - and property not in self._properties - ): - default = attributes[4] - - defaults[property] = default - - if len(defaults) > 0: - # Use do_copy=True so that each new object gets its own copy of strong - # objects, lists, and dicts. - self.UpdateProperties(defaults, do_copy=True) - - -class XCHierarchicalElement(XCObject): - """Abstract base for PBXGroup and PBXFileReference. Not represented in a - project file.""" - - # TODO(mark): Do name and path belong here? Probably so. - # If path is set and name is not, name may have a default value. Name will - # be set to the basename of path, if the basename of path is different from - # the full value of path. If path is already just a leaf name, name will - # not be set. - _schema = XCObject._schema.copy() - _schema.update( - { - "comments": [0, str, 0, 0], - "fileEncoding": [0, str, 0, 0], - "includeInIndex": [0, int, 0, 0], - "indentWidth": [0, int, 0, 0], - "lineEnding": [0, int, 0, 0], - "sourceTree": [0, str, 0, 1, ""], - "tabWidth": [0, int, 0, 0], - "usesTabs": [0, int, 0, 0], - "wrapsLines": [0, int, 0, 0], - } - ) - - def __init__(self, properties=None, id=None, parent=None): - # super - XCObject.__init__(self, properties, id, parent) - if "path" in self._properties and "name" not in self._properties: - path = self._properties["path"] - name = posixpath.basename(path) - if name != "" and path != name: - self.SetProperty("name", name) - - if "path" in self._properties and ( - "sourceTree" not in self._properties - or self._properties["sourceTree"] == "" - ): - # If the pathname begins with an Xcode variable like "$(SDKROOT)/", take - # the variable out and make the path be relative to that variable by - # assigning the variable name as the sourceTree. - (source_tree, path) = SourceTreeAndPathFromPath(self._properties["path"]) - if source_tree is not None: - self._properties["sourceTree"] = source_tree - if path is not None: - self._properties["path"] = path - if ( - source_tree is not None - and path is None - and "name" not in self._properties - ): - # The path was of the form "$(SDKROOT)" with no path following it. - # This object is now relative to that variable, so it has no path - # attribute of its own. It does, however, keep a name. - del self._properties["path"] - self._properties["name"] = source_tree - - def Name(self): - if "name" in self._properties: - return self._properties["name"] - elif "path" in self._properties: - return self._properties["path"] - else: - # This happens in the case of the root PBXGroup. - return None - - def Hashables(self): - """Custom hashables for XCHierarchicalElements. - - XCHierarchicalElements are special. Generally, their hashes shouldn't - change if the paths don't change. The normal XCObject implementation of - Hashables adds a hashable for each object, which means that if - the hierarchical structure changes (possibly due to changes caused when - TakeOverOnlyChild runs and encounters slight changes in the hierarchy), - the hashes will change. For example, if a project file initially contains - a/b/f1 and a/b becomes collapsed into a/b, f1 will have a single parent - a/b. If someone later adds a/f2 to the project file, a/b can no longer be - collapsed, and f1 winds up with parent b and grandparent a. That would - be sufficient to change f1's hash. - - To counteract this problem, hashables for all XCHierarchicalElements except - for the main group (which has neither a name nor a path) are taken to be - just the set of path components. Because hashables are inherited from - parents, this provides assurance that a/b/f1 has the same set of hashables - whether its parent is b or a/b. - - The main group is a special case. As it is permitted to have no name or - path, it is permitted to use the standard XCObject hash mechanism. This - is not considered a problem because there can be only one main group. - """ - - if self == self.PBXProjectAncestor()._properties["mainGroup"]: - # super - return XCObject.Hashables(self) - - hashables = [] - - # Put the name in first, ensuring that if TakeOverOnlyChild collapses - # children into a top-level group like "Source", the name always goes - # into the list of hashables without interfering with path components. - if "name" in self._properties: - # Make it less likely for people to manipulate hashes by following the - # pattern of always pushing an object type value onto the list first. - hashables.append(self.__class__.__name__ + ".name") - hashables.append(self._properties["name"]) - - # NOTE: This still has the problem that if an absolute path is encountered, - # including paths with a sourceTree, they'll still inherit their parents' - # hashables, even though the paths aren't relative to their parents. This - # is not expected to be much of a problem in practice. - path = self.PathFromSourceTreeAndPath() - if path is not None: - components = path.split(posixpath.sep) - for component in components: - hashables.append(self.__class__.__name__ + ".path") - hashables.append(component) - - hashables.extend(self._hashables) - - return hashables - - def Compare(self, other): - # Allow comparison of these types. PBXGroup has the highest sort rank; - # PBXVariantGroup is treated as equal to PBXFileReference. - valid_class_types = { - PBXFileReference: "file", - PBXGroup: "group", - PBXVariantGroup: "file", - } - self_type = valid_class_types[self.__class__] - other_type = valid_class_types[other.__class__] - - if self_type == other_type: - # If the two objects are of the same sort rank, compare their names. - return cmp(self.Name(), other.Name()) - - # Otherwise, sort groups before everything else. - if self_type == "group": - return -1 - return 1 - - def CompareRootGroup(self, other): - # This function should be used only to compare direct children of the - # containing PBXProject's mainGroup. These groups should appear in the - # listed order. - # TODO(mark): "Build" is used by gyp.generator.xcode, perhaps the - # generator should have a way of influencing this list rather than having - # to hardcode for the generator here. - order = [ - "Source", - "Intermediates", - "Projects", - "Frameworks", - "Products", - "Build", - ] - - # If the groups aren't in the listed order, do a name comparison. - # Otherwise, groups in the listed order should come before those that - # aren't. - self_name = self.Name() - other_name = other.Name() - self_in = isinstance(self, PBXGroup) and self_name in order - other_in = isinstance(self, PBXGroup) and other_name in order - if not self_in and not other_in: - return self.Compare(other) - if self_name in order and other_name not in order: - return -1 - if other_name in order and self_name not in order: - return 1 - - # If both groups are in the listed order, go by the defined order. - self_index = order.index(self_name) - other_index = order.index(other_name) - if self_index < other_index: - return -1 - if self_index > other_index: - return 1 - return 0 - - def PathFromSourceTreeAndPath(self): - # Turn the object's sourceTree and path properties into a single flat - # string of a form comparable to the path parameter. If there's a - # sourceTree property other than "", wrap it in $(...) for the - # comparison. - components = [] - if self._properties["sourceTree"] != "": - components.append("$(" + self._properties["sourceTree"] + ")") - if "path" in self._properties: - components.append(self._properties["path"]) - - if len(components) > 0: - return posixpath.join(*components) - - return None - - def FullPath(self): - # Returns a full path to self relative to the project file, or relative - # to some other source tree. Start with self, and walk up the chain of - # parents prepending their paths, if any, until no more parents are - # available (project-relative path) or until a path relative to some - # source tree is found. - xche = self - path = None - while isinstance(xche, XCHierarchicalElement) and ( - path is None or (not path.startswith("/") and not path.startswith("$")) - ): - this_path = xche.PathFromSourceTreeAndPath() - if this_path is not None and path is not None: - path = posixpath.join(this_path, path) - elif this_path is not None: - path = this_path - xche = xche.parent - - return path - - -class PBXGroup(XCHierarchicalElement): - """ - Attributes: - _children_by_path: Maps pathnames of children of this PBXGroup to the - actual child XCHierarchicalElement objects. - _variant_children_by_name_and_path: Maps (name, path) tuples of - PBXVariantGroup children to the actual child PBXVariantGroup objects. - """ - - _schema = XCHierarchicalElement._schema.copy() - _schema.update( - { - "children": [1, XCHierarchicalElement, 1, 1, []], - "name": [0, str, 0, 0], - "path": [0, str, 0, 0], - } - ) - - def __init__(self, properties=None, id=None, parent=None): - # super - XCHierarchicalElement.__init__(self, properties, id, parent) - self._children_by_path = {} - self._variant_children_by_name_and_path = {} - for child in self._properties.get("children", []): - self._AddChildToDicts(child) - - def Hashables(self): - # super - hashables = XCHierarchicalElement.Hashables(self) - - # It is not sufficient to just rely on name and parent to build a unique - # hashable : a node could have two child PBXGroup sharing a common name. - # To add entropy the hashable is enhanced with the names of all its - # children. - for child in self._properties.get("children", []): - child_name = child.Name() - if child_name is not None: - hashables.append(child_name) - - return hashables - - def HashablesForChild(self): - # To avoid a circular reference the hashables used to compute a child id do - # not include the child names. - return XCHierarchicalElement.Hashables(self) - - def _AddChildToDicts(self, child): - # Sets up this PBXGroup object's dicts to reference the child properly. - child_path = child.PathFromSourceTreeAndPath() - if child_path: - if child_path in self._children_by_path: - raise ValueError("Found multiple children with path " + child_path) - self._children_by_path[child_path] = child - - if isinstance(child, PBXVariantGroup): - child_name = child._properties.get("name", None) - key = (child_name, child_path) - if key in self._variant_children_by_name_and_path: - raise ValueError( - "Found multiple PBXVariantGroup children with " - + "name " - + str(child_name) - + " and path " - + str(child_path) - ) - self._variant_children_by_name_and_path[key] = child - - def AppendChild(self, child): - # Callers should use this instead of calling - # AppendProperty('children', child) directly because this function - # maintains the group's dicts. - self.AppendProperty("children", child) - self._AddChildToDicts(child) - - def GetChildByName(self, name): - # This is not currently optimized with a dict as GetChildByPath is because - # it has few callers. Most callers probably want GetChildByPath. This - # function is only useful to get children that have names but no paths, - # which is rare. The children of the main group ("Source", "Products", - # etc.) is pretty much the only case where this likely to come up. - # - # TODO(mark): Maybe this should raise an error if more than one child is - # present with the same name. - if "children" not in self._properties: - return None - - for child in self._properties["children"]: - if child.Name() == name: - return child - - return None - - def GetChildByPath(self, path): - if not path: - return None - - if path in self._children_by_path: - return self._children_by_path[path] - - return None - - def GetChildByRemoteObject(self, remote_object): - # This method is a little bit esoteric. Given a remote_object, which - # should be a PBXFileReference in another project file, this method will - # return this group's PBXReferenceProxy object serving as a local proxy - # for the remote PBXFileReference. - # - # This function might benefit from a dict optimization as GetChildByPath - # for some workloads, but profiling shows that it's not currently a - # problem. - if "children" not in self._properties: - return None - - for child in self._properties["children"]: - if not isinstance(child, PBXReferenceProxy): - continue - - container_proxy = child._properties["remoteRef"] - if container_proxy._properties["remoteGlobalIDString"] == remote_object: - return child - - return None - - def AddOrGetFileByPath(self, path, hierarchical): - """Returns an existing or new file reference corresponding to path. - - If hierarchical is True, this method will create or use the necessary - hierarchical group structure corresponding to path. Otherwise, it will - look in and create an item in the current group only. - - If an existing matching reference is found, it is returned, otherwise, a - new one will be created, added to the correct group, and returned. - - If path identifies a directory by virtue of carrying a trailing slash, - this method returns a PBXFileReference of "folder" type. If path - identifies a variant, by virtue of it identifying a file inside a directory - with an ".lproj" extension, this method returns a PBXVariantGroup - containing the variant named by path, and possibly other variants. For - all other paths, a "normal" PBXFileReference will be returned. - """ - - # Adding or getting a directory? Directories end with a trailing slash. - is_dir = False - if path.endswith("/"): - is_dir = True - path = posixpath.normpath(path) - if is_dir: - path = path + "/" - - # Adding or getting a variant? Variants are files inside directories - # with an ".lproj" extension. Xcode uses variants for localization. For - # a variant path/to/Language.lproj/MainMenu.nib, put a variant group named - # MainMenu.nib inside path/to, and give it a variant named Language. In - # this example, grandparent would be set to path/to and parent_root would - # be set to Language. - variant_name = None - parent = posixpath.dirname(path) - grandparent = posixpath.dirname(parent) - parent_basename = posixpath.basename(parent) - (parent_root, parent_ext) = posixpath.splitext(parent_basename) - if parent_ext == ".lproj": - variant_name = parent_root - if grandparent == "": - grandparent = None - - # Putting a directory inside a variant group is not currently supported. - assert not is_dir or variant_name is None - - path_split = path.split(posixpath.sep) - if ( - len(path_split) == 1 - or ((is_dir or variant_name is not None) and len(path_split) == 2) - or not hierarchical - ): - # The PBXFileReference or PBXVariantGroup will be added to or gotten from - # this PBXGroup, no recursion necessary. - if variant_name is None: - # Add or get a PBXFileReference. - file_ref = self.GetChildByPath(path) - if file_ref is not None: - assert file_ref.__class__ == PBXFileReference - else: - file_ref = PBXFileReference({"path": path}) - self.AppendChild(file_ref) - else: - # Add or get a PBXVariantGroup. The variant group name is the same - # as the basename (MainMenu.nib in the example above). grandparent - # specifies the path to the variant group itself, and path_split[-2:] - # is the path of the specific variant relative to its group. - variant_group_name = posixpath.basename(path) - variant_group_ref = self.AddOrGetVariantGroupByNameAndPath( - variant_group_name, grandparent - ) - variant_path = posixpath.sep.join(path_split[-2:]) - variant_ref = variant_group_ref.GetChildByPath(variant_path) - if variant_ref is not None: - assert variant_ref.__class__ == PBXFileReference - else: - variant_ref = PBXFileReference( - {"name": variant_name, "path": variant_path} - ) - variant_group_ref.AppendChild(variant_ref) - # The caller is interested in the variant group, not the specific - # variant file. - file_ref = variant_group_ref - return file_ref - else: - # Hierarchical recursion. Add or get a PBXGroup corresponding to the - # outermost path component, and then recurse into it, chopping off that - # path component. - next_dir = path_split[0] - group_ref = self.GetChildByPath(next_dir) - if group_ref is not None: - assert group_ref.__class__ == PBXGroup - else: - group_ref = PBXGroup({"path": next_dir}) - self.AppendChild(group_ref) - return group_ref.AddOrGetFileByPath( - posixpath.sep.join(path_split[1:]), hierarchical - ) - - def AddOrGetVariantGroupByNameAndPath(self, name, path): - """Returns an existing or new PBXVariantGroup for name and path. - - If a PBXVariantGroup identified by the name and path arguments is already - present as a child of this object, it is returned. Otherwise, a new - PBXVariantGroup with the correct properties is created, added as a child, - and returned. - - This method will generally be called by AddOrGetFileByPath, which knows - when to create a variant group based on the structure of the pathnames - passed to it. - """ - - key = (name, path) - if key in self._variant_children_by_name_and_path: - variant_group_ref = self._variant_children_by_name_and_path[key] - assert variant_group_ref.__class__ == PBXVariantGroup - return variant_group_ref - - variant_group_properties = {"name": name} - if path is not None: - variant_group_properties["path"] = path - variant_group_ref = PBXVariantGroup(variant_group_properties) - self.AppendChild(variant_group_ref) - - return variant_group_ref - - def TakeOverOnlyChild(self, recurse=False): - """If this PBXGroup has only one child and it's also a PBXGroup, take - it over by making all of its children this object's children. - - This function will continue to take over only children when those children - are groups. If there are three PBXGroups representing a, b, and c, with - c inside b and b inside a, and a and b have no other children, this will - result in a taking over both b and c, forming a PBXGroup for a/b/c. - - If recurse is True, this function will recurse into children and ask them - to collapse themselves by taking over only children as well. Assuming - an example hierarchy with files at a/b/c/d1, a/b/c/d2, and a/b/c/d3/e/f - (d1, d2, and f are files, the rest are groups), recursion will result in - a group for a/b/c containing a group for d3/e. - """ - - # At this stage, check that child class types are PBXGroup exactly, - # instead of using isinstance. The only subclass of PBXGroup, - # PBXVariantGroup, should not participate in reparenting in the same way: - # reparenting by merging different object types would be wrong. - while ( - len(self._properties["children"]) == 1 - and self._properties["children"][0].__class__ == PBXGroup - ): - # Loop to take over the innermost only-child group possible. - - child = self._properties["children"][0] - - # Assume the child's properties, including its children. Save a copy - # of this object's old properties, because they'll still be needed. - # This object retains its existing id and parent attributes. - old_properties = self._properties - self._properties = child._properties - self._children_by_path = child._children_by_path - - if ( - "sourceTree" not in self._properties - or self._properties["sourceTree"] == "" - ): - # The child was relative to its parent. Fix up the path. Note that - # children with a sourceTree other than "" are not relative to - # their parents, so no path fix-up is needed in that case. - if "path" in old_properties: - if "path" in self._properties: - # Both the original parent and child have paths set. - self._properties["path"] = posixpath.join( - old_properties["path"], self._properties["path"] - ) - else: - # Only the original parent has a path, use it. - self._properties["path"] = old_properties["path"] - if "sourceTree" in old_properties: - # The original parent had a sourceTree set, use it. - self._properties["sourceTree"] = old_properties["sourceTree"] - - # If the original parent had a name set, keep using it. If the original - # parent didn't have a name but the child did, let the child's name - # live on. If the name attribute seems unnecessary now, get rid of it. - if "name" in old_properties and old_properties["name"] not in ( - None, - self.Name(), - ): - self._properties["name"] = old_properties["name"] - if ( - "name" in self._properties - and "path" in self._properties - and self._properties["name"] == self._properties["path"] - ): - del self._properties["name"] - - # Notify all children of their new parent. - for child in self._properties["children"]: - child.parent = self - - # If asked to recurse, recurse. - if recurse: - for child in self._properties["children"]: - if child.__class__ == PBXGroup: - child.TakeOverOnlyChild(recurse) - - def SortGroup(self): - self._properties["children"] = sorted( - self._properties["children"], key=cmp_to_key(lambda x, y: x.Compare(y)) - ) - - # Recurse. - for child in self._properties["children"]: - if isinstance(child, PBXGroup): - child.SortGroup() - - -class XCFileLikeElement(XCHierarchicalElement): - # Abstract base for objects that can be used as the fileRef property of - # PBXBuildFile. - - def PathHashables(self): - # A PBXBuildFile that refers to this object will call this method to - # obtain additional hashables specific to this XCFileLikeElement. Don't - # just use this object's hashables, they're not specific and unique enough - # on their own (without access to the parent hashables.) Instead, provide - # hashables that identify this object by path by getting its hashables as - # well as the hashables of ancestor XCHierarchicalElement objects. - - hashables = [] - xche = self - while isinstance(xche, XCHierarchicalElement): - xche_hashables = xche.Hashables() - for index, xche_hashable in enumerate(xche_hashables): - hashables.insert(index, xche_hashable) - xche = xche.parent - return hashables - - -class XCContainerPortal(XCObject): - # Abstract base for objects that can be used as the containerPortal property - # of PBXContainerItemProxy. - pass - - -class XCRemoteObject(XCObject): - # Abstract base for objects that can be used as the remoteGlobalIDString - # property of PBXContainerItemProxy. - pass - - -class PBXFileReference(XCFileLikeElement, XCContainerPortal, XCRemoteObject): - _schema = XCFileLikeElement._schema.copy() - _schema.update( - { - "explicitFileType": [0, str, 0, 0], - "lastKnownFileType": [0, str, 0, 0], - "name": [0, str, 0, 0], - "path": [0, str, 0, 1], - } - ) - - # Weird output rules for PBXFileReference. - _should_print_single_line = True - # super - _encode_transforms = XCFileLikeElement._alternate_encode_transforms - - def __init__(self, properties=None, id=None, parent=None): - # super - XCFileLikeElement.__init__(self, properties, id, parent) - if "path" in self._properties and self._properties["path"].endswith("/"): - self._properties["path"] = self._properties["path"][:-1] - is_dir = True - else: - is_dir = False - - if ( - "path" in self._properties - and "lastKnownFileType" not in self._properties - and "explicitFileType" not in self._properties - ): - # TODO(mark): This is the replacement for a replacement for a quick hack. - # It is no longer incredibly sucky, but this list needs to be extended. - extension_map = { - "a": "archive.ar", - "app": "wrapper.application", - "bdic": "file", - "bundle": "wrapper.cfbundle", - "c": "sourcecode.c.c", - "cc": "sourcecode.cpp.cpp", - "cpp": "sourcecode.cpp.cpp", - "css": "text.css", - "cxx": "sourcecode.cpp.cpp", - "dart": "sourcecode", - "dylib": "compiled.mach-o.dylib", - "framework": "wrapper.framework", - "gyp": "sourcecode", - "gypi": "sourcecode", - "h": "sourcecode.c.h", - "hxx": "sourcecode.cpp.h", - "icns": "image.icns", - "java": "sourcecode.java", - "js": "sourcecode.javascript", - "kext": "wrapper.kext", - "m": "sourcecode.c.objc", - "mm": "sourcecode.cpp.objcpp", - "nib": "wrapper.nib", - "o": "compiled.mach-o.objfile", - "pdf": "image.pdf", - "pl": "text.script.perl", - "plist": "text.plist.xml", - "pm": "text.script.perl", - "png": "image.png", - "py": "text.script.python", - "r": "sourcecode.rez", - "rez": "sourcecode.rez", - "s": "sourcecode.asm", - "storyboard": "file.storyboard", - "strings": "text.plist.strings", - "swift": "sourcecode.swift", - "ttf": "file", - "xcassets": "folder.assetcatalog", - "xcconfig": "text.xcconfig", - "xcdatamodel": "wrapper.xcdatamodel", - "xcdatamodeld": "wrapper.xcdatamodeld", - "xib": "file.xib", - "y": "sourcecode.yacc", - } - - prop_map = { - "dart": "explicitFileType", - "gyp": "explicitFileType", - "gypi": "explicitFileType", - } - - if is_dir: - file_type = "folder" - prop_name = "lastKnownFileType" - else: - basename = posixpath.basename(self._properties["path"]) - (root, ext) = posixpath.splitext(basename) - # Check the map using a lowercase extension. - # TODO(mark): Maybe it should try with the original case first and fall - # back to lowercase, in case there are any instances where case - # matters. There currently aren't. - if ext != "": - ext = ext[1:].lower() - - # TODO(mark): "text" is the default value, but "file" is appropriate - # for unrecognized files not containing text. Xcode seems to choose - # based on content. - file_type = extension_map.get(ext, "text") - prop_name = prop_map.get(ext, "lastKnownFileType") - - self._properties[prop_name] = file_type - - -class PBXVariantGroup(PBXGroup, XCFileLikeElement): - """PBXVariantGroup is used by Xcode to represent localizations.""" - - # No additions to the schema relative to PBXGroup. - pass - - -# PBXReferenceProxy is also an XCFileLikeElement subclass. It is defined below -# because it uses PBXContainerItemProxy, defined below. - - -class XCBuildConfiguration(XCObject): - _schema = XCObject._schema.copy() - _schema.update( - { - "baseConfigurationReference": [0, PBXFileReference, 0, 0], - "buildSettings": [0, dict, 0, 1, {}], - "name": [0, str, 0, 1], - } - ) - - def HasBuildSetting(self, key): - return key in self._properties["buildSettings"] - - def GetBuildSetting(self, key): - return self._properties["buildSettings"][key] - - def SetBuildSetting(self, key, value): - # TODO(mark): If a list, copy? - self._properties["buildSettings"][key] = value - - def AppendBuildSetting(self, key, value): - if key not in self._properties["buildSettings"]: - self._properties["buildSettings"][key] = [] - self._properties["buildSettings"][key].append(value) - - def DelBuildSetting(self, key): - if key in self._properties["buildSettings"]: - del self._properties["buildSettings"][key] - - def SetBaseConfiguration(self, value): - self._properties["baseConfigurationReference"] = value - - -class XCConfigurationList(XCObject): - # _configs is the default list of configurations. - _configs = [ - XCBuildConfiguration({"name": "Debug"}), - XCBuildConfiguration({"name": "Release"}), - ] - - _schema = XCObject._schema.copy() - _schema.update( - { - "buildConfigurations": [1, XCBuildConfiguration, 1, 1, _configs], - "defaultConfigurationIsVisible": [0, int, 0, 1, 1], - "defaultConfigurationName": [0, str, 0, 1, "Release"], - } - ) - - def Name(self): - return ( - "Build configuration list for " - + self.parent.__class__.__name__ - + ' "' - + self.parent.Name() - + '"' - ) - - def ConfigurationNamed(self, name): - """Convenience accessor to obtain an XCBuildConfiguration by name.""" - for configuration in self._properties["buildConfigurations"]: - if configuration._properties["name"] == name: - return configuration - - raise KeyError(name) - - def DefaultConfiguration(self): - """Convenience accessor to obtain the default XCBuildConfiguration.""" - return self.ConfigurationNamed(self._properties["defaultConfigurationName"]) - - def HasBuildSetting(self, key): - """Determines the state of a build setting in all XCBuildConfiguration - child objects. - - If all child objects have key in their build settings, and the value is the - same in all child objects, returns 1. - - If no child objects have the key in their build settings, returns 0. - - If some, but not all, child objects have the key in their build settings, - or if any children have different values for the key, returns -1. - """ - - has = None - value = None - for configuration in self._properties["buildConfigurations"]: - configuration_has = configuration.HasBuildSetting(key) - if has is None: - has = configuration_has - elif has != configuration_has: - return -1 - - if configuration_has: - configuration_value = configuration.GetBuildSetting(key) - if value is None: - value = configuration_value - elif value != configuration_value: - return -1 - - if not has: - return 0 - - return 1 - - def GetBuildSetting(self, key): - """Gets the build setting for key. - - All child XCConfiguration objects must have the same value set for the - setting, or a ValueError will be raised. - """ - - # TODO(mark): This is wrong for build settings that are lists. The list - # contents should be compared (and a list copy returned?) - - value = None - for configuration in self._properties["buildConfigurations"]: - configuration_value = configuration.GetBuildSetting(key) - if value is None: - value = configuration_value - else: - if value != configuration_value: - raise ValueError("Variant values for " + key) - - return value - - def SetBuildSetting(self, key, value): - """Sets the build setting for key to value in all child - XCBuildConfiguration objects. - """ - - for configuration in self._properties["buildConfigurations"]: - configuration.SetBuildSetting(key, value) - - def AppendBuildSetting(self, key, value): - """Appends value to the build setting for key, which is treated as a list, - in all child XCBuildConfiguration objects. - """ - - for configuration in self._properties["buildConfigurations"]: - configuration.AppendBuildSetting(key, value) - - def DelBuildSetting(self, key): - """Deletes the build setting key from all child XCBuildConfiguration - objects. - """ - - for configuration in self._properties["buildConfigurations"]: - configuration.DelBuildSetting(key) - - def SetBaseConfiguration(self, value): - """Sets the build configuration in all child XCBuildConfiguration objects. - """ - - for configuration in self._properties["buildConfigurations"]: - configuration.SetBaseConfiguration(value) - - -class PBXBuildFile(XCObject): - _schema = XCObject._schema.copy() - _schema.update( - { - "fileRef": [0, XCFileLikeElement, 0, 1], - "settings": [0, str, 0, 0], # hack, it's a dict - } - ) - - # Weird output rules for PBXBuildFile. - _should_print_single_line = True - _encode_transforms = XCObject._alternate_encode_transforms - - def Name(self): - # Example: "main.cc in Sources" - return self._properties["fileRef"].Name() + " in " + self.parent.Name() - - def Hashables(self): - # super - hashables = XCObject.Hashables(self) - - # It is not sufficient to just rely on Name() to get the - # XCFileLikeElement's name, because that is not a complete pathname. - # PathHashables returns hashables unique enough that no two - # PBXBuildFiles should wind up with the same set of hashables, unless - # someone adds the same file multiple times to the same target. That - # would be considered invalid anyway. - hashables.extend(self._properties["fileRef"].PathHashables()) - - return hashables - - -class XCBuildPhase(XCObject): - """Abstract base for build phase classes. Not represented in a project - file. - - Attributes: - _files_by_path: A dict mapping each path of a child in the files list by - path (keys) to the corresponding PBXBuildFile children (values). - _files_by_xcfilelikeelement: A dict mapping each XCFileLikeElement (keys) - to the corresponding PBXBuildFile children (values). - """ - - # TODO(mark): Some build phase types, like PBXShellScriptBuildPhase, don't - # actually have a "files" list. XCBuildPhase should not have "files" but - # another abstract subclass of it should provide this, and concrete build - # phase types that do have "files" lists should be derived from that new - # abstract subclass. XCBuildPhase should only provide buildActionMask and - # runOnlyForDeploymentPostprocessing, and not files or the various - # file-related methods and attributes. - - _schema = XCObject._schema.copy() - _schema.update( - { - "buildActionMask": [0, int, 0, 1, 0x7FFFFFFF], - "files": [1, PBXBuildFile, 1, 1, []], - "runOnlyForDeploymentPostprocessing": [0, int, 0, 1, 0], - } - ) - - def __init__(self, properties=None, id=None, parent=None): - # super - XCObject.__init__(self, properties, id, parent) - - self._files_by_path = {} - self._files_by_xcfilelikeelement = {} - for pbxbuildfile in self._properties.get("files", []): - self._AddBuildFileToDicts(pbxbuildfile) - - def FileGroup(self, path): - # Subclasses must override this by returning a two-element tuple. The - # first item in the tuple should be the PBXGroup to which "path" should be - # added, either as a child or deeper descendant. The second item should - # be a boolean indicating whether files should be added into hierarchical - # groups or one single flat group. - raise NotImplementedError(self.__class__.__name__ + " must implement FileGroup") - - def _AddPathToDict(self, pbxbuildfile, path): - """Adds path to the dict tracking paths belonging to this build phase. - - If the path is already a member of this build phase, raises an exception. - """ - - if path in self._files_by_path: - raise ValueError("Found multiple build files with path " + path) - self._files_by_path[path] = pbxbuildfile - - def _AddBuildFileToDicts(self, pbxbuildfile, path=None): - """Maintains the _files_by_path and _files_by_xcfilelikeelement dicts. - - If path is specified, then it is the path that is being added to the - phase, and pbxbuildfile must contain either a PBXFileReference directly - referencing that path, or it must contain a PBXVariantGroup that itself - contains a PBXFileReference referencing the path. - - If path is not specified, either the PBXFileReference's path or the paths - of all children of the PBXVariantGroup are taken as being added to the - phase. - - If the path is already present in the phase, raises an exception. - - If the PBXFileReference or PBXVariantGroup referenced by pbxbuildfile - are already present in the phase, referenced by a different PBXBuildFile - object, raises an exception. This does not raise an exception when - a PBXFileReference or PBXVariantGroup reappear and are referenced by the - same PBXBuildFile that has already introduced them, because in the case - of PBXVariantGroup objects, they may correspond to multiple paths that are - not all added simultaneously. When this situation occurs, the path needs - to be added to _files_by_path, but nothing needs to change in - _files_by_xcfilelikeelement, and the caller should have avoided adding - the PBXBuildFile if it is already present in the list of children. - """ - - xcfilelikeelement = pbxbuildfile._properties["fileRef"] - - paths = [] - if path is not None: - # It's best when the caller provides the path. - if isinstance(xcfilelikeelement, PBXVariantGroup): - paths.append(path) - else: - # If the caller didn't provide a path, there can be either multiple - # paths (PBXVariantGroup) or one. - if isinstance(xcfilelikeelement, PBXVariantGroup): - for variant in xcfilelikeelement._properties["children"]: - paths.append(variant.FullPath()) - else: - paths.append(xcfilelikeelement.FullPath()) - - # Add the paths first, because if something's going to raise, the - # messages provided by _AddPathToDict are more useful owing to its - # having access to a real pathname and not just an object's Name(). - for a_path in paths: - self._AddPathToDict(pbxbuildfile, a_path) - - # If another PBXBuildFile references this XCFileLikeElement, there's a - # problem. - if ( - xcfilelikeelement in self._files_by_xcfilelikeelement - and self._files_by_xcfilelikeelement[xcfilelikeelement] != pbxbuildfile - ): - raise ValueError( - "Found multiple build files for " + xcfilelikeelement.Name() - ) - self._files_by_xcfilelikeelement[xcfilelikeelement] = pbxbuildfile - - def AppendBuildFile(self, pbxbuildfile, path=None): - # Callers should use this instead of calling - # AppendProperty('files', pbxbuildfile) directly because this function - # maintains the object's dicts. Better yet, callers can just call AddFile - # with a pathname and not worry about building their own PBXBuildFile - # objects. - self.AppendProperty("files", pbxbuildfile) - self._AddBuildFileToDicts(pbxbuildfile, path) - - def AddFile(self, path, settings=None): - (file_group, hierarchical) = self.FileGroup(path) - file_ref = file_group.AddOrGetFileByPath(path, hierarchical) - - if file_ref in self._files_by_xcfilelikeelement and isinstance( - file_ref, PBXVariantGroup - ): - # There's already a PBXBuildFile in this phase corresponding to the - # PBXVariantGroup. path just provides a new variant that belongs to - # the group. Add the path to the dict. - pbxbuildfile = self._files_by_xcfilelikeelement[file_ref] - self._AddBuildFileToDicts(pbxbuildfile, path) - else: - # Add a new PBXBuildFile to get file_ref into the phase. - if settings is None: - pbxbuildfile = PBXBuildFile({"fileRef": file_ref}) - else: - pbxbuildfile = PBXBuildFile({"fileRef": file_ref, "settings": settings}) - self.AppendBuildFile(pbxbuildfile, path) - - -class PBXHeadersBuildPhase(XCBuildPhase): - # No additions to the schema relative to XCBuildPhase. - - def Name(self): - return "Headers" - - def FileGroup(self, path): - return self.PBXProjectAncestor().RootGroupForPath(path) - - -class PBXResourcesBuildPhase(XCBuildPhase): - # No additions to the schema relative to XCBuildPhase. - - def Name(self): - return "Resources" - - def FileGroup(self, path): - return self.PBXProjectAncestor().RootGroupForPath(path) - - -class PBXSourcesBuildPhase(XCBuildPhase): - # No additions to the schema relative to XCBuildPhase. - - def Name(self): - return "Sources" - - def FileGroup(self, path): - return self.PBXProjectAncestor().RootGroupForPath(path) - - -class PBXFrameworksBuildPhase(XCBuildPhase): - # No additions to the schema relative to XCBuildPhase. - - def Name(self): - return "Frameworks" - - def FileGroup(self, path): - (root, ext) = posixpath.splitext(path) - if ext != "": - ext = ext[1:].lower() - if ext == "o": - # .o files are added to Xcode Frameworks phases, but conceptually aren't - # frameworks, they're more like sources or intermediates. Redirect them - # to show up in one of those other groups. - return self.PBXProjectAncestor().RootGroupForPath(path) - else: - return (self.PBXProjectAncestor().FrameworksGroup(), False) - - -class PBXShellScriptBuildPhase(XCBuildPhase): - _schema = XCBuildPhase._schema.copy() - _schema.update( - { - "inputPaths": [1, str, 0, 1, []], - "name": [0, str, 0, 0], - "outputPaths": [1, str, 0, 1, []], - "shellPath": [0, str, 0, 1, "/bin/sh"], - "shellScript": [0, str, 0, 1], - "showEnvVarsInLog": [0, int, 0, 0], - } - ) - - def Name(self): - if "name" in self._properties: - return self._properties["name"] - - return "ShellScript" - - -class PBXCopyFilesBuildPhase(XCBuildPhase): - _schema = XCBuildPhase._schema.copy() - _schema.update( - { - "dstPath": [0, str, 0, 1], - "dstSubfolderSpec": [0, int, 0, 1], - "name": [0, str, 0, 0], - } - ) - - # path_tree_re matches "$(DIR)/path", "$(DIR)/$(DIR2)/path" or just "$(DIR)". - # Match group 1 is "DIR", group 3 is "path" or "$(DIR2") or "$(DIR2)/path" - # or None. If group 3 is "path", group 4 will be None otherwise group 4 is - # "DIR2" and group 6 is "path". - path_tree_re = re.compile(r"^\$\((.*?)\)(/(\$\((.*?)\)(/(.*)|)|(.*)|)|)$") - - # path_tree_{first,second}_to_subfolder map names of Xcode variables to the - # associated dstSubfolderSpec property value used in a PBXCopyFilesBuildPhase - # object. - path_tree_first_to_subfolder = { - # Types that can be chosen via the Xcode UI. - "BUILT_PRODUCTS_DIR": 16, # Products Directory - "BUILT_FRAMEWORKS_DIR": 10, # Not an official Xcode macro. - # Existed before support for the - # names below was added. Maps to - # "Frameworks". - } - - path_tree_second_to_subfolder = { - "WRAPPER_NAME": 1, # Wrapper - # Although Xcode's friendly name is "Executables", the destination - # is demonstrably the value of the build setting - # EXECUTABLE_FOLDER_PATH not EXECUTABLES_FOLDER_PATH. - "EXECUTABLE_FOLDER_PATH": 6, # Executables. - "UNLOCALIZED_RESOURCES_FOLDER_PATH": 7, # Resources - "JAVA_FOLDER_PATH": 15, # Java Resources - "FRAMEWORKS_FOLDER_PATH": 10, # Frameworks - "SHARED_FRAMEWORKS_FOLDER_PATH": 11, # Shared Frameworks - "SHARED_SUPPORT_FOLDER_PATH": 12, # Shared Support - "PLUGINS_FOLDER_PATH": 13, # PlugIns - # For XPC Services, Xcode sets both dstPath and dstSubfolderSpec. - # Note that it re-uses the BUILT_PRODUCTS_DIR value for - # dstSubfolderSpec. dstPath is set below. - "XPCSERVICES_FOLDER_PATH": 16, # XPC Services. - } - - def Name(self): - if "name" in self._properties: - return self._properties["name"] - - return "CopyFiles" - - def FileGroup(self, path): - return self.PBXProjectAncestor().RootGroupForPath(path) - - def SetDestination(self, path): - """Set the dstSubfolderSpec and dstPath properties from path. - - path may be specified in the same notation used for XCHierarchicalElements, - specifically, "$(DIR)/path". - """ - - path_tree_match = self.path_tree_re.search(path) - if path_tree_match: - path_tree = path_tree_match.group(1) - if path_tree in self.path_tree_first_to_subfolder: - subfolder = self.path_tree_first_to_subfolder[path_tree] - relative_path = path_tree_match.group(3) - if relative_path is None: - relative_path = "" - - if subfolder == 16 and path_tree_match.group(4) is not None: - # BUILT_PRODUCTS_DIR (16) is the first element in a path whose - # second element is possibly one of the variable names in - # path_tree_second_to_subfolder. Xcode sets the values of all these - # variables to relative paths so .gyp files must prefix them with - # BUILT_PRODUCTS_DIR, e.g. - # $(BUILT_PRODUCTS_DIR)/$(PLUGINS_FOLDER_PATH). Then - # xcode_emulation.py can export these variables with the same values - # as Xcode yet make & ninja files can determine the absolute path - # to the target. Xcode uses the dstSubfolderSpec value set here - # to determine the full path. - # - # An alternative of xcode_emulation.py setting the values to - # absolute paths when exporting these variables has been - # ruled out because then the values would be different - # depending on the build tool. - # - # Another alternative is to invent new names for the variables used - # to match to the subfolder indices in the second table. .gyp files - # then will not need to prepend $(BUILT_PRODUCTS_DIR) because - # xcode_emulation.py can set the values of those variables to - # the absolute paths when exporting. This is possibly the thinking - # behind BUILT_FRAMEWORKS_DIR which is used in exactly this manner. - # - # Requiring prepending BUILT_PRODUCTS_DIR has been chosen because - # this same way could be used to specify destinations in .gyp files - # that pre-date this addition to GYP. However they would only work - # with the Xcode generator. - # The previous version of xcode_emulation.py - # does not export these variables. Such files will get the benefit - # of the Xcode UI showing the proper destination name simply by - # regenerating the projects with this version of GYP. - path_tree = path_tree_match.group(4) - relative_path = path_tree_match.group(6) - separator = "/" - - if path_tree in self.path_tree_second_to_subfolder: - subfolder = self.path_tree_second_to_subfolder[path_tree] - if relative_path is None: - relative_path = "" - separator = "" - if path_tree == "XPCSERVICES_FOLDER_PATH": - relative_path = ( - "$(CONTENTS_FOLDER_PATH)/XPCServices" - + separator - + relative_path - ) - else: - # subfolder = 16 from above - # The second element of the path is an unrecognized variable. - # Include it and any remaining elements in relative_path. - relative_path = path_tree_match.group(3) - - else: - # The path starts with an unrecognized Xcode variable - # name like $(SRCROOT). Xcode will still handle this - # as an "absolute path" that starts with the variable. - subfolder = 0 - relative_path = path - elif path.startswith("/"): - # Special case. Absolute paths are in dstSubfolderSpec 0. - subfolder = 0 - relative_path = path[1:] - else: - raise ValueError( - f"Can't use path {path} in a {self.__class__.__name__}" - ) - - self._properties["dstPath"] = relative_path - self._properties["dstSubfolderSpec"] = subfolder - - -class PBXBuildRule(XCObject): - _schema = XCObject._schema.copy() - _schema.update( - { - "compilerSpec": [0, str, 0, 1], - "filePatterns": [0, str, 0, 0], - "fileType": [0, str, 0, 1], - "isEditable": [0, int, 0, 1, 1], - "outputFiles": [1, str, 0, 1, []], - "script": [0, str, 0, 0], - } - ) - - def Name(self): - # Not very inspired, but it's what Xcode uses. - return self.__class__.__name__ - - def Hashables(self): - # super - hashables = XCObject.Hashables(self) - - # Use the hashables of the weak objects that this object refers to. - hashables.append(self._properties["fileType"]) - if "filePatterns" in self._properties: - hashables.append(self._properties["filePatterns"]) - return hashables - - -class PBXContainerItemProxy(XCObject): - # When referencing an item in this project file, containerPortal is the - # PBXProject root object of this project file. When referencing an item in - # another project file, containerPortal is a PBXFileReference identifying - # the other project file. - # - # When serving as a proxy to an XCTarget (in this project file or another), - # proxyType is 1. When serving as a proxy to a PBXFileReference (in another - # project file), proxyType is 2. Type 2 is used for references to the - # producs of the other project file's targets. - # - # Xcode is weird about remoteGlobalIDString. Usually, it's printed without - # a comment, indicating that it's tracked internally simply as a string, but - # sometimes it's printed with a comment (usually when the object is initially - # created), indicating that it's tracked as a project file object at least - # sometimes. This module always tracks it as an object, but contains a hack - # to prevent it from printing the comment in the project file output. See - # _XCKVPrint. - _schema = XCObject._schema.copy() - _schema.update( - { - "containerPortal": [0, XCContainerPortal, 0, 1], - "proxyType": [0, int, 0, 1], - "remoteGlobalIDString": [0, XCRemoteObject, 0, 1], - "remoteInfo": [0, str, 0, 1], - } - ) - - def __repr__(self): - props = self._properties - name = "{}.gyp:{}".format(props["containerPortal"].Name(), props["remoteInfo"]) - return f"<{self.__class__.__name__} {name!r} at 0x{id(self):x}>" - - def Name(self): - # Admittedly not the best name, but it's what Xcode uses. - return self.__class__.__name__ - - def Hashables(self): - # super - hashables = XCObject.Hashables(self) - - # Use the hashables of the weak objects that this object refers to. - hashables.extend(self._properties["containerPortal"].Hashables()) - hashables.extend(self._properties["remoteGlobalIDString"].Hashables()) - return hashables - - -class PBXTargetDependency(XCObject): - # The "target" property accepts an XCTarget object, and obviously not - # NoneType. But XCTarget is defined below, so it can't be put into the - # schema yet. The definition of PBXTargetDependency can't be moved below - # XCTarget because XCTarget's own schema references PBXTargetDependency. - # Python doesn't deal well with this circular relationship, and doesn't have - # a real way to do forward declarations. To work around, the type of - # the "target" property is reset below, after XCTarget is defined. - # - # At least one of "name" and "target" is required. - _schema = XCObject._schema.copy() - _schema.update( - { - "name": [0, str, 0, 0], - "target": [0, None.__class__, 0, 0], - "targetProxy": [0, PBXContainerItemProxy, 1, 1], - } - ) - - def __repr__(self): - name = self._properties.get("name") or self._properties["target"].Name() - return f"<{self.__class__.__name__} {name!r} at 0x{id(self):x}>" - - def Name(self): - # Admittedly not the best name, but it's what Xcode uses. - return self.__class__.__name__ - - def Hashables(self): - # super - hashables = XCObject.Hashables(self) - - # Use the hashables of the weak objects that this object refers to. - hashables.extend(self._properties["targetProxy"].Hashables()) - return hashables - - -class PBXReferenceProxy(XCFileLikeElement): - _schema = XCFileLikeElement._schema.copy() - _schema.update( - { - "fileType": [0, str, 0, 1], - "path": [0, str, 0, 1], - "remoteRef": [0, PBXContainerItemProxy, 1, 1], - } - ) - - -class XCTarget(XCRemoteObject): - # An XCTarget is really just an XCObject, the XCRemoteObject thing is just - # to allow PBXProject to be used in the remoteGlobalIDString property of - # PBXContainerItemProxy. - # - # Setting a "name" property at instantiation may also affect "productName", - # which may in turn affect the "PRODUCT_NAME" build setting in children of - # "buildConfigurationList". See __init__ below. - _schema = XCRemoteObject._schema.copy() - _schema.update( - { - "buildConfigurationList": [ - 0, - XCConfigurationList, - 1, - 1, - XCConfigurationList(), - ], - "buildPhases": [1, XCBuildPhase, 1, 1, []], - "dependencies": [1, PBXTargetDependency, 1, 1, []], - "name": [0, str, 0, 1], - "productName": [0, str, 0, 1], - } - ) - - def __init__( - self, - properties=None, - id=None, - parent=None, - force_outdir=None, - force_prefix=None, - force_extension=None, - ): - # super - XCRemoteObject.__init__(self, properties, id, parent) - - # Set up additional defaults not expressed in the schema. If a "name" - # property was supplied, set "productName" if it is not present. Also set - # the "PRODUCT_NAME" build setting in each configuration, but only if - # the setting is not present in any build configuration. - if "name" in self._properties: - if "productName" not in self._properties: - self.SetProperty("productName", self._properties["name"]) - - if "productName" in self._properties: - if "buildConfigurationList" in self._properties: - configs = self._properties["buildConfigurationList"] - if configs.HasBuildSetting("PRODUCT_NAME") == 0: - configs.SetBuildSetting( - "PRODUCT_NAME", self._properties["productName"] - ) - - def AddDependency(self, other): - pbxproject = self.PBXProjectAncestor() - other_pbxproject = other.PBXProjectAncestor() - if pbxproject == other_pbxproject: - # Add a dependency to another target in the same project file. - container = PBXContainerItemProxy( - { - "containerPortal": pbxproject, - "proxyType": 1, - "remoteGlobalIDString": other, - "remoteInfo": other.Name(), - } - ) - dependency = PBXTargetDependency( - {"target": other, "targetProxy": container} - ) - self.AppendProperty("dependencies", dependency) - else: - # Add a dependency to a target in a different project file. - other_project_ref = pbxproject.AddOrGetProjectReference(other_pbxproject)[1] - container = PBXContainerItemProxy( - { - "containerPortal": other_project_ref, - "proxyType": 1, - "remoteGlobalIDString": other, - "remoteInfo": other.Name(), - } - ) - dependency = PBXTargetDependency( - {"name": other.Name(), "targetProxy": container} - ) - self.AppendProperty("dependencies", dependency) - - # Proxy all of these through to the build configuration list. - - def ConfigurationNamed(self, name): - return self._properties["buildConfigurationList"].ConfigurationNamed(name) - - def DefaultConfiguration(self): - return self._properties["buildConfigurationList"].DefaultConfiguration() - - def HasBuildSetting(self, key): - return self._properties["buildConfigurationList"].HasBuildSetting(key) - - def GetBuildSetting(self, key): - return self._properties["buildConfigurationList"].GetBuildSetting(key) - - def SetBuildSetting(self, key, value): - return self._properties["buildConfigurationList"].SetBuildSetting(key, value) - - def AppendBuildSetting(self, key, value): - return self._properties["buildConfigurationList"].AppendBuildSetting(key, value) - - def DelBuildSetting(self, key): - return self._properties["buildConfigurationList"].DelBuildSetting(key) - - -# Redefine the type of the "target" property. See PBXTargetDependency._schema -# above. -PBXTargetDependency._schema["target"][1] = XCTarget - - -class PBXNativeTarget(XCTarget): - # buildPhases is overridden in the schema to be able to set defaults. - # - # NOTE: Contrary to most objects, it is advisable to set parent when - # constructing PBXNativeTarget. A parent of an XCTarget must be a PBXProject - # object. A parent reference is required for a PBXNativeTarget during - # construction to be able to set up the target defaults for productReference, - # because a PBXBuildFile object must be created for the target and it must - # be added to the PBXProject's mainGroup hierarchy. - _schema = XCTarget._schema.copy() - _schema.update( - { - "buildPhases": [ - 1, - XCBuildPhase, - 1, - 1, - [PBXSourcesBuildPhase(), PBXFrameworksBuildPhase()], - ], - "buildRules": [1, PBXBuildRule, 1, 1, []], - "productReference": [0, PBXFileReference, 0, 1], - "productType": [0, str, 0, 1], - } - ) - - # Mapping from Xcode product-types to settings. The settings are: - # filetype : used for explicitFileType in the project file - # prefix : the prefix for the file name - # suffix : the suffix for the file name - _product_filetypes = { - "com.apple.product-type.application": ["wrapper.application", "", ".app"], - "com.apple.product-type.application.watchapp": [ - "wrapper.application", - "", - ".app", - ], - "com.apple.product-type.watchkit-extension": [ - "wrapper.app-extension", - "", - ".appex", - ], - "com.apple.product-type.app-extension": ["wrapper.app-extension", "", ".appex"], - "com.apple.product-type.bundle": ["wrapper.cfbundle", "", ".bundle"], - "com.apple.product-type.framework": ["wrapper.framework", "", ".framework"], - "com.apple.product-type.library.dynamic": [ - "compiled.mach-o.dylib", - "lib", - ".dylib", - ], - "com.apple.product-type.library.static": ["archive.ar", "lib", ".a"], - "com.apple.product-type.tool": ["compiled.mach-o.executable", "", ""], - "com.apple.product-type.bundle.unit-test": ["wrapper.cfbundle", "", ".xctest"], - "com.apple.product-type.bundle.ui-testing": ["wrapper.cfbundle", "", ".xctest"], - "com.googlecode.gyp.xcode.bundle": ["compiled.mach-o.dylib", "", ".so"], - "com.apple.product-type.kernel-extension": ["wrapper.kext", "", ".kext"], - } - - def __init__( - self, - properties=None, - id=None, - parent=None, - force_outdir=None, - force_prefix=None, - force_extension=None, - ): - # super - XCTarget.__init__(self, properties, id, parent) - - if ( - "productName" in self._properties - and "productType" in self._properties - and "productReference" not in self._properties - and self._properties["productType"] in self._product_filetypes - ): - products_group = None - pbxproject = self.PBXProjectAncestor() - if pbxproject is not None: - products_group = pbxproject.ProductsGroup() - - if products_group is not None: - (filetype, prefix, suffix) = self._product_filetypes[ - self._properties["productType"] - ] - # Xcode does not have a distinct type for loadable modules that are - # pure BSD targets (not in a bundle wrapper). GYP allows such modules - # to be specified by setting a target type to loadable_module without - # having mac_bundle set. These are mapped to the pseudo-product type - # com.googlecode.gyp.xcode.bundle. - # - # By picking up this special type and converting it to a dynamic - # library (com.apple.product-type.library.dynamic) with fix-ups, - # single-file loadable modules can be produced. - # - # MACH_O_TYPE is changed to mh_bundle to produce the proper file type - # (as opposed to mh_dylib). In order for linking to succeed, - # DYLIB_CURRENT_VERSION and DYLIB_COMPATIBILITY_VERSION must be - # cleared. They are meaningless for type mh_bundle. - # - # Finally, the .so extension is forcibly applied over the default - # (.dylib), unless another forced extension is already selected. - # .dylib is plainly wrong, and .bundle is used by loadable_modules in - # bundle wrappers (com.apple.product-type.bundle). .so seems an odd - # choice because it's used as the extension on many other systems that - # don't distinguish between linkable shared libraries and non-linkable - # loadable modules, but there's precedent: Python loadable modules on - # Mac OS X use an .so extension. - if self._properties["productType"] == "com.googlecode.gyp.xcode.bundle": - self._properties[ - "productType" - ] = "com.apple.product-type.library.dynamic" - self.SetBuildSetting("MACH_O_TYPE", "mh_bundle") - self.SetBuildSetting("DYLIB_CURRENT_VERSION", "") - self.SetBuildSetting("DYLIB_COMPATIBILITY_VERSION", "") - if force_extension is None: - force_extension = suffix[1:] - - if ( - self._properties["productType"] - == "com.apple.product-type-bundle.unit.test" - or self._properties["productType"] - == "com.apple.product-type-bundle.ui-testing" - ): - if force_extension is None: - force_extension = suffix[1:] - - if force_extension is not None: - # If it's a wrapper (bundle), set WRAPPER_EXTENSION. - # Extension override. - suffix = "." + force_extension - if filetype.startswith("wrapper."): - self.SetBuildSetting("WRAPPER_EXTENSION", force_extension) - else: - self.SetBuildSetting("EXECUTABLE_EXTENSION", force_extension) - - if filetype.startswith("compiled.mach-o.executable"): - product_name = self._properties["productName"] - product_name += suffix - suffix = "" - self.SetProperty("productName", product_name) - self.SetBuildSetting("PRODUCT_NAME", product_name) - - # Xcode handles most prefixes based on the target type, however there - # are exceptions. If a "BSD Dynamic Library" target is added in the - # Xcode UI, Xcode sets EXECUTABLE_PREFIX. This check duplicates that - # behavior. - if force_prefix is not None: - prefix = force_prefix - if filetype.startswith("wrapper."): - self.SetBuildSetting("WRAPPER_PREFIX", prefix) - else: - self.SetBuildSetting("EXECUTABLE_PREFIX", prefix) - - if force_outdir is not None: - self.SetBuildSetting("TARGET_BUILD_DIR", force_outdir) - - # TODO(tvl): Remove the below hack. - # http://code.google.com/p/gyp/issues/detail?id=122 - - # Some targets include the prefix in the target_name. These targets - # really should just add a product_name setting that doesn't include - # the prefix. For example: - # target_name = 'libevent', product_name = 'event' - # This check cleans up for them. - product_name = self._properties["productName"] - prefix_len = len(prefix) - if prefix_len and (product_name[:prefix_len] == prefix): - product_name = product_name[prefix_len:] - self.SetProperty("productName", product_name) - self.SetBuildSetting("PRODUCT_NAME", product_name) - - ref_props = { - "explicitFileType": filetype, - "includeInIndex": 0, - "path": prefix + product_name + suffix, - "sourceTree": "BUILT_PRODUCTS_DIR", - } - file_ref = PBXFileReference(ref_props) - products_group.AppendChild(file_ref) - self.SetProperty("productReference", file_ref) - - def GetBuildPhaseByType(self, type): - if "buildPhases" not in self._properties: - return None - - the_phase = None - for phase in self._properties["buildPhases"]: - if isinstance(phase, type): - # Some phases may be present in multiples in a well-formed project file, - # but phases like PBXSourcesBuildPhase may only be present singly, and - # this function is intended as an aid to GetBuildPhaseByType. Loop - # over the entire list of phases and assert if more than one of the - # desired type is found. - assert the_phase is None - the_phase = phase - - return the_phase - - def HeadersPhase(self): - headers_phase = self.GetBuildPhaseByType(PBXHeadersBuildPhase) - if headers_phase is None: - headers_phase = PBXHeadersBuildPhase() - - # The headers phase should come before the resources, sources, and - # frameworks phases, if any. - insert_at = len(self._properties["buildPhases"]) - for index, phase in enumerate(self._properties["buildPhases"]): - if ( - isinstance(phase, PBXResourcesBuildPhase) - or isinstance(phase, PBXSourcesBuildPhase) - or isinstance(phase, PBXFrameworksBuildPhase) - ): - insert_at = index - break - - self._properties["buildPhases"].insert(insert_at, headers_phase) - headers_phase.parent = self - - return headers_phase - - def ResourcesPhase(self): - resources_phase = self.GetBuildPhaseByType(PBXResourcesBuildPhase) - if resources_phase is None: - resources_phase = PBXResourcesBuildPhase() - - # The resources phase should come before the sources and frameworks - # phases, if any. - insert_at = len(self._properties["buildPhases"]) - for index, phase in enumerate(self._properties["buildPhases"]): - if isinstance(phase, PBXSourcesBuildPhase) or isinstance( - phase, PBXFrameworksBuildPhase - ): - insert_at = index - break - - self._properties["buildPhases"].insert(insert_at, resources_phase) - resources_phase.parent = self - - return resources_phase - - def SourcesPhase(self): - sources_phase = self.GetBuildPhaseByType(PBXSourcesBuildPhase) - if sources_phase is None: - sources_phase = PBXSourcesBuildPhase() - self.AppendProperty("buildPhases", sources_phase) - - return sources_phase - - def FrameworksPhase(self): - frameworks_phase = self.GetBuildPhaseByType(PBXFrameworksBuildPhase) - if frameworks_phase is None: - frameworks_phase = PBXFrameworksBuildPhase() - self.AppendProperty("buildPhases", frameworks_phase) - - return frameworks_phase - - def AddDependency(self, other): - # super - XCTarget.AddDependency(self, other) - - static_library_type = "com.apple.product-type.library.static" - shared_library_type = "com.apple.product-type.library.dynamic" - framework_type = "com.apple.product-type.framework" - if ( - isinstance(other, PBXNativeTarget) - and "productType" in self._properties - and self._properties["productType"] != static_library_type - and "productType" in other._properties - and ( - other._properties["productType"] == static_library_type - or ( - ( - other._properties["productType"] == shared_library_type - or other._properties["productType"] == framework_type - ) - and ( - (not other.HasBuildSetting("MACH_O_TYPE")) - or other.GetBuildSetting("MACH_O_TYPE") != "mh_bundle" - ) - ) - ) - ): - - file_ref = other.GetProperty("productReference") - - pbxproject = self.PBXProjectAncestor() - other_pbxproject = other.PBXProjectAncestor() - if pbxproject != other_pbxproject: - other_project_product_group = pbxproject.AddOrGetProjectReference( - other_pbxproject - )[0] - file_ref = other_project_product_group.GetChildByRemoteObject(file_ref) - - self.FrameworksPhase().AppendProperty( - "files", PBXBuildFile({"fileRef": file_ref}) - ) - - -class PBXAggregateTarget(XCTarget): - pass - - -class PBXProject(XCContainerPortal): - # A PBXProject is really just an XCObject, the XCContainerPortal thing is - # just to allow PBXProject to be used in the containerPortal property of - # PBXContainerItemProxy. - """ - - Attributes: - path: "sample.xcodeproj". TODO(mark) Document me! - _other_pbxprojects: A dictionary, keyed by other PBXProject objects. Each - value is a reference to the dict in the - projectReferences list associated with the keyed - PBXProject. - """ - - _schema = XCContainerPortal._schema.copy() - _schema.update( - { - "attributes": [0, dict, 0, 0], - "buildConfigurationList": [ - 0, - XCConfigurationList, - 1, - 1, - XCConfigurationList(), - ], - "compatibilityVersion": [0, str, 0, 1, "Xcode 3.2"], - "hasScannedForEncodings": [0, int, 0, 1, 1], - "mainGroup": [0, PBXGroup, 1, 1, PBXGroup()], - "projectDirPath": [0, str, 0, 1, ""], - "projectReferences": [1, dict, 0, 0], - "projectRoot": [0, str, 0, 1, ""], - "targets": [1, XCTarget, 1, 1, []], - } - ) - - def __init__(self, properties=None, id=None, parent=None, path=None): - self.path = path - self._other_pbxprojects = {} - # super - XCContainerPortal.__init__(self, properties, id, parent) - - def Name(self): - name = self.path - if name[-10:] == ".xcodeproj": - name = name[:-10] - return posixpath.basename(name) - - def Path(self): - return self.path - - def Comment(self): - return "Project object" - - def Children(self): - # super - children = XCContainerPortal.Children(self) - - # Add children that the schema doesn't know about. Maybe there's a more - # elegant way around this, but this is the only case where we need to own - # objects in a dictionary (that is itself in a list), and three lines for - # a one-off isn't that big a deal. - if "projectReferences" in self._properties: - for reference in self._properties["projectReferences"]: - children.append(reference["ProductGroup"]) - - return children - - def PBXProjectAncestor(self): - return self - - def _GroupByName(self, name): - if "mainGroup" not in self._properties: - self.SetProperty("mainGroup", PBXGroup()) - - main_group = self._properties["mainGroup"] - group = main_group.GetChildByName(name) - if group is None: - group = PBXGroup({"name": name}) - main_group.AppendChild(group) - - return group - - # SourceGroup and ProductsGroup are created by default in Xcode's own - # templates. - def SourceGroup(self): - return self._GroupByName("Source") - - def ProductsGroup(self): - return self._GroupByName("Products") - - # IntermediatesGroup is used to collect source-like files that are generated - # by rules or script phases and are placed in intermediate directories such - # as DerivedSources. - def IntermediatesGroup(self): - return self._GroupByName("Intermediates") - - # FrameworksGroup and ProjectsGroup are top-level groups used to collect - # frameworks and projects. - def FrameworksGroup(self): - return self._GroupByName("Frameworks") - - def ProjectsGroup(self): - return self._GroupByName("Projects") - - def RootGroupForPath(self, path): - """Returns a PBXGroup child of this object to which path should be added. - - This method is intended to choose between SourceGroup and - IntermediatesGroup on the basis of whether path is present in a source - directory or an intermediates directory. For the purposes of this - determination, any path located within a derived file directory such as - PROJECT_DERIVED_FILE_DIR is treated as being in an intermediates - directory. - - The returned value is a two-element tuple. The first element is the - PBXGroup, and the second element specifies whether that group should be - organized hierarchically (True) or as a single flat list (False). - """ - - # TODO(mark): make this a class variable and bind to self on call? - # Also, this list is nowhere near exhaustive. - # INTERMEDIATE_DIR and SHARED_INTERMEDIATE_DIR are used by - # gyp.generator.xcode. There should probably be some way for that module - # to push the names in, rather than having to hard-code them here. - source_tree_groups = { - "DERIVED_FILE_DIR": (self.IntermediatesGroup, True), - "INTERMEDIATE_DIR": (self.IntermediatesGroup, True), - "PROJECT_DERIVED_FILE_DIR": (self.IntermediatesGroup, True), - "SHARED_INTERMEDIATE_DIR": (self.IntermediatesGroup, True), - } - - (source_tree, path) = SourceTreeAndPathFromPath(path) - if source_tree is not None and source_tree in source_tree_groups: - (group_func, hierarchical) = source_tree_groups[source_tree] - group = group_func() - return (group, hierarchical) - - # TODO(mark): make additional choices based on file extension. - - return (self.SourceGroup(), True) - - def AddOrGetFileInRootGroup(self, path): - """Returns a PBXFileReference corresponding to path in the correct group - according to RootGroupForPath's heuristics. - - If an existing PBXFileReference for path exists, it will be returned. - Otherwise, one will be created and returned. - """ - - (group, hierarchical) = self.RootGroupForPath(path) - return group.AddOrGetFileByPath(path, hierarchical) - - def RootGroupsTakeOverOnlyChildren(self, recurse=False): - """Calls TakeOverOnlyChild for all groups in the main group.""" - - for group in self._properties["mainGroup"]._properties["children"]: - if isinstance(group, PBXGroup): - group.TakeOverOnlyChild(recurse) - - def SortGroups(self): - # Sort the children of the mainGroup (like "Source" and "Products") - # according to their defined order. - self._properties["mainGroup"]._properties["children"] = sorted( - self._properties["mainGroup"]._properties["children"], - key=cmp_to_key(lambda x, y: x.CompareRootGroup(y)), - ) - - # Sort everything else by putting group before files, and going - # alphabetically by name within sections of groups and files. SortGroup - # is recursive. - for group in self._properties["mainGroup"]._properties["children"]: - if not isinstance(group, PBXGroup): - continue - - if group.Name() == "Products": - # The Products group is a special case. Instead of sorting - # alphabetically, sort things in the order of the targets that - # produce the products. To do this, just build up a new list of - # products based on the targets. - products = [] - for target in self._properties["targets"]: - if not isinstance(target, PBXNativeTarget): - continue - product = target._properties["productReference"] - # Make sure that the product is already in the products group. - assert product in group._properties["children"] - products.append(product) - - # Make sure that this process doesn't miss anything that was already - # in the products group. - assert len(products) == len(group._properties["children"]) - group._properties["children"] = products - else: - group.SortGroup() - - def AddOrGetProjectReference(self, other_pbxproject): - """Add a reference to another project file (via PBXProject object) to this - one. - - Returns [ProductGroup, ProjectRef]. ProductGroup is a PBXGroup object in - this project file that contains a PBXReferenceProxy object for each - product of each PBXNativeTarget in the other project file. ProjectRef is - a PBXFileReference to the other project file. - - If this project file already references the other project file, the - existing ProductGroup and ProjectRef are returned. The ProductGroup will - still be updated if necessary. - """ - - if "projectReferences" not in self._properties: - self._properties["projectReferences"] = [] - - product_group = None - project_ref = None - - if other_pbxproject not in self._other_pbxprojects: - # This project file isn't yet linked to the other one. Establish the - # link. - product_group = PBXGroup({"name": "Products"}) - - # ProductGroup is strong. - product_group.parent = self - - # There's nothing unique about this PBXGroup, and if left alone, it will - # wind up with the same set of hashables as all other PBXGroup objects - # owned by the projectReferences list. Add the hashables of the - # remote PBXProject that it's related to. - product_group._hashables.extend(other_pbxproject.Hashables()) - - # The other project reports its path as relative to the same directory - # that this project's path is relative to. The other project's path - # is not necessarily already relative to this project. Figure out the - # pathname that this project needs to use to refer to the other one. - this_path = posixpath.dirname(self.Path()) - projectDirPath = self.GetProperty("projectDirPath") - if projectDirPath: - if posixpath.isabs(projectDirPath[0]): - this_path = projectDirPath - else: - this_path = posixpath.join(this_path, projectDirPath) - other_path = gyp.common.RelativePath(other_pbxproject.Path(), this_path) - - # ProjectRef is weak (it's owned by the mainGroup hierarchy). - project_ref = PBXFileReference( - { - "lastKnownFileType": "wrapper.pb-project", - "path": other_path, - "sourceTree": "SOURCE_ROOT", - } - ) - self.ProjectsGroup().AppendChild(project_ref) - - ref_dict = {"ProductGroup": product_group, "ProjectRef": project_ref} - self._other_pbxprojects[other_pbxproject] = ref_dict - self.AppendProperty("projectReferences", ref_dict) - - # Xcode seems to sort this list case-insensitively - self._properties["projectReferences"] = sorted( - self._properties["projectReferences"], - key=lambda x: x["ProjectRef"].Name().lower() - ) - else: - # The link already exists. Pull out the relevnt data. - project_ref_dict = self._other_pbxprojects[other_pbxproject] - product_group = project_ref_dict["ProductGroup"] - project_ref = project_ref_dict["ProjectRef"] - - self._SetUpProductReferences(other_pbxproject, product_group, project_ref) - - inherit_unique_symroot = self._AllSymrootsUnique(other_pbxproject, False) - targets = other_pbxproject.GetProperty("targets") - if all(self._AllSymrootsUnique(t, inherit_unique_symroot) for t in targets): - dir_path = project_ref._properties["path"] - product_group._hashables.extend(dir_path) - - return [product_group, project_ref] - - def _AllSymrootsUnique(self, target, inherit_unique_symroot): - # Returns True if all configurations have a unique 'SYMROOT' attribute. - # The value of inherit_unique_symroot decides, if a configuration is assumed - # to inherit a unique 'SYMROOT' attribute from its parent, if it doesn't - # define an explicit value for 'SYMROOT'. - symroots = self._DefinedSymroots(target) - for s in self._DefinedSymroots(target): - if ( - s is not None - and not self._IsUniqueSymrootForTarget(s) - or s is None - and not inherit_unique_symroot - ): - return False - return True if symroots else inherit_unique_symroot - - def _DefinedSymroots(self, target): - # Returns all values for the 'SYMROOT' attribute defined in all - # configurations for this target. If any configuration doesn't define the - # 'SYMROOT' attribute, None is added to the returned set. If all - # configurations don't define the 'SYMROOT' attribute, an empty set is - # returned. - config_list = target.GetProperty("buildConfigurationList") - symroots = set() - for config in config_list.GetProperty("buildConfigurations"): - setting = config.GetProperty("buildSettings") - if "SYMROOT" in setting: - symroots.add(setting["SYMROOT"]) - else: - symroots.add(None) - if len(symroots) == 1 and None in symroots: - return set() - return symroots - - def _IsUniqueSymrootForTarget(self, symroot): - # This method returns True if all configurations in target contain a - # 'SYMROOT' attribute that is unique for the given target. A value is - # unique, if the Xcode macro '$SRCROOT' appears in it in any form. - uniquifier = ["$SRCROOT", "$(SRCROOT)"] - if any(x in symroot for x in uniquifier): - return True - return False - - def _SetUpProductReferences(self, other_pbxproject, product_group, project_ref): - # TODO(mark): This only adds references to products in other_pbxproject - # when they don't exist in this pbxproject. Perhaps it should also - # remove references from this pbxproject that are no longer present in - # other_pbxproject. Perhaps it should update various properties if they - # change. - for target in other_pbxproject._properties["targets"]: - if not isinstance(target, PBXNativeTarget): - continue - - other_fileref = target._properties["productReference"] - if product_group.GetChildByRemoteObject(other_fileref) is None: - # Xcode sets remoteInfo to the name of the target and not the name - # of its product, despite this proxy being a reference to the product. - container_item = PBXContainerItemProxy( - { - "containerPortal": project_ref, - "proxyType": 2, - "remoteGlobalIDString": other_fileref, - "remoteInfo": target.Name(), - } - ) - # TODO(mark): Does sourceTree get copied straight over from the other - # project? Can the other project ever have lastKnownFileType here - # instead of explicitFileType? (Use it if so?) Can path ever be - # unset? (I don't think so.) Can other_fileref have name set, and - # does it impact the PBXReferenceProxy if so? These are the questions - # that perhaps will be answered one day. - reference_proxy = PBXReferenceProxy( - { - "fileType": other_fileref._properties["explicitFileType"], - "path": other_fileref._properties["path"], - "sourceTree": other_fileref._properties["sourceTree"], - "remoteRef": container_item, - } - ) - - product_group.AppendChild(reference_proxy) - - def SortRemoteProductReferences(self): - # For each remote project file, sort the associated ProductGroup in the - # same order that the targets are sorted in the remote project file. This - # is the sort order used by Xcode. - - def CompareProducts(x, y, remote_products): - # x and y are PBXReferenceProxy objects. Go through their associated - # PBXContainerItem to get the remote PBXFileReference, which will be - # present in the remote_products list. - x_remote = x._properties["remoteRef"]._properties["remoteGlobalIDString"] - y_remote = y._properties["remoteRef"]._properties["remoteGlobalIDString"] - x_index = remote_products.index(x_remote) - y_index = remote_products.index(y_remote) - - # Use the order of each remote PBXFileReference in remote_products to - # determine the sort order. - return cmp(x_index, y_index) - - for other_pbxproject, ref_dict in self._other_pbxprojects.items(): - # Build up a list of products in the remote project file, ordered the - # same as the targets that produce them. - remote_products = [] - for target in other_pbxproject._properties["targets"]: - if not isinstance(target, PBXNativeTarget): - continue - remote_products.append(target._properties["productReference"]) - - # Sort the PBXReferenceProxy children according to the list of remote - # products. - product_group = ref_dict["ProductGroup"] - product_group._properties["children"] = sorted( - product_group._properties["children"], - key=cmp_to_key( - lambda x, y, rp=remote_products: CompareProducts(x, y, rp)), - ) - - -class XCProjectFile(XCObject): - _schema = XCObject._schema.copy() - _schema.update( - { - "archiveVersion": [0, int, 0, 1, 1], - "classes": [0, dict, 0, 1, {}], - "objectVersion": [0, int, 0, 1, 46], - "rootObject": [0, PBXProject, 1, 1], - } - ) - - def ComputeIDs(self, recursive=True, overwrite=True, hash=None): - # Although XCProjectFile is implemented here as an XCObject, it's not a - # proper object in the Xcode sense, and it certainly doesn't have its own - # ID. Pass through an attempt to update IDs to the real root object. - if recursive: - self._properties["rootObject"].ComputeIDs(recursive, overwrite, hash) - - def Print(self, file=sys.stdout): - self.VerifyHasRequiredProperties() - - # Add the special "objects" property, which will be caught and handled - # separately during printing. This structure allows a fairly standard - # loop do the normal printing. - self._properties["objects"] = {} - self._XCPrint(file, 0, "// !$*UTF8*$!\n") - if self._should_print_single_line: - self._XCPrint(file, 0, "{ ") - else: - self._XCPrint(file, 0, "{\n") - for property, value in sorted( - self._properties.items() - ): - if property == "objects": - self._PrintObjects(file) - else: - self._XCKVPrint(file, 1, property, value) - self._XCPrint(file, 0, "}\n") - del self._properties["objects"] - - def _PrintObjects(self, file): - if self._should_print_single_line: - self._XCPrint(file, 0, "objects = {") - else: - self._XCPrint(file, 1, "objects = {\n") - - objects_by_class = {} - for object in self.Descendants(): - if object == self: - continue - class_name = object.__class__.__name__ - if class_name not in objects_by_class: - objects_by_class[class_name] = [] - objects_by_class[class_name].append(object) - - for class_name in sorted(objects_by_class): - self._XCPrint(file, 0, "\n") - self._XCPrint(file, 0, "/* Begin " + class_name + " section */\n") - for object in sorted( - objects_by_class[class_name], key=attrgetter("id") - ): - object.Print(file) - self._XCPrint(file, 0, "/* End " + class_name + " section */\n") - - if self._should_print_single_line: - self._XCPrint(file, 0, "}; ") - else: - self._XCPrint(file, 1, "};\n") diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py deleted file mode 100644 index 530196366946d..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (c) 2011 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Applies a fix to CR LF TAB handling in xml.dom. - -Fixes this: http://code.google.com/p/chromium/issues/detail?id=76293 -Working around this: http://bugs.python.org/issue5752 -TODO(bradnelson): Consider dropping this when we drop XP support. -""" - - -import xml.dom.minidom - - -def _Replacement_write_data(writer, data, is_attrib=False): - """Writes datachars to writer.""" - data = data.replace("&", "&").replace("<", "<") - data = data.replace('"', """).replace(">", ">") - if is_attrib: - data = data.replace("\r", " ").replace("\n", " ").replace("\t", " ") - writer.write(data) - - -def _Replacement_writexml(self, writer, indent="", addindent="", newl=""): - # indent = current indentation - # addindent = indentation to add to higher levels - # newl = newline string - writer.write(indent + "<" + self.tagName) - - attrs = self._get_attributes() - a_names = sorted(attrs.keys()) - - for a_name in a_names: - writer.write(' %s="' % a_name) - _Replacement_write_data(writer, attrs[a_name].value, is_attrib=True) - writer.write('"') - if self.childNodes: - writer.write(">%s" % newl) - for node in self.childNodes: - node.writexml(writer, indent + addindent, addindent, newl) - writer.write(f"{indent}{newl}") - else: - writer.write("/>%s" % newl) - - -class XmlFix: - """Object to manage temporary patching of xml.dom.minidom.""" - - def __init__(self): - # Preserve current xml.dom.minidom functions. - self.write_data = xml.dom.minidom._write_data - self.writexml = xml.dom.minidom.Element.writexml - # Inject replacement versions of a function and a method. - xml.dom.minidom._write_data = _Replacement_write_data - xml.dom.minidom.Element.writexml = _Replacement_writexml - - def Cleanup(self): - if self.write_data: - xml.dom.minidom._write_data = self.write_data - xml.dom.minidom.Element.writexml = self.writexml - self.write_data = None - - def __del__(self): - self.Cleanup() diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pyproject.toml b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pyproject.toml deleted file mode 100644 index d8a5451520cc3..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/pyproject.toml +++ /dev/null @@ -1,41 +0,0 @@ -[build-system] -requires = ["setuptools>=61.0"] -build-backend = "setuptools.build_meta" - -[project] -name = "gyp-next" -version = "0.14.0" -authors = [ - { name="Node.js contributors", email="ryzokuken@disroot.org" }, -] -description = "A fork of the GYP build system for use in the Node.js projects" -readme = "README.md" -license = { file="LICENSE" } -requires-python = ">=3.6" -classifiers = [ - "Development Status :: 3 - Alpha", - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Natural Language :: English", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", -] - -[project.optional-dependencies] -dev = ["flake8", "pytest"] - -[project.scripts] -gyp = "gyp:script_main" - -[project.urls] -"Homepage" = "https://github.com/nodejs/gyp-next" - -[tool.setuptools] -package-dir = {"" = "pylib"} -packages = ["gyp", "gyp.generator"] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/test_gyp.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/test_gyp.py deleted file mode 100755 index b7bb956b8ed58..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/test_gyp.py +++ /dev/null @@ -1,261 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""gyptest.py -- test runner for GYP tests.""" - - -import argparse -import os -import platform -import subprocess -import sys -import time - - -def is_test_name(f): - return f.startswith("gyptest") and f.endswith(".py") - - -def find_all_gyptest_files(directory): - result = [] - for root, dirs, files in os.walk(directory): - result.extend([os.path.join(root, f) for f in files if is_test_name(f)]) - result.sort() - return result - - -def main(argv=None): - if argv is None: - argv = sys.argv - - parser = argparse.ArgumentParser() - parser.add_argument("-a", "--all", action="store_true", help="run all tests") - parser.add_argument("-C", "--chdir", action="store", help="change to directory") - parser.add_argument( - "-f", - "--format", - action="store", - default="", - help="run tests with the specified formats", - ) - parser.add_argument( - "-G", - "--gyp_option", - action="append", - default=[], - help="Add -G options to the gyp command line", - ) - parser.add_argument( - "-l", "--list", action="store_true", help="list available tests and exit" - ) - parser.add_argument( - "-n", - "--no-exec", - action="store_true", - help="no execute, just print the command line", - ) - parser.add_argument( - "--path", action="append", default=[], help="additional $PATH directory" - ) - parser.add_argument( - "-q", - "--quiet", - action="store_true", - help="quiet, don't print anything unless there are failures", - ) - parser.add_argument( - "-v", - "--verbose", - action="store_true", - help="print configuration info and test results.", - ) - parser.add_argument("tests", nargs="*") - args = parser.parse_args(argv[1:]) - - if args.chdir: - os.chdir(args.chdir) - - if args.path: - extra_path = [os.path.abspath(p) for p in args.path] - extra_path = os.pathsep.join(extra_path) - os.environ["PATH"] = extra_path + os.pathsep + os.environ["PATH"] - - if not args.tests: - if not args.all: - sys.stderr.write("Specify -a to get all tests.\n") - return 1 - args.tests = ["test"] - - tests = [] - for arg in args.tests: - if os.path.isdir(arg): - tests.extend(find_all_gyptest_files(os.path.normpath(arg))) - else: - if not is_test_name(os.path.basename(arg)): - print(arg, "is not a valid gyp test name.", file=sys.stderr) - sys.exit(1) - tests.append(arg) - - if args.list: - for test in tests: - print(test) - sys.exit(0) - - os.environ["PYTHONPATH"] = os.path.abspath("test/lib") - - if args.verbose: - print_configuration_info() - - if args.gyp_option and not args.quiet: - print("Extra Gyp options: %s\n" % args.gyp_option) - - if args.format: - format_list = args.format.split(",") - else: - format_list = { - "aix5": ["make"], - "os400": ["make"], - "freebsd7": ["make"], - "freebsd8": ["make"], - "openbsd5": ["make"], - "cygwin": ["msvs"], - "win32": ["msvs", "ninja"], - "linux": ["make", "ninja"], - "linux2": ["make", "ninja"], - "linux3": ["make", "ninja"], - # TODO: Re-enable xcode-ninja. - # https://bugs.chromium.org/p/gyp/issues/detail?id=530 - # 'darwin': ['make', 'ninja', 'xcode', 'xcode-ninja'], - "darwin": ["make", "ninja", "xcode"], - }[sys.platform] - - gyp_options = [] - for option in args.gyp_option: - gyp_options += ["-G", option] - - runner = Runner(format_list, tests, gyp_options, args.verbose) - runner.run() - - if not args.quiet: - runner.print_results() - - return 1 if runner.failures else 0 - - -def print_configuration_info(): - print("Test configuration:") - if sys.platform == "darwin": - sys.path.append(os.path.abspath("test/lib")) - import TestMac - - print(f" Mac {platform.mac_ver()[0]} {platform.mac_ver()[2]}") - print(f" Xcode {TestMac.Xcode.Version()}") - elif sys.platform == "win32": - sys.path.append(os.path.abspath("pylib")) - import gyp.MSVSVersion - - print(" Win %s %s\n" % platform.win32_ver()[0:2]) - print(" MSVS %s" % gyp.MSVSVersion.SelectVisualStudioVersion().Description()) - elif sys.platform in ("linux", "linux2"): - print(" Linux %s" % " ".join(platform.linux_distribution())) - print(f" Python {platform.python_version()}") - print(f" PYTHONPATH={os.environ['PYTHONPATH']}") - print() - - -class Runner: - def __init__(self, formats, tests, gyp_options, verbose): - self.formats = formats - self.tests = tests - self.verbose = verbose - self.gyp_options = gyp_options - self.failures = [] - self.num_tests = len(formats) * len(tests) - num_digits = len(str(self.num_tests)) - self.fmt_str = "[%%%dd/%%%dd] (%%s) %%s" % (num_digits, num_digits) - self.isatty = sys.stdout.isatty() and not self.verbose - self.env = os.environ.copy() - self.hpos = 0 - - def run(self): - run_start = time.time() - - i = 1 - for fmt in self.formats: - for test in self.tests: - self.run_test(test, fmt, i) - i += 1 - - if self.isatty: - self.erase_current_line() - - self.took = time.time() - run_start - - def run_test(self, test, fmt, i): - if self.isatty: - self.erase_current_line() - - msg = self.fmt_str % (i, self.num_tests, fmt, test) - self.print_(msg) - - start = time.time() - cmd = [sys.executable, test] + self.gyp_options - self.env["TESTGYP_FORMAT"] = fmt - proc = subprocess.Popen( - cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=self.env - ) - proc.wait() - took = time.time() - start - - stdout = proc.stdout.read().decode("utf8") - if proc.returncode == 2: - res = "skipped" - elif proc.returncode: - res = "failed" - self.failures.append(f"({test}) {fmt}") - else: - res = "passed" - res_msg = f" {res} {took:.3f}s" - self.print_(res_msg) - - if stdout and not stdout.endswith(("PASSED\n", "NO RESULT\n")): - print() - print("\n".join(f" {line}" for line in stdout.splitlines())) - elif not self.isatty: - print() - - def print_(self, msg): - print(msg, end="") - index = msg.rfind("\n") - if index == -1: - self.hpos += len(msg) - else: - self.hpos = len(msg) - index - sys.stdout.flush() - - def erase_current_line(self): - print("\b" * self.hpos + " " * self.hpos + "\b" * self.hpos, end="") - sys.stdout.flush() - self.hpos = 0 - - def print_results(self): - num_failures = len(self.failures) - if num_failures: - print() - if num_failures == 1: - print("Failed the following test:") - else: - print("Failed the following %d tests:" % num_failures) - print("\t" + "\n\t".join(sorted(self.failures))) - print() - print( - "Ran %d tests in %.3fs, %d failed." - % (self.num_tests, self.took, num_failures) - ) - print() - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.pbfilespec b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.pbfilespec deleted file mode 100644 index 85e2e268a51b7..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.pbfilespec +++ /dev/null @@ -1,27 +0,0 @@ -/* - gyp.pbfilespec - GYP source file spec for Xcode 3 - - There is not much documentation available regarding the format - of .pbfilespec files. As a starting point, see for instance the - outdated documentation at: - http://maxao.free.fr/xcode-plugin-interface/specifications.html - and the files in: - /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/ - - Place this file in directory: - ~/Library/Application Support/Developer/Shared/Xcode/Specifications/ -*/ - -( - { - Identifier = sourcecode.gyp; - BasedOn = sourcecode; - Name = "GYP Files"; - Extensions = ("gyp", "gypi"); - MIMETypes = ("text/gyp"); - Language = "xcode.lang.gyp"; - IsTextFile = YES; - IsSourceFile = YES; - } -) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.xclangspec b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.xclangspec deleted file mode 100644 index 3b3506d319e0f..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/Xcode/Specifications/gyp.xclangspec +++ /dev/null @@ -1,226 +0,0 @@ -/* - Copyright (c) 2011 Google Inc. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. - - gyp.xclangspec - GYP language specification for Xcode 3 - - There is not much documentation available regarding the format - of .xclangspec files. As a starting point, see for instance the - outdated documentation at: - http://maxao.free.fr/xcode-plugin-interface/specifications.html - and the files in: - /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/ - - Place this file in directory: - ~/Library/Application Support/Developer/Shared/Xcode/Specifications/ -*/ - -( - - { - Identifier = "xcode.lang.gyp.keyword"; - Syntax = { - Words = ( - "and", - "or", - " (caar gyp-parse-history) target-point) - (setq gyp-parse-history (cdr gyp-parse-history)))) - -(defun gyp-parse-point () - "The point of the last parse state added by gyp-parse-to." - (caar gyp-parse-history)) - -(defun gyp-parse-sections () - "A list of section symbols holding at the last parse state point." - (cdar gyp-parse-history)) - -(defun gyp-inside-dictionary-p () - "Predicate returning true if the parser is inside a dictionary." - (not (eq (cadar gyp-parse-history) 'list))) - -(defun gyp-add-parse-history (point sections) - "Add parse state SECTIONS to the parse history at POINT so that parsing can be - resumed instantly." - (while (>= (caar gyp-parse-history) point) - (setq gyp-parse-history (cdr gyp-parse-history))) - (setq gyp-parse-history (cons (cons point sections) gyp-parse-history))) - -(defun gyp-parse-to (target-point) - "Parses from (point) to TARGET-POINT adding the parse state information to - gyp-parse-state-history. Parsing stops if TARGET-POINT is reached or if a - string literal has been parsed. Returns nil if no further parsing can be - done, otherwise returns the position of the start of a parsed string, leaving - the point at the end of the string." - (let ((parsing t) - string-start) - (while parsing - (setq string-start nil) - ;; Parse up to a character that starts a sexp, or if the nesting - ;; level decreases. - (let ((state (parse-partial-sexp (gyp-parse-point) - target-point - -1 - t)) - (sections (gyp-parse-sections))) - (if (= (nth 0 state) -1) - (setq sections (cdr sections)) ; pop out a level - (cond ((looking-at-p "['\"]") ; a string - (setq string-start (point)) - (goto-char (scan-sexps (point) 1)) - (if (gyp-inside-dictionary-p) - ;; Look for sections inside a dictionary - (let ((section (gyp-section-name - (buffer-substring-no-properties - (+ 1 string-start) - (- (point) 1))))) - (setq sections (cons section (cdr sections))))) - ;; Stop after the string so it can be fontified. - (setq target-point (point))) - ((looking-at-p "{") - ;; Inside a dictionary. Increase nesting. - (forward-char 1) - (setq sections (cons 'unknown sections))) - ((looking-at-p "\\[") - ;; Inside a list. Increase nesting - (forward-char 1) - (setq sections (cons 'list sections))) - ((not (eobp)) - ;; other - (forward-char 1)))) - (gyp-add-parse-history (point) sections) - (setq parsing (< (point) target-point)))) - string-start)) - -(defun gyp-section-at-point () - "Transform the last parse state, which is a list of nested sections and return - the section symbol that should be used to determine font-lock information for - the string. Can return nil indicating the string should not have any attached - section." - (let ((sections (gyp-parse-sections))) - (cond - ((eq (car sections) 'conditions) - ;; conditions can occur in a variables section, but we still want to - ;; highlight it as a keyword. - nil) - ((and (eq (car sections) 'list) - (eq (cadr sections) 'list)) - ;; conditions and sources can have items in [[ ]] - (caddr sections)) - (t (cadr sections))))) - -(defun gyp-section-match (limit) - "Parse from (point) to LIMIT returning by means of match data what was - matched. The group of the match indicates what style font-lock should apply. - See also `gyp-add-font-lock-keywords'." - (gyp-invalidate-parse-states-after (point)) - (let ((group nil) - (string-start t)) - (while (and (< (point) limit) - (not group) - string-start) - (setq string-start (gyp-parse-to limit)) - (if string-start - (setq group (cl-case (gyp-section-at-point) - ('dependencies 1) - ('variables 2) - ('conditions 2) - ('sources 3) - ('defines 4) - (nil nil))))) - (if group - (progn - ;; Set the match data to indicate to the font-lock mechanism the - ;; highlighting to be performed. - (set-match-data (append (list string-start (point)) - (make-list (* (1- group) 2) nil) - (list (1+ string-start) (1- (point))))) - t)))) - -;;; Please see http://code.google.com/p/gyp/wiki/GypLanguageSpecification for -;;; canonical list of keywords. -(defun gyp-add-font-lock-keywords () - "Add gyp-mode keywords to font-lock mechanism." - ;; TODO(jknotten): Move all the keyword highlighting into gyp-section-match - ;; so that we can do the font-locking in a single font-lock pass. - (font-lock-add-keywords - nil - (list - ;; Top-level keywords - (list (concat "['\"]\\(" - (regexp-opt (list "action" "action_name" "actions" "cflags" - "cflags_cc" "conditions" "configurations" - "copies" "defines" "dependencies" "destination" - "direct_dependent_settings" - "export_dependent_settings" "extension" "files" - "include_dirs" "includes" "inputs" "ldflags" "libraries" - "link_settings" "mac_bundle" "message" - "msvs_external_rule" "outputs" "product_name" - "process_outputs_as_sources" "rules" "rule_name" - "sources" "suppress_wildcard" - "target_conditions" "target_defaults" - "target_defines" "target_name" "toolsets" - "targets" "type" "variables" "xcode_settings")) - "[!/+=]?\\)") 1 'font-lock-keyword-face t) - ;; Type of target - (list (concat "['\"]\\(" - (regexp-opt (list "loadable_module" "static_library" - "shared_library" "executable" "none")) - "\\)") 1 'font-lock-type-face t) - (list "\\(?:target\\|action\\)_name['\"]\\s-*:\\s-*['\"]\\([^ '\"]*\\)" 1 - 'font-lock-function-name-face t) - (list 'gyp-section-match - (list 1 'font-lock-function-name-face t t) ; dependencies - (list 2 'font-lock-variable-name-face t t) ; variables, conditions - (list 3 'font-lock-constant-face t t) ; sources - (list 4 'font-lock-preprocessor-face t t)) ; preprocessor - ;; Variable expansion - (list "<@?(\\([^\n )]+\\))" 1 'font-lock-variable-name-face t) - ;; Command expansion - (list " "{dst}"') - - print("}") - - -def main(): - if len(sys.argv) < 2: - print(__doc__, file=sys.stderr) - print(file=sys.stderr) - print("usage: %s target1 target2..." % (sys.argv[0]), file=sys.stderr) - return 1 - - edges = LoadEdges("dump.json", sys.argv[1:]) - - WriteGraph(edges) - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_gyp.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_gyp.py deleted file mode 100755 index 6eef3a1bbf02a..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_gyp.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Pretty-prints the contents of a GYP file.""" - - -import sys -import re - - -# Regex to remove comments when we're counting braces. -COMMENT_RE = re.compile(r"\s*#.*") - -# Regex to remove quoted strings when we're counting braces. -# It takes into account quoted quotes, and makes sure that the quotes match. -# NOTE: It does not handle quotes that span more than one line, or -# cases where an escaped quote is preceded by an escaped backslash. -QUOTE_RE_STR = r'(?P[\'"])(.*?)(? 0: - after = True - - # This catches the special case of a closing brace having something - # other than just whitespace ahead of it -- we don't want to - # unindent that until after this line is printed so it stays with - # the previous indentation level. - if cnt < 0 and closing_prefix_re.match(stripline): - after = True - return (cnt, after) - - -def prettyprint_input(lines): - """Does the main work of indenting the input based on the brace counts.""" - indent = 0 - basic_offset = 2 - for line in lines: - if COMMENT_RE.match(line): - print(line) - else: - line = line.strip("\r\n\t ") # Otherwise doesn't strip \r on Unix. - if len(line) > 0: - (brace_diff, after) = count_braces(line) - if brace_diff != 0: - if after: - print(" " * (basic_offset * indent) + line) - indent += brace_diff - else: - indent += brace_diff - print(" " * (basic_offset * indent) + line) - else: - print(" " * (basic_offset * indent) + line) - else: - print("") - - -def main(): - if len(sys.argv) > 1: - data = open(sys.argv[1]).read().splitlines() - else: - data = sys.stdin.read().splitlines() - # Split up the double braces. - lines = split_double_braces(data) - - # Indent and print the output. - prettyprint_input(lines) - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_sln.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_sln.py deleted file mode 100755 index 6ca0cd12a7ba0..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_sln.py +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Prints the information in a sln file in a diffable way. - - It first outputs each projects in alphabetical order with their - dependencies. - - Then it outputs a possible build order. -""" - - -import os -import re -import sys -import pretty_vcproj - -__author__ = "nsylvain (Nicolas Sylvain)" - - -def BuildProject(project, built, projects, deps): - # if all dependencies are done, we can build it, otherwise we try to build the - # dependency. - # This is not infinite-recursion proof. - for dep in deps[project]: - if dep not in built: - BuildProject(dep, built, projects, deps) - print(project) - built.append(project) - - -def ParseSolution(solution_file): - # All projects, their clsid and paths. - projects = dict() - - # A list of dependencies associated with a project. - dependencies = dict() - - # Regular expressions that matches the SLN format. - # The first line of a project definition. - begin_project = re.compile( - r'^Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942' - r'}"\) = "(.*)", "(.*)", "(.*)"$' - ) - # The last line of a project definition. - end_project = re.compile("^EndProject$") - # The first line of a dependency list. - begin_dep = re.compile(r"ProjectSection\(ProjectDependencies\) = postProject$") - # The last line of a dependency list. - end_dep = re.compile("EndProjectSection$") - # A line describing a dependency. - dep_line = re.compile(" *({.*}) = ({.*})$") - - in_deps = False - solution = open(solution_file) - for line in solution: - results = begin_project.search(line) - if results: - # Hack to remove icu because the diff is too different. - if results.group(1).find("icu") != -1: - continue - # We remove "_gyp" from the names because it helps to diff them. - current_project = results.group(1).replace("_gyp", "") - projects[current_project] = [ - results.group(2).replace("_gyp", ""), - results.group(3), - results.group(2), - ] - dependencies[current_project] = [] - continue - - results = end_project.search(line) - if results: - current_project = None - continue - - results = begin_dep.search(line) - if results: - in_deps = True - continue - - results = end_dep.search(line) - if results: - in_deps = False - continue - - results = dep_line.search(line) - if results and in_deps and current_project: - dependencies[current_project].append(results.group(1)) - continue - - # Change all dependencies clsid to name instead. - for project in dependencies: - # For each dependencies in this project - new_dep_array = [] - for dep in dependencies[project]: - # Look for the project name matching this cldis - for project_info in projects: - if projects[project_info][1] == dep: - new_dep_array.append(project_info) - dependencies[project] = sorted(new_dep_array) - - return (projects, dependencies) - - -def PrintDependencies(projects, deps): - print("---------------------------------------") - print("Dependencies for all projects") - print("---------------------------------------") - print("-- --") - - for (project, dep_list) in sorted(deps.items()): - print("Project : %s" % project) - print("Path : %s" % projects[project][0]) - if dep_list: - for dep in dep_list: - print(" - %s" % dep) - print("") - - print("-- --") - - -def PrintBuildOrder(projects, deps): - print("---------------------------------------") - print("Build order ") - print("---------------------------------------") - print("-- --") - - built = [] - for (project, _) in sorted(deps.items()): - if project not in built: - BuildProject(project, built, projects, deps) - - print("-- --") - - -def PrintVCProj(projects): - - for project in projects: - print("-------------------------------------") - print("-------------------------------------") - print(project) - print(project) - print(project) - print("-------------------------------------") - print("-------------------------------------") - - project_path = os.path.abspath( - os.path.join(os.path.dirname(sys.argv[1]), projects[project][2]) - ) - - pretty = pretty_vcproj - argv = [ - "", - project_path, - "$(SolutionDir)=%s\\" % os.path.dirname(sys.argv[1]), - ] - argv.extend(sys.argv[3:]) - pretty.main(argv) - - -def main(): - # check if we have exactly 1 parameter. - if len(sys.argv) < 2: - print('Usage: %s "c:\\path\\to\\project.sln"' % sys.argv[0]) - return 1 - - (projects, deps) = ParseSolution(sys.argv[1]) - PrintDependencies(projects, deps) - PrintBuildOrder(projects, deps) - - if "--recursive" in sys.argv: - PrintVCProj(projects) - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_vcproj.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_vcproj.py deleted file mode 100755 index 00d32debda51f..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +++ /dev/null @@ -1,339 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Make the format of a vcproj really pretty. - - This script normalize and sort an xml. It also fetches all the properties - inside linked vsprops and include them explicitly in the vcproj. - - It outputs the resulting xml to stdout. -""" - - -import os -import sys - -from xml.dom.minidom import parse -from xml.dom.minidom import Node - -__author__ = "nsylvain (Nicolas Sylvain)" -ARGUMENTS = None -REPLACEMENTS = dict() - - -def cmp(x, y): - return (x > y) - (x < y) - - -class CmpTuple: - """Compare function between 2 tuple.""" - - def __call__(self, x, y): - return cmp(x[0], y[0]) - - -class CmpNode: - """Compare function between 2 xml nodes.""" - - def __call__(self, x, y): - def get_string(node): - node_string = "node" - node_string += node.nodeName - if node.nodeValue: - node_string += node.nodeValue - - if node.attributes: - # We first sort by name, if present. - node_string += node.getAttribute("Name") - - all_nodes = [] - for (name, value) in node.attributes.items(): - all_nodes.append((name, value)) - - all_nodes.sort(CmpTuple()) - for (name, value) in all_nodes: - node_string += name - node_string += value - - return node_string - - return cmp(get_string(x), get_string(y)) - - -def PrettyPrintNode(node, indent=0): - if node.nodeType == Node.TEXT_NODE: - if node.data.strip(): - print("{}{}".format(" " * indent, node.data.strip())) - return - - if node.childNodes: - node.normalize() - # Get the number of attributes - attr_count = 0 - if node.attributes: - attr_count = node.attributes.length - - # Print the main tag - if attr_count == 0: - print("{}<{}>".format(" " * indent, node.nodeName)) - else: - print("{}<{}".format(" " * indent, node.nodeName)) - - all_attributes = [] - for (name, value) in node.attributes.items(): - all_attributes.append((name, value)) - all_attributes.sort(CmpTuple()) - for (name, value) in all_attributes: - print('{} {}="{}"'.format(" " * indent, name, value)) - print("%s>" % (" " * indent)) - if node.nodeValue: - print("{} {}".format(" " * indent, node.nodeValue)) - - for sub_node in node.childNodes: - PrettyPrintNode(sub_node, indent=indent + 2) - print("{}".format(" " * indent, node.nodeName)) - - -def FlattenFilter(node): - """Returns a list of all the node and sub nodes.""" - node_list = [] - - if node.attributes and node.getAttribute("Name") == "_excluded_files": - # We don't add the "_excluded_files" filter. - return [] - - for current in node.childNodes: - if current.nodeName == "Filter": - node_list.extend(FlattenFilter(current)) - else: - node_list.append(current) - - return node_list - - -def FixFilenames(filenames, current_directory): - new_list = [] - for filename in filenames: - if filename: - for key in REPLACEMENTS: - filename = filename.replace(key, REPLACEMENTS[key]) - os.chdir(current_directory) - filename = filename.strip("\"' ") - if filename.startswith("$"): - new_list.append(filename) - else: - new_list.append(os.path.abspath(filename)) - return new_list - - -def AbsoluteNode(node): - """Makes all the properties we know about in this node absolute.""" - if node.attributes: - for (name, value) in node.attributes.items(): - if name in [ - "InheritedPropertySheets", - "RelativePath", - "AdditionalIncludeDirectories", - "IntermediateDirectory", - "OutputDirectory", - "AdditionalLibraryDirectories", - ]: - # We want to fix up these paths - path_list = value.split(";") - new_list = FixFilenames(path_list, os.path.dirname(ARGUMENTS[1])) - node.setAttribute(name, ";".join(new_list)) - if not value: - node.removeAttribute(name) - - -def CleanupVcproj(node): - """For each sub node, we call recursively this function.""" - for sub_node in node.childNodes: - AbsoluteNode(sub_node) - CleanupVcproj(sub_node) - - # Normalize the node, and remove all extraneous whitespaces. - for sub_node in node.childNodes: - if sub_node.nodeType == Node.TEXT_NODE: - sub_node.data = sub_node.data.replace("\r", "") - sub_node.data = sub_node.data.replace("\n", "") - sub_node.data = sub_node.data.rstrip() - - # Fix all the semicolon separated attributes to be sorted, and we also - # remove the dups. - if node.attributes: - for (name, value) in node.attributes.items(): - sorted_list = sorted(value.split(";")) - unique_list = [] - for i in sorted_list: - if not unique_list.count(i): - unique_list.append(i) - node.setAttribute(name, ";".join(unique_list)) - if not value: - node.removeAttribute(name) - - if node.childNodes: - node.normalize() - - # For each node, take a copy, and remove it from the list. - node_array = [] - while node.childNodes and node.childNodes[0]: - # Take a copy of the node and remove it from the list. - current = node.childNodes[0] - node.removeChild(current) - - # If the child is a filter, we want to append all its children - # to this same list. - if current.nodeName == "Filter": - node_array.extend(FlattenFilter(current)) - else: - node_array.append(current) - - # Sort the list. - node_array.sort(CmpNode()) - - # Insert the nodes in the correct order. - for new_node in node_array: - # But don't append empty tool node. - if new_node.nodeName == "Tool": - if new_node.attributes and new_node.attributes.length == 1: - # This one was empty. - continue - if new_node.nodeName == "UserMacro": - continue - node.appendChild(new_node) - - -def GetConfiguationNodes(vcproj): - # TODO(nsylvain): Find a better way to navigate the xml. - nodes = [] - for node in vcproj.childNodes: - if node.nodeName == "Configurations": - for sub_node in node.childNodes: - if sub_node.nodeName == "Configuration": - nodes.append(sub_node) - - return nodes - - -def GetChildrenVsprops(filename): - dom = parse(filename) - if dom.documentElement.attributes: - vsprops = dom.documentElement.getAttribute("InheritedPropertySheets") - return FixFilenames(vsprops.split(";"), os.path.dirname(filename)) - return [] - - -def SeekToNode(node1, child2): - # A text node does not have properties. - if child2.nodeType == Node.TEXT_NODE: - return None - - # Get the name of the current node. - current_name = child2.getAttribute("Name") - if not current_name: - # There is no name. We don't know how to merge. - return None - - # Look through all the nodes to find a match. - for sub_node in node1.childNodes: - if sub_node.nodeName == child2.nodeName: - name = sub_node.getAttribute("Name") - if name == current_name: - return sub_node - - # No match. We give up. - return None - - -def MergeAttributes(node1, node2): - # No attributes to merge? - if not node2.attributes: - return - - for (name, value2) in node2.attributes.items(): - # Don't merge the 'Name' attribute. - if name == "Name": - continue - value1 = node1.getAttribute(name) - if value1: - # The attribute exist in the main node. If it's equal, we leave it - # untouched, otherwise we concatenate it. - if value1 != value2: - node1.setAttribute(name, ";".join([value1, value2])) - else: - # The attribute does not exist in the main node. We append this one. - node1.setAttribute(name, value2) - - # If the attribute was a property sheet attributes, we remove it, since - # they are useless. - if name == "InheritedPropertySheets": - node1.removeAttribute(name) - - -def MergeProperties(node1, node2): - MergeAttributes(node1, node2) - for child2 in node2.childNodes: - child1 = SeekToNode(node1, child2) - if child1: - MergeProperties(child1, child2) - else: - node1.appendChild(child2.cloneNode(True)) - - -def main(argv): - """Main function of this vcproj prettifier.""" - global ARGUMENTS - ARGUMENTS = argv - - # check if we have exactly 1 parameter. - if len(argv) < 2: - print( - 'Usage: %s "c:\\path\\to\\vcproj.vcproj" [key1=value1] ' - "[key2=value2]" % argv[0] - ) - return 1 - - # Parse the keys - for i in range(2, len(argv)): - (key, value) = argv[i].split("=") - REPLACEMENTS[key] = value - - # Open the vcproj and parse the xml. - dom = parse(argv[1]) - - # First thing we need to do is find the Configuration Node and merge them - # with the vsprops they include. - for configuration_node in GetConfiguationNodes(dom.documentElement): - # Get the property sheets associated with this configuration. - vsprops = configuration_node.getAttribute("InheritedPropertySheets") - - # Fix the filenames to be absolute. - vsprops_list = FixFilenames( - vsprops.strip().split(";"), os.path.dirname(argv[1]) - ) - - # Extend the list of vsprops with all vsprops contained in the current - # vsprops. - for current_vsprops in vsprops_list: - vsprops_list.extend(GetChildrenVsprops(current_vsprops)) - - # Now that we have all the vsprops, we need to merge them. - for current_vsprops in vsprops_list: - MergeProperties(configuration_node, parse(current_vsprops).documentElement) - - # Now that everything is merged, we need to cleanup the xml. - CleanupVcproj(dom.documentElement) - - # Finally, we use the prett xml function to print the vcproj back to the - # user. - # print dom.toprettyxml(newl="\n") - PrettyPrintNode(dom.documentElement) - return 0 - - -if __name__ == "__main__": - sys.exit(main(sys.argv)) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/Find-VisualStudio.cs b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/Find-VisualStudio.cs deleted file mode 100644 index d2e45a76275f5..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/Find-VisualStudio.cs +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright 2017 - Refael Ackermann -// Distributed under MIT style license -// See accompanying file LICENSE at https://github.com/node4good/windows-autoconf - -// Usage: -// powershell -ExecutionPolicy Unrestricted -Command "Add-Type -Path Find-VisualStudio.cs; [VisualStudioConfiguration.Main]::PrintJson()" -// This script needs to be compatible with PowerShell v2 to run on Windows 2008R2 and Windows 7. - -using System; -using System.Text; -using System.Runtime.InteropServices; -using System.Collections.Generic; - -namespace VisualStudioConfiguration -{ - [Flags] - public enum InstanceState : uint - { - None = 0, - Local = 1, - Registered = 2, - NoRebootRequired = 4, - NoErrors = 8, - Complete = 4294967295, - } - - [Guid("6380BCFF-41D3-4B2E-8B2E-BF8A6810C848")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - public interface IEnumSetupInstances - { - - void Next([MarshalAs(UnmanagedType.U4), In] int celt, - [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface), Out] ISetupInstance[] rgelt, - [MarshalAs(UnmanagedType.U4)] out int pceltFetched); - - void Skip([MarshalAs(UnmanagedType.U4), In] int celt); - - void Reset(); - - [return: MarshalAs(UnmanagedType.Interface)] - IEnumSetupInstances Clone(); - } - - [Guid("42843719-DB4C-46C2-8E7C-64F1816EFD5B")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - public interface ISetupConfiguration - { - } - - [Guid("26AAB78C-4A60-49D6-AF3B-3C35BC93365D")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - public interface ISetupConfiguration2 : ISetupConfiguration - { - - [return: MarshalAs(UnmanagedType.Interface)] - IEnumSetupInstances EnumInstances(); - - [return: MarshalAs(UnmanagedType.Interface)] - ISetupInstance GetInstanceForCurrentProcess(); - - [return: MarshalAs(UnmanagedType.Interface)] - ISetupInstance GetInstanceForPath([MarshalAs(UnmanagedType.LPWStr), In] string path); - - [return: MarshalAs(UnmanagedType.Interface)] - IEnumSetupInstances EnumAllInstances(); - } - - [Guid("B41463C3-8866-43B5-BC33-2B0676F7F42E")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - public interface ISetupInstance - { - } - - [Guid("89143C9A-05AF-49B0-B717-72E218A2185C")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - public interface ISetupInstance2 : ISetupInstance - { - [return: MarshalAs(UnmanagedType.BStr)] - string GetInstanceId(); - - [return: MarshalAs(UnmanagedType.Struct)] - System.Runtime.InteropServices.ComTypes.FILETIME GetInstallDate(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetInstallationName(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetInstallationPath(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetInstallationVersion(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetDisplayName([MarshalAs(UnmanagedType.U4), In] int lcid); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetDescription([MarshalAs(UnmanagedType.U4), In] int lcid); - - [return: MarshalAs(UnmanagedType.BStr)] - string ResolvePath([MarshalAs(UnmanagedType.LPWStr), In] string pwszRelativePath); - - [return: MarshalAs(UnmanagedType.U4)] - InstanceState GetState(); - - [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] - ISetupPackageReference[] GetPackages(); - - ISetupPackageReference GetProduct(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetProductPath(); - - [return: MarshalAs(UnmanagedType.VariantBool)] - bool IsLaunchable(); - - [return: MarshalAs(UnmanagedType.VariantBool)] - bool IsComplete(); - - [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] - ISetupPropertyStore GetProperties(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetEnginePath(); - } - - [Guid("DA8D8A16-B2B6-4487-A2F1-594CCCCD6BF5")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - public interface ISetupPackageReference - { - - [return: MarshalAs(UnmanagedType.BStr)] - string GetId(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetVersion(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetChip(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetLanguage(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetBranch(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetType(); - - [return: MarshalAs(UnmanagedType.BStr)] - string GetUniqueId(); - - [return: MarshalAs(UnmanagedType.VariantBool)] - bool GetIsExtension(); - } - - [Guid("c601c175-a3be-44bc-91f6-4568d230fc83")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComImport] - public interface ISetupPropertyStore - { - - [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_BSTR)] - string[] GetNames(); - - object GetValue([MarshalAs(UnmanagedType.LPWStr), In] string pwszName); - } - - [Guid("42843719-DB4C-46C2-8E7C-64F1816EFD5B")] - [CoClass(typeof(SetupConfigurationClass))] - [ComImport] - public interface SetupConfiguration : ISetupConfiguration2, ISetupConfiguration - { - } - - [Guid("177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D")] - [ClassInterface(ClassInterfaceType.None)] - [ComImport] - public class SetupConfigurationClass - { - } - - public static class Main - { - public static void PrintJson() - { - ISetupConfiguration query = new SetupConfiguration(); - ISetupConfiguration2 query2 = (ISetupConfiguration2)query; - IEnumSetupInstances e = query2.EnumAllInstances(); - - int pceltFetched; - ISetupInstance2[] rgelt = new ISetupInstance2[1]; - List instances = new List(); - while (true) - { - e.Next(1, rgelt, out pceltFetched); - if (pceltFetched <= 0) - { - Console.WriteLine(String.Format("[{0}]", string.Join(",", instances.ToArray()))); - return; - } - - try - { - instances.Add(InstanceJson(rgelt[0])); - } - catch (COMException) - { - // Ignore instances that can't be queried. - } - } - } - - private static string JsonString(string s) - { - return "\"" + s.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\""; - } - - private static string InstanceJson(ISetupInstance2 setupInstance2) - { - // Visual Studio component directory: - // https://docs.microsoft.com/en-us/visualstudio/install/workload-and-component-ids - - StringBuilder json = new StringBuilder(); - json.Append("{"); - - string path = JsonString(setupInstance2.GetInstallationPath()); - json.Append(String.Format("\"path\":{0},", path)); - - string version = JsonString(setupInstance2.GetInstallationVersion()); - json.Append(String.Format("\"version\":{0},", version)); - - List packages = new List(); - foreach (ISetupPackageReference package in setupInstance2.GetPackages()) - { - string id = JsonString(package.GetId()); - packages.Add(id); - } - json.Append(String.Format("\"packages\":[{0}]", string.Join(",", packages.ToArray()))); - - json.Append("}"); - return json.ToString(); - } - } -} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js deleted file mode 100644 index ea1f90652a05d..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js +++ /dev/null @@ -1,213 +0,0 @@ -'use strict' - -const fs = require('graceful-fs') -const path = require('path') -const glob = require('glob') -const log = require('npmlog') -const which = require('which') -const win = process.platform === 'win32' - -function build (gyp, argv, callback) { - var platformMake = 'make' - if (process.platform === 'aix') { - platformMake = 'gmake' - } else if (process.platform === 'os400') { - platformMake = 'gmake' - } else if (process.platform.indexOf('bsd') !== -1) { - platformMake = 'gmake' - } else if (win && argv.length > 0) { - argv = argv.map(function (target) { - return '/t:' + target - }) - } - - var makeCommand = gyp.opts.make || process.env.MAKE || platformMake - var command = win ? 'msbuild' : makeCommand - var jobs = gyp.opts.jobs || process.env.JOBS - var buildType - var config - var arch - var nodeDir - var guessedSolution - - loadConfigGypi() - - /** - * Load the "config.gypi" file that was generated during "configure". - */ - - function loadConfigGypi () { - var configPath = path.resolve('build', 'config.gypi') - - fs.readFile(configPath, 'utf8', function (err, data) { - if (err) { - if (err.code === 'ENOENT') { - callback(new Error('You must run `node-gyp configure` first!')) - } else { - callback(err) - } - return - } - config = JSON.parse(data.replace(/#.+\n/, '')) - - // get the 'arch', 'buildType', and 'nodeDir' vars from the config - buildType = config.target_defaults.default_configuration - arch = config.variables.target_arch - nodeDir = config.variables.nodedir - - if ('debug' in gyp.opts) { - buildType = gyp.opts.debug ? 'Debug' : 'Release' - } - if (!buildType) { - buildType = 'Release' - } - - log.verbose('build type', buildType) - log.verbose('architecture', arch) - log.verbose('node dev dir', nodeDir) - - if (win) { - findSolutionFile() - } else { - doWhich() - } - }) - } - - /** - * On Windows, find the first build/*.sln file. - */ - - function findSolutionFile () { - glob('build/*.sln', function (err, files) { - if (err) { - return callback(err) - } - if (files.length === 0) { - return callback(new Error('Could not find *.sln file. Did you run "configure"?')) - } - guessedSolution = files[0] - log.verbose('found first Solution file', guessedSolution) - doWhich() - }) - } - - /** - * Uses node-which to locate the msbuild / make executable. - */ - - function doWhich () { - // On Windows use msbuild provided by node-gyp configure - if (win) { - if (!config.variables.msbuild_path) { - return callback(new Error( - 'MSBuild is not set, please run `node-gyp configure`.')) - } - command = config.variables.msbuild_path - log.verbose('using MSBuild:', command) - doBuild() - return - } - // First make sure we have the build command in the PATH - which(command, function (err, execPath) { - if (err) { - // Some other error or 'make' not found on Unix, report that to the user - callback(err) - return - } - log.verbose('`which` succeeded for `' + command + '`', execPath) - doBuild() - }) - } - - /** - * Actually spawn the process and compile the module. - */ - - function doBuild () { - // Enable Verbose build - var verbose = log.levels[log.level] <= log.levels.verbose - var j - - if (!win && verbose) { - argv.push('V=1') - } - - if (win && !verbose) { - argv.push('/clp:Verbosity=minimal') - } - - if (win) { - // Turn off the Microsoft logo on Windows - argv.push('/nologo') - } - - // Specify the build type, Release by default - if (win) { - // Convert .gypi config target_arch to MSBuild /Platform - // Since there are many ways to state '32-bit Intel', default to it. - // N.B. msbuild's Condition string equality tests are case-insensitive. - var archLower = arch.toLowerCase() - var p = archLower === 'x64' ? 'x64' - : (archLower === 'arm' ? 'ARM' - : (archLower === 'arm64' ? 'ARM64' : 'Win32')) - argv.push('/p:Configuration=' + buildType + ';Platform=' + p) - if (jobs) { - j = parseInt(jobs, 10) - if (!isNaN(j) && j > 0) { - argv.push('/m:' + j) - } else if (jobs.toUpperCase() === 'MAX') { - argv.push('/m:' + require('os').cpus().length) - } - } - } else { - argv.push('BUILDTYPE=' + buildType) - // Invoke the Makefile in the 'build' dir. - argv.push('-C') - argv.push('build') - if (jobs) { - j = parseInt(jobs, 10) - if (!isNaN(j) && j > 0) { - argv.push('--jobs') - argv.push(j) - } else if (jobs.toUpperCase() === 'MAX') { - argv.push('--jobs') - argv.push(require('os').cpus().length) - } - } - } - - if (win) { - // did the user specify their own .sln file? - var hasSln = argv.some(function (arg) { - return path.extname(arg) === '.sln' - }) - if (!hasSln) { - argv.unshift(gyp.opts.solution || guessedSolution) - } - } - - if (!win) { - // Add build-time dependency symlinks (such as Python) to PATH - const buildBinsDir = path.resolve('build', 'node_gyp_bins') - process.env.PATH = `${buildBinsDir}:${process.env.PATH}` - log.verbose('bin symlinks', `adding symlinks (such as Python), at "${buildBinsDir}", to PATH`) - } - - var proc = gyp.spawn(command, argv) - proc.on('exit', onExit) - } - - function onExit (code, signal) { - if (code !== 0) { - return callback(new Error('`' + command + '` failed with exit code: ' + code)) - } - if (signal) { - return callback(new Error('`' + command + '` got signal: ' + signal)) - } - callback() - } -} - -module.exports = build -module.exports.usage = 'Invokes `' + (win ? 'msbuild' : 'make') + '` and builds the module' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/clean.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/clean.js deleted file mode 100644 index dbfa4dbb99d3c..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/clean.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict' - -const rm = require('rimraf') -const log = require('npmlog') - -function clean (gyp, argv, callback) { - // Remove the 'build' dir - var buildDir = 'build' - - log.verbose('clean', 'removing "%s" directory', buildDir) - rm(buildDir, callback) -} - -module.exports = clean -module.exports.usage = 'Removes any generated build files and the "out" dir' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/configure.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/configure.js deleted file mode 100644 index 1ca3ade70935e..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/configure.js +++ /dev/null @@ -1,360 +0,0 @@ -'use strict' - -const fs = require('graceful-fs') -const path = require('path') -const log = require('npmlog') -const os = require('os') -const processRelease = require('./process-release') -const win = process.platform === 'win32' -const findNodeDirectory = require('./find-node-directory') -const createConfigGypi = require('./create-config-gypi') -const msgFormat = require('util').format -var findPython = require('./find-python') -if (win) { - var findVisualStudio = require('./find-visualstudio') -} - -function configure (gyp, argv, callback) { - var python - var buildDir = path.resolve('build') - var buildBinsDir = path.join(buildDir, 'node_gyp_bins') - var configNames = ['config.gypi', 'common.gypi'] - var configs = [] - var nodeDir - var release = processRelease(argv, gyp, process.version, process.release) - - findPython(gyp.opts.python, function (err, found) { - if (err) { - callback(err) - } else { - python = found - getNodeDir() - } - }) - - function getNodeDir () { - // 'python' should be set by now - process.env.PYTHON = python - - if (gyp.opts.nodedir) { - // --nodedir was specified. use that for the dev files - nodeDir = gyp.opts.nodedir.replace(/^~/, os.homedir()) - - log.verbose('get node dir', 'compiling against specified --nodedir dev files: %s', nodeDir) - createBuildDir() - } else { - // if no --nodedir specified, ensure node dependencies are installed - if ('v' + release.version !== process.version) { - // if --target was given, then determine a target version to compile for - log.verbose('get node dir', 'compiling against --target node version: %s', release.version) - } else { - // if no --target was specified then use the current host node version - log.verbose('get node dir', 'no --target version specified, falling back to host node version: %s', release.version) - } - - if (!release.semver) { - // could not parse the version string with semver - return callback(new Error('Invalid version number: ' + release.version)) - } - - // If the tarball option is set, always remove and reinstall the headers - // into devdir. Otherwise only install if they're not already there. - gyp.opts.ensure = !gyp.opts.tarball - - gyp.commands.install([release.version], function (err) { - if (err) { - return callback(err) - } - log.verbose('get node dir', 'target node version installed:', release.versionDir) - nodeDir = path.resolve(gyp.devDir, release.versionDir) - createBuildDir() - }) - } - } - - function createBuildDir () { - log.verbose('build dir', 'attempting to create "build" dir: %s', buildDir) - - const deepestBuildDirSubdirectory = win ? buildDir : buildBinsDir - fs.mkdir(deepestBuildDirSubdirectory, { recursive: true }, function (err, isNew) { - if (err) { - return callback(err) - } - log.verbose( - 'build dir', '"build" dir needed to be created?', isNew ? 'Yes' : 'No' - ) - if (win) { - findVisualStudio(release.semver, gyp.opts.msvs_version, - createConfigFile) - } else { - createPythonSymlink() - createConfigFile() - } - }) - } - - function createPythonSymlink () { - const symlinkDestination = path.join(buildBinsDir, 'python3') - - log.verbose('python symlink', `creating symlink to "${python}" at "${symlinkDestination}"`) - - fs.unlink(symlinkDestination, function (err) { - if (err && err.code !== 'ENOENT') { - log.verbose('python symlink', 'error when attempting to remove existing symlink') - log.verbose('python symlink', err.stack, 'errno: ' + err.errno) - } - fs.symlink(python, symlinkDestination, function (err) { - if (err) { - log.verbose('python symlink', 'error when attempting to create Python symlink') - log.verbose('python symlink', err.stack, 'errno: ' + err.errno) - } - }) - }) - } - - function createConfigFile (err, vsInfo) { - if (err) { - return callback(err) - } - if (process.platform === 'win32') { - process.env.GYP_MSVS_VERSION = Math.min(vsInfo.versionYear, 2015) - process.env.GYP_MSVS_OVERRIDE_PATH = vsInfo.path - } - createConfigGypi({ gyp, buildDir, nodeDir, vsInfo }).then(configPath => { - configs.push(configPath) - findConfigs() - }).catch(err => { - callback(err) - }) - } - - function findConfigs () { - var name = configNames.shift() - if (!name) { - return runGyp() - } - var fullPath = path.resolve(name) - - log.verbose(name, 'checking for gypi file: %s', fullPath) - fs.stat(fullPath, function (err) { - if (err) { - if (err.code === 'ENOENT') { - findConfigs() // check next gypi filename - } else { - callback(err) - } - } else { - log.verbose(name, 'found gypi file') - configs.push(fullPath) - findConfigs() - } - }) - } - - function runGyp (err) { - if (err) { - return callback(err) - } - - if (!~argv.indexOf('-f') && !~argv.indexOf('--format')) { - if (win) { - log.verbose('gyp', 'gyp format was not specified; forcing "msvs"') - // force the 'make' target for non-Windows - argv.push('-f', 'msvs') - } else { - log.verbose('gyp', 'gyp format was not specified; forcing "make"') - // force the 'make' target for non-Windows - argv.push('-f', 'make') - } - } - - // include all the ".gypi" files that were found - configs.forEach(function (config) { - argv.push('-I', config) - }) - - // For AIX and z/OS we need to set up the path to the exports file - // which contains the symbols needed for linking. - var nodeExpFile - if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') { - var ext = process.platform === 'os390' ? 'x' : 'exp' - var nodeRootDir = findNodeDirectory() - var candidates - - if (process.platform === 'aix' || process.platform === 'os400') { - candidates = [ - 'include/node/node', - 'out/Release/node', - 'out/Debug/node', - 'node' - ].map(function (file) { - return file + '.' + ext - }) - } else { - candidates = [ - 'out/Release/lib.target/libnode', - 'out/Debug/lib.target/libnode', - 'out/Release/obj.target/libnode', - 'out/Debug/obj.target/libnode', - 'lib/libnode' - ].map(function (file) { - return file + '.' + ext - }) - } - - var logprefix = 'find exports file' - nodeExpFile = findAccessibleSync(logprefix, nodeRootDir, candidates) - if (nodeExpFile !== undefined) { - log.verbose(logprefix, 'Found exports file: %s', nodeExpFile) - } else { - var msg = msgFormat('Could not find node.%s file in %s', ext, nodeRootDir) - log.error(logprefix, 'Could not find exports file') - return callback(new Error(msg)) - } - } - - // For z/OS we need to set up the path to zoslib include directory, - // which contains headers included in v8config.h. - var zoslibIncDir - if (process.platform === 'os390') { - logprefix = "find zoslib's zos-base.h:" - let msg - var zoslibIncPath = process.env.ZOSLIB_INCLUDES - if (zoslibIncPath) { - zoslibIncPath = findAccessibleSync(logprefix, zoslibIncPath, ['zos-base.h']) - if (zoslibIncPath === undefined) { - msg = msgFormat('Could not find zos-base.h file in the directory set ' + - 'in ZOSLIB_INCLUDES environment variable: %s; set it ' + - 'to the correct path, or unset it to search %s', process.env.ZOSLIB_INCLUDES, nodeRootDir) - } - } else { - candidates = [ - 'include/node/zoslib/zos-base.h', - 'include/zoslib/zos-base.h', - 'zoslib/include/zos-base.h', - 'install/include/node/zoslib/zos-base.h' - ] - zoslibIncPath = findAccessibleSync(logprefix, nodeRootDir, candidates) - if (zoslibIncPath === undefined) { - msg = msgFormat('Could not find any of %s in directory %s; set ' + - 'environmant variable ZOSLIB_INCLUDES to the path ' + - 'that contains zos-base.h', candidates.toString(), nodeRootDir) - } - } - if (zoslibIncPath !== undefined) { - zoslibIncDir = path.dirname(zoslibIncPath) - log.verbose(logprefix, "Found zoslib's zos-base.h in: %s", zoslibIncDir) - } else if (release.version.split('.')[0] >= 16) { - // zoslib is only shipped in Node v16 and above. - log.error(logprefix, msg) - return callback(new Error(msg)) - } - } - - // this logic ported from the old `gyp_addon` python file - var gypScript = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py') - var addonGypi = path.resolve(__dirname, '..', 'addon.gypi') - var commonGypi = path.resolve(nodeDir, 'include/node/common.gypi') - fs.stat(commonGypi, function (err) { - if (err) { - commonGypi = path.resolve(nodeDir, 'common.gypi') - } - - var outputDir = 'build' - if (win) { - // Windows expects an absolute path - outputDir = buildDir - } - var nodeGypDir = path.resolve(__dirname, '..') - - var nodeLibFile = path.join(nodeDir, - !gyp.opts.nodedir ? '<(target_arch)' : '$(Configuration)', - release.name + '.lib') - - argv.push('-I', addonGypi) - argv.push('-I', commonGypi) - argv.push('-Dlibrary=shared_library') - argv.push('-Dvisibility=default') - argv.push('-Dnode_root_dir=' + nodeDir) - if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') { - argv.push('-Dnode_exp_file=' + nodeExpFile) - if (process.platform === 'os390' && zoslibIncDir) { - argv.push('-Dzoslib_include_dir=' + zoslibIncDir) - } - } - argv.push('-Dnode_gyp_dir=' + nodeGypDir) - - // Do this to keep Cygwin environments happy, else the unescaped '\' gets eaten up, - // resulting in bad paths, Ex c:parentFolderfolderanotherFolder instead of c:\parentFolder\folder\anotherFolder - if (win) { - nodeLibFile = nodeLibFile.replace(/\\/g, '\\\\') - } - argv.push('-Dnode_lib_file=' + nodeLibFile) - argv.push('-Dmodule_root_dir=' + process.cwd()) - argv.push('-Dnode_engine=' + - (gyp.opts.node_engine || process.jsEngine || 'v8')) - argv.push('--depth=.') - argv.push('--no-parallel') - - // tell gyp to write the Makefile/Solution files into output_dir - argv.push('--generator-output', outputDir) - - // tell make to write its output into the same dir - argv.push('-Goutput_dir=.') - - // enforce use of the "binding.gyp" file - argv.unshift('binding.gyp') - - // execute `gyp` from the current target nodedir - argv.unshift(gypScript) - - // make sure python uses files that came with this particular node package - var pypath = [path.join(__dirname, '..', 'gyp', 'pylib')] - if (process.env.PYTHONPATH) { - pypath.push(process.env.PYTHONPATH) - } - process.env.PYTHONPATH = pypath.join(win ? ';' : ':') - - var cp = gyp.spawn(python, argv) - cp.on('exit', onCpExit) - }) - } - - function onCpExit (code) { - if (code !== 0) { - callback(new Error('`gyp` failed with exit code: ' + code)) - } else { - // we're done - callback() - } - } -} - -/** - * Returns the first file or directory from an array of candidates that is - * readable by the current user, or undefined if none of the candidates are - * readable. - */ -function findAccessibleSync (logprefix, dir, candidates) { - for (var next = 0; next < candidates.length; next++) { - var candidate = path.resolve(dir, candidates[next]) - try { - var fd = fs.openSync(candidate, 'r') - } catch (e) { - // this candidate was not found or not readable, do nothing - log.silly(logprefix, 'Could not open %s: %s', candidate, e.message) - continue - } - fs.closeSync(fd) - log.silly(logprefix, 'Found readable %s', candidate) - return candidate - } - - return undefined -} - -module.exports = configure -module.exports.test = { - findAccessibleSync: findAccessibleSync -} -module.exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/create-config-gypi.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/create-config-gypi.js deleted file mode 100644 index ced4911502733..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/create-config-gypi.js +++ /dev/null @@ -1,147 +0,0 @@ -'use strict' - -const fs = require('graceful-fs') -const log = require('npmlog') -const path = require('path') - -function parseConfigGypi (config) { - // translated from tools/js2c.py of Node.js - // 1. string comments - config = config.replace(/#.*/g, '') - // 2. join multiline strings - config = config.replace(/'$\s+'/mg, '') - // 3. normalize string literals from ' into " - config = config.replace(/'/g, '"') - return JSON.parse(config) -} - -async function getBaseConfigGypi ({ gyp, nodeDir }) { - // try reading $nodeDir/include/node/config.gypi first when: - // 1. --dist-url or --nodedir is specified - // 2. and --force-process-config is not specified - const useCustomHeaders = gyp.opts.nodedir || gyp.opts.disturl || gyp.opts['dist-url'] - const shouldReadConfigGypi = useCustomHeaders && !gyp.opts['force-process-config'] - if (shouldReadConfigGypi && nodeDir) { - try { - const baseConfigGypiPath = path.resolve(nodeDir, 'include/node/config.gypi') - const baseConfigGypi = await fs.promises.readFile(baseConfigGypiPath) - return parseConfigGypi(baseConfigGypi.toString()) - } catch (err) { - log.warn('read config.gypi', err.message) - } - } - - // fallback to process.config if it is invalid - return JSON.parse(JSON.stringify(process.config)) -} - -async function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo }) { - const config = await getBaseConfigGypi({ gyp, nodeDir }) - if (!config.target_defaults) { - config.target_defaults = {} - } - if (!config.variables) { - config.variables = {} - } - - const defaults = config.target_defaults - const variables = config.variables - - // don't inherit the "defaults" from the base config.gypi. - // doing so could cause problems in cases where the `node` executable was - // compiled on a different machine (with different lib/include paths) than - // the machine where the addon is being built to - defaults.cflags = [] - defaults.defines = [] - defaults.include_dirs = [] - defaults.libraries = [] - - // set the default_configuration prop - if ('debug' in gyp.opts) { - defaults.default_configuration = gyp.opts.debug ? 'Debug' : 'Release' - } - - if (!defaults.default_configuration) { - defaults.default_configuration = 'Release' - } - - // set the target_arch variable - variables.target_arch = gyp.opts.arch || process.arch || 'ia32' - if (variables.target_arch === 'arm64') { - defaults.msvs_configuration_platform = 'ARM64' - defaults.xcode_configuration_platform = 'arm64' - } - - // set the node development directory - variables.nodedir = nodeDir - - // disable -T "thin" static archives by default - variables.standalone_static_library = gyp.opts.thin ? 0 : 1 - - if (process.platform === 'win32') { - defaults.msbuild_toolset = vsInfo.toolset - if (vsInfo.sdk) { - defaults.msvs_windows_target_platform_version = vsInfo.sdk - } - if (variables.target_arch === 'arm64') { - if (vsInfo.versionMajor > 15 || - (vsInfo.versionMajor === 15 && vsInfo.versionMajor >= 9)) { - defaults.msvs_enable_marmasm = 1 - } else { - log.warn('Compiling ARM64 assembly is only available in\n' + - 'Visual Studio 2017 version 15.9 and above') - } - } - variables.msbuild_path = vsInfo.msBuild - } - - // loop through the rest of the opts and add the unknown ones as variables. - // this allows for module-specific configure flags like: - // - // $ node-gyp configure --shared-libxml2 - Object.keys(gyp.opts).forEach(function (opt) { - if (opt === 'argv') { - return - } - if (opt in gyp.configDefs) { - return - } - variables[opt.replace(/-/g, '_')] = gyp.opts[opt] - }) - - return config -} - -async function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo }) { - const configFilename = 'config.gypi' - const configPath = path.resolve(buildDir, configFilename) - - log.verbose('build/' + configFilename, 'creating config file') - - const config = await getCurrentConfigGypi({ gyp, nodeDir, vsInfo }) - - // ensures that any boolean values in config.gypi get stringified - function boolsToString (k, v) { - if (typeof v === 'boolean') { - return String(v) - } - return v - } - - log.silly('build/' + configFilename, config) - - // now write out the config.gypi file to the build/ dir - const prefix = '# Do not edit. File was generated by node-gyp\'s "configure" step' - - const json = JSON.stringify(config, boolsToString, 2) - log.verbose('build/' + configFilename, 'writing out config file: %s', configPath) - await fs.promises.writeFile(configPath, [prefix, json, ''].join('\n')) - - return configPath -} - -module.exports = createConfigGypi -module.exports.test = { - parseConfigGypi: parseConfigGypi, - getCurrentConfigGypi: getCurrentConfigGypi -} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-node-directory.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-node-directory.js deleted file mode 100644 index 0dd781a6cfae8..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-node-directory.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict' - -const path = require('path') -const log = require('npmlog') - -function findNodeDirectory (scriptLocation, processObj) { - // set dirname and process if not passed in - // this facilitates regression tests - if (scriptLocation === undefined) { - scriptLocation = __dirname - } - if (processObj === undefined) { - processObj = process - } - - // Have a look to see what is above us, to try and work out where we are - var npmParentDirectory = path.join(scriptLocation, '../../../..') - log.verbose('node-gyp root', 'npm_parent_directory is ' + - path.basename(npmParentDirectory)) - var nodeRootDir = '' - - log.verbose('node-gyp root', 'Finding node root directory') - if (path.basename(npmParentDirectory) === 'deps') { - // We are in a build directory where this script lives in - // deps/npm/node_modules/node-gyp/lib - nodeRootDir = path.join(npmParentDirectory, '..') - log.verbose('node-gyp root', 'in build directory, root = ' + - nodeRootDir) - } else if (path.basename(npmParentDirectory) === 'node_modules') { - // We are in a node install directory where this script lives in - // lib/node_modules/npm/node_modules/node-gyp/lib or - // node_modules/npm/node_modules/node-gyp/lib depending on the - // platform - if (processObj.platform === 'win32') { - nodeRootDir = path.join(npmParentDirectory, '..') - } else { - nodeRootDir = path.join(npmParentDirectory, '../..') - } - log.verbose('node-gyp root', 'in install directory, root = ' + - nodeRootDir) - } else { - // We don't know where we are, try working it out from the location - // of the node binary - var nodeDir = path.dirname(processObj.execPath) - var directoryUp = path.basename(nodeDir) - if (directoryUp === 'bin') { - nodeRootDir = path.join(nodeDir, '..') - } else if (directoryUp === 'Release' || directoryUp === 'Debug') { - // If we are a recently built node, and the directory structure - // is that of a repository. If we are on Windows then we only need - // to go one level up, everything else, two - if (processObj.platform === 'win32') { - nodeRootDir = path.join(nodeDir, '..') - } else { - nodeRootDir = path.join(nodeDir, '../..') - } - } - // Else return the default blank, "". - } - return nodeRootDir -} - -module.exports = findNodeDirectory diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js deleted file mode 100644 index a445e825b9d7e..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js +++ /dev/null @@ -1,344 +0,0 @@ -'use strict' - -const log = require('npmlog') -const semver = require('semver') -const cp = require('child_process') -const extend = require('util')._extend // eslint-disable-line -const win = process.platform === 'win32' -const logWithPrefix = require('./util').logWithPrefix - -const systemDrive = process.env.SystemDrive || 'C:' -const username = process.env.USERNAME || process.env.USER || getOsUserInfo() -const localAppData = process.env.LOCALAPPDATA || `${systemDrive}\\${username}\\AppData\\Local` -const foundLocalAppData = process.env.LOCALAPPDATA || username -const programFiles = process.env.ProgramW6432 || process.env.ProgramFiles || `${systemDrive}\\Program Files` -const programFilesX86 = process.env['ProgramFiles(x86)'] || `${programFiles} (x86)` - -const winDefaultLocationsArray = [] -for (const majorMinor of ['39', '38', '37', '36']) { - if (foundLocalAppData) { - winDefaultLocationsArray.push( - `${localAppData}\\Programs\\Python\\Python${majorMinor}\\python.exe`, - `${programFiles}\\Python${majorMinor}\\python.exe`, - `${localAppData}\\Programs\\Python\\Python${majorMinor}-32\\python.exe`, - `${programFiles}\\Python${majorMinor}-32\\python.exe`, - `${programFilesX86}\\Python${majorMinor}-32\\python.exe` - ) - } else { - winDefaultLocationsArray.push( - `${programFiles}\\Python${majorMinor}\\python.exe`, - `${programFiles}\\Python${majorMinor}-32\\python.exe`, - `${programFilesX86}\\Python${majorMinor}-32\\python.exe` - ) - } -} - -function getOsUserInfo () { - try { - return require('os').userInfo().username - } catch (e) {} -} - -function PythonFinder (configPython, callback) { - this.callback = callback - this.configPython = configPython - this.errorLog = [] -} - -PythonFinder.prototype = { - log: logWithPrefix(log, 'find Python'), - argsExecutable: ['-c', 'import sys; print(sys.executable);'], - argsVersion: ['-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);'], - semverRange: '>=3.6.0', - - // These can be overridden for testing: - execFile: cp.execFile, - env: process.env, - win: win, - pyLauncher: 'py.exe', - winDefaultLocations: winDefaultLocationsArray, - - // Logs a message at verbose level, but also saves it to be displayed later - // at error level if an error occurs. This should help diagnose the problem. - addLog: function addLog (message) { - this.log.verbose(message) - this.errorLog.push(message) - }, - - // Find Python by trying a sequence of possibilities. - // Ignore errors, keep trying until Python is found. - findPython: function findPython () { - const SKIP = 0; const FAIL = 1 - var toCheck = getChecks.apply(this) - - function getChecks () { - if (this.env.NODE_GYP_FORCE_PYTHON) { - return [{ - before: () => { - this.addLog( - 'checking Python explicitly set from NODE_GYP_FORCE_PYTHON') - this.addLog('- process.env.NODE_GYP_FORCE_PYTHON is ' + - `"${this.env.NODE_GYP_FORCE_PYTHON}"`) - }, - check: this.checkCommand, - arg: this.env.NODE_GYP_FORCE_PYTHON - }] - } - - var checks = [ - { - before: () => { - if (!this.configPython) { - this.addLog( - 'Python is not set from command line or npm configuration') - return SKIP - } - this.addLog('checking Python explicitly set from command line or ' + - 'npm configuration') - this.addLog('- "--python=" or "npm config get python" is ' + - `"${this.configPython}"`) - }, - check: this.checkCommand, - arg: this.configPython - }, - { - before: () => { - if (!this.env.PYTHON) { - this.addLog('Python is not set from environment variable ' + - 'PYTHON') - return SKIP - } - this.addLog('checking Python explicitly set from environment ' + - 'variable PYTHON') - this.addLog(`- process.env.PYTHON is "${this.env.PYTHON}"`) - }, - check: this.checkCommand, - arg: this.env.PYTHON - }, - { - before: () => { this.addLog('checking if "python3" can be used') }, - check: this.checkCommand, - arg: 'python3' - }, - { - before: () => { this.addLog('checking if "python" can be used') }, - check: this.checkCommand, - arg: 'python' - } - ] - - if (this.win) { - for (var i = 0; i < this.winDefaultLocations.length; ++i) { - const location = this.winDefaultLocations[i] - checks.push({ - before: () => { - this.addLog('checking if Python is ' + - `${location}`) - }, - check: this.checkExecPath, - arg: location - }) - } - checks.push({ - before: () => { - this.addLog( - 'checking if the py launcher can be used to find Python 3') - }, - check: this.checkPyLauncher - }) - } - - return checks - } - - function runChecks (err) { - this.log.silly('runChecks: err = %j', (err && err.stack) || err) - - const check = toCheck.shift() - if (!check) { - return this.fail() - } - - const before = check.before.apply(this) - if (before === SKIP) { - return runChecks.apply(this) - } - if (before === FAIL) { - return this.fail() - } - - const args = [runChecks.bind(this)] - if (check.arg) { - args.unshift(check.arg) - } - check.check.apply(this, args) - } - - runChecks.apply(this) - }, - - // Check if command is a valid Python to use. - // Will exit the Python finder on success. - // If on Windows, run in a CMD shell to support BAT/CMD launchers. - checkCommand: function checkCommand (command, errorCallback) { - var exec = command - var args = this.argsExecutable - var shell = false - if (this.win) { - // Arguments have to be manually quoted - exec = `"${exec}"` - args = args.map(a => `"${a}"`) - shell = true - } - - this.log.verbose(`- executing "${command}" to get executable path`) - this.run(exec, args, shell, function (err, execPath) { - // Possible outcomes: - // - Error: not in PATH, not executable or execution fails - // - Gibberish: the next command to check version will fail - // - Absolute path to executable - if (err) { - this.addLog(`- "${command}" is not in PATH or produced an error`) - return errorCallback(err) - } - this.addLog(`- executable path is "${execPath}"`) - this.checkExecPath(execPath, errorCallback) - }.bind(this)) - }, - - // Check if the py launcher can find a valid Python to use. - // Will exit the Python finder on success. - // Distributions of Python on Windows by default install with the "py.exe" - // Python launcher which is more likely to exist than the Python executable - // being in the $PATH. - // Because the Python launcher supports Python 2 and Python 3, we should - // explicitly request a Python 3 version. This is done by supplying "-3" as - // the first command line argument. Since "py.exe -3" would be an invalid - // executable for "execFile", we have to use the launcher to figure out - // where the actual "python.exe" executable is located. - checkPyLauncher: function checkPyLauncher (errorCallback) { - this.log.verbose( - `- executing "${this.pyLauncher}" to get Python 3 executable path`) - this.run(this.pyLauncher, ['-3', ...this.argsExecutable], false, - function (err, execPath) { - // Possible outcomes: same as checkCommand - if (err) { - this.addLog( - `- "${this.pyLauncher}" is not in PATH or produced an error`) - return errorCallback(err) - } - this.addLog(`- executable path is "${execPath}"`) - this.checkExecPath(execPath, errorCallback) - }.bind(this)) - }, - - // Check if a Python executable is the correct version to use. - // Will exit the Python finder on success. - checkExecPath: function checkExecPath (execPath, errorCallback) { - this.log.verbose(`- executing "${execPath}" to get version`) - this.run(execPath, this.argsVersion, false, function (err, version) { - // Possible outcomes: - // - Error: executable can not be run (likely meaning the command wasn't - // a Python executable and the previous command produced gibberish) - // - Gibberish: somehow the last command produced an executable path, - // this will fail when verifying the version - // - Version of the Python executable - if (err) { - this.addLog(`- "${execPath}" could not be run`) - return errorCallback(err) - } - this.addLog(`- version is "${version}"`) - - const range = new semver.Range(this.semverRange) - var valid = false - try { - valid = range.test(version) - } catch (err) { - this.log.silly('range.test() threw:\n%s', err.stack) - this.addLog(`- "${execPath}" does not have a valid version`) - this.addLog('- is it a Python executable?') - return errorCallback(err) - } - - if (!valid) { - this.addLog(`- version is ${version} - should be ${this.semverRange}`) - this.addLog('- THIS VERSION OF PYTHON IS NOT SUPPORTED') - return errorCallback(new Error( - `Found unsupported Python version ${version}`)) - } - this.succeed(execPath, version) - }.bind(this)) - }, - - // Run an executable or shell command, trimming the output. - run: function run (exec, args, shell, callback) { - var env = extend({}, this.env) - env.TERM = 'dumb' - const opts = { env: env, shell: shell } - - this.log.silly('execFile: exec = %j', exec) - this.log.silly('execFile: args = %j', args) - this.log.silly('execFile: opts = %j', opts) - try { - this.execFile(exec, args, opts, execFileCallback.bind(this)) - } catch (err) { - this.log.silly('execFile: threw:\n%s', err.stack) - return callback(err) - } - - function execFileCallback (err, stdout, stderr) { - this.log.silly('execFile result: err = %j', (err && err.stack) || err) - this.log.silly('execFile result: stdout = %j', stdout) - this.log.silly('execFile result: stderr = %j', stderr) - if (err) { - return callback(err) - } - const execPath = stdout.trim() - callback(null, execPath) - } - }, - - succeed: function succeed (execPath, version) { - this.log.info(`using Python version ${version} found at "${execPath}"`) - process.nextTick(this.callback.bind(null, null, execPath)) - }, - - fail: function fail () { - const errorLog = this.errorLog.join('\n') - - const pathExample = this.win ? 'C:\\Path\\To\\python.exe' - : '/path/to/pythonexecutable' - // For Windows 80 col console, use up to the column before the one marked - // with X (total 79 chars including logger prefix, 58 chars usable here): - // X - const info = [ - '**********************************************************', - 'You need to install the latest version of Python.', - 'Node-gyp should be able to find and use Python. If not,', - 'you can try one of the following options:', - `- Use the switch --python="${pathExample}"`, - ' (accepted by both node-gyp and npm)', - '- Set the environment variable PYTHON', - '- Set the npm configuration variable python:', - ` npm config set python "${pathExample}"`, - 'For more information consult the documentation at:', - 'https://github.com/nodejs/node-gyp#installation', - '**********************************************************' - ].join('\n') - - this.log.error(`\n${errorLog}\n\n${info}\n`) - process.nextTick(this.callback.bind(null, new Error( - 'Could not find any Python installation to use'))) - } -} - -function findPython (configPython, callback) { - var finder = new PythonFinder(configPython, callback) - finder.findPython() -} - -module.exports = findPython -module.exports.test = { - PythonFinder: PythonFinder, - findPython: findPython -} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-visualstudio.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-visualstudio.js deleted file mode 100644 index 16f6e79559307..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-visualstudio.js +++ /dev/null @@ -1,463 +0,0 @@ -'use strict' - -const log = require('npmlog') -const execFile = require('child_process').execFile -const fs = require('fs') -const path = require('path').win32 -const logWithPrefix = require('./util').logWithPrefix -const regSearchKeys = require('./util').regSearchKeys - -function findVisualStudio (nodeSemver, configMsvsVersion, callback) { - const finder = new VisualStudioFinder(nodeSemver, configMsvsVersion, - callback) - finder.findVisualStudio() -} - -function VisualStudioFinder (nodeSemver, configMsvsVersion, callback) { - this.nodeSemver = nodeSemver - this.configMsvsVersion = configMsvsVersion - this.callback = callback - this.errorLog = [] - this.validVersions = [] -} - -VisualStudioFinder.prototype = { - log: logWithPrefix(log, 'find VS'), - - regSearchKeys: regSearchKeys, - - // Logs a message at verbose level, but also saves it to be displayed later - // at error level if an error occurs. This should help diagnose the problem. - addLog: function addLog (message) { - this.log.verbose(message) - this.errorLog.push(message) - }, - - findVisualStudio: function findVisualStudio () { - this.configVersionYear = null - this.configPath = null - if (this.configMsvsVersion) { - this.addLog('msvs_version was set from command line or npm config') - if (this.configMsvsVersion.match(/^\d{4}$/)) { - this.configVersionYear = parseInt(this.configMsvsVersion, 10) - this.addLog( - `- looking for Visual Studio version ${this.configVersionYear}`) - } else { - this.configPath = path.resolve(this.configMsvsVersion) - this.addLog( - `- looking for Visual Studio installed in "${this.configPath}"`) - } - } else { - this.addLog('msvs_version not set from command line or npm config') - } - - if (process.env.VCINSTALLDIR) { - this.envVcInstallDir = - path.resolve(process.env.VCINSTALLDIR, '..') - this.addLog('running in VS Command Prompt, installation path is:\n' + - `"${this.envVcInstallDir}"\n- will only use this version`) - } else { - this.addLog('VCINSTALLDIR not set, not running in VS Command Prompt') - } - - this.findVisualStudio2017OrNewer((info) => { - if (info) { - return this.succeed(info) - } - this.findVisualStudio2015((info) => { - if (info) { - return this.succeed(info) - } - this.findVisualStudio2013((info) => { - if (info) { - return this.succeed(info) - } - this.fail() - }) - }) - }) - }, - - succeed: function succeed (info) { - this.log.info(`using VS${info.versionYear} (${info.version}) found at:` + - `\n"${info.path}"` + - '\nrun with --verbose for detailed information') - process.nextTick(this.callback.bind(null, null, info)) - }, - - fail: function fail () { - if (this.configMsvsVersion && this.envVcInstallDir) { - this.errorLog.push( - 'msvs_version does not match this VS Command Prompt or the', - 'installation cannot be used.') - } else if (this.configMsvsVersion) { - // If msvs_version was specified but finding VS failed, print what would - // have been accepted - this.errorLog.push('') - if (this.validVersions) { - this.errorLog.push('valid versions for msvs_version:') - this.validVersions.forEach((version) => { - this.errorLog.push(`- "${version}"`) - }) - } else { - this.errorLog.push('no valid versions for msvs_version were found') - } - } - - const errorLog = this.errorLog.join('\n') - - // For Windows 80 col console, use up to the column before the one marked - // with X (total 79 chars including logger prefix, 62 chars usable here): - // X - const infoLog = [ - '**************************************************************', - 'You need to install the latest version of Visual Studio', - 'including the "Desktop development with C++" workload.', - 'For more information consult the documentation at:', - 'https://github.com/nodejs/node-gyp#on-windows', - '**************************************************************' - ].join('\n') - - this.log.error(`\n${errorLog}\n\n${infoLog}\n`) - process.nextTick(this.callback.bind(null, new Error( - 'Could not find any Visual Studio installation to use'))) - }, - - // Invoke the PowerShell script to get information about Visual Studio 2017 - // or newer installations - findVisualStudio2017OrNewer: function findVisualStudio2017OrNewer (cb) { - var ps = path.join(process.env.SystemRoot, 'System32', - 'WindowsPowerShell', 'v1.0', 'powershell.exe') - var csFile = path.join(__dirname, 'Find-VisualStudio.cs') - var psArgs = [ - '-ExecutionPolicy', - 'Unrestricted', - '-NoProfile', - '-Command', - '&{Add-Type -Path \'' + csFile + '\';' + '[VisualStudioConfiguration.Main]::PrintJson()}' - ] - - this.log.silly('Running', ps, psArgs) - var child = execFile(ps, psArgs, { encoding: 'utf8' }, - (err, stdout, stderr) => { - this.parseData(err, stdout, stderr, cb) - }) - child.stdin.end() - }, - - // Parse the output of the PowerShell script and look for an installation - // of Visual Studio 2017 or newer to use - parseData: function parseData (err, stdout, stderr, cb) { - this.log.silly('PS stderr = %j', stderr) - - const failPowershell = () => { - this.addLog( - 'could not use PowerShell to find Visual Studio 2017 or newer, try re-running with \'--loglevel silly\' for more details') - cb(null) - } - - if (err) { - this.log.silly('PS err = %j', err && (err.stack || err)) - return failPowershell() - } - - var vsInfo - try { - vsInfo = JSON.parse(stdout) - } catch (e) { - this.log.silly('PS stdout = %j', stdout) - this.log.silly(e) - return failPowershell() - } - - if (!Array.isArray(vsInfo)) { - this.log.silly('PS stdout = %j', stdout) - return failPowershell() - } - - vsInfo = vsInfo.map((info) => { - this.log.silly(`processing installation: "${info.path}"`) - info.path = path.resolve(info.path) - var ret = this.getVersionInfo(info) - ret.path = info.path - ret.msBuild = this.getMSBuild(info, ret.versionYear) - ret.toolset = this.getToolset(info, ret.versionYear) - ret.sdk = this.getSDK(info) - return ret - }) - this.log.silly('vsInfo:', vsInfo) - - // Remove future versions or errors parsing version number - vsInfo = vsInfo.filter((info) => { - if (info.versionYear) { - return true - } - this.addLog(`unknown version "${info.version}" found at "${info.path}"`) - return false - }) - - // Sort to place newer versions first - vsInfo.sort((a, b) => b.versionYear - a.versionYear) - - for (var i = 0; i < vsInfo.length; ++i) { - const info = vsInfo[i] - this.addLog(`checking VS${info.versionYear} (${info.version}) found ` + - `at:\n"${info.path}"`) - - if (info.msBuild) { - this.addLog('- found "Visual Studio C++ core features"') - } else { - this.addLog('- "Visual Studio C++ core features" missing') - continue - } - - if (info.toolset) { - this.addLog(`- found VC++ toolset: ${info.toolset}`) - } else { - this.addLog('- missing any VC++ toolset') - continue - } - - if (info.sdk) { - this.addLog(`- found Windows SDK: ${info.sdk}`) - } else { - this.addLog('- missing any Windows SDK') - continue - } - - if (!this.checkConfigVersion(info.versionYear, info.path)) { - continue - } - - return cb(info) - } - - this.addLog( - 'could not find a version of Visual Studio 2017 or newer to use') - cb(null) - }, - - // Helper - process version information - getVersionInfo: function getVersionInfo (info) { - const match = /^(\d+)\.(\d+)\..*/.exec(info.version) - if (!match) { - this.log.silly('- failed to parse version:', info.version) - return {} - } - this.log.silly('- version match = %j', match) - var ret = { - version: info.version, - versionMajor: parseInt(match[1], 10), - versionMinor: parseInt(match[2], 10) - } - if (ret.versionMajor === 15) { - ret.versionYear = 2017 - return ret - } - if (ret.versionMajor === 16) { - ret.versionYear = 2019 - return ret - } - if (ret.versionMajor === 17) { - ret.versionYear = 2022 - return ret - } - this.log.silly('- unsupported version:', ret.versionMajor) - return {} - }, - - msBuildPathExists: function msBuildPathExists (path) { - return fs.existsSync(path) - }, - - // Helper - process MSBuild information - getMSBuild: function getMSBuild (info, versionYear) { - const pkg = 'Microsoft.VisualStudio.VC.MSBuild.Base' - const msbuildPath = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'MSBuild.exe') - const msbuildPathArm64 = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'arm64', 'MSBuild.exe') - if (info.packages.indexOf(pkg) !== -1) { - this.log.silly('- found VC.MSBuild.Base') - if (versionYear === 2017) { - return path.join(info.path, 'MSBuild', '15.0', 'Bin', 'MSBuild.exe') - } - if (versionYear === 2019) { - return msbuildPath - } - } - /** - * Visual Studio 2022 doesn't have the MSBuild package. - * Support for compiling _on_ ARM64 was added in MSVC 14.32.31326, - * so let's leverage it if the user has an ARM64 device. - */ - if (process.arch === 'arm64' && this.msBuildPathExists(msbuildPathArm64)) { - return msbuildPathArm64 - } else if (this.msBuildPathExists(msbuildPath)) { - return msbuildPath - } - return null - }, - - // Helper - process toolset information - getToolset: function getToolset (info, versionYear) { - const pkg = 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64' - const express = 'Microsoft.VisualStudio.WDExpress' - - if (info.packages.indexOf(pkg) !== -1) { - this.log.silly('- found VC.Tools.x86.x64') - } else if (info.packages.indexOf(express) !== -1) { - this.log.silly('- found Visual Studio Express (looking for toolset)') - } else { - return null - } - - if (versionYear === 2017) { - return 'v141' - } else if (versionYear === 2019) { - return 'v142' - } else if (versionYear === 2022) { - return 'v143' - } - this.log.silly('- invalid versionYear:', versionYear) - return null - }, - - // Helper - process Windows SDK information - getSDK: function getSDK (info) { - const win8SDK = 'Microsoft.VisualStudio.Component.Windows81SDK' - const win10SDKPrefix = 'Microsoft.VisualStudio.Component.Windows10SDK.' - const win11SDKPrefix = 'Microsoft.VisualStudio.Component.Windows11SDK.' - - var Win10or11SDKVer = 0 - info.packages.forEach((pkg) => { - if (!pkg.startsWith(win10SDKPrefix) && !pkg.startsWith(win11SDKPrefix)) { - return - } - const parts = pkg.split('.') - if (parts.length > 5 && parts[5] !== 'Desktop') { - this.log.silly('- ignoring non-Desktop Win10/11SDK:', pkg) - return - } - const foundSdkVer = parseInt(parts[4], 10) - if (isNaN(foundSdkVer)) { - // Microsoft.VisualStudio.Component.Windows10SDK.IpOverUsb - this.log.silly('- failed to parse Win10/11SDK number:', pkg) - return - } - this.log.silly('- found Win10/11SDK:', foundSdkVer) - Win10or11SDKVer = Math.max(Win10or11SDKVer, foundSdkVer) - }) - - if (Win10or11SDKVer !== 0) { - return `10.0.${Win10or11SDKVer}.0` - } else if (info.packages.indexOf(win8SDK) !== -1) { - this.log.silly('- found Win8SDK') - return '8.1' - } - return null - }, - - // Find an installation of Visual Studio 2015 to use - findVisualStudio2015: function findVisualStudio2015 (cb) { - if (this.nodeSemver.major >= 19) { - this.addLog( - 'not looking for VS2015 as it is only supported up to Node.js 18') - return cb(null) - } - return this.findOldVS({ - version: '14.0', - versionMajor: 14, - versionMinor: 0, - versionYear: 2015, - toolset: 'v140' - }, cb) - }, - - // Find an installation of Visual Studio 2013 to use - findVisualStudio2013: function findVisualStudio2013 (cb) { - if (this.nodeSemver.major >= 9) { - this.addLog( - 'not looking for VS2013 as it is only supported up to Node.js 8') - return cb(null) - } - return this.findOldVS({ - version: '12.0', - versionMajor: 12, - versionMinor: 0, - versionYear: 2013, - toolset: 'v120' - }, cb) - }, - - // Helper - common code for VS2013 and VS2015 - findOldVS: function findOldVS (info, cb) { - const regVC7 = ['HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7', - 'HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7'] - const regMSBuild = 'HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions' - - this.addLog(`looking for Visual Studio ${info.versionYear}`) - this.regSearchKeys(regVC7, info.version, [], (err, res) => { - if (err) { - this.addLog('- not found') - return cb(null) - } - - const vsPath = path.resolve(res, '..') - this.addLog(`- found in "${vsPath}"`) - - const msBuildRegOpts = process.arch === 'ia32' ? [] : ['/reg:32'] - this.regSearchKeys([`${regMSBuild}\\${info.version}`], - 'MSBuildToolsPath', msBuildRegOpts, (err, res) => { - if (err) { - this.addLog( - '- could not find MSBuild in registry for this version') - return cb(null) - } - - const msBuild = path.join(res, 'MSBuild.exe') - this.addLog(`- MSBuild in "${msBuild}"`) - - if (!this.checkConfigVersion(info.versionYear, vsPath)) { - return cb(null) - } - - info.path = vsPath - info.msBuild = msBuild - info.sdk = null - cb(info) - }) - }) - }, - - // After finding a usable version of Visual Studio: - // - add it to validVersions to be displayed at the end if a specific - // version was requested and not found; - // - check if this is the version that was requested. - // - check if this matches the Visual Studio Command Prompt - checkConfigVersion: function checkConfigVersion (versionYear, vsPath) { - this.validVersions.push(versionYear) - this.validVersions.push(vsPath) - - if (this.configVersionYear && this.configVersionYear !== versionYear) { - this.addLog('- msvs_version does not match this version') - return false - } - if (this.configPath && - path.relative(this.configPath, vsPath) !== '') { - this.addLog('- msvs_version does not point to this installation') - return false - } - if (this.envVcInstallDir && - path.relative(this.envVcInstallDir, vsPath) !== '') { - this.addLog('- does not match this Visual Studio Command Prompt') - return false - } - - return true - } -} - -module.exports = findVisualStudio -module.exports.test = { - VisualStudioFinder: VisualStudioFinder, - findVisualStudio: findVisualStudio -} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/install.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/install.js deleted file mode 100644 index 1eb9f14c6742a..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/install.js +++ /dev/null @@ -1,458 +0,0 @@ -'use strict' - -const fs = require('graceful-fs') -const os = require('os') -const { backOff } = require('exponential-backoff') -const rm = require('rimraf') -const tar = require('tar') -const path = require('path') -const util = require('util') -const stream = require('stream') -const crypto = require('crypto') -const log = require('npmlog') -const semver = require('semver') -const fetch = require('make-fetch-happen') -const processRelease = require('./process-release') -const win = process.platform === 'win32' -const streamPipeline = util.promisify(stream.pipeline) - -/** - * @param {typeof import('graceful-fs')} fs - */ - -async function install (fs, gyp, argv) { - const release = processRelease(argv, gyp, process.version, process.release) - // Detecting target_arch based on logic from create-cnfig-gyp.js. Used on Windows only. - const arch = win ? (gyp.opts.target_arch || gyp.opts.arch || process.arch || 'ia32') : '' - // Used to prevent downloading tarball if only new node.lib is required on Windows. - let shouldDownloadTarball = true - - // Determine which node dev files version we are installing - log.verbose('install', 'input version string %j', release.version) - - if (!release.semver) { - // could not parse the version string with semver - throw new Error('Invalid version number: ' + release.version) - } - - if (semver.lt(release.version, '0.8.0')) { - throw new Error('Minimum target version is `0.8.0` or greater. Got: ' + release.version) - } - - // 0.x.y-pre versions are not published yet and cannot be installed. Bail. - if (release.semver.prerelease[0] === 'pre') { - log.verbose('detected "pre" node version', release.version) - if (!gyp.opts.nodedir) { - throw new Error('"pre" versions of node cannot be installed, use the --nodedir flag instead') - } - log.verbose('--nodedir flag was passed; skipping install', gyp.opts.nodedir) - return - } - - // flatten version into String - log.verbose('install', 'installing version: %s', release.versionDir) - - // the directory where the dev files will be installed - const devDir = path.resolve(gyp.devDir, release.versionDir) - - // If '--ensure' was passed, then don't *always* install the version; - // check if it is already installed, and only install when needed - if (gyp.opts.ensure) { - log.verbose('install', '--ensure was passed, so won\'t reinstall if already installed') - try { - await fs.promises.stat(devDir) - } catch (err) { - if (err.code === 'ENOENT') { - log.verbose('install', 'version not already installed, continuing with install', release.version) - try { - return await go() - } catch (err) { - return rollback(err) - } - } else if (err.code === 'EACCES') { - return eaccesFallback(err) - } - throw err - } - log.verbose('install', 'version is already installed, need to check "installVersion"') - const installVersionFile = path.resolve(devDir, 'installVersion') - let installVersion = 0 - try { - const ver = await fs.promises.readFile(installVersionFile, 'ascii') - installVersion = parseInt(ver, 10) || 0 - } catch (err) { - if (err.code !== 'ENOENT') { - throw err - } - } - log.verbose('got "installVersion"', installVersion) - log.verbose('needs "installVersion"', gyp.package.installVersion) - if (installVersion < gyp.package.installVersion) { - log.verbose('install', 'version is no good; reinstalling') - try { - return await go() - } catch (err) { - return rollback(err) - } - } - log.verbose('install', 'version is good') - if (win) { - log.verbose('on Windows; need to check node.lib') - const nodeLibPath = path.resolve(devDir, arch, 'node.lib') - try { - await fs.promises.stat(nodeLibPath) - } catch (err) { - if (err.code === 'ENOENT') { - log.verbose('install', `version not already installed for ${arch}, continuing with install`, release.version) - try { - shouldDownloadTarball = false - return await go() - } catch (err) { - return rollback(err) - } - } else if (err.code === 'EACCES') { - return eaccesFallback(err) - } - throw err - } - } - } else { - try { - return await go() - } catch (err) { - return rollback(err) - } - } - - async function copyDirectory (src, dest) { - try { - await fs.promises.stat(src) - } catch { - throw new Error(`Missing source directory for copy: ${src}`) - } - await fs.promises.mkdir(dest, { recursive: true }) - const entries = await fs.promises.readdir(src, { withFileTypes: true }) - for (const entry of entries) { - if (entry.isDirectory()) { - await copyDirectory(path.join(src, entry.name), path.join(dest, entry.name)) - } else if (entry.isFile()) { - // with parallel installs, copying files may cause file errors on - // Windows so use an exponential backoff to resolve collisions - await backOff(async () => { - try { - await fs.promises.copyFile(path.join(src, entry.name), path.join(dest, entry.name)) - } catch (err) { - // if ensure, check if file already exists and that's good enough - if (gyp.opts.ensure && err.code === 'EBUSY') { - try { - await fs.promises.stat(path.join(dest, entry.name)) - return - } catch {} - } - throw err - } - }) - } else { - throw new Error('Unexpected file directory entry type') - } - } - } - - async function go () { - log.verbose('ensuring devDir is created', devDir) - - // first create the dir for the node dev files - try { - const created = await fs.promises.mkdir(devDir, { recursive: true }) - - if (created) { - log.verbose('created devDir', created) - } - } catch (err) { - if (err.code === 'EACCES') { - return eaccesFallback(err) - } - - throw err - } - - // now download the node tarball - const tarPath = gyp.opts.tarball - let extractErrors = false - let extractCount = 0 - const contentShasums = {} - const expectShasums = {} - - // checks if a file to be extracted from the tarball is valid. - // only .h header files and the gyp files get extracted - function isValid (path) { - const isValid = valid(path) - if (isValid) { - log.verbose('extracted file from tarball', path) - extractCount++ - } else { - // invalid - log.silly('ignoring from tarball', path) - } - return isValid - } - - function onwarn (code, message) { - extractErrors = true - log.error('error while extracting tarball', code, message) - } - - // download the tarball and extract! - // Ommited on Windows if only new node.lib is required - - // on Windows there can be file errors from tar if parallel installs - // are happening (not uncommon with multiple native modules) so - // extract the tarball to a temp directory first and then copy over - const tarExtractDir = win ? await fs.promises.mkdtemp(path.join(os.tmpdir(), 'node-gyp-tmp-')) : devDir - - try { - if (shouldDownloadTarball) { - if (tarPath) { - await tar.extract({ - file: tarPath, - strip: 1, - filter: isValid, - onwarn, - cwd: tarExtractDir - }) - } else { - try { - const res = await download(gyp, release.tarballUrl) - - if (res.status !== 200) { - throw new Error(`${res.status} response downloading ${release.tarballUrl}`) - } - - await streamPipeline( - res.body, - // content checksum - new ShaSum((_, checksum) => { - const filename = path.basename(release.tarballUrl).trim() - contentShasums[filename] = checksum - log.verbose('content checksum', filename, checksum) - }), - tar.extract({ - strip: 1, - cwd: tarExtractDir, - filter: isValid, - onwarn - }) - ) - } catch (err) { - // something went wrong downloading the tarball? - if (err.code === 'ENOTFOUND') { - throw new Error('This is most likely not a problem with node-gyp or the package itself and\n' + - 'is related to network connectivity. In most cases you are behind a proxy or have bad \n' + - 'network settings.') - } - throw err - } - } - - // invoked after the tarball has finished being extracted - if (extractErrors || extractCount === 0) { - throw new Error('There was a fatal problem while downloading/extracting the tarball') - } - - log.verbose('tarball', 'done parsing tarball') - } - - const installVersionPath = path.resolve(tarExtractDir, 'installVersion') - await Promise.all([ - // need to download node.lib - ...(win ? [downloadNodeLib()] : []), - // write the "installVersion" file - fs.promises.writeFile(installVersionPath, gyp.package.installVersion + '\n'), - // Only download SHASUMS.txt if we downloaded something in need of SHA verification - ...(!tarPath || win ? [downloadShasums()] : []) - ]) - - log.verbose('download contents checksum', JSON.stringify(contentShasums)) - // check content shasums - for (const k in contentShasums) { - log.verbose('validating download checksum for ' + k, '(%s == %s)', contentShasums[k], expectShasums[k]) - if (contentShasums[k] !== expectShasums[k]) { - throw new Error(k + ' local checksum ' + contentShasums[k] + ' not match remote ' + expectShasums[k]) - } - } - - // copy over the files from the temp tarball extract directory to devDir - if (tarExtractDir !== devDir) { - await copyDirectory(tarExtractDir, devDir) - } - } finally { - if (tarExtractDir !== devDir) { - try { - // try to cleanup temp dir - await util.promisify(rm)(tarExtractDir) - } catch { - log.warn('failed to clean up temp tarball extract directory') - } - } - } - - async function downloadShasums () { - log.verbose('check download content checksum, need to download `SHASUMS256.txt`...') - log.verbose('checksum url', release.shasumsUrl) - - const res = await download(gyp, release.shasumsUrl) - - if (res.status !== 200) { - throw new Error(`${res.status} status code downloading checksum`) - } - - for (const line of (await res.text()).trim().split('\n')) { - const items = line.trim().split(/\s+/) - if (items.length !== 2) { - return - } - - // 0035d18e2dcf9aad669b1c7c07319e17abfe3762 ./node-v0.11.4.tar.gz - const name = items[1].replace(/^\.\//, '') - expectShasums[name] = items[0] - } - - log.verbose('checksum data', JSON.stringify(expectShasums)) - } - - async function downloadNodeLib () { - log.verbose('on Windows; need to download `' + release.name + '.lib`...') - const dir = path.resolve(tarExtractDir, arch) - const targetLibPath = path.resolve(dir, release.name + '.lib') - const { libUrl, libPath } = release[arch] - const name = `${arch} ${release.name}.lib` - log.verbose(name, 'dir', dir) - log.verbose(name, 'url', libUrl) - - await fs.promises.mkdir(dir, { recursive: true }) - log.verbose('streaming', name, 'to:', targetLibPath) - - const res = await download(gyp, libUrl) - - // Since only required node.lib is downloaded throw error if it is not fetched - if (res.status !== 200) { - throw new Error(`${res.status} status code downloading ${name}`) - } - - return streamPipeline( - res.body, - new ShaSum((_, checksum) => { - contentShasums[libPath] = checksum - log.verbose('content checksum', libPath, checksum) - }), - fs.createWriteStream(targetLibPath) - ) - } // downloadNodeLib() - } // go() - - /** - * Checks if a given filename is "valid" for this installation. - */ - - function valid (file) { - // header files - const extname = path.extname(file) - return extname === '.h' || extname === '.gypi' - } - - async function rollback (err) { - log.warn('install', 'got an error, rolling back install') - // roll-back the install if anything went wrong - await util.promisify(gyp.commands.remove)([release.versionDir]) - throw err - } - - /** - * The EACCES fallback is a workaround for npm's `sudo` behavior, where - * it drops the permissions before invoking any child processes (like - * node-gyp). So what happens is the "nobody" user doesn't have - * permission to create the dev dir. As a fallback, make the tmpdir() be - * the dev dir for this installation. This is not ideal, but at least - * the compilation will succeed... - */ - - async function eaccesFallback (err) { - const noretry = '--node_gyp_internal_noretry' - if (argv.indexOf(noretry) !== -1) { - throw err - } - const tmpdir = os.tmpdir() - gyp.devDir = path.resolve(tmpdir, '.node-gyp') - let userString = '' - try { - // os.userInfo can fail on some systems, it's not critical here - userString = ` ("${os.userInfo().username}")` - } catch (e) {} - log.warn('EACCES', 'current user%s does not have permission to access the dev dir "%s"', userString, devDir) - log.warn('EACCES', 'attempting to reinstall using temporary dev dir "%s"', gyp.devDir) - if (process.cwd() === tmpdir) { - log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space') - gyp.todo.push({ name: 'remove', args: argv }) - } - return util.promisify(gyp.commands.install)([noretry].concat(argv)) - } -} - -class ShaSum extends stream.Transform { - constructor (callback) { - super() - this._callback = callback - this._digester = crypto.createHash('sha256') - } - - _transform (chunk, _, callback) { - this._digester.update(chunk) - callback(null, chunk) - } - - _flush (callback) { - this._callback(null, this._digester.digest('hex')) - callback() - } -} - -async function download (gyp, url) { - log.http('GET', url) - - const requestOpts = { - headers: { - 'User-Agent': `node-gyp v${gyp.version} (node ${process.version})`, - Connection: 'keep-alive' - }, - proxy: gyp.opts.proxy, - noProxy: gyp.opts.noproxy - } - - const cafile = gyp.opts.cafile - if (cafile) { - requestOpts.ca = await readCAFile(cafile) - } - - const res = await fetch(url, requestOpts) - log.http(res.status, res.url) - - return res -} - -async function readCAFile (filename) { - // The CA file can contain multiple certificates so split on certificate - // boundaries. [\S\s]*? is used to match everything including newlines. - const ca = await fs.promises.readFile(filename, 'utf8') - const re = /(-----BEGIN CERTIFICATE-----[\S\s]*?-----END CERTIFICATE-----)/g - return ca.match(re) -} - -module.exports = function (gyp, argv, callback) { - install(fs, gyp, argv).then(callback.bind(undefined, null), callback) -} -module.exports.test = { - download, - install, - readCAFile -} -module.exports.usage = 'Install node development files for the specified node version.' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/list.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/list.js deleted file mode 100644 index 405ebc0d88959..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/list.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const fs = require('graceful-fs') -const log = require('npmlog') - -function list (gyp, args, callback) { - var devDir = gyp.devDir - log.verbose('list', 'using node-gyp dir:', devDir) - - fs.readdir(devDir, onreaddir) - - function onreaddir (err, versions) { - if (err && err.code !== 'ENOENT') { - return callback(err) - } - - if (Array.isArray(versions)) { - versions = versions.filter(function (v) { return v !== 'current' }) - } else { - versions = [] - } - callback(null, versions) - } -} - -module.exports = list -module.exports.usage = 'Prints a listing of the currently installed node development files' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/node-gyp.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/node-gyp.js deleted file mode 100644 index e492ec1026d9d..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/node-gyp.js +++ /dev/null @@ -1,215 +0,0 @@ -'use strict' - -const path = require('path') -const nopt = require('nopt') -const log = require('npmlog') -const childProcess = require('child_process') -const EE = require('events').EventEmitter -const inherits = require('util').inherits -const commands = [ - // Module build commands - 'build', - 'clean', - 'configure', - 'rebuild', - // Development Header File management commands - 'install', - 'list', - 'remove' -] -const aliases = { - ls: 'list', - rm: 'remove' -} - -// differentiate node-gyp's logs from npm's -log.heading = 'gyp' - -function gyp () { - return new Gyp() -} - -function Gyp () { - var self = this - - this.devDir = '' - this.commands = {} - - commands.forEach(function (command) { - self.commands[command] = function (argv, callback) { - log.verbose('command', command, argv) - return require('./' + command)(self, argv, callback) - } - }) -} -inherits(Gyp, EE) -exports.Gyp = Gyp -var proto = Gyp.prototype - -/** - * Export the contents of the package.json. - */ - -proto.package = require('../package.json') - -/** - * nopt configuration definitions - */ - -proto.configDefs = { - help: Boolean, // everywhere - arch: String, // 'configure' - cafile: String, // 'install' - debug: Boolean, // 'build' - directory: String, // bin - make: String, // 'build' - msvs_version: String, // 'configure' - ensure: Boolean, // 'install' - solution: String, // 'build' (windows only) - proxy: String, // 'install' - noproxy: String, // 'install' - devdir: String, // everywhere - nodedir: String, // 'configure' - loglevel: String, // everywhere - python: String, // 'configure' - 'dist-url': String, // 'install' - tarball: String, // 'install' - jobs: String, // 'build' - thin: String, // 'configure' - 'force-process-config': Boolean // 'configure' -} - -/** - * nopt shorthands - */ - -proto.shorthands = { - release: '--no-debug', - C: '--directory', - debug: '--debug', - j: '--jobs', - silly: '--loglevel=silly', - verbose: '--loglevel=verbose', - silent: '--loglevel=silent' -} - -/** - * expose the command aliases for the bin file to use. - */ - -proto.aliases = aliases - -/** - * Parses the given argv array and sets the 'opts', - * 'argv' and 'command' properties. - */ - -proto.parseArgv = function parseOpts (argv) { - this.opts = nopt(this.configDefs, this.shorthands, argv) - this.argv = this.opts.argv.remain.slice() - - var commands = this.todo = [] - - // create a copy of the argv array with aliases mapped - argv = this.argv.map(function (arg) { - // is this an alias? - if (arg in this.aliases) { - arg = this.aliases[arg] - } - return arg - }, this) - - // process the mapped args into "command" objects ("name" and "args" props) - argv.slice().forEach(function (arg) { - if (arg in this.commands) { - var args = argv.splice(0, argv.indexOf(arg)) - argv.shift() - if (commands.length > 0) { - commands[commands.length - 1].args = args - } - commands.push({ name: arg, args: [] }) - } - }, this) - if (commands.length > 0) { - commands[commands.length - 1].args = argv.splice(0) - } - - // support for inheriting config env variables from npm - var npmConfigPrefix = 'npm_config_' - Object.keys(process.env).forEach(function (name) { - if (name.indexOf(npmConfigPrefix) !== 0) { - return - } - var val = process.env[name] - if (name === npmConfigPrefix + 'loglevel') { - log.level = val - } else { - // add the user-defined options to the config - name = name.substring(npmConfigPrefix.length) - // gyp@741b7f1 enters an infinite loop when it encounters - // zero-length options so ensure those don't get through. - if (name) { - // convert names like force_process_config to force-process-config - if (name.includes('_')) { - name = name.replace(/_/g, '-') - } - this.opts[name] = val - } - } - }, this) - - if (this.opts.loglevel) { - log.level = this.opts.loglevel - } - log.resume() -} - -/** - * Spawns a child process and emits a 'spawn' event. - */ - -proto.spawn = function spawn (command, args, opts) { - if (!opts) { - opts = {} - } - if (!opts.silent && !opts.stdio) { - opts.stdio = [0, 1, 2] - } - var cp = childProcess.spawn(command, args, opts) - log.info('spawn', command) - log.info('spawn args', args) - return cp -} - -/** - * Returns the usage instructions for node-gyp. - */ - -proto.usage = function usage () { - var str = [ - '', - ' Usage: node-gyp [options]', - '', - ' where is one of:', - commands.map(function (c) { - return ' - ' + c + ' - ' + require('./' + c).usage - }).join('\n'), - '', - 'node-gyp@' + this.version + ' ' + path.resolve(__dirname, '..'), - 'node@' + process.versions.node - ].join('\n') - return str -} - -/** - * Version number getter. - */ - -Object.defineProperty(proto, 'version', { - get: function () { - return this.package.version - }, - enumerable: true -}) - -module.exports = exports = gyp diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/process-release.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/process-release.js deleted file mode 100644 index 95b55e4426dee..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/process-release.js +++ /dev/null @@ -1,147 +0,0 @@ -/* eslint-disable node/no-deprecated-api */ - -'use strict' - -const semver = require('semver') -const url = require('url') -const path = require('path') -const log = require('npmlog') - -// versions where -headers.tar.gz started shipping -const headersTarballRange = '>= 3.0.0 || ~0.12.10 || ~0.10.42' -const bitsre = /\/win-(x86|x64|arm64)\// -const bitsreV3 = /\/win-(x86|ia32|x64)\// // io.js v3.x.x shipped with "ia32" but should -// have been "x86" - -// Captures all the logic required to determine download URLs, local directory and -// file names. Inputs come from command-line switches (--target, --dist-url), -// `process.version` and `process.release` where it exists. -function processRelease (argv, gyp, defaultVersion, defaultRelease) { - var version = (semver.valid(argv[0]) && argv[0]) || gyp.opts.target || defaultVersion - var versionSemver = semver.parse(version) - var overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl - var isDefaultVersion - var isNamedForLegacyIojs - var name - var distBaseUrl - var baseUrl - var libUrl32 - var libUrl64 - var libUrlArm64 - var tarballUrl - var canGetHeaders - - if (!versionSemver) { - // not a valid semver string, nothing we can do - return { version: version } - } - // flatten version into String - version = versionSemver.version - - // defaultVersion should come from process.version so ought to be valid semver - isDefaultVersion = version === semver.parse(defaultVersion).version - - // can't use process.release if we're using --target=x.y.z - if (!isDefaultVersion) { - defaultRelease = null - } - - if (defaultRelease) { - // v3 onward, has process.release - name = defaultRelease.name.replace(/io\.js/, 'iojs') // remove the '.' for directory naming purposes - } else { - // old node or alternative --target= - // semver.satisfies() doesn't like prerelease tags so test major directly - isNamedForLegacyIojs = versionSemver.major >= 1 && versionSemver.major < 4 - // isNamedForLegacyIojs is required to support Electron < 4 (in particular Electron 3) - // as previously this logic was used to ensure "iojs" was used to download iojs releases - // and "node" for node releases. Unfortunately the logic was broad enough that electron@3 - // published release assets as "iojs" so that the node-gyp logic worked. Once Electron@3 has - // been EOL for a while (late 2019) we should remove this hack. - name = isNamedForLegacyIojs ? 'iojs' : 'node' - } - - // check for the nvm.sh standard mirror env variables - if (!overrideDistUrl && process.env.NODEJS_ORG_MIRROR) { - overrideDistUrl = process.env.NODEJS_ORG_MIRROR - } - - if (overrideDistUrl) { - log.verbose('download', 'using dist-url', overrideDistUrl) - } - - if (overrideDistUrl) { - distBaseUrl = overrideDistUrl.replace(/\/+$/, '') - } else { - distBaseUrl = 'https://nodejs.org/dist' - } - distBaseUrl += '/v' + version + '/' - - // new style, based on process.release so we have a lot of the data we need - if (defaultRelease && defaultRelease.headersUrl && !overrideDistUrl) { - baseUrl = url.resolve(defaultRelease.headersUrl, './') - libUrl32 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'x86', versionSemver.major) - libUrl64 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'x64', versionSemver.major) - libUrlArm64 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'arm64', versionSemver.major) - tarballUrl = defaultRelease.headersUrl - } else { - // older versions without process.release are captured here and we have to make - // a lot of assumptions, additionally if you --target=x.y.z then we can't use the - // current process.release - baseUrl = distBaseUrl - libUrl32 = resolveLibUrl(name, baseUrl, 'x86', versionSemver.major) - libUrl64 = resolveLibUrl(name, baseUrl, 'x64', versionSemver.major) - libUrlArm64 = resolveLibUrl(name, baseUrl, 'arm64', versionSemver.major) - - // making the bold assumption that anything with a version number >3.0.0 will - // have a *-headers.tar.gz file in its dist location, even some frankenstein - // custom version - canGetHeaders = semver.satisfies(versionSemver, headersTarballRange) - tarballUrl = url.resolve(baseUrl, name + '-v' + version + (canGetHeaders ? '-headers' : '') + '.tar.gz') - } - - return { - version: version, - semver: versionSemver, - name: name, - baseUrl: baseUrl, - tarballUrl: tarballUrl, - shasumsUrl: url.resolve(baseUrl, 'SHASUMS256.txt'), - versionDir: (name !== 'node' ? name + '-' : '') + version, - ia32: { - libUrl: libUrl32, - libPath: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrl32).path)) - }, - x64: { - libUrl: libUrl64, - libPath: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrl64).path)) - }, - arm64: { - libUrl: libUrlArm64, - libPath: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrlArm64).path)) - } - } -} - -function normalizePath (p) { - return path.normalize(p).replace(/\\/g, '/') -} - -function resolveLibUrl (name, defaultUrl, arch, versionMajor) { - var base = url.resolve(defaultUrl, './') - var hasLibUrl = bitsre.test(defaultUrl) || (versionMajor === 3 && bitsreV3.test(defaultUrl)) - - if (!hasLibUrl) { - // let's assume it's a baseUrl then - if (versionMajor >= 1) { - return url.resolve(base, 'win-' + arch + '/' + name + '.lib') - } - // prior to io.js@1.0.0 32-bit node.lib lives in /, 64-bit lives in /x64/ - return url.resolve(base, (arch === 'x86' ? '' : arch + '/') + name + '.lib') - } - - // else we have a proper url to a .lib, just make sure it's the right arch - return defaultUrl.replace(versionMajor === 3 ? bitsreV3 : bitsre, '/win-' + arch + '/') -} - -module.exports = processRelease diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/rebuild.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/rebuild.js deleted file mode 100644 index a1c5b27cbe56a..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/rebuild.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -function rebuild (gyp, argv, callback) { - gyp.todo.push( - { name: 'clean', args: [] } - , { name: 'configure', args: argv } - , { name: 'build', args: [] } - ) - process.nextTick(callback) -} - -module.exports = rebuild -module.exports.usage = 'Runs "clean", "configure" and "build" all at once' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/remove.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/remove.js deleted file mode 100644 index 8c945e5659001..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/remove.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict' - -const fs = require('fs') -const rm = require('rimraf') -const path = require('path') -const log = require('npmlog') -const semver = require('semver') - -function remove (gyp, argv, callback) { - var devDir = gyp.devDir - log.verbose('remove', 'using node-gyp dir:', devDir) - - // get the user-specified version to remove - var version = argv[0] || gyp.opts.target - log.verbose('remove', 'removing target version:', version) - - if (!version) { - return callback(new Error('You must specify a version number to remove. Ex: "' + process.version + '"')) - } - - var versionSemver = semver.parse(version) - if (versionSemver) { - // flatten the version Array into a String - version = versionSemver.version - } - - var versionPath = path.resolve(gyp.devDir, version) - log.verbose('remove', 'removing development files for version:', version) - - // first check if its even installed - fs.stat(versionPath, function (err) { - if (err) { - if (err.code === 'ENOENT') { - callback(null, 'version was already uninstalled: ' + version) - } else { - callback(err) - } - return - } - // Go ahead and delete the dir - rm(versionPath, callback) - }) -} - -module.exports = exports = remove -module.exports.usage = 'Removes the node development files for the specified version' diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/util.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/util.js deleted file mode 100644 index 3e23c628e6ad7..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/util.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict' - -const log = require('npmlog') -const execFile = require('child_process').execFile -const path = require('path') - -function logWithPrefix (log, prefix) { - function setPrefix (logFunction) { - return (...args) => logFunction.apply(null, [ prefix, ...args ]) // eslint-disable-line - } - return { - silly: setPrefix(log.silly), - verbose: setPrefix(log.verbose), - info: setPrefix(log.info), - warn: setPrefix(log.warn), - error: setPrefix(log.error) - } -} - -function regGetValue (key, value, addOpts, cb) { - const outReValue = value.replace(/\W/g, '.') - const outRe = new RegExp(`^\\s+${outReValue}\\s+REG_\\w+\\s+(\\S.*)$`, 'im') - const reg = path.join(process.env.SystemRoot, 'System32', 'reg.exe') - const regArgs = ['query', key, '/v', value].concat(addOpts) - - log.silly('reg', 'running', reg, regArgs) - const child = execFile(reg, regArgs, { encoding: 'utf8' }, - function (err, stdout, stderr) { - log.silly('reg', 'reg.exe stdout = %j', stdout) - if (err || stderr.trim() !== '') { - log.silly('reg', 'reg.exe err = %j', err && (err.stack || err)) - log.silly('reg', 'reg.exe stderr = %j', stderr) - return cb(err, stderr) - } - - const result = outRe.exec(stdout) - if (!result) { - log.silly('reg', 'error parsing stdout') - return cb(new Error('Could not parse output of reg.exe')) - } - log.silly('reg', 'found: %j', result[1]) - cb(null, result[1]) - }) - child.stdin.end() -} - -function regSearchKeys (keys, value, addOpts, cb) { - var i = 0 - const search = () => { - log.silly('reg-search', 'looking for %j in %j', value, keys[i]) - regGetValue(keys[i], value, addOpts, (err, res) => { - ++i - if (err && i < keys.length) { return search() } - cb(err, res) - }) - } - search() -} - -module.exports = { - logWithPrefix: logWithPrefix, - regGetValue: regGetValue, - regSearchKeys: regSearchKeys -} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina.md b/node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina.md deleted file mode 100644 index dde5fe3f7d4fb..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina.md +++ /dev/null @@ -1,104 +0,0 @@ -# Installation notes for macOS Catalina (v10.15) - -_This document specifically refers to upgrades from previous versions of macOS to Catalina (10.15). It should be removed from the source repository when Catalina ceases to be the latest macOS version or when future Catalina versions no longer raise these issues._ - -**Both upgrading to macOS Catalina and running a Software Update in Catalina may cause normal `node-gyp` installations to fail. This might manifest as the following error during `npm install`:** - -```console -gyp: No Xcode or CLT version detected! -``` - -## node-gyp v7 - -The newest release of `node-gyp` should solve this problem. If you are using `node-gyp` directly then you should be able to install v7 and use it as-is. - -If you need to use `node-gyp` from within `npm` (e.g. through `npm install`), you will have to install `node-gyp` (either globally with `-g` or to a predictable location) and tell `npm` where the new version is. Either use: - -* `npm config set node_gyp `; or -* run `npm` with an environment variable prefix: `npm_config_node_gyp= npm install` - -Where "path to node-gyp" is to the `node-gyp` executable which may be a symlink in your global bin directory (e.g. `/usr/local/bin/node-gyp`), or a path to the `node-gyp` installation directory and the `bin/node-gyp.js` file within it (e.g. `/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js`). - -**If you use `npm config set` to change your global `node_gyp` you are responsible for keeping it up to date and can't rely on `npm` to give you a newer version when available.** Use `npm config delete node_gyp` to unset this configuration option. - -## Fixing Catalina for older versions of `node-gyp` - -### Is my Mac running macOS Catalina? -Let's first make sure that your Mac is running Catalina: -``` -% sw_vers - ProductName: Mac OS X - ProductVersion: 10.15 - BuildVersion: 19A602 -``` -If `ProductVersion` is less then `10.15` then this document is not for you. Normal install docs for `node-gyp` on macOS can be found at https://github.com/nodejs/node-gyp#on-macos - - -### The acid test -To see if `Xcode Command Line Tools` is installed in a way that will work with `node-gyp`, run: -``` -curl -sL https://github.com/nodejs/node-gyp/raw/main/macOS_Catalina_acid_test.sh | bash -``` - -If test succeeded, _you are done_! You should be ready to [install](https://github.com/nodejs/node-gyp#installation) `node-gyp`. - -If test failed, there is a problem with your Xcode Command Line Tools installation. [Continue to Solutions](#Solutions). - -### Solutions -There are three ways to install the Xcode libraries `node-gyp` needs on macOS. People running Catalina have had success with some but not others in a way that has been unpredictable. - -1. With the full Xcode (~7.6 GB download) from the `App Store` app. -2. With the _much_ smaller Xcode Command Line Tools via `xcode-select --install` -3. With the _much_ smaller Xcode Command Line Tools via manual download. **For people running the latest version of Catalina (10.15.2 at the time of this writing), this has worked when the other two solutions haven't.** - -### Installing `node-gyp` using the full Xcode -1. `xcodebuild -version` should show `Xcode 11.1` or later. - * If not, then install/upgrade Xcode from the App Store app. -2. Open the Xcode app and... - * Under __Preferences > Locations__ select the tools if their location is empty. - * Allow Xcode app to do an essential install of the most recent compiler tools. -3. Once all installations are _complete_, quit out of Xcode. -4. `sudo xcodebuild -license accept` # If you agree with the licensing terms. -5. `softwareupdate -l` # No listing is a good sign. - * If Xcode or Tools upgrades are listed, use "Software Upgrade" to install them. -6. `xcode-select -version` # Should return `xcode-select version 2370` or later. -7. `xcode-select -print-path` # Should return `/Applications/Xcode.app/Contents/Developer` -8. Try the [_acid test_ steps above](#The-acid-test) to see if your Mac is ready. -9. If the _acid test_ does _not_ pass then... -10. `sudo xcode-select --reset` # Enter root password. No output is normal. -11. Repeat step 7 above. Is the path different this time? Repeat the _acid test_. - -### Installing `node-gyp` using the Xcode Command Line Tools via `xcode-select --install` -1. If the _acid test_ has not succeeded, then try `xcode-select --install` -2. If the installation command returns `xcode-select: error: command line tools are already installed, use "Software Update" to install updates`, continue to [remove and reinstall](#i-did-all-that-and-the-acid-test-still-does-not-pass--) -3. Wait until the install process is _complete_. -4. `softwareupdate -l` # No listing is a good sign. - * If Xcode or Tools upgrades are listed, use "Software Update" to install them. -5. `xcode-select -version` # Should return `xcode-select version 2370` or later. -6. `xcode-select -print-path` # Should return `/Library/Developer/CommandLineTools` -7. Try the [_acid test_ steps above](#The-acid-test) to see if your Mac is ready. -8. If the _acid test_ does _not_ pass then... -9. `sudo xcode-select --reset` # Enter root password. No output is normal. -10. Repeat step 5 above. Is the path different this time? Repeat the _acid test_. - -### Installing `node-gyp` using the Xcode Command Line Tools via manual download -1. Download the appropriate version of the "Command Line Tools for Xcode" for your version of Catalina from . As of MacOS 10.15.5, that's [Command_Line_Tools_for_Xcode_11.5.dmg](https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_for_Xcode_11.5/Command_Line_Tools_for_Xcode_11.5.dmg) -2. Install the package. -3. Run the [_acid test_ steps above](#The-acid-test). - -### I did all that and the acid test still does not pass :-( -1. `sudo rm -rf $(xcode-select -print-path)` # Enter root password. No output is normal. -2. `sudo rm -rf /Library/Developer/CommandLineTools` # Enter root password. -3. `sudo xcode-select --reset` -4. `xcode-select --install` -5. If the [_acid test_ steps above](#The-acid-test) still does _not_ pass then... -6. `npm explore npm -g -- npm install node-gyp@latest` -7. `npm explore npm -g -- npm explore npm-lifecycle -- npm install node-gyp@latest` -8. If the _acid test_ still does _not_ pass then... -9. Add a comment to https://github.com/nodejs/node-gyp/issues/1927 so we can improve. - -Lessons learned from: -* https://github.com/nodejs/node-gyp/issues/1779 -* https://github.com/nodejs/node-gyp/issues/1861 -* https://github.com/nodejs/node-gyp/issues/1927 and elsewhere -* Thanks to @rrrix for discovering Solution 3 diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina_acid_test.sh b/node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina_acid_test.sh deleted file mode 100644 index e1e98941a8e4c..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/macOS_Catalina_acid_test.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -pkgs=( - "com.apple.pkg.DeveloperToolsCLILeo" # standalone - "com.apple.pkg.DeveloperToolsCLI" # from XCode - "com.apple.pkg.CLTools_Executables" # Mavericks -) - -for pkg in "${pkgs[@]}"; do - output=$(/usr/sbin/pkgutil --pkg-info "$pkg" 2>/dev/null) - if [ "$output" ]; then - version=$(echo "$output" | grep 'version' | cut -d' ' -f2) - break - fi -done - -if [ "$version" ]; then - echo "Command Line Tools version: $version" -else - echo >&2 'Command Line Tools not found' -fi diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/LICENSE b/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/bin/node-which b/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/bin/node-which deleted file mode 100755 index 7cee3729eebdd..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/bin/node-which +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env node -var which = require("../") -if (process.argv.length < 3) - usage() - -function usage () { - console.error('usage: which [-as] program ...') - process.exit(1) -} - -var all = false -var silent = false -var dashdash = false -var args = process.argv.slice(2).filter(function (arg) { - if (dashdash || !/^-/.test(arg)) - return true - - if (arg === '--') { - dashdash = true - return false - } - - var flags = arg.substr(1).split('') - for (var f = 0; f < flags.length; f++) { - var flag = flags[f] - switch (flag) { - case 's': - silent = true - break - case 'a': - all = true - break - default: - console.error('which: illegal option -- ' + flag) - usage() - } - } - return false -}) - -process.exit(args.reduce(function (pv, current) { - try { - var f = which.sync(current, { all: all }) - if (all) - f = f.join('\n') - if (!silent) - console.log(f) - return pv; - } catch (e) { - return 1; - } -}, 0)) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/package.json b/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/package.json deleted file mode 100644 index 97ad7fbabc52b..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "author": "Isaac Z. Schlueter (http://blog.izs.me)", - "name": "which", - "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", - "version": "2.0.2", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/node-which.git" - }, - "main": "which.js", - "bin": { - "node-which": "./bin/node-which" - }, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "devDependencies": { - "mkdirp": "^0.5.0", - "rimraf": "^2.6.2", - "tap": "^14.6.9" - }, - "scripts": { - "test": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "prepublish": "npm run changelog", - "prechangelog": "bash gen-changelog.sh", - "changelog": "git add CHANGELOG.md", - "postchangelog": "git commit -m 'update changelog - '${npm_package_version}", - "postpublish": "git push origin --follow-tags" - }, - "files": [ - "which.js", - "bin/node-which" - ], - "tap": { - "check-coverage": true - }, - "engines": { - "node": ">= 8" - } -} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/which.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/which.js deleted file mode 100644 index 82afffd214374..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which/which.js +++ /dev/null @@ -1,125 +0,0 @@ -const isWindows = process.platform === 'win32' || - process.env.OSTYPE === 'cygwin' || - process.env.OSTYPE === 'msys' - -const path = require('path') -const COLON = isWindows ? ';' : ':' -const isexe = require('isexe') - -const getNotFoundError = (cmd) => - Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }) - -const getPathInfo = (cmd, opt) => { - const colon = opt.colon || COLON - - // If it has a slash, then we don't bother searching the pathenv. - // just check the file itself, and that's it. - const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [''] - : ( - [ - // windows always checks the cwd first - ...(isWindows ? [process.cwd()] : []), - ...(opt.path || process.env.PATH || - /* istanbul ignore next: very unusual */ '').split(colon), - ] - ) - const pathExtExe = isWindows - ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' - : '' - const pathExt = isWindows ? pathExtExe.split(colon) : [''] - - if (isWindows) { - if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') - pathExt.unshift('') - } - - return { - pathEnv, - pathExt, - pathExtExe, - } -} - -const which = (cmd, opt, cb) => { - if (typeof opt === 'function') { - cb = opt - opt = {} - } - if (!opt) - opt = {} - - const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) - const found = [] - - const step = i => new Promise((resolve, reject) => { - if (i === pathEnv.length) - return opt.all && found.length ? resolve(found) - : reject(getNotFoundError(cmd)) - - const ppRaw = pathEnv[i] - const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw - - const pCmd = path.join(pathPart, cmd) - const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd - : pCmd - - resolve(subStep(p, i, 0)) - }) - - const subStep = (p, i, ii) => new Promise((resolve, reject) => { - if (ii === pathExt.length) - return resolve(step(i + 1)) - const ext = pathExt[ii] - isexe(p + ext, { pathExt: pathExtExe }, (er, is) => { - if (!er && is) { - if (opt.all) - found.push(p + ext) - else - return resolve(p + ext) - } - return resolve(subStep(p, i, ii + 1)) - }) - }) - - return cb ? step(0).then(res => cb(null, res), cb) : step(0) -} - -const whichSync = (cmd, opt) => { - opt = opt || {} - - const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) - const found = [] - - for (let i = 0; i < pathEnv.length; i ++) { - const ppRaw = pathEnv[i] - const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw - - const pCmd = path.join(pathPart, cmd) - const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd - : pCmd - - for (let j = 0; j < pathExt.length; j ++) { - const cur = p + pathExt[j] - try { - const is = isexe.sync(cur, { pathExt: pathExtExe }) - if (is) { - if (opt.all) - found.push(cur) - else - return cur - } - } catch (ex) {} - } - } - - if (opt.all && found.length) - return found - - if (opt.nothrow) - return null - - throw getNotFoundError(cmd) -} - -module.exports = which -which.sync = whichSync diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/package.json b/node_modules/@npmcli/run-script/node_modules/node-gyp/package.json deleted file mode 100644 index 38359c3008c04..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "node-gyp", - "description": "Node.js native addon build tool", - "license": "MIT", - "keywords": [ - "native", - "addon", - "module", - "c", - "c++", - "bindings", - "gyp" - ], - "version": "9.4.1", - "installVersion": 11, - "author": "Nathan Rajlich (http://tootallnate.net)", - "repository": { - "type": "git", - "url": "git://github.com/nodejs/node-gyp.git" - }, - "preferGlobal": true, - "bin": "./bin/node-gyp.js", - "main": "./lib/node-gyp.js", - "dependencies": { - "env-paths": "^2.2.0", - "exponential-backoff": "^3.1.1", - "glob": "^7.1.4", - "graceful-fs": "^4.2.6", - "make-fetch-happen": "^10.0.3", - "nopt": "^6.0.0", - "npmlog": "^6.0.0", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.2", - "which": "^2.0.2" - }, - "engines": { - "node": "^12.13 || ^14.13 || >=16" - }, - "devDependencies": { - "bindings": "^1.5.0", - "mocha": "^10.2.0", - "nan": "^2.14.2", - "require-inject": "^1.4.4", - "standard": "^14.3.4" - }, - "scripts": { - "lint": "standard */*.js test/**/*.js", - "test": "npm run lint && mocha --reporter=test/reporter.js test/test-download.js test/test-*" - } -} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/src/win_delay_load_hook.cc b/node_modules/@npmcli/run-script/node_modules/node-gyp/src/win_delay_load_hook.cc deleted file mode 100644 index 169f8029f10fd..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/src/win_delay_load_hook.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* - * When this file is linked to a DLL, it sets up a delay-load hook that - * intervenes when the DLL is trying to load the host executable - * dynamically. Instead of trying to locate the .exe file it'll just - * return a handle to the process image. - * - * This allows compiled addons to work when the host executable is renamed. - */ - -#ifdef _MSC_VER - -#pragma managed(push, off) - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif - -#include - -#include -#include - -static FARPROC WINAPI load_exe_hook(unsigned int event, DelayLoadInfo* info) { - HMODULE m; - if (event != dliNotePreLoadLibrary) - return NULL; - - if (_stricmp(info->szDll, HOST_BINARY) != 0) - return NULL; - - m = GetModuleHandle(NULL); - return (FARPROC) m; -} - -decltype(__pfnDliNotifyHook2) __pfnDliNotifyHook2 = load_exe_hook; - -#pragma managed(pop) - -#endif diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/common.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/common.js deleted file mode 100644 index b714ee29029d3..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/common.js +++ /dev/null @@ -1,3 +0,0 @@ -const envPaths = require('env-paths') - -module.exports.devDir = () => envPaths('node-gyp', { suffix: '' }).cache diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_BuildTools_minimal.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_BuildTools_minimal.txt deleted file mode 100644 index 244f6b0798240..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_BuildTools_minimal.txt +++ /dev/null @@ -1 +0,0 @@ -[{"path":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools","version":"15.9.28307.665","packages":["Microsoft.VisualStudio.Product.BuildTools","Microsoft.VisualStudio.Component.VC.CoreIde","Microsoft.VisualStudio.VC.Ide.Pro","Microsoft.VisualStudio.VC.Ide.Pro.Resources","Microsoft.VisualStudio.VC.Templates.Pro","Microsoft.VisualStudio.VC.Templates.Pro.Resources","Microsoft.VisualStudio.VC.Items.Pro","Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced","Microsoft.VisualStudio.VC.Ide.MDD","Microsoft.VisualStudio.VC.Ide.x64","Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express","Microsoft.VisualStudio.PackageGroup.Debugger.Script","Microsoft.VisualStudio.JavaScript.LanguageService","Microsoft.VisualStudio.JavaScript.LanguageService.Resources","Microsoft.VisualStudio.Debugger.Script.Msi","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualStudio.VC.Ide.WinXPlus","Microsoft.VisualStudio.VC.Ide.Dskx","Microsoft.VisualStudio.VC.Ide.Dskx.Resources","Microsoft.VisualStudio.VC.Ide.Core","Microsoft.VisualStudio.VC.Ide.Core.Resources","Microsoft.VisualStudio.VC.Ide.Base","Microsoft.VisualStudio.VC.Ide.LanguageService","Microsoft.VisualStudio.VC.Ide.ResourceEditor","Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources","Microsoft.VisualStudio.VC.Ide.ProjectSystem","Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources","Microsoft.VisualStudio.VC.Ide.LanguageService.Resources","Microsoft.VisualStudio.VC.Ide.Base.Resources","Microsoft.VisualStudio.PackageGroup.Core","Microsoft.VisualStudio.TestTools.TeamFoundationClient","Microsoft.VisualStudio.PackageGroup.Debugger.Core","Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost","Microsoft.VisualStudio.VC.Ide.Debugger","Microsoft.VisualStudio.VC.Ide.Debugger.Resources","Microsoft.VisualStudio.VC.Ide.Common","Microsoft.VisualStudio.VC.Ide.Common.Resources","Microsoft.VisualStudio.Debugger.Parallel","Microsoft.VisualStudio.Debugger.Parallel.Resources","Microsoft.VisualStudio.Debugger.CollectionAgents","Microsoft.VisualStudio.Debugger.Managed","Microsoft.CodeAnalysis.VisualStudio.Setup.Resources","Microsoft.CodeAnalysis.VisualStudio.Setup","Microsoft.CodeAnalysis.ExpressionEvaluator.Resources","Microsoft.CodeAnalysis.ExpressionEvaluator","Microsoft.VisualStudio.Debugger.Managed.Resources","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.Debugger","Microsoft.VisualStudio.VC.MSVCDis","Microsoft.VisualStudio.ScriptedHost","Microsoft.VisualStudio.ScriptedHost.Targeted","Microsoft.VisualStudio.ScriptedHost.Resources","Microsoft.IntelliTrace.DiagnosticsHub","Microsoft.VisualStudio.Debugger.Resources","Microsoft.PackageGroup.ClientDiagnostics","Microsoft.VisualStudio.AppResponsiveness","Microsoft.VisualStudio.AppResponsiveness.Targeted","Microsoft.VisualStudio.AppResponsiveness.Resources","Microsoft.VisualStudio.ClientDiagnostics","Microsoft.VisualStudio.ClientDiagnostics.Targeted","Microsoft.VisualStudio.ClientDiagnostics.Resources","Microsoft.VisualStudio.PackageGroup.CommunityCore","Microsoft.VisualStudio.ProjectSystem.Full","Microsoft.VisualStudio.ProjectSystem","Microsoft.VisualStudio.Community.x86","Microsoft.VisualStudio.Community.x64","Microsoft.VisualStudio.Community","Microsoft.IntelliTrace.CollectorCab","Microsoft.VisualStudio.Community.Resources","Microsoft.VisualStudio.WebSiteProject.DTE","Microsoft.MSHtml","Microsoft.VisualStudio.Community.Msi.Resources","Microsoft.VisualStudio.Community.Msi","Microsoft.VisualStudio.MinShell.Interop.Msi","Microsoft.VisualStudio.PackageGroup.CoreEditor","PortableFacades","Microsoft.VisualStudio.VirtualTree","Microsoft.VisualStudio.PackageGroup.Progression","Microsoft.VisualStudio.PerformanceProvider","Microsoft.VisualStudio.GraphModel","Microsoft.VisualStudio.GraphProvider","Microsoft.DiaSymReader","Microsoft.VisualStudio.TextMateGrammars","Microsoft.VisualStudio.PackageGroup.TeamExplorer","Microsoft.TeamFoundation.OfficeIntegration","Microsoft.TeamFoundation.OfficeIntegration.Resources","Microsoft.VisualStudio.TeamExplorer","Microsoft.ServiceHub","Microsoft.VisualStudio.ProjectServices","Microsoft.VisualStudio.SLNX.VSIX","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.PackageGroup.MinShell","Microsoft.VisualStudio.MinShell.Msi","Microsoft.VisualStudio.MinShell.Msi.Resources","Microsoft.VisualStudio.MinShell.Interop","Microsoft.VisualStudio.Log","Microsoft.VisualStudio.Log.Targeted","Microsoft.VisualStudio.Log.Resources","Microsoft.VisualStudio.Finalizer","Microsoft.VisualStudio.CoreEditor","Microsoft.VisualStudio.Connected","Microsoft.VisualStudio.Connected.Resources","Microsoft.VisualStudio.MinShell","Microsoft.VisualStudio.MinShell.Platform","Microsoft.VisualStudio.MinShell.Platform.Resources","Microsoft.VisualStudio.MefHosting","Microsoft.VisualStudio.MefHosting.Resources","Microsoft.VisualStudio.Initializer","Microsoft.VisualStudio.ExtensionManager","Microsoft.VisualStudio.Editors","Microsoft.Net.4.TargetingPack","Microsoft.VisualStudio.Component.Windows10SDK.17134","Win10SDK_10.0.17134","Microsoft.VisualStudio.Component.VC.Tools.x86.x64","Microsoft.VisualCpp.CodeAnalysis.Extensions","Microsoft.VisualCpp.CodeAnalysis.Extensions.X86","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources","Microsoft.VisualCpp.CodeAnalysis.Extensions.X64","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources","Microsoft.VisualStudio.Component.Static.Analysis.Tools","Microsoft.VisualStudio.StaticAnalysis","Microsoft.VisualStudio.StaticAnalysis.Resources","Microsoft.VisualCpp.Tools.HostX64.TargetX86","Microsoft.VisualCpp.VCTip.HostX64.TargetX86","Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources","Microsoft.VisualCpp.Tools.HostX64.TargetX64","Microsoft.VisualCpp.VCTip.HostX64.TargetX64","Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64","Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources","Microsoft.VisualCpp.PGO.X86","Microsoft.VisualCpp.PGO.X64","Microsoft.VisualCpp.PGO.Headers","Microsoft.VisualCpp.CRT.x86.Store","Microsoft.VisualCpp.CRT.x86.OneCore.Desktop","Microsoft.VisualCpp.CRT.x64.Store","Microsoft.VisualCpp.CRT.x64.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop","Microsoft.VisualCpp.CRT.ClickOnce.Msi","Microsoft.VisualStudio.PackageGroup.VC.Tools.x86","Microsoft.VisualCpp.Tools.HostX86.TargetX64","Microsoft.VisualCpp.VCTip.hostX86.targetX64","Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Tools.HostX86.TargetX86","Microsoft.VisualCpp.VCTip.hostX86.targetX86","Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources","Microsoft.VisualCpp.Tools.Core.Resources","Microsoft.VisualCpp.Tools.Core.x86","Microsoft.VisualCpp.Tools.Common.Utils","Microsoft.VisualCpp.Tools.Common.Utils.Resources","Microsoft.VisualCpp.DIA.SDK","Microsoft.VisualCpp.CRT.x86.Desktop","Microsoft.VisualCpp.CRT.x64.Desktop","Microsoft.VisualCpp.CRT.Source","Microsoft.VisualCpp.CRT.Redist.X86","Microsoft.VisualCpp.CRT.Redist.X64","Microsoft.VisualCpp.CRT.Redist.Resources","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.Redist.14","Microsoft.VisualCpp.Redist.14","Microsoft.VisualCpp.CRT.Headers","Microsoft.VisualStudio.VC.MSBuild.X86","Microsoft.VisualStudio.VC.MSBuild.X64","Microsoft.VS.VC.MSBuild.X64.Resources","Microsoft.VisualStudio.VC.MSBuild.Base","Microsoft.VisualStudio.VC.MSBuild.Base.Resources","Microsoft.VisualStudio.VC.MSBuild.ARM","Microsoft.VisualStudio.Workload.MSBuildTools","Microsoft.VisualStudio.Component.CoreBuildTools","Microsoft.VisualStudio.Setup.Configuration","Microsoft.VisualStudio.PackageGroup.VsDevCmd","Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk","Microsoft.VisualStudio.VsDevCmd.Core.WinSdk","Microsoft.VisualStudio.VsDevCmd.Core.DotNet","Microsoft.VisualStudio.VC.DevCmd","Microsoft.VisualStudio.VC.DevCmd.Resources","Microsoft.VisualStudio.BuildTools.Resources","Microsoft.VisualStudio.Net.Eula.Resources","Microsoft.Build.Dependencies","Microsoft.Build.FileTracker.Msi","Microsoft.Component.MSBuild","Microsoft.PythonTools.BuildCore.Vsix","Microsoft.NuGet.Build.Tasks","Microsoft.VisualStudio.Component.Roslyn.Compiler","Microsoft.CodeAnalysis.Compilers.Resources","Microsoft.CodeAnalysis.Compilers","Microsoft.Net.PackageGroup.4.6.1.Redist","Microsoft.VisualStudio.NativeImageSupport","Microsoft.Build"]}] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Community_workload.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Community_workload.txt deleted file mode 100644 index dd5e77dafb9df..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Community_workload.txt +++ /dev/null @@ -1 +0,0 @@ -[{"path":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community","version":"15.9.28307.665","packages":["Microsoft.VisualStudio.Component.Windows10SDK.IpOverUsb","Win10SDK_IpOverUsb","Microsoft.VisualStudio.Component.VC.ATL.ARM64","Microsoft.VisualCpp.ATL.ARM64","Microsoft.VisualStudio.Component.VC.ATL.ARM","Microsoft.VisualCpp.ATL.ARM","Microsoft.VisualStudio.Component.VC.Tools.ARM","Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources","Microsoft.VisualStudio.Graphics.Analyzer.Resources","Microsoft.Icecap.Analysis","Microsoft.VisualCpp.CRT.Redist.arm.OneCore.Desktop","Microsoft.VisualCpp.CRT.arm.Store","Microsoft.VisualCpp.CRT.arm.Desktop","Microsoft.VisualStudio.PackageGroup.VC.Tools.x64.ARM","Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetarm","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetARM.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM.Resources","Microsoft.VisualCpp.Premium.Tools.ARM.Base","Microsoft.VisualCpp.Premium.Tools.ARM.Base.Resources","Microsoft.VisualCpp.PGO.ARM","Microsoft.VisualCpp.Tools.HostX64.TargetX64","Microsoft.VisualStudio.Product.Community","Microsoft.VisualCpp.Tools.Hostx86.Targetarm","Microsoft.VisualStudio.Component.VC.Tools.ARM64","Microsoft.VisualStudio.VC.MSBuild.Arm64","Microsoft.VisualCpp.CRT.Redist.ARM64.OneCore.Desktop","Microsoft.VisualCpp.VCTip.HostX64.TargetX64","Microsoft.VisualCpp.CRT.ARM64.OneCore.Desktop","Microsoft.VisualCpp.CRT.ARM64.Store","Microsoft.VisualCpp.CRT.ARM64.Desktop","Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources","Microsoft.Icecap.Analysis.Resources","Microsoft.VisualCpp.VCTip.hostX86.targetARM","Microsoft.VisualStudio.PackageGroup.VC.Tools.x64.ARM64","Microsoft.VisualCpp.Tools.Core","Microsoft.VisualCpp.PGO.ARM64","Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetarm64","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetARM64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM64","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM64.Resources","Microsoft.VisualCpp.Premium.Tools.ARM64.Base","Microsoft.VisualCpp.Tools.HostX86.TargetX64","Microsoft.VisualCpp.Tools.HostX86.TargetARM.Resources","Microsoft.VisualCpp.CRT.Redist.ARM64","Microsoft.VisualCpp.CRT.arm.OneCore.Desktop","Microsoft.VisualCpp.CodeAnalysis.Extensions.X86","Microsoft.VisualCpp.CodeAnalysis.Extensions.X64","Microsoft.VisualCpp.VCTip.HostX64.TargetX86","Component.WixToolset.VisualStudioExtension.Dev15","WixToolset.VisualStudioExtension.Dev15","Microsoft.VisualCpp.MFC.X64","Microsoft.VisualCpp.ATL.Headers","Microsoft.VisualStudio.Component.VC.CMake.Project","Microsoft.VisualStudio.VC.CMake","Microsoft.VisualStudio.VC.CMake.Project","Microsoft.VisualStudio.Component.Windows10SDK.17763","Microsoft.VisualStudio.VC.MSBuild.Base.Resources","MLGen","Microsoft.VisualStudio.Graphics.Analyzer","Microsoft.VisualStudio.Component.TestTools.Core","Microsoft.VisualCpp.Tools.Core.x86","Microsoft.VisualCpp.CRT.x86.OneCore.Desktop","Microsoft.VisualCpp.DIA.SDK","Microsoft.VisualCpp.CRT.x64.OneCore.Desktop","Microsoft.VisualCpp.CRT.ClickOnce.Msi","Microsoft.VisualStudio.NuGet.Licenses","SQLCommon","Microsoft.VisualStudio.VC.MSBuild.X86","Microsoft.VisualCpp.Tools.HostX64.TargetARM","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources","Microsoft.VisualCpp.HTMLHelpWorkshop.Msi","Microsoft.Icecap.Collection.Msi.Resources","Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.VCTip.hostX64.targetARM","Microsoft.VisualStudio.VC.Ide.Dskx.Resources","Microsoft.VisualStudio.VC.Templates.UnitTest","Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP","Microsoft.VisualStudio.VC.Ide.Core","Microsoft.VisualStudio.Graphics.Appid","Microsoft.VisualCpp.ATL.Source","Microsoft.VisualStudio.VC.Ide.Core.Resources","Microsoft.VisualStudio.Debugger.ImmersiveActivateHelper.Msi","Microsoft.VisualStudio.Debugger.JustInTime","Microsoft.DiagnosticsHub.CpuSampling","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common","Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res","Microsoft.VisualStudio.ProTools.Resources","Microsoft.VisualStudio.Community.Msi","Microsoft.VisualCpp.Tools.HostX64.TargetARM.Resources","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent","Microsoft.Component.MSBuild","Microsoft.VisualStudio.Graphics.Msi","Microsoft.VisualStudio.WebToolsExtensions","Microsoft.VisualCpp.Tools.Hostx86.Targetarm64","Microsoft.VisualStudio.TextTemplating.MSBuild","Microsoft.VisualCpp.VCTip.hostX86.targetARM64","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine","Microsoft.VisualCpp.Tools.HostX86.TargetARM64.Resources","Microsoft.VisualStudio.RazorExtension","Microsoft.VisualCpp.CRT.x86.Store","Microsoft.VisualCpp.Tools.Core.Resources","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualCpp.MFC.Source","Microsoft.VisualCpp.CRT.x86.Desktop","Microsoft.VisualStudio.VC.MSBuild.X64","Microsoft.VisualStudio.VC.Items.Pro","Microsoft.VisualStudio.Graphics.Viewers","Microsoft.VisualCpp.CRT.x64.Desktop","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources","Microsoft.VisualCpp.MFC.Redist.X86","Microsoft.VisualStudio.WebToolsExtensions.Chip","Microsoft.DiagnosticsHub.Runtime.Resources","Microsoft.DiagnosticsHub.CpuSampling.Targeted","Microsoft.VisualStudio.VC.Ide.LanguageService.Resources","Microsoft.VisualStudio.Component.VC.DiagnosticTools","Microsoft.VisualCpp.MFC.Redist.X64","Microsoft.VisualStudio.PackageGroup.TestTools.Native","Microsoft.VisualStudio.Graphics.Viewers.Resources","Microsoft.VisualCpp.MFC.MBCS","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.Component.TextTemplating","Win10SDK_10.0.17763","Microsoft.VisualStudio.VC.Ide.Base.Resources","Microsoft.VisualCpp.MFC.MBCS.X64","Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage","Microsoft.VisualStudio.Graphics.EnableTools","Microsoft.VisualStudio.Graphics.Appid.Resources","Microsoft.VisualStudio.VC.MSBuild.Base","Microsoft.VisualStudio.VC.MSBuild.ARM","Microsoft.VisualCpp.MFC.Headers","Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop","Microsoft.VisualCpp.Tools.HostX86.TargetX86","Microsoft.VisualStudio.VC.Ide.Base","Microsoft.VisualStudio.Graphics.Analyzer.Targeted","Microsoft.VisualCpp.CRT.Headers","Microsoft.DiagnosticsHub.Runtime.Targeted","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86","Microsoft.VisualCpp.Tools.HostX64.TargetARM64","Microsoft.VisualCpp.VCTip.hostX64.targetARM64","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources","Microsoft.Icecap.Collection.Msi","Microsoft.VisualCpp.ATL.X86","Microsoft.VisualCpp.Tools.HostX64.TargetARM64.Resources","Microsoft.VisualStudio.Component.VC.ATLMFC","Microsoft.VisualCpp.VCTip.hostX86.targetX86","Microsoft.Icecap.Collection.Msi.Resources.Targeted","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86","Microsoft.VisualStudio.Component.Graphics.Tools","Microsoft.VisualStudio.WebTools.Resources","Microsoft.VisualCpp.ATL.X64","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources","Microsoft.VisualStudio.Component.Graphics.Win81","Microsoft.VisualStudio.VC.Ide.MDD","Microsoft.VisualStudio.VC.Ide.ResourceEditor","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64","Microsoft.Icecap.Analysis.Resources.Targeted","Microsoft.VisualStudio.Debugger.Script.Msi","Microsoft.VisualStudio.Component.VC.CoreIde","Microsoft.VisualStudio.VC.Ide.MFC.Resources","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualStudio.PackageGroup.VC.Tools.x86","Microsoft.VisualStudio.TextTemplating.Core","Microsoft.VisualStudio.JavaScript.LanguageService","Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources","Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources","Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest","Microsoft.VisualStudio.VC.Ide.ProjectSystem","Microsoft.VisualStudio.VC.Ide.Dskx","Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources","Microsoft.CredentialProvider","Microsoft.VisualStudio.VC.Templates.Desktop","Microsoft.VisualStudio.VC.Ide.Pro.Resources","Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core","Microsoft.VisualStudio.TextTemplating.Integration","Microsoft.VisualStudio.Component.NuGet","Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced","Microsoft.VisualCpp.PGO.Headers","Microsoft.DiagnosticsHub.Collection","Microsoft.Icecap.Collection.Msi.Targeted","Microsoft.VisualStudio.VC.Ide.LanguageService","Microsoft.VisualStudio.WebTools.WSP.FSA","Microsoft.VisualStudio.Graphics.Msi","Microsoft.VisualCpp.CRT.Redist.X86","Microsoft.VisualStudio.Branding.Community","Microsoft.VisualStudio.VC.Ide.x64","Microsoft.VisualStudio.WebToolsExtensions.Common","Microsoft.VisualStudio.WebTools.MSBuild","Microsoft.VisualStudio.NuGet.Core","Microsoft.DiagnosticsHub.Collection.Service","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources","Microsoft.CodeAnalysis.ExpressionEvaluator","Microsoft.VisualCpp.CRT.Redist.X64","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VS.VC.MSBuild.X64.Resources","Microsoft.VisualCpp.CRT.Source","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources","Microsoft.VisualStudio.VC.Ide.WinXPlus","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.Redist.14.Latest","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64","Microsoft.VisualCpp.CRT.Redist.Resources","Microsoft.VisualCpp.Redist.14.Latest","Microsoft.Net.4.TargetingPack","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualCpp.CRT.x64.Store","Microsoft.VisualStudio.VC.Ide.Debugger.Resources","Microsoft.DiaSymReader.Native","Microsoft.VisualCpp.Redist.14","Microsoft.VisualCpp.Redist.14","Microsoft.VisualStudio.StaticAnalysis","Microsoft.VisualStudio.TestTools.TeamFoundationClient","Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI","Microsoft.VisualStudio.VC.Ide.Common","Microsoft.VisualStudio.Community.Extra.Resources","Microsoft.VisualStudio.Component.Roslyn.LanguageServices","Microsoft.DiagnosticsHub.Collection.StopService.Install","Microsoft.VisualStudio.InteractiveWindow","Microsoft.PackageGroup.DiagnosticsHub.Platform","Microsoft.VisualStudio.StaticAnalysis.Resources","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.VC.Ide.Common.Resources","Microsoft.VisualCpp.Tools.HostX64.TargetX86","Microsoft.VisualStudio.VC.DevCmd","Microsoft.VisualStudio.Community.Extra","Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestTools","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources","Microsoft.VisualStudio.PackageGroup.TestTools.Core","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI","Microsoft.VisualStudio.Component.VC.Tools.x86.x64","Microsoft.VisualStudio.TestTools.Pex.Common","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy","Microsoft.VisualStudio.PackageGroup.MinShell.Interop","Microsoft.CodeAnalysis.ExpressionEvaluator.Resources","Microsoft.VisualCpp.CodeAnalysis.Extensions","Microsoft.VisualStudio.PackageGroup.CoreEditor","Microsoft.VisualStudio.Component.Roslyn.Compiler","Microsoft.VisualStudio.ScriptedHost.Targeted","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional","Microsoft.VisualStudio.Debugger.Resources","Microsoft.VisualStudio.Debugger.Parallel","Microsoft.VisualStudio.Debugger.Parallel.Resources","Microsoft.VisualCpp.PGO.X64","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE","Microsoft.VisualStudio.GraphModel","Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors","sqlsysclrtypes","Microsoft.VisualStudio.ProTools","Component.Microsoft.VisualStudio.RazorExtension","Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI","Microsoft.Build.Dependencies","Microsoft.VisualStudio.WebTools.WSP.FSA.Resources","Microsoft.VisualStudio.Component.Static.Analysis.Tools","Microsoft.VisualStudio.VC.Ide.ATL.Resources","Microsoft.VisualStudio.VC.Templates.UnitTest.Resources","Microsoft.VisualStudio.Debugger.Managed","Microsoft.VisualStudio.Workload.NativeDesktop","Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest","Microsoft.VisualStudio.Debugger.JustInTime.Msi","Microsoft.Net.PackageGroup.4.6.1.Redist","Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost","sqlsysclrtypes","Microsoft.VisualStudio.Debugger.Managed.Resources","Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common","Microsoft.VisualStudio.VC.Ide.Debugger","Microsoft.VisualStudio.AppResponsiveness","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.TestTools.TestWIExtension","Microsoft.VisualStudio.VC.Ide.Pro","Microsoft.VisualStudio.PackageGroup.Debugger.Core","Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express","Microsoft.VisualStudio.WebTools","Microsoft.VisualStudio.Component.VC.Redist.14.Latest","Microsoft.VisualStudio.VsDevCmd.Core.WinSdk","Microsoft.VisualStudio.TestTools.TestPlatform.IDE","Microsoft.VisualStudio.TextTemplating.Integration.Resources","Microsoft.VisualStudio.Debugger.CollectionAgents","Microsoft.VisualStudio.Debugger","Microsoft.VisualStudio.PackageGroup.Debugger.Script","Microsoft.VisualStudio.VC.MSVCDis","Microsoft.VisualStudio.ScriptedHost","Microsoft.VisualStudio.ClientDiagnostics.Targeted","Microsoft.VisualStudio.ScriptedHost.Resources","Microsoft.TeamFoundation.OfficeIntegration.Resources","Microsoft.IntelliTrace.DiagnosticsHub","Microsoft.VisualStudio.JavaScript.LanguageService.Resources","Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest","Microsoft.VisualStudio.PackageGroup.Community","Microsoft.VisualStudio.ClientDiagnostics","Microsoft.VisualStudio.Component.Windows10SDK.17134","Microsoft.VisualStudio.PackageGroup.Core","PortableFacades","Microsoft.DiaSymReader","Microsoft.DiagnosticsHub.Runtime","Microsoft.VisualStudio.Component.CoreEditor","Microsoft.VisualStudio.AppResponsiveness.Targeted","Microsoft.VisualStudio.AppResponsiveness.Resources","Microsoft.VisualStudio.Community","Microsoft.TeamFoundation.OfficeIntegration","Microsoft.VisualStudio.WebSiteProject.DTE","Microsoft.VisualStudio.ClientDiagnostics.Resources","Microsoft.VisualStudio.ProjectSystem.Full","Microsoft.VisualStudio.ProjectSystem","Microsoft.VisualCpp.Tools.Common.UtilsPrereq","Microsoft.IntelliTrace.CollectorCab","Microsoft.VisualStudio.Community.Resources","Microsoft.VisualCpp.Tools.Common.Utils","Microsoft.ServiceHub","Microsoft.VisualStudio.Editors","Microsoft.VisualStudio.TeamExplorer","Microsoft.CodeAnalysis.VisualStudio.InteractiveComponents.Resources","Microsoft.VisualStudio.MinShell.Interop.Msi","Microsoft.VisualStudio.GraphProvider","Microsoft.CodeAnalysis.VisualStudio.InteractiveComponents","Microsoft.CodeAnalysis.VisualStudio.Setup.Interactive.Resources","Microsoft.CodeAnalysis.VisualStudio.Setup.Resources","Microsoft.VisualStudio.Community.x86","Microsoft.VisualStudio.Community.x64","Microsoft.CodeAnalysis.VisualStudio.Setup","Microsoft.NuGet.Build.Tasks","Microsoft.PackageGroup.ClientDiagnostics","Microsoft.CodeAnalysis.Compilers.Resources","Microsoft.CodeAnalysis.Compilers","Microsoft.VisualCpp.Tools.Common.Utils.Resources","Microsoft.VisualStudio.Net.Eula.Resources","Microsoft.VisualStudio.PackageGroup.CommunityCore","Microsoft.Build","Microsoft.VisualStudio.VC.Ide.TestAdapterForBoostTest","Microsoft.VisualStudio.VC.Ide.ATL","Microsoft.VisualStudio.TextMateGrammars","Microsoft.VisualStudio.Workload.CoreEditor","Microsoft.VisualStudio.MinShell.Interop","Microsoft.Build.FileTracker.Msi","Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core","Microsoft.MSHtml","Microsoft.VisualStudio.Community.Msi.Resources","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips","Microsoft.VisualStudio.Devenv.Msi","Microsoft.VisualStudio.Component.VC.ATL","Microsoft.VisualStudio.VC.Templates.Pro","Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop","Microsoft.VisualStudio.SLNX.VSIX","Microsoft.VisualStudio.CoreEditor","Win10SDK_10.0.17134","Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk","Microsoft.VisualStudio.Component.Debugger.JustInTime","Microsoft.VisualStudio.VC.Ide.MFC","Microsoft.VisualStudio.VsDevCmd.Core.DotNet","Microsoft.VisualStudio.PackageGroup.VsDevCmd","Microsoft.VisualStudio.Finalizer","Microsoft.VisualStudio.VirtualTree","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.ProjectServices","Microsoft.VisualStudio.VC.DevCmd.Resources","Microsoft.VisualStudio.MinShell","Microsoft.VisualStudio.PackageGroup.Progression","Microsoft.VisualStudio.PerformanceProvider","Microsoft.VisualStudio.Connected.Resources","Microsoft.VisualStudio.Log","Microsoft.VisualStudio.PackageGroup.TeamExplorer","Microsoft.VisualStudio.Log.Targeted","Microsoft.VisualStudio.MinShell.Platform","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.VC.Templates.Pro.Resources","Microsoft.VisualStudio.Devenv","Microsoft.VisualCpp.VCTip.hostX86.targetX64","Microsoft.VisualStudio.Devenv.Resources","Microsoft.VisualStudio.MinShell.Platform.Resources","Microsoft.VisualStudio.Connected","Microsoft.VisualStudio.MefHosting","Microsoft.DiagnosticsHub.Collection.StopService.Uninstall","Microsoft.VisualStudio.PackageGroup.MinShell","Microsoft.VisualStudio.MefHosting.Resources","Microsoft.VisualCpp.MFC.X86","Microsoft.VisualStudio.Log.Resources","Microsoft.Icecap.Analysis.Targeted","Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources","Microsoft.VisualCpp.PGO.X86","Microsoft.VisualStudio.ExtensionManager","Microsoft.VisualStudio.MinShell.x86","Microsoft.VisualStudio.MinShell.Msi","Microsoft.VisualStudio.Setup.Configuration","Microsoft.VisualStudio.LanguageServer","Microsoft.VisualStudio.NativeImageSupport","Microsoft.VisualStudio.MinShell.Msi.Resources","Microsoft.VisualStudio.Devenv.Config","Microsoft.VisualStudio.MinShell.Resources","Microsoft.VisualStudio.Initializer","Microsoft.Net.PackageGroup.4.6.Redist"]}] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Express.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Express.txt deleted file mode 100644 index c4b3b5f2b0163..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Express.txt +++ /dev/null @@ -1 +0,0 @@ -[{"path":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\WDExpress","version":"15.9.28307.858","packages":["Microsoft.VisualStudio.Product.WDExpress","Microsoft.VisualStudio.Workload.WDExpress","Microsoft.VisualStudio.Component.Windows10SDK.17763","MLGen","Win10SDK_10.0.17763","Microsoft.VisualStudio.Component.Windows10SDK.14393","Win10SDK_10.0.14393.795","Microsoft.VisualStudio.VC.Items.Pro","Microsoft.VisualStudio.VC.Ide.Pro","Microsoft.VisualStudio.VC.Ide.Pro.Resources","Microsoft.VisualStudio.Component.VC.Tools.ARM64","Microsoft.VisualStudio.VC.MSBuild.Arm64","Microsoft.VisualCpp.CRT.Redist.ARM64.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.ARM64","Microsoft.VisualCpp.CRT.ARM64.OneCore.Desktop","Microsoft.VisualCpp.CRT.ARM64.Store","Microsoft.VisualCpp.CRT.ARM64.Desktop","Microsoft.VisualCpp.Tools.Hostx86.Targetarm64","Microsoft.VisualCpp.VCTip.hostX86.targetARM64","Microsoft.VisualCpp.Tools.HostX86.TargetARM64.Resources","Microsoft.VisualStudio.Component.VC.Tools.ARM","Microsoft.VisualCpp.Tools.Hostx86.Targetarm","Microsoft.VisualCpp.VCTip.hostX86.targetARM","Microsoft.VisualCpp.Tools.HostX86.TargetARM.Resources","Microsoft.VisualCpp.CRT.x86.Store","Microsoft.VisualCpp.CRT.x86.OneCore.Desktop","Microsoft.VisualCpp.CRT.x64.Store","Microsoft.VisualCpp.CRT.x64.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.arm.OneCore.Desktop","Microsoft.VisualCpp.CRT.arm.OneCore.Desktop","Microsoft.VisualCpp.CRT.arm.Store","Microsoft.VisualCpp.CRT.arm.Desktop","Microsoft.VisualStudio.VC.Templates.UnitTest","Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP","Microsoft.VisualStudio.VC.Templates.UnitTest.Resources","Microsoft.VisualStudio.VC.Templates.Desktop","Microsoft.VisualStudio.VC.Templates.Pro","Microsoft.VisualStudio.VC.Templates.Pro.Resources","Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express","Microsoft.VisualStudio.PackageGroup.Debugger.Script","Microsoft.VisualStudio.JavaScript.LanguageService","Microsoft.VisualStudio.JavaScript.LanguageService.Resources","Microsoft.VisualStudio.Debugger.Script.Msi","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualStudio.VC.MSBuild.X64","Microsoft.VS.VC.MSBuild.X64.Resources","Microsoft.VisualStudio.VC.MSBuild.ARM","Microsoft.VisualStudio.VC.MSBuild.X86","Microsoft.VisualStudio.VC.MSBuild.Base","Microsoft.VisualStudio.VC.MSBuild.Base.Resources","Microsoft.VisualStudio.VC.Ide.WinXPlus","Microsoft.VisualStudio.VC.Ide.Dskx","Microsoft.VisualStudio.VC.Ide.Dskx.Resources","Microsoft.VisualStudio.VC.Ide.Core","Microsoft.VisualStudio.VC.Ide.Core.Resources","Microsoft.VisualStudio.VC.Ide.Base","Microsoft.VisualStudio.VC.Ide.Base.Resources","Microsoft.VisualStudio.Component.VC.CLI.Support","Microsoft.VisualCpp.CLI.X86","Microsoft.VisualCpp.CLI.X64","Microsoft.VisualCpp.CLI.Source","Microsoft.VisualCpp.CLI.ARM64","Microsoft.VisualCpp.CLI.ARM","Microsoft.VisualStudio.VC.Templates.CLR","Microsoft.VisualStudio.VC.Ide.LanguageService","Microsoft.VisualStudio.VC.Ide.ResourceEditor","Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources","Microsoft.VisualStudio.VC.Ide.ProjectSystem","Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources","Microsoft.VisualStudio.VC.Ide.LanguageService.Resources","Microsoft.VisualStudio.VC.Templates.CLR.Resources","Microsoft.Component.VC.Runtime.OSSupport","Microsoft.Windows.UniversalCRT.Tools.Msi","Microsoft.Windows.UniversalCRT.Tools.Msi","Microsoft.Windows.UniversalCRT.ExtensionSDK.Msi","Microsoft.Windows.UniversalCRT.HeadersLibsSources.Msi","Microsoft.VisualStudio.PackageGroup.VC.Tools.x86","Microsoft.VisualCpp.Tools.HostX86.TargetX64","Microsoft.VisualCpp.VCTip.hostX86.targetX64","Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Tools.HostX86.TargetX86","Microsoft.VisualCpp.VCTip.hostX86.targetX86","Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources","Microsoft.VisualCpp.Tools.Core.Resources","Microsoft.VisualCpp.Tools.Core.x86","Microsoft.VisualCpp.Tools.Common.Utils","Microsoft.VisualCpp.Tools.Common.Utils.Resources","Microsoft.VisualCpp.DIA.SDK","Microsoft.VisualCpp.CRT.x86.Desktop","Microsoft.VisualCpp.CRT.x64.Desktop","Microsoft.VisualCpp.CRT.Source","Microsoft.VisualCpp.CRT.Redist.X86","Microsoft.VisualCpp.CRT.Redist.X64","Microsoft.VisualCpp.CRT.Redist.Resources","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.CRT.Headers","Microsoft.Component.HelpViewer","Microsoft.HelpViewer","Microsoft.VisualStudio.Help.Configuration.Msi","Microsoft.VisualStudio.Component.SQL.DataSources","Microsoft.VisualStudio.Component.SQL.SSDT","Microsoft.VisualStudio.Component.SQL.CMDUtils","sqlcmdlnutils","Microsoft.VisualStudio.Component.Common.Azure.Tools","Microsoft.VisualStudio.Azure.CommonAzureTools","SSDT","Microsoft.VisualStudio.Component.SQL.ADAL","sql_adalsql","Microsoft.VisualStudio.Component.NuGet","Microsoft.CredentialProvider","Microsoft.VisualStudio.NuGet.Licenses","Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime","Microsoft.VisualStudio.Component.SQL.NCLI","sqllocaldb","sqlncli","Microsoft.VisualStudio.Component.EntityFramework","Microsoft.VisualStudio.PackageGroup.DslRuntime","Microsoft.VisualStudio.Dsl.Core","Microsoft.VisualStudio.Dsl.GraphObject","Microsoft.VisualStudio.Dsl.Core.Resources","Microsoft.VisualStudio.EntityFrameworkTools","Microsoft.VisualStudio.EntityFrameworkTools.Msi","Microsoft.VisualStudio.Component.Roslyn.LanguageServices","Microsoft.VisualStudio.InteractiveWindow","Microsoft.DiaSymReader.Native","Microsoft.VisualStudio.Component.Static.Analysis.Tools","Microsoft.VisualCpp.Redist.14","Microsoft.VisualCpp.Redist.14","Microsoft.VisualStudio.StaticAnalysis","Microsoft.VisualStudio.StaticAnalysis.Resources","Microsoft.CodeAnalysis.VisualStudio.InteractiveComponents.Resources","Microsoft.CodeAnalysis.VisualStudio.InteractiveComponents","Microsoft.CodeAnalysis.VisualStudio.Setup.Interactive.Resources","Microsoft.Net.ComponentGroup.TargetingPacks.Common","Microsoft.Net.Component.4.6.TargetingPack","Microsoft.Net.4.6.TargetingPack","Microsoft.Net.Component.4.5.2.TargetingPack","Microsoft.Net.4.5.2.TargetingPack","Microsoft.Net.Component.4.5.1.TargetingPack","Microsoft.Net.4.5.1.TargetingPack","Microsoft.Net.Component.4.5.TargetingPack","Microsoft.Net.4.5.TargetingPack","Microsoft.Net.Component.4.TargetingPack","Microsoft.Net.4.TargetingPack","Microsoft.Net.ComponentGroup.DevelopmentPrerequisites","Microsoft.Net.Component.4.6.1.TargetingPack","Microsoft.Net.4.6.1.TargetingPack","Microsoft.Net.Cumulative.TargetingPack.Resources","Microsoft.Net.Component.4.6.1.SDK","Microsoft.Net.4.6.1.SDK","Microsoft.VisualStudio.Component.TextTemplating","Microsoft.VisualStudio.TextTemplating.MSBuild","Microsoft.VisualStudio.TextTemplating.Integration","Microsoft.VisualStudio.TextTemplating.Core","Microsoft.VisualStudio.TextTemplating.Integration.Resources","Microsoft.VisualStudio.Component.VisualStudioData","Microsoft.VisualStudio.Component.SQL.CLR","Microsoft.VisualStudio.ProTools","sqlsysclrtypes","sqlsysclrtypes","SQLCommon","Microsoft.VisualStudio.ProTools.Resources","Microsoft.VisualStudio.XamlDiagnostics","Microsoft.VisualStudio.XamlDiagnostics.Resources","Microsoft.VisualStudio.XamlDesigner","Microsoft.VisualStudio.XamlDesigner.Resources","Microsoft.VisualStudio.XamlDesigner.Executables","Microsoft.VisualStudio.XamlShared","Microsoft.VisualStudio.XamlShared.Resources","Microsoft.VisualStudio.PackageGroup.TestTools.Managed","Microsoft.VisualStudio.PackageGroup.IntelliTrace.Core","Microsoft.IntelliTrace.Core","Microsoft.IntelliTrace.Core.Targeted","Microsoft.IntelliTrace.ProfilerProxy.Msi.x64","Microsoft.IntelliTrace.ProfilerProxy.Msi","Microsoft.VisualStudio.NuGet.Core","Microsoft.VisualStudio.TestWindow.SourceBasedTestDiscovery","Microsoft.VisualStudio.TestWindow.Dotnet","Microsoft.VisualStudio.TestTools.TestGeneration","Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage","Microsoft.VisualStudio.PackageGroup.TestTools.Enterprise","Microsoft.VisualStudio.PackageGroup.TestTools.MSTestV2.Managed","Microsoft.VisualStudio.TestTools.MSTestV2.WizardExtension.UnitTest","Microsoft.VisualStudio.PackageGroup.TestTools.Core","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI","Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI","Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI","Microsoft.VisualStudio.TestTools.Pex.Common","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy","Microsoft.VisualStudio.PackageGroup.MinShell.Interop","Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi","Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestTools","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common","Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE","Microsoft.VisualStudio.TestTools.TestWIExtension","Microsoft.VisualStudio.TestTools.TestPlatform.IDE","Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors","Microsoft.Component.ClickOnce","Microsoft.VisualStudio.PackageGroup.ClickOnce.MSBuild","Microsoft.VisualCpp.CRT.ClickOnce.Msi","Microsoft.ClickOnce.SignTool.Msi","Microsoft.SQL.ClickOnceBootstrapper.Msi","Microsoft.Net.ClickOnceBootstrapper","Microsoft.ClickOnce.BootStrapper.Msi.Resources","Microsoft.ClickOnce.BootStrapper.Msi","Microsoft.VisualStudio.WebTools.WSP.FSA","Microsoft.VisualStudio.WebTools.WSP.FSA.Resources","Microsoft.VisualStudio.PackageGroup.Community","Microsoft.VisualStudio.Community.Extra.Resources","Microsoft.VisualStudio.Community.Extra","Microsoft.VisualStudio.PackageGroup.Core","Microsoft.VisualStudio.TestTools.TeamFoundationClient","Microsoft.VisualStudio.PackageGroup.Debugger.Core","Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost","Microsoft.VisualStudio.VC.Ide.Debugger","Microsoft.VisualStudio.VC.Ide.Debugger.Resources","Microsoft.VisualStudio.VC.Ide.Common","Microsoft.VisualStudio.VC.Ide.Common.Resources","Microsoft.VisualStudio.Debugger.Parallel","Microsoft.VisualStudio.Debugger.Parallel.Resources","Microsoft.VisualStudio.Debugger.CollectionAgents","Microsoft.VisualStudio.Debugger.Managed","Microsoft.CodeAnalysis.VisualStudio.Setup.Resources","Microsoft.CodeAnalysis.VisualStudio.Setup","Microsoft.CodeAnalysis.ExpressionEvaluator.Resources","Microsoft.CodeAnalysis.ExpressionEvaluator","Microsoft.VisualStudio.Debugger.Managed.Resources","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.Debugger","Microsoft.VisualStudio.VC.MSVCDis","Microsoft.VisualStudio.ScriptedHost","Microsoft.VisualStudio.ScriptedHost.Targeted","Microsoft.VisualStudio.ScriptedHost.Resources","Microsoft.IntelliTrace.DiagnosticsHub","Microsoft.VisualStudio.Debugger.Resources","Microsoft.PackageGroup.ClientDiagnostics","Microsoft.VisualStudio.AppResponsiveness","Microsoft.VisualStudio.AppResponsiveness.Targeted","Microsoft.VisualStudio.AppResponsiveness.Resources","Microsoft.VisualStudio.ClientDiagnostics","Microsoft.VisualStudio.ClientDiagnostics.Targeted","Microsoft.VisualStudio.ClientDiagnostics.Resources","Microsoft.VisualStudio.PackageGroup.CommunityCore","Microsoft.VisualStudio.ProjectSystem.Full","Microsoft.VisualStudio.ProjectSystem","Microsoft.VisualStudio.Community.x86","Microsoft.VisualStudio.Community.x64","Microsoft.VisualStudio.Community","Microsoft.IntelliTrace.CollectorCab","Microsoft.VisualStudio.Community.Resources","Microsoft.VisualStudio.Net.Eula.Resources","Microsoft.VisualStudio.WebSiteProject.DTE","Microsoft.MSHtml","Microsoft.VisualStudio.Community.Msi.Resources","Microsoft.VisualStudio.Community.Msi","Microsoft.VisualStudio.MinShell.Interop.Msi","Microsoft.VisualStudio.Editors","Microsoft.VisualStudio.ClickOnce.Resources","Microsoft.VisualStudio.ClickOnce","Microsoft.Component.MSBuild","Microsoft.NuGet.Build.Tasks","Microsoft.VisualStudio.Component.Roslyn.Compiler","Microsoft.CodeAnalysis.Compilers.Resources","Microsoft.CodeAnalysis.Compilers","Microsoft.Net.PackageGroup.4.6.1.Redist","Microsoft.VisualStudio.TemplateEngine","Microsoft.VisualStudio.WebToolsExtensions.Common","Microsoft.NET.Sdk","Microsoft.VisualStudio.PackageGroup.TestTools.Templates.Managed","Microsoft.VisualStudio.TestTools.Templates.Managed","Microsoft.VisualStudio.TestTools.Templates.Managed.Resources","Microsoft.VisualStudio.Templates.VB.MSTestv2.Desktop.UnitTest","Microsoft.VisualStudio.Templates.CS.MSTestv2.Desktop.UnitTest","Microsoft.VisualStudio.Templates.VB.Wpf","Microsoft.VisualStudio.Templates.VB.Wpf.Resources","Microsoft.VisualStudio.Templates.VB.Winforms","Microsoft.VisualStudio.Templates.VB.ManagedCore","Microsoft.VisualStudio.Templates.VB.Shared","Microsoft.VisualStudio.Templates.VB.Shared.Resources","Microsoft.VisualStudio.Templates.VB.ManagedCore.Resources","Microsoft.VisualStudio.Templates.CS.GettingStarted.Desktop.Package","Microsoft.VisualStudio.Templates.GetStarted.Desktop.Setup","Microsoft.VisualStudio.Templates.CS.GettingStarted.Console.Package","Microsoft.VisualStudio.Templates.GetStarted.Resources","Microsoft.VisualStudio.Templates.GetStarted.Common.Setup","Microsoft.VisualStudio.Templates.GetStarted.Console.Setup","Microsoft.VisualStudio.Templates.CS.Wpf","Microsoft.VisualStudio.Templates.CS.Wpf.Resources","Microsoft.VisualStudio.Templates.CS.Winforms","Microsoft.VisualStudio.Templates.CS.ManagedCore","Microsoft.VisualStudio.Templates.CS.Shared","Microsoft.VisualStudio.Templates.Editorconfig.Wizard.Setup","Templates.Editorconfig.SolutionFile.Setup","Microsoft.VisualStudio.Templates.CS.Shared.Resources","Microsoft.VisualStudio.Templates.CS.ManagedCore.Resources","Microsoft.VisualStudio.Component.CoreEditor","Microsoft.VisualStudio.PackageGroup.CoreEditor","PortableFacades","Microsoft.VisualStudio.PackageGroup.VsDevCmd","Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk","Microsoft.VisualStudio.VsDevCmd.Core.WinSdk","Microsoft.VisualStudio.VsDevCmd.Core.DotNet","Microsoft.VisualStudio.VC.DevCmd","Microsoft.VisualStudio.VC.DevCmd.Resources","Microsoft.VisualStudio.VirtualTree","Microsoft.VisualStudio.PackageGroup.Progression","Microsoft.VisualStudio.PerformanceProvider","Microsoft.VisualStudio.GraphModel","Microsoft.VisualStudio.GraphProvider","Microsoft.DiaSymReader","Microsoft.Build.Dependencies","Microsoft.Build.FileTracker.Msi","Microsoft.Build","Microsoft.VisualStudio.TextMateGrammars","Microsoft.VisualStudio.PackageGroup.TeamExplorer","Microsoft.TeamFoundation.OfficeIntegration","Microsoft.TeamFoundation.OfficeIntegration.Resources","Microsoft.VisualStudio.TeamExplorer","Microsoft.ServiceHub","Microsoft.VisualStudio.ProjectServices","Microsoft.VisualStudio.SLNX.VSIX","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.PackageGroup.MinShell","Microsoft.VisualStudio.MinShell.Interop","Microsoft.VisualStudio.Log","Microsoft.VisualStudio.Log.Targeted","Microsoft.VisualStudio.Log.Resources","Microsoft.VisualStudio.Finalizer","Microsoft.VisualStudio.WDExpress","Microsoft.VisualStudio.WDExpress.Resources","Microsoft.VisualStudio.CoreEditor","Microsoft.VisualStudio.Connected","Microsoft.VisualStudio.Connected.Resources","Microsoft.VisualStudio.MinShell","Microsoft.VisualStudio.Setup.Configuration","Microsoft.VisualStudio.MinShell.Platform","Microsoft.VisualStudio.MinShell.Platform.Resources","Microsoft.VisualStudio.MefHosting","Microsoft.VisualStudio.MefHosting.Resources","Microsoft.VisualStudio.Initializer","Microsoft.VisualStudio.ExtensionManager","Microsoft.VisualStudio.MinShell.x86","Microsoft.VisualStudio.NativeImageSupport","Microsoft.VisualStudio.MinShell.Msi","Microsoft.VisualStudio.MinShell.Msi.Resources","Microsoft.VisualStudio.LanguageServer","Microsoft.VisualStudio.MinShell.Resources","Microsoft.Net.PackageGroup.4.6.Redist","Microsoft.VisualStudio.Branding.WDExpress"]}] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Unusable.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Unusable.txt deleted file mode 100644 index fc0a257f44783..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2017_Unusable.txt +++ /dev/null @@ -1 +0,0 @@ -[{"path":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildToolsUnusable","version":"15.9.28307.665","packages":["Microsoft.VisualStudio.Product.BuildTools","Microsoft.VisualStudio.Component.Windows10SDK.17134","Win10SDK_10.0.17134","Microsoft.VisualStudio.Component.VC.Tools.x86.x64","Microsoft.VisualCpp.CodeAnalysis.Extensions","Microsoft.VisualCpp.CodeAnalysis.Extensions.X86","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources","Microsoft.VisualCpp.CodeAnalysis.Extensions.X64","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources","Microsoft.VisualStudio.Component.Static.Analysis.Tools","Microsoft.VisualStudio.StaticAnalysis","Microsoft.VisualStudio.StaticAnalysis.Resources","Microsoft.VisualCpp.Tools.HostX64.TargetX86","Microsoft.VisualCpp.VCTip.HostX64.TargetX86","Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources","Microsoft.VisualCpp.Tools.HostX64.TargetX64","Microsoft.VisualCpp.VCTip.HostX64.TargetX64","Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64","Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources","Microsoft.VisualCpp.PGO.X86","Microsoft.VisualCpp.PGO.X64","Microsoft.VisualCpp.PGO.Headers","Microsoft.VisualCpp.CRT.x86.Store","Microsoft.VisualCpp.CRT.x86.OneCore.Desktop","Microsoft.VisualCpp.CRT.x64.Store","Microsoft.VisualCpp.CRT.x64.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop","Microsoft.VisualCpp.CRT.ClickOnce.Msi","Microsoft.VisualStudio.PackageGroup.VC.Tools.x86","Microsoft.VisualCpp.Tools.HostX86.TargetX64","Microsoft.VisualCpp.VCTip.hostX86.targetX64","Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Tools.HostX86.TargetX86","Microsoft.VisualCpp.VCTip.hostX86.targetX86","Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources","Microsoft.VisualCpp.Tools.Core.Resources","Microsoft.VisualCpp.Tools.Core.x86","Microsoft.VisualCpp.Tools.Common.Utils","Microsoft.VisualCpp.Tools.Common.Utils.Resources","Microsoft.VisualCpp.DIA.SDK","Microsoft.VisualCpp.CRT.x86.Desktop","Microsoft.VisualCpp.CRT.x64.Desktop","Microsoft.VisualCpp.CRT.Source","Microsoft.VisualCpp.CRT.Redist.X86","Microsoft.VisualCpp.CRT.Redist.X64","Microsoft.VisualCpp.CRT.Redist.Resources","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.Redist.14","Microsoft.VisualCpp.Redist.14","Microsoft.VisualCpp.CRT.Headers","Microsoft.VisualStudio.Workload.MSBuildTools","Microsoft.VisualStudio.Component.CoreBuildTools","Microsoft.VisualStudio.Setup.Configuration","Microsoft.VisualStudio.PackageGroup.VsDevCmd","Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk","Microsoft.VisualStudio.VsDevCmd.Core.WinSdk","Microsoft.VisualStudio.VsDevCmd.Core.DotNet","Microsoft.VisualStudio.VC.DevCmd","Microsoft.VisualStudio.VC.DevCmd.Resources","Microsoft.VisualStudio.BuildTools.Resources","Microsoft.VisualStudio.Net.Eula.Resources","Microsoft.Build.Dependencies","Microsoft.Build.FileTracker.Msi","Microsoft.Component.MSBuild","Microsoft.PythonTools.BuildCore.Vsix","Microsoft.NuGet.Build.Tasks","Microsoft.VisualStudio.Component.Roslyn.Compiler","Microsoft.CodeAnalysis.Compilers.Resources","Microsoft.CodeAnalysis.Compilers","Microsoft.Net.PackageGroup.4.6.1.Redist","Microsoft.Net.4.6.1.FullRedist.NonThreshold","Microsoft.Windows.UniversalCRT.Msu.81","Microsoft.VisualStudio.NativeImageSupport","Microsoft.Build"]}] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_BuildTools_minimal.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_BuildTools_minimal.txt deleted file mode 100644 index f07d254164882..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_BuildTools_minimal.txt +++ /dev/null @@ -1 +0,0 @@ -[{"path":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools","version":"16.1.28922.388","packages":["Microsoft.VisualStudio.Product.BuildTools","Microsoft.VisualStudio.Component.VC.CoreIde","Microsoft.VisualStudio.VC.Ide.Pro","Microsoft.VisualStudio.VC.Ide.Pro.Resources","Microsoft.VisualStudio.VC.Templates.Pro","Microsoft.VisualStudio.VC.Templates.Pro.Resources","Microsoft.VisualStudio.VC.Items.Pro","Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced","Microsoft.VisualStudio.VC.Ide.MDD","Microsoft.VisualStudio.PackageGroup.Core","Microsoft.VisualStudio.CodeSense.Community","Microsoft.VisualStudio.TestTools.TeamFoundationClient","Microsoft.PackageGroup.ClientDiagnostics","Microsoft.VisualStudio.AppResponsiveness","Microsoft.VisualStudio.AppResponsiveness.Targeted","Microsoft.VisualStudio.AppResponsiveness.Resources","Microsoft.VisualStudio.ClientDiagnostics","Microsoft.VisualStudio.ClientDiagnostics.Targeted","Microsoft.VisualStudio.ClientDiagnostics.Resources","Microsoft.VisualStudio.PackageGroup.CommunityCore","Microsoft.VisualStudio.ProjectSystem.Full","Microsoft.VisualStudio.ProjectSystem","Microsoft.VisualStudio.Community.x86","Microsoft.VisualStudio.Community.x64","Microsoft.VisualStudio.Community","Microsoft.IntelliTrace.CollectorCab","Microsoft.VisualStudio.Community.Resources","Microsoft.VisualStudio.WebSiteProject.DTE","Microsoft.MSHtml","Microsoft.VisualStudio.Platform.CallHierarchy","Microsoft.VisualStudio.Community.Msi.Resources","Microsoft.VisualStudio.Community.Msi","Microsoft.VisualStudio.MinShell.Interop.Msi","Microsoft.VisualStudio.PackageGroup.CoreEditor","Microsoft.VisualStudio.VirtualTree","Microsoft.VisualStudio.PackageGroup.Progression","Microsoft.VisualStudio.PerformanceProvider","Microsoft.VisualStudio.GraphModel","Microsoft.VisualStudio.GraphProvider","Microsoft.VisualStudio.TextMateGrammars","Microsoft.VisualStudio.PackageGroup.TeamExplorer.Common","Microsoft.VisualStudio.TeamExplorer","Microsoft.ServiceHub","Microsoft.VisualStudio.ProjectServices","Microsoft.VisualStudio.OpenFolder.VSIX","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.PackageGroup.MinShell","Microsoft.VisualStudio.MinShell.Msi","Microsoft.VisualStudio.MinShell.Msi.Resources","Microsoft.VisualStudio.MinShell.Interop","Microsoft.VisualStudio.Log","Microsoft.VisualStudio.Log.Targeted","Microsoft.VisualStudio.Log.Resources","Microsoft.VisualStudio.Finalizer","Microsoft.VisualStudio.CoreEditor","Microsoft.VisualStudio.Platform.NavigateTo","Microsoft.VisualStudio.Connected","Microsoft.VisualStudio.Connected.Resources","Microsoft.VisualStudio.VC.Ide.x64","Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express","Microsoft.VisualStudio.PackageGroup.Debugger.Script","Microsoft.VisualStudio.Debugger.Script.Msi","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualStudio.VC.Ide.WinXPlus","Microsoft.VisualStudio.VC.Ide.Dskx","Microsoft.VisualStudio.VC.Ide.Dskx.Resources","Microsoft.VisualStudio.VC.Ide.Base","Microsoft.VisualStudio.VC.Ide.LanguageService","Microsoft.VisualStudio.VC.Ide.Core","Microsoft.VisualStudio.VisualC.Logging","Microsoft.VisualStudio.VC.Ide.Core.Resources","Microsoft.VisualStudio.VC.Ide.VCPkgDatabase","Microsoft.VisualStudio.VC.Ide.ResourceEditor","Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources","Microsoft.VisualStudio.VC.Ide.ProjectSystem","Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources","Microsoft.VisualStudio.VC.Ide.LanguageService.Resources","Microsoft.VisualStudio.VC.Ide.Base.Resources","Microsoft.Net.4.TargetingPack","Microsoft.VisualStudio.PackageGroup.Debugger.Core","Microsoft.VisualStudio.PackageGroup.Debugger.TimeTravel.Record","Microsoft.VisualStudio.Debugger.TimeTravel.Runtime","Microsoft.VisualStudio.Debugger.TimeTravel.Runtime","Microsoft.VisualStudio.Debugger.TimeTravel.Agent","Microsoft.VisualStudio.Debugger.TimeTravel.Record","Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost","Microsoft.VisualStudio.VC.Ide.Debugger","Microsoft.VisualStudio.VC.Ide.Debugger.Concord","Microsoft.VisualStudio.VC.Ide.Debugger.Concord.Resources","Microsoft.VisualStudio.VC.Ide.Debugger.Resources","Microsoft.VisualStudio.VC.Ide.Common","Microsoft.VisualStudio.VC.Ide.Common.Resources","Microsoft.VisualStudio.Debugger.Parallel","Microsoft.VisualStudio.Debugger.Parallel.Resources","Microsoft.VisualStudio.Debugger.CollectionAgents","Microsoft.VisualStudio.Debugger.Managed","Microsoft.DiaSymReader","Microsoft.CodeAnalysis.ExpressionEvaluator","Microsoft.VisualStudio.Debugger.Concord.Managed","Microsoft.VisualStudio.Debugger.Concord.Managed.Resources","Microsoft.VisualStudio.Debugger.Managed.Resources","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.Debugger.Concord.Remote","Microsoft.VisualStudio.Debugger.Concord.Remote.Resources","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.Debugger.Concord.Remote","Microsoft.VisualStudio.Debugger.Concord.Remote.Resources","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.Debugger","Microsoft.VisualStudio.PerfLib","Microsoft.VisualStudio.Debugger.Package.DiagHub.Client.VSx86","Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client","Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client","Microsoft.VisualStudio.VC.MSVCDis","Microsoft.VisualStudio.ScriptedHost","Microsoft.VisualStudio.ScriptedHost.Targeted","Microsoft.VisualStudio.ScriptedHost.Resources","Microsoft.VisualStudio.Editors","Microsoft.IntelliTrace.DiagnosticsHub","Microsoft.VisualStudio.MinShell","Microsoft.VisualStudio.MinShell.Platform","Microsoft.VisualStudio.MinShell.Platform.Resources","Microsoft.VisualStudio.MefHosting","Microsoft.VisualStudio.MefHosting.Resources","Microsoft.VisualStudio.Initializer","Microsoft.VisualStudio.ExtensionManager","Microsoft.VisualStudio.Platform.Editor","Microsoft.VisualStudio.Debugger.Concord","Microsoft.VisualStudio.Debugger.Concord.Resources","Microsoft.VisualStudio.Debugger.Resources","Microsoft.CodeAnalysis.VisualStudio.Setup","Microsoft.VisualStudio.Component.Windows10SDK.17134","Win10SDK_10.0.17134","Microsoft.VisualStudio.Component.VC.Tools.x86.x64","Microsoft.VisualCpp.CodeAnalysis.Extensions","Microsoft.VisualCpp.CodeAnalysis.Extensions.X86","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources","Microsoft.VisualCpp.CodeAnalysis.Extensions.X64","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources","Microsoft.VisualStudio.StaticAnalysis","Microsoft.VisualStudio.StaticAnalysis.Resources","Microsoft.VisualCpp.Tools.HostX64.TargetX86","Microsoft.VisualCpp.VCTip.HostX64.TargetX86","Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources","Microsoft.VisualCpp.Tools.HostX64.TargetX64","Microsoft.VisualCpp.VCTip.HostX64.TargetX64","Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64","Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources","Microsoft.VisualCpp.PGO.X86","Microsoft.VisualCpp.PGO.X64","Microsoft.VisualCpp.PGO.Headers","Microsoft.VisualCpp.CRT.x86.Store","Microsoft.VisualCpp.CRT.x86.OneCore.Desktop","Microsoft.VisualCpp.CRT.x64.Store","Microsoft.VisualCpp.CRT.x64.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop","Microsoft.VisualCpp.CRT.ClickOnce.Msi","Microsoft.VisualStudio.PackageGroup.VC.Tools.x86","Microsoft.VisualCpp.Tools.HostX86.TargetX64","Microsoft.VisualCpp.VCTip.hostX86.targetX64","Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Tools.HostX86.TargetX86","Microsoft.VisualCpp.VCTip.hostX86.targetX86","Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources","Microsoft.VisualCpp.Tools.Core.Resources","Microsoft.VisualCpp.Tools.Core.x86","Microsoft.VisualCpp.Tools.Common.Utils","Microsoft.VisualCpp.Tools.Common.Utils.Resources","Microsoft.VisualCpp.DIA.SDK","Microsoft.VisualCpp.CRT.x86.Desktop","Microsoft.VisualCpp.CRT.x64.Desktop","Microsoft.VisualCpp.CRT.Source","Microsoft.VisualCpp.CRT.Redist.X86","Microsoft.VisualCpp.CRT.Redist.X64","Microsoft.VisualCpp.CRT.Redist.Resources","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.Redist.14.Latest","Microsoft.VisualCpp.Redist.14.Latest","Microsoft.VisualCpp.Redist.14","Microsoft.VisualCpp.Redist.14","Microsoft.VisualCpp.CRT.Headers","Microsoft.VisualStudio.VC.MSBuild.x86.v142","Microsoft.VisualStudio.VC.MSBuild.X86","Microsoft.VisualStudio.VC.MSBuild.X64.v142","Microsoft.VisualStudio.VC.MSBuild.X64","Microsoft.VS.VC.MSBuild.X64.Resources","Microsoft.VisualStudio.VC.MSBuild.ARM.v142","Microsoft.VisualStudio.VC.MSBuild.ARM","Microsoft.VisualStudio.VC.MSBuild.Base","Microsoft.VisualStudio.VC.MSBuild.Base.Resources","Microsoft.VisualStudio.Workload.MSBuildTools","Microsoft.VisualStudio.Component.CoreBuildTools","Microsoft.VisualStudio.Setup.Configuration","Microsoft.VisualStudio.PackageGroup.VsDevCmd","Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk","Microsoft.VisualStudio.VsDevCmd.Core.WinSdk","Microsoft.VisualStudio.VsDevCmd.Core.DotNet","Microsoft.VisualStudio.VC.DevCmd","Microsoft.VisualStudio.VC.DevCmd.Resources","Microsoft.VisualStudio.BuildTools.Resources","Microsoft.VisualStudio.Net.Eula.Resources","Microsoft.Build.Dependencies","Microsoft.Build.FileTracker.Msi","Microsoft.Component.MSBuild","Microsoft.PythonTools.BuildCore.Vsix","Microsoft.NuGet.Build.Tasks","Microsoft.VisualStudio.Component.Roslyn.Compiler","Microsoft.CodeAnalysis.Compilers","Microsoft.Net.PackageGroup.4.7.2.Redist","Microsoft.VisualStudio.NativeImageSupport","Microsoft.Build","Microsoft.VisualStudio.PackageGroup.NuGet","Microsoft.VisualStudio.NuGet.BuildTools"]}] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Community_workload.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Community_workload.txt deleted file mode 100644 index 50071c25f189e..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Community_workload.txt +++ /dev/null @@ -1 +0,0 @@ -[{"path":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community","version":"16.1.28922.388","packages":["Microsoft.VisualStudio.Workload.NativeDesktop","Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest","Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest","Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest","Microsoft.VisualStudio.VC.Ide.TestAdapterForBoostTest","Microsoft.VisualStudio.Component.VC.ATL","Microsoft.VisualStudio.VC.Ide.ATL","Microsoft.VisualStudio.VC.Ide.ATL.Resources","Microsoft.VisualCpp.ATL.X86","Microsoft.VisualCpp.ATL.X64","Microsoft.VisualCpp.ATL.Source","Microsoft.VisualCpp.ATL.Headers","Microsoft.VisualStudio.Component.VC.CMake.Project","Microsoft.VisualStudio.VC.CMake","Microsoft.VisualStudio.VC.CMake.Project","Microsoft.VisualStudio.VC.ExternalBuildFramework","Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core","Microsoft.VisualStudio.PackageGroup.TestTools.Native","Microsoft.VisualStudio.Component.VC.Redist.14.Latest","Microsoft.VisualStudio.VC.Templates.UnitTest","Microsoft.VisualStudio.VC.UnitTest.Desktop.Build.Core","Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP","Microsoft.VisualStudio.VC.Templates.UnitTest.Resources","Microsoft.VisualStudio.VC.Templates.Desktop","Microsoft.VisualStudio.Component.Debugger.JustInTime","Microsoft.VisualStudio.Debugger.ImmersiveActivateHelper.Msi","Microsoft.VisualStudio.Debugger.JustInTime","Microsoft.VisualStudio.Debugger.JustInTime.Msi","Microsoft.VisualStudio.Component.Windows10SDK.17763","Win10SDK_10.0.17763","Microsoft.VisualStudio.Component.VC.DiagnosticTools","Microsoft.VisualStudio.Component.Graphics.Tools","Microsoft.VisualStudio.Component.VC.Tools.x86.x64","Microsoft.VisualCpp.CodeAnalysis.Extensions","Microsoft.VisualCpp.CodeAnalysis.Extensions.X86","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources","Microsoft.VisualCpp.CodeAnalysis.Extensions.X64","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources","Microsoft.VisualCpp.Tools.HostX64.TargetX86","Microsoft.VisualCpp.VCTip.HostX64.TargetX86","Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources","Microsoft.VisualCpp.Tools.HostX64.TargetX64","Microsoft.VisualCpp.VCTip.HostX64.TargetX64","Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64","Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources","Microsoft.VisualCpp.PGO.X86","Microsoft.VisualCpp.PGO.X64","Microsoft.VisualCpp.PGO.Headers","Microsoft.VisualCpp.CRT.x86.Store","Microsoft.VisualCpp.CRT.x86.OneCore.Desktop","Microsoft.VisualCpp.CRT.x64.Store","Microsoft.VisualCpp.CRT.x64.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop","Microsoft.VisualStudio.PackageGroup.VC.Tools.x86","Microsoft.VisualCpp.Tools.HostX86.TargetX64","Microsoft.VisualCpp.VCTip.hostX86.targetX64","Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Tools.HostX86.TargetX86","Microsoft.VisualCpp.VCTip.hostX86.targetX86","Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources","Microsoft.VisualCpp.Tools.Core.Resources","Microsoft.VisualCpp.Tools.Core.x86","Microsoft.VisualCpp.DIA.SDK","Microsoft.VisualCpp.CRT.x86.Desktop","Microsoft.VisualCpp.CRT.x64.Desktop","Microsoft.VisualCpp.CRT.Source","Microsoft.VisualCpp.CRT.Redist.X86","Microsoft.VisualCpp.CRT.Redist.X64","Microsoft.VisualCpp.CRT.Redist.Resources","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.Redist.14.Latest","Microsoft.VisualCpp.Redist.14.Latest","Microsoft.VisualCpp.CRT.Headers","Microsoft.VisualStudio.Graphics.Viewers","Microsoft.VisualStudio.Graphics.Viewers.Resources","Microsoft.VisualStudio.Graphics.Msi","Microsoft.VisualStudio.Graphics.Msi","Microsoft.VisualStudio.Graphics.Analyzer","Microsoft.VisualStudio.Graphics.Analyzer.Targeted","Microsoft.VisualStudio.Graphics.Analyzer.Resources","Microsoft.VisualStudio.Graphics.Appid","Microsoft.VisualStudio.Graphics.Appid.Resources","Microsoft.VisualStudio.Component.VC.CoreIde","Microsoft.VisualStudio.VC.Ide.Pro","Microsoft.VisualStudio.VC.Ide.Pro.Resources","Microsoft.VisualStudio.VC.Templates.Pro","Microsoft.VisualStudio.VC.Templates.Pro.Resources","Microsoft.VisualStudio.VC.Items.Pro","Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced","Microsoft.VisualStudio.VC.Ide.x64","Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express","Microsoft.VisualStudio.VC.MSBuild.X64.v142","Microsoft.VisualStudio.VC.MSBuild.X64","Microsoft.VS.VC.MSBuild.X64.Resources","Microsoft.VisualStudio.VC.MSBuild.ARM.v142","Microsoft.VisualStudio.VC.MSBuild.ARM","Microsoft.VisualStudio.VC.MSBuild.x86.v142","Microsoft.VisualStudio.VC.MSBuild.X86","Microsoft.VisualStudio.VC.MSBuild.Base","Microsoft.VisualStudio.VC.MSBuild.Base.Resources","Microsoft.VisualStudio.VC.Ide.WinXPlus","Microsoft.VisualStudio.VC.Ide.Dskx","Microsoft.VisualStudio.VC.Ide.Dskx.Resources","Microsoft.VisualStudio.VC.Ide.Base","Microsoft.VisualStudio.VC.Ide.LanguageService","Microsoft.VisualStudio.VC.Ide.Core","Microsoft.VisualStudio.VC.Ide.Core.Resources","Microsoft.VisualStudio.VC.Ide.VCPkgDatabase","Microsoft.VisualStudio.VC.Ide.ProjectSystem","Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources","Microsoft.VisualStudio.VC.Ide.LanguageService.Resources","Microsoft.VisualStudio.VC.Ide.Base.Resources","Component.Microsoft.VisualStudio.LiveShare","Microsoft.VisualStudio.LiveShare","Microsoft.Icecap.Analysis","Microsoft.Icecap.Analysis.Targeted","Microsoft.Icecap.Analysis.Resources","Microsoft.Icecap.Analysis.Resources.Targeted","Microsoft.Icecap.Collection.Msi","Microsoft.Icecap.Collection.Msi.Targeted","Microsoft.Icecap.Collection.Msi.Resources","Microsoft.Icecap.Collection.Msi.Resources.Targeted","Microsoft.DiagnosticsHub.Instrumentation","Microsoft.DiagnosticsHub.CpuSampling.ExternalDependencies","Microsoft.DiagnosticsHub.CpuSampling","Microsoft.DiagnosticsHub.CpuSampling.Targeted","Microsoft.PackageGroup.DiagnosticsHub.Platform","Microsoft.DiagnosticsHub.Runtime.ExternalDependencies","Microsoft.DiagnosticsHub.Runtime.ExternalDependencies.Targeted","Microsoft.DiagnosticsHub.Collection.ExternalDependencies.x64","Microsoft.DiagnosticsHub.Collection.StopService.Uninstall","Microsoft.DiagnosticsHub.Runtime","Microsoft.DiagnosticsHub.Runtime.Targeted","Microsoft.DiagnosticsHub.Collection","Microsoft.DiagnosticsHub.Collection.Service","Microsoft.DiagnosticsHub.Collection.StopService.Install","Microsoft.VisualStudio.Component.IntelliCode","Microsoft.VisualStudio.IntelliCode","Microsoft.Net.4.TargetingPack","Microsoft.VisualStudio.VC.Ide.ResourceEditor","Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources","Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage","Microsoft.VisualStudio.PackageGroup.TestTools.Core","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI","Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI","Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI","Microsoft.VisualStudio.TestTools.Pex.Common","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy","Microsoft.VisualStudio.PackageGroup.MinShell.Interop","Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi","Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestTools","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common","Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE","Microsoft.VisualStudio.TestTools.TestWIExtension","Microsoft.VisualStudio.TestTools.TestPlatform.IDE","Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors","Microsoft.VisualStudio.LiveShareApi","Microsoft.VisualStudio.Component.TextTemplating","Microsoft.VisualStudio.TextTemplating.MSBuild","Microsoft.VisualStudio.TextTemplating.Integration","Microsoft.VisualStudio.TextTemplating.Core","Microsoft.VisualStudio.TextTemplating.Integration.Resources","Microsoft.VisualCpp.CRT.ClickOnce.Msi","Microsoft.Component.MSBuild","Microsoft.NuGet.Build.Tasks","Microsoft.DiagnosticsHub.KB2882822.Win7","Microsoft.VisualStudio.PackageGroup.Debugger.Script","Microsoft.VisualStudio.Debugger.Script.Msi","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions","Microsoft.VisualStudio.ProTools","sqlsysclrtypes","sqlsysclrtypes","SQLCommon","Microsoft.VisualStudio.ProTools.Resources","Microsoft.VisualStudio.WebToolsExtensions","Microsoft.VisualStudio.WebTools","Microsoft.VisualStudio.WebTools.Resources","Microsoft.VisualStudio.WebTools.MSBuild","Microsoft.VisualStudio.WebTools.WSP.FSA","Microsoft.VisualStudio.WebTools.WSP.FSA.Resources","Microsoft.VisualStudio.VC.Ide.MDD","Microsoft.VisualStudio.VisualC.Logging","Microsoft.WebTools.Shared","Microsoft.WebTools.DotNet.Core.ItemTemplates","Microsoft.VisualCpp.Redist.14","Microsoft.VisualCpp.Redist.14","Microsoft.Windows.UniversalCRT.Msu.7","Microsoft.VisualStudio.StaticAnalysis","Microsoft.VisualStudio.StaticAnalysis.Resources","Microsoft.VisualStudio.Component.Roslyn.Compiler","Microsoft.CodeAnalysis.Compilers","Microsoft.VisualStudio.Component.NuGet","Microsoft.CredentialProvider","Microsoft.VisualStudio.NuGet.PowershellBindingRedirect","Microsoft.VisualStudio.NuGet.Licenses","Microsoft.VisualStudio.PackageGroup.Community","Microsoft.VisualStudio.Community.Extra.Resources","Microsoft.VisualStudio.Community.Extra","Microsoft.VisualStudio.PackageGroup.Core","Microsoft.VisualStudio.CodeSense.Community","Microsoft.VisualStudio.TestTools.TeamFoundationClient","Microsoft.VisualStudio.PackageGroup.Debugger.Core","Microsoft.VisualStudio.PackageGroup.Debugger.TimeTravel.Record","Microsoft.VisualStudio.Debugger.TimeTravel.Runtime","Microsoft.VisualStudio.Debugger.TimeTravel.Runtime","Microsoft.VisualStudio.Debugger.TimeTravel.Agent","Microsoft.VisualStudio.Debugger.TimeTravel.Record","Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost","Microsoft.VisualStudio.VC.Ide.Debugger","Microsoft.VisualStudio.VC.Ide.Debugger.Concord","Microsoft.VisualStudio.VC.Ide.Debugger.Concord.Resources","Microsoft.VisualStudio.VC.Ide.Debugger.Resources","Microsoft.VisualStudio.VC.Ide.Common","Microsoft.VisualStudio.VC.Ide.Common.Resources","Microsoft.VisualStudio.Debugger.Parallel","Microsoft.VisualStudio.Debugger.Parallel.Resources","Microsoft.VisualStudio.Debugger.CollectionAgents","Microsoft.VisualStudio.Debugger.Managed","Microsoft.CodeAnalysis.VisualStudio.Setup","Microsoft.CodeAnalysis.ExpressionEvaluator","Microsoft.VisualStudio.Debugger.Concord.Managed","Microsoft.VisualStudio.Debugger.Concord.Managed.Resources","Microsoft.VisualStudio.Debugger.Managed.Resources","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.Debugger.Remote.DbgHelp.Win8","Microsoft.VisualStudio.Debugger.Concord.Remote","Microsoft.VisualStudio.Debugger.Concord.Remote.Resources","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.Debugger.Remote.DbgHelp.Win8","Microsoft.VisualStudio.Debugger.Concord.Remote","Microsoft.VisualStudio.Debugger.Concord.Remote.Resources","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.Debugger","Microsoft.VisualStudio.Debugger.Package.DiagHub.Client.VSx86","Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client","Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client","Microsoft.VisualStudio.Debugger.DbgHelp.Win8","Microsoft.VisualStudio.VC.MSVCDis","Microsoft.VisualStudio.ScriptedHost","Microsoft.VisualStudio.ScriptedHost.Targeted","Microsoft.VisualStudio.ScriptedHost.Resources","Microsoft.IntelliTrace.DiagnosticsHub","Microsoft.VisualStudio.Debugger.Concord","Microsoft.VisualStudio.Debugger.Concord.Resources","Microsoft.VisualStudio.Debugger.Resources","Microsoft.PackageGroup.ClientDiagnostics","Microsoft.VisualStudio.AppResponsiveness","Microsoft.VisualStudio.AppResponsiveness.Targeted","Microsoft.VisualStudio.AppResponsiveness.Resources","Microsoft.VisualStudio.ClientDiagnostics","Microsoft.VisualStudio.ClientDiagnostics.Targeted","Microsoft.VisualStudio.ClientDiagnostics.Resources","Microsoft.VisualStudio.PackageGroup.CommunityCore","Microsoft.VisualStudio.ProjectSystem.Full","Microsoft.VisualStudio.ProjectSystem","Microsoft.VisualStudio.Community.x86","Microsoft.VisualStudio.Community.x64","Microsoft.VisualStudio.Community","Microsoft.IntelliTrace.CollectorCab","Microsoft.VisualStudio.Community.Resources","Microsoft.VisualStudio.Net.Eula.Resources","Microsoft.VisualStudio.WebSiteProject.DTE","Microsoft.MSHtml","Microsoft.VisualStudio.Platform.CallHierarchy","Microsoft.VisualStudio.Community.Msi.Resources","Microsoft.VisualStudio.Community.Msi","Microsoft.VisualStudio.Devenv.Msi","Microsoft.VisualStudio.MinShell.Interop.Msi","Microsoft.VisualStudio.Editors","Microsoft.VisualStudio.Product.Community","Microsoft.VisualStudio.Workload.CoreEditor","Microsoft.VisualStudio.Component.CoreEditor","Microsoft.VisualStudio.PackageGroup.CoreEditor","Microsoft.VisualCpp.Tools.Common.UtilsPrereq","Microsoft.VisualCpp.Tools.Common.Utils","Microsoft.VisualCpp.Tools.Common.Utils.Resources","Microsoft.VisualStudio.PackageGroup.VsDevCmd","Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk","Microsoft.VisualStudio.VsDevCmd.Core.WinSdk","Microsoft.VisualStudio.VsDevCmd.Core.DotNet","Microsoft.VisualStudio.VC.DevCmd","Microsoft.VisualStudio.VC.DevCmd.Resources","Microsoft.VisualStudio.VirtualTree","Microsoft.VisualStudio.PackageGroup.Progression","Microsoft.VisualStudio.PerformanceProvider","Microsoft.VisualStudio.GraphModel","Microsoft.VisualStudio.GraphProvider","Microsoft.DiaSymReader","Microsoft.Build.Dependencies","Microsoft.Build.FileTracker.Msi","Microsoft.Build","Microsoft.VisualStudio.PackageGroup.NuGet","Microsoft.VisualStudio.NuGet.Core","Microsoft.VisualStudio.TextMateGrammars","Microsoft.VisualStudio.PackageGroup.TeamExplorer.Common","Microsoft.VisualStudio.TeamExplorer","Microsoft.ServiceHub","Microsoft.VisualStudio.ProjectServices","Microsoft.VisualStudio.OpenFolder.VSIX","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.PackageGroup.MinShell","Microsoft.VisualStudio.MinShell.Interop","Microsoft.VisualStudio.Log","Microsoft.VisualStudio.Log.Targeted","Microsoft.VisualStudio.Log.Resources","Microsoft.VisualStudio.Finalizer","Microsoft.VisualStudio.Devenv","Microsoft.VisualStudio.Devenv.Resources","Microsoft.VisualStudio.CoreEditor","Microsoft.VisualStudio.Platform.NavigateTo","Microsoft.VisualStudio.Connected","Microsoft.VisualStudio.PerfLib","Microsoft.VisualStudio.Connected.Resources","Microsoft.VisualStudio.MinShell","Microsoft.VisualStudio.Setup.Configuration","Microsoft.VisualStudio.MinShell.Platform","Microsoft.VisualStudio.MinShell.Platform.Resources","Microsoft.VisualStudio.MefHosting","Microsoft.VisualStudio.MefHosting.Resources","Microsoft.VisualStudio.Initializer","Microsoft.VisualStudio.ExtensionManager","Microsoft.VisualStudio.Platform.Editor","Microsoft.VisualStudio.MinShell.x86","Microsoft.VisualStudio.NativeImageSupport","Microsoft.VisualStudio.MinShell.Msi","Microsoft.VisualStudio.MinShell.Msi.Resources","Microsoft.VisualStudio.LanguageServer","Microsoft.VisualStudio.Devenv.Config","Microsoft.VisualStudio.MinShell.Resources","Microsoft.Net.PackageGroup.4.7.2.Redist","Microsoft.Net.4.7.2.FullRedist","Microsoft.VisualStudio.Branding.Community"]}] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Preview.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Preview.txt deleted file mode 100644 index 806509e7ce865..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2019_Preview.txt +++ /dev/null @@ -1 +0,0 @@ -[{"path":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview","version":"16.0.28608.199","packages":["Microsoft.VisualStudio.Product.Enterprise","Microsoft.VisualStudio.Workload.NativeDesktop","Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest","Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest","Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest","Microsoft.VisualStudio.VC.Ide.TestAdapterForBoostTest","Microsoft.VisualStudio.Component.VC.ATL","Microsoft.VisualStudio.VC.Ide.ATL","Microsoft.VisualStudio.VC.Ide.ATL.Resources","Microsoft.VisualCpp.ATL.X86","Microsoft.VisualCpp.ATL.X64","Microsoft.VisualCpp.ATL.Source","Microsoft.VisualCpp.ATL.Headers","Microsoft.VisualStudio.Component.VC.CMake.Project","Microsoft.VisualStudio.VC.CMake","Microsoft.VisualStudio.VC.CMake.Project","Microsoft.VisualStudio.VC.ExternalBuildFramework","Microsoft.VisualStudio.Component.VC.DiagnosticTools","Microsoft.VisualStudio.Component.Graphics.Tools","Microsoft.VisualStudio.Graphics.Viewers","Microsoft.VisualStudio.Graphics.Viewers.Resources","Microsoft.VisualStudio.Graphics.EnableTools","Microsoft.VisualStudio.Graphics.Msi","Microsoft.VisualStudio.Graphics.Msi","Microsoft.VisualStudio.Graphics.Analyzer","Microsoft.VisualStudio.Graphics.Analyzer.Targeted","Microsoft.VisualStudio.Graphics.Analyzer.Resources","Microsoft.VisualStudio.Graphics.Appid","Microsoft.VisualStudio.Graphics.Appid.Resources","Microsoft.VisualStudio.Component.Windows10SDK.17763","Win10SDK_10.0.17763","Microsoft.VisualStudio.Component.VC.Tools.x86.x64","Microsoft.VisualCpp.CodeAnalysis.Extensions","Microsoft.VisualCpp.CodeAnalysis.Extensions.X86","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X86.Resources","Microsoft.VisualCpp.CodeAnalysis.Extensions.X64","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64","Microsoft.VisualCpp.CodeAnalysis.ConcurrencyCheck.X64.Resources","Microsoft.VisualCpp.Tools.HostX64.TargetX86","Microsoft.VisualCpp.VCTip.HostX64.TargetX86","Microsoft.VisualCpp.Tools.HostX64.TargetX86.Resources","Microsoft.VisualCpp.Tools.HostX64.TargetX64","Microsoft.VisualCpp.VCTip.HostX64.TargetX64","Microsoft.VisualCpp.Tools.HostX64.TargetX64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64","Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86","Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86.Resources","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64","Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64.Resources","Microsoft.VisualCpp.PGO.X86","Microsoft.VisualCpp.PGO.X64","Microsoft.VisualCpp.PGO.Headers","Microsoft.VisualCpp.CRT.x86.Store","Microsoft.VisualCpp.CRT.x86.OneCore.Desktop","Microsoft.VisualCpp.CRT.x64.Store","Microsoft.VisualCpp.CRT.x64.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop","Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop","Microsoft.VisualStudio.PackageGroup.VC.Tools.x86","Microsoft.VisualCpp.Tools.HostX86.TargetX64","Microsoft.VisualCpp.VCTip.hostX86.targetX64","Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Resources","Microsoft.VisualCpp.Tools.HostX86.TargetX86","Microsoft.VisualCpp.VCTip.hostX86.targetX86","Microsoft.VisualCpp.Tools.HostX86.TargetX86.Resources","Microsoft.VisualCpp.Tools.Core.Resources","Microsoft.VisualCpp.Tools.Core.x86","Microsoft.VisualCpp.DIA.SDK","Microsoft.VisualCpp.CRT.x86.Desktop","Microsoft.VisualCpp.CRT.x64.Desktop","Microsoft.VisualCpp.CRT.Source","Microsoft.VisualCpp.CRT.Redist.X86","Microsoft.VisualCpp.CRT.Redist.X64","Microsoft.VisualCpp.CRT.Redist.Resources","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.RuntimeDebug.14","Microsoft.VisualCpp.CRT.Headers","Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core","Microsoft.VisualStudio.PackageGroup.TestTools.Native","Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Native","Microsoft.VisualStudio.Component.ClassDesigner","Microsoft.VisualStudio.ClassDesigner","Microsoft.VisualStudio.ClassDesigner.Resources","Microsoft.VisualStudio.Component.VC.Redist.14.Latest","Microsoft.VisualCpp.Redist.14.Latest","Microsoft.VisualCpp.Redist.14.Latest","Microsoft.VisualStudio.VC.Templates.UnitTest","Microsoft.VisualStudio.VC.UnitTest.Desktop.Build.Core","Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP","Microsoft.VisualStudio.VC.Templates.UnitTest.Resources","Microsoft.VisualStudio.VC.Templates.Desktop","Microsoft.VisualStudio.Component.VC.CoreIde","Microsoft.VisualStudio.VC.Ide.Pro","Microsoft.VisualStudio.VC.Ide.Pro.Resources","Microsoft.VisualStudio.VC.Templates.Pro","Microsoft.VisualStudio.VC.Templates.Pro.Resources","Microsoft.VisualStudio.VC.Items.Pro","Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced","Microsoft.VisualStudio.VC.Ide.x64","Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express","Microsoft.VisualStudio.VC.MSBuild.X64.v142","Microsoft.VisualStudio.VC.MSBuild.X64","Microsoft.VS.VC.MSBuild.X64.Resources","Microsoft.VisualStudio.VC.MSBuild.ARM.v142","Microsoft.VisualStudio.VC.MSBuild.ARM","Microsoft.VisualStudio.VC.MSBuild.x86.v142","Microsoft.VisualStudio.VC.MSBuild.X86","Microsoft.VisualStudio.VC.MSBuild.Base","Microsoft.VisualStudio.VC.MSBuild.Base.Resources","Microsoft.VisualStudio.VC.Ide.WinXPlus","Microsoft.VisualStudio.VC.Ide.Dskx","Microsoft.VisualStudio.VC.Ide.Dskx.Resources","Microsoft.VisualStudio.VC.Ide.Base","Microsoft.VisualStudio.VC.Ide.LanguageService","Microsoft.VisualStudio.VC.Ide.Core","Microsoft.VisualStudio.VC.Ide.Core.Resources","Microsoft.VisualStudio.VC.Ide.VCPkgDatabase","Microsoft.VisualStudio.VC.Ide.Progression.Enterprise","Microsoft.VisualStudio.VC.Ide.ProjectSystem","Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine","Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources","Microsoft.VisualStudio.VC.Ide.LanguageService.Resources","Microsoft.VisualStudio.VC.Ide.Base.Resources","Microsoft.VisualStudio.Component.CodeMap","Microsoft.VisualStudio.Component.GraphDocument","Microsoft.VisualStudio.Vmp","Microsoft.VisualStudio.GraphDocument","Microsoft.VisualStudio.GraphDocument.Resources","Microsoft.VisualStudio.CodeMap","Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime","Microsoft.VisualStudio.Component.SQL.NCLI","sqllocaldb","sqlncli","Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions","Microsoft.VisualStudio.WebToolsExtensions","Microsoft.VisualStudio.WebTools","Microsoft.VisualStudio.WebTools.Resources","Microsoft.VisualStudio.WebTools.MSBuild","Microsoft.VisualStudio.PackageGroup.Debugger.Script","Microsoft.VisualStudio.Debugger.Script.Msi","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualStudio.Debugger.Script","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualStudio.Debugger.Script.Resources","Microsoft.VisualStudio.VC.Ide.MDD","Microsoft.VisualStudio.Component.NuGet","Microsoft.CredentialProvider","Component.Microsoft.VisualStudio.LiveShare","Microsoft.VisualStudio.LiveShare","Microsoft.VisualStudio.Component.Debugger.JustInTime","Microsoft.VisualStudio.Debugger.ImmersiveActivateHelper.Msi","Microsoft.VisualStudio.Debugger.JustInTime","Microsoft.VisualStudio.Debugger.JustInTime.Msi","Microsoft.VisualStudio.Component.IntelliTrace.FrontEnd","Microsoft.IntelliTrace.DiagnosticsHubAgent.Targeted","Microsoft.IntelliTrace.Debugger","Microsoft.IntelliTrace.Debugger.Targeted","Microsoft.IntelliTrace.FrontEnd","Microsoft.DiagnosticsHub.Instrumentation","Microsoft.DiagnosticsHub.CpuSampling","Microsoft.DiagnosticsHub.CpuSampling.Targeted","Microsoft.PackageGroup.DiagnosticsHub.Platform","Microsoft.DiagnosticsHub.Collection.StopService.Uninstall","Microsoft.DiagnosticsHub.Runtime","Microsoft.DiagnosticsHub.Runtime.Targeted","Microsoft.DiagnosticsHub.Runtime.Resources","Microsoft.DiagnosticsHub.Collection","Microsoft.DiagnosticsHub.Collection.Service","Microsoft.DiagnosticsHub.Collection.StopService.Install","Microsoft.VisualStudio.Dsl.GraphObject","Microsoft.Net.4.TargetingPack","Microsoft.VisualStudio.VC.Ide.ResourceEditor","Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources","Microsoft.VisualStudio.NuGet.Licenses","Microsoft.WebTools.Shared","Microsoft.VisualStudio.WebToolsExtensions.DotNet.Core.ItemTemplates","Microsoft.VisualStudio.Component.TextTemplating","Microsoft.VisualStudio.TextTemplating.MSBuild","Microsoft.VisualStudio.TextTemplating.Integration","Microsoft.VisualStudio.TextTemplating.Core","Microsoft.VisualStudio.TextTemplating.Integration.Resources","Microsoft.VisualStudio.ProTools","sqlsysclrtypes","sqlsysclrtypes","SQLCommon","Microsoft.VisualStudio.ProTools.Resources","Microsoft.VisualStudio.NuGet.Core","Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage","Microsoft.VisualStudio.PackageGroup.IntelliTrace.Core","Microsoft.IntelliTrace.Core","Microsoft.IntelliTrace.Core.Concord","Microsoft.IntelliTrace.Core.Targeted","Microsoft.IntelliTrace.ProfilerProxy.Msi.x64","Microsoft.IntelliTrace.ProfilerProxy.Msi","Microsoft.VisualStudio.TestTools.DynamicCodeCoverage","Microsoft.VisualStudio.TestTools.CodeCoverage.Msi","Microsoft.VisualStudio.TestTools.CodeCoverage","Microsoft.Icecap.Analysis","Microsoft.Icecap.Analysis.Targeted","Microsoft.Icecap.Analysis.Resources","Microsoft.Icecap.Analysis.Resources.Targeted","Microsoft.Icecap.Collection.Msi","Microsoft.Icecap.Collection.Msi.Targeted","Microsoft.Icecap.Collection.Msi.Resources","Microsoft.Icecap.Collection.Msi.Resources.Targeted","Microsoft.VisualStudio.PackageGroup.TestTools.Core","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI","Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI","Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI","Microsoft.VisualStudio.TestTools.Pex.Common","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy","Microsoft.VisualStudio.PackageGroup.MinShell.Interop","Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi","Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestTools","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Remote","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Premium","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common","Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources","Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent","Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE","Microsoft.VisualStudio.TestTools.TestWIExtension","Microsoft.VisualStudio.TestTools.TestPlatform.IDE","Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors","Microsoft.VisualStudio.TestTools.NE.Msi.Targeted","Microsoft.VisualStudio.TestTools.NetworkEmulation","Microsoft.VisualStudio.TestTools.DataCollectors","Microsoft.VisualCpp.CRT.ClickOnce.Msi","Microsoft.VisualStudio.WebTools.WSP.FSA","Microsoft.VisualStudio.WebTools.WSP.FSA.Resources","Microsoft.VisualStudio.Component.Static.Analysis.Tools","Microsoft.VisualCpp.Redist.14","Microsoft.VisualCpp.Redist.14","Microsoft.VisualStudio.StaticAnalysis","Microsoft.VisualStudio.StaticAnalysis.Resources","Microsoft.VisualStudio.PackageGroup.Community","Microsoft.VisualStudio.Community.Extra.Resources","Microsoft.VisualStudio.Community.Extra","Microsoft.VisualStudio.PackageGroup.Core","Microsoft.VisualStudio.CodeSense","Microsoft.VisualStudio.CodeSense.Community","Microsoft.VisualStudio.TestTools.TeamFoundationClient","Microsoft.VisualStudio.PackageGroup.Debugger.Core","Microsoft.VisualStudio.PackageGroup.Debugger.TimeTravel.Record","Microsoft.VisualStudio.Debugger.TimeTravel.Runtime","Microsoft.VisualStudio.Debugger.TimeTravel.Runtime","Microsoft.VisualStudio.Debugger.TimeTravel.Agent","Microsoft.VisualStudio.Debugger.TimeTravel.Record","Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost","Microsoft.VisualStudio.VC.Ide.Debugger","Microsoft.VisualStudio.VC.Ide.Debugger.Concord","Microsoft.VisualStudio.VC.Ide.Debugger.Concord.Resources","Microsoft.VisualStudio.VC.Ide.Debugger.Resources","Microsoft.VisualStudio.VC.Ide.Common","Microsoft.VisualStudio.VC.Ide.Common.Resources","Microsoft.VisualStudio.Debugger.Parallel","Microsoft.VisualStudio.Debugger.Parallel.Resources","Microsoft.VisualStudio.Debugger.CollectionAgents","Microsoft.VisualStudio.Debugger.Managed","Microsoft.VisualStudio.Debugger.Concord.Managed","Microsoft.VisualStudio.Debugger.Concord.Managed.Resources","Microsoft.VisualStudio.Debugger.Managed.Resources","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.Debugger.Concord.Remote","Microsoft.VisualStudio.Debugger.Concord.Remote.Resources","Microsoft.VisualStudio.Debugger.Remote","Microsoft.VisualStudio.Debugger.Concord.Remote","Microsoft.VisualStudio.Debugger.Concord.Remote.Resources","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.Debugger.Remote.Resources","Microsoft.VisualStudio.Debugger","Microsoft.VisualStudio.Debugger.Package.DiagHub.Client.VSx86","Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client","Microsoft.VisualStudio.Debugger.Remote.DiagHub.Client","Microsoft.VisualStudio.VC.MSVCDis","Microsoft.VisualStudio.ScriptedHost","Microsoft.VisualStudio.ScriptedHost.Targeted","Microsoft.VisualStudio.ScriptedHost.Resources","Microsoft.IntelliTrace.DiagnosticsHub","Microsoft.VisualStudio.Debugger.Concord","Microsoft.VisualStudio.Debugger.Concord.Resources","Microsoft.VisualStudio.Debugger.Resources","Microsoft.PackageGroup.ClientDiagnostics","Microsoft.VisualStudio.AppResponsiveness","Microsoft.VisualStudio.AppResponsiveness.Targeted","Microsoft.VisualStudio.AppResponsiveness.Resources","Microsoft.VisualStudio.ClientDiagnostics","Microsoft.VisualStudio.ClientDiagnostics.Targeted","Microsoft.VisualStudio.ClientDiagnostics.Resources","Microsoft.VisualStudio.PackageGroup.ProfessionalCore","Microsoft.VisualStudio.Professional","Microsoft.VisualStudio.Professional.Msi","Microsoft.VisualStudio.PackageGroup.EnterpriseCore","Microsoft.VisualStudio.Enterprise.Msi","Microsoft.VisualStudio.Enterprise","Microsoft.ShDocVw","Microsoft.VisualStudio.PackageGroup.CommunityCore","Microsoft.VisualStudio.ProjectSystem.Full","Microsoft.VisualStudio.ProjectSystem","Microsoft.VisualStudio.Community.x86","Microsoft.VisualStudio.Community.x64","Microsoft.VisualStudio.Community","Microsoft.IntelliTrace.CollectorCab","Microsoft.VisualStudio.Community.Resources","Microsoft.VisualStudio.WebSiteProject.DTE","Microsoft.MSHtml","Microsoft.VisualStudio.Platform.CallHierarchy","Microsoft.VisualStudio.Community.Msi.Resources","Microsoft.VisualStudio.Community.Msi","Microsoft.VisualStudio.Devenv.Msi","Microsoft.VisualStudio.MinShell.Interop.Msi","Microsoft.VisualStudio.Editors","Microsoft.VisualStudio.Net.Eula.Resources","Microsoft.CodeAnalysis.ExpressionEvaluator","Microsoft.CodeAnalysis.VisualStudio.Setup","Microsoft.Component.MSBuild","Microsoft.NuGet.Build.Tasks","Microsoft.VisualStudio.Component.Roslyn.Compiler","Microsoft.CodeAnalysis.Compilers","Microsoft.VisualStudio.Workload.CoreEditor","Microsoft.VisualStudio.Component.CoreEditor","Microsoft.VisualStudio.PackageGroup.CoreEditor","Microsoft.VisualCpp.Tools.Common.UtilsPrereq","Microsoft.VisualCpp.Tools.Common.Utils","Microsoft.VisualCpp.Tools.Common.Utils.Resources","Microsoft.VisualStudio.PackageGroup.VsDevCmd","Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk","Microsoft.VisualStudio.VsDevCmd.Core.WinSdk","Microsoft.VisualStudio.VsDevCmd.Core.DotNet","Microsoft.VisualStudio.VC.DevCmd","Microsoft.VisualStudio.VC.DevCmd.Resources","Microsoft.VisualStudio.VirtualTree","Microsoft.VisualStudio.PackageGroup.Progression","Microsoft.VisualStudio.PerformanceProvider","Microsoft.VisualStudio.GraphModel","Microsoft.VisualStudio.GraphProvider","Microsoft.DiaSymReader","Microsoft.Build.Dependencies","Microsoft.Build.FileTracker.Msi","Microsoft.Build","Microsoft.VisualStudio.TextMateGrammars","Microsoft.VisualStudio.PackageGroup.TeamExplorer.Common","Microsoft.VisualStudio.TeamExplorer","Microsoft.ServiceHub","Microsoft.VisualStudio.ProjectServices","Microsoft.VisualStudio.SLNX.VSIX","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.FileHandler.Msi","Microsoft.VisualStudio.PackageGroup.MinShell","Microsoft.VisualStudio.MinShell.Interop","Microsoft.VisualStudio.Log","Microsoft.VisualStudio.Log.Targeted","Microsoft.VisualStudio.Log.Resources","Microsoft.VisualStudio.Finalizer","Microsoft.VisualStudio.Devenv","Microsoft.VisualStudio.Devenv.Resources","Microsoft.VisualStudio.CoreEditor","Microsoft.VisualStudio.Platform.NavigateTo","Microsoft.VisualStudio.Connected","Microsoft.VisualStudio.Connected.Resources","Microsoft.VisualStudio.MinShell","Microsoft.VisualStudio.Setup.Configuration","Microsoft.VisualStudio.Platform.Search","Microsoft.VisualStudio.MinShell.Platform","Microsoft.VisualStudio.MinShell.Platform.Resources","Microsoft.VisualStudio.MefHosting","Microsoft.VisualStudio.MefHosting.Resources","Microsoft.VisualStudio.Initializer","Microsoft.VisualStudio.ExtensionManager","Microsoft.VisualStudio.Platform.Editor","Microsoft.VisualStudio.MinShell.x86","Microsoft.VisualStudio.NativeImageSupport","Microsoft.VisualStudio.MinShell.Msi","Microsoft.VisualStudio.MinShell.Msi.Resources","Microsoft.VisualStudio.LanguageServer","Microsoft.VisualStudio.Devenv.Config","Microsoft.VisualStudio.MinShell.Resources","Microsoft.Net.PackageGroup.4.7.2.Redist","Microsoft.VisualStudio.Branding.Enterprise"]}] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2022_Community_workload.txt b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2022_Community_workload.txt deleted file mode 100644 index 7cd20f8598926..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/VS_2022_Community_workload.txt +++ /dev/null @@ -1,569 +0,0 @@ -[ - { - "path": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community", - "version": "17.4.33213.308", - "packages": [ - "Microsoft.VisualStudio.Product.Community", - "Microsoft.VisualStudio.PackageGroup.LiveShare.VSCore", - "Microsoft.VisualStudio.LiveShare.VSCore", - "Microsoft.VisualStudio.Workload.NativeDesktop", - "Microsoft.VisualStudio.Component.VC.ASAN", - "Microsoft.VisualCpp.ASAN.X86", - "Microsoft.VC.14.34.17.4.ASAN.X86.base", - "Microsoft.VC.14.34.17.4.ASAN.X64.base", - "Microsoft.VC.14.34.17.4.ASAN.Headers.base", - "Microsoft.VisualStudio.VC.IDE.Project.Factories", - "Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest", - "Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest", - "Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest", - "Microsoft.VisualStudio.VC.Ide.TestAdapterForBoostTest", - "Microsoft.VisualStudio.Component.VC.CMake.Project", - "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake", - "Microsoft.VisualStudio.VC.CMake", - "Microsoft.VisualStudio.VC.CMake.Project", - "Microsoft.VisualStudio.VC.CMake.Client", - "Microsoft.VisualStudio.VC.ExternalBuildFramework", - "Microsoft.VisualStudio.Component.VC.DiagnosticTools", - "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", - "Microsoft.VisualStudio.PackageGroup.TestTools.Native", - "Microsoft.VisualStudio.Component.VC.Redist.14.Latest", - "Microsoft.VisualStudio.VC.Templates.UnitTest", - "Microsoft.VisualStudio.VC.UnitTest.Desktop.Build.Core", - "Microsoft.VisualStudio.TestTools.TestPlatform.V1.CPP", - "Microsoft.VisualStudio.VC.Templates.UnitTest.Resources", - "Microsoft.VisualStudio.VC.Templates.Desktop", - "Microsoft.VisualStudio.Component.Graphics", - "Microsoft.VisualStudio.Graphics.Viewers", - "Microsoft.VisualStudio.Graphics.Viewers.Resources", - "Microsoft.VisualStudio.Component.VC.ATL.ARM64", - "Microsoft.VisualCpp.ATL.ARM64", - "Microsoft.VC.14.34.17.4.ATL.ARM64.base", - "Microsoft.VisualStudio.Component.VC.ATL", - "Microsoft.VisualStudio.VC.Ide.ATL", - "Microsoft.VisualStudio.VC.Ide.ATL.Resources", - "Microsoft.VisualCpp.ATL.X86", - "Microsoft.VC.14.34.17.4.ATL.X86.base", - "Microsoft.VisualCpp.ATL.X64", - "Microsoft.VC.14.34.17.4.ATL.X64.base", - "Microsoft.VC.14.34.17.4.Props.ATLMFC", - "Microsoft.VisualCpp.ATL.Source", - "Microsoft.VC.14.34.17.4.ATL.Source.base", - "Microsoft.VisualCpp.ATL.Headers", - "Microsoft.VC.14.34.17.4.ATL.Headers.base", - "Microsoft.VC.14.34.17.4.Servicing.ATL", - "Microsoft.VisualStudio.Component.VC.Tools.ARM64", - "Microsoft.VisualStudio.VC.MSBuild.v170.ARM64.v143", - "Microsoft.VisualStudio.VC.MSBuild.v170.ARM64", - "Microsoft.VS.VC.vcvars.arm64.Shortcuts", - "Microsoft.VisualCpp.CA.Ext.Hostx64.TargetARM64", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.TargetARM64.base", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.TargetARM64.Res.base", - "Microsoft.VisualCpp.CA.Ext.Hostx86.TargetARM64", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.TargetARM64.base", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.TargetARM64.Res.base", - "Microsoft.VisualCpp.CA.Ext.HostARM64.TargetARM64", - "Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.TargetARM64.base", - "Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.TargetARM64.Res.base", - "Microsoft.VisualCpp.Tools.Hostx86.Targetarm64", - "Microsoft.VC.14.34.17.4.Tools.Hostx86.Targetarm64.base", - "Microsoft.VC.14.34.17.4.Tools.HostX86.TargetARM64.Res.base", - "Microsoft.VisualCpp.Tools.HostARM64.TargetARM64", - "Microsoft.VC.14.34.17.4.Tools.HostARM64.TargetARM64.base", - "Microsoft.VC.14.34.17.4.Tools.HostARM64.TargetARM64.Res.base", - "Microsoft.VisualCpp.CRT.Redist.ARM64.OneCore.Desktop", - "Microsoft.VC.14.34.17.4.CRT.Redist.ARM64.OneCore.Desktop.base", - "Microsoft.VisualCpp.CRT.Redist.ARM64", - "Microsoft.VC.14.34.17.4.CRT.Redist.ARM64.base", - "Microsoft.VisualCpp.CRT.ARM64.OneCore.Desktop", - "Microsoft.VC.14.34.17.4.CRT.ARM64.OneCore.Desktop.base", - "Microsoft.VC.14.34.17.4.CRT.ARM64.OneCore.Desktop.debug.base", - "Microsoft.VisualCpp.CRT.ARM64.Store", - "Microsoft.VC.14.34.17.4.CRT.ARM64.Store.base", - "Microsoft.VisualCpp.CRT.ARM64.Desktop", - "Microsoft.VC.14.34.17.4.CRT.ARM64.Desktop.base", - "Microsoft.VC.14.34.17.4.CRT.ARM64.Desktop.debug.base", - "Microsoft.VisualStudio.PackageGroup.VC.Tools.x64.ARM64", - "Microsoft.VisualCpp.Tools.Core", - "Microsoft.VisualCpp.PGO.ARM64", - "Microsoft.VC.14.34.17.4.PGO.ARM64.base", - "Microsoft.VisualCpp.Premium.Tools.Hostx86.Targetarm64", - "Microsoft.VC.14.34.17.4.Premium.Tools.Hostx86.Targetarm64.base", - "Microsoft.VC.14.34.17.4.Prem.HostX86.TargetARM64.Res.base", - "Microsoft.VisualCpp.Premium.Tools.HostX64.TargetARM64", - "Microsoft.VC.14.34.17.4.Premium.Tools.HostX64.TargetARM64.base", - "Microsoft.VC.14.34.17.4.Prem.HostX64.TargetARM64.Res.base", - "Microsoft.VisualCpp.Premium.Tools.ARM64.Base", - "Microsoft.VC.14.34.17.4.Premium.Tools.ARM64.Base.base", - "Microsoft.VisualCpp.Tools.HostX64.TargetARM64", - "Microsoft.VC.14.34.17.4.Tools.HostX64.TargetARM64.base", - "Microsoft.VC.14.34.17.4.Props.ARM64", - "Microsoft.VC.14.34.17.4.Tools.HostX64.TargetARM64.Res.base", - "Microsoft.VisualStudio.Component.VC.Tools.ARM64EC", - "Microsoft.VisualStudio.Component.Windows11SDK.22621", - "Win11SDK_10.0.22621", - "Microsoft.VisualStudio.VC.MSBuild.v170.ARM64EC.v143", - "Microsoft.VisualStudio.VC.MSBuild.v170.ARM64EC", - "Microsoft.VisualCpp.CRT.ARM64EC.Store", - "Microsoft.VC.14.34.17.4.CRT.ARM64EC.Store.base", - "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", - "Microsoft.VisualCpp.CodeAnalysis.Extensions", - "Microsoft.VisualCpp.CA.Ext.HostARM64.Targetx64", - "Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.Targetx64.base", - "Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.Targetx64.Res.base", - "Microsoft.VisualCpp.CA.Ext.HostARM64.Targetx86", - "Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.Targetx86.base", - "Microsoft.VC.14.34.17.4.CA.Ext.HostARM64.Targetx86.Res.base", - "Microsoft.VisualCpp.CA.Ext.Hostx86.Targetx64", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.Targetx64.base", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.Targetx64.Res.base", - "Microsoft.VisualCpp.CA.Ext.Hostx86.Targetx86", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.Targetx86.base", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx86.Targetx86.Res.base", - "Microsoft.VisualCpp.CA.Ext.Hostx64.Targetx64", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.Targetx64.base", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.Targetx64.Res.base", - "Microsoft.VisualCpp.CA.Ext.Hostx64.Targetx86", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.Targetx86.base", - "Microsoft.VC.14.34.17.4.Servicing.CAExtensions", - "Microsoft.VC.14.34.17.4.CA.Ext.Hostx64.Targetx86.Res.base", - "Microsoft.VisualCpp.Tools.HostX64.TargetX86", - "Microsoft.VC.14.34.17.4.Tools.HostX64.TargetX86.base", - "Microsoft.VC.14.34.17.4.Tools.HostX64.TargetX86.Res.base", - "Microsoft.VisualCpp.Tools.HostX64.TargetX64", - "Microsoft.VC.14.34.17.4.Tools.HostX64.TargetX64.base", - "Microsoft.VC.14.34.17.4.Tools.HostX64.TargetX64.Res.base", - "Microsoft.VisualCpp.Tools.HostARM64.TargetX86", - "Microsoft.VC.14.34.17.4.Tools.HostARM64.TargetX86.base", - "Microsoft.VisualCpp.RuntimeDebug.14", - "Microsoft.VC.14.34.17.4.Tools.HostARM64.TargetX86.Res.base", - "Microsoft.VisualCpp.Tools.HostARM64.TargetX64", - "Microsoft.VC.14.34.17.4.Tools.HostARM64.TargetX64.base", - "Microsoft.VisualCpp.RuntimeDebug.14.ARM64", - "Microsoft.VisualCpp.Redist.14.Latest", - "Microsoft.VisualCpp.Redist.14.Latest", - "Microsoft.VC.14.34.17.4.Tools.HostARM64.Targetx64.Res.base", - "Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX64", - "Microsoft.VC.14.34.17.4.Premium.Tools.HostX86.TargetX64.base", - "Microsoft.VC.14.34.17.4.Prem.Hostx86.Targetx64.Res.base", - "Microsoft.VisualCpp.Premium.Tools.HostX86.TargetX86", - "Microsoft.VC.14.34.17.4.Premium.Tools.HostX86.TargetX86.base", - "Microsoft.VC.14.34.17.4.Prem.HostX86.TargetX86.Res.base", - "Microsoft.VisualCpp.Premium.Tools.HostARM64.TargetX86", - "Microsoft.VC.14.34.17.4.Premium.Tools.HostARM64.TargetX86.base", - "Microsoft.VC.14.34.17.4.Prem.HostARM64.TargetX86.Res.base", - "Microsoft.VisualCpp.Premium.Tools.HostARM64.TargetX64", - "Microsoft.VC.14.34.17.4.Premium.Tools.HostARM64.TargetX64.base", - "Microsoft.VC.14.34.17.4.Prem.HostARM64.Targetx64.Res.base", - "Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX86", - "Microsoft.VC.14.34.17.4.Premium.Tools.HostX64.TargetX86.base", - "Microsoft.VC.14.34.17.4.Prem.HostX64.TargetX86.Res.base", - "Microsoft.VisualCpp.Premium.Tools.HostX64.TargetX64", - "Microsoft.VC.14.34.17.4.Premium.Tools.HostX64.TargetX64.base", - "Microsoft.VC.14.34.17.4.Prem.HostX64.TargetX64.Res.base", - "Microsoft.VisualCpp.PGO.X86", - "Microsoft.VC.14.34.17.4.PGO.X86.base", - "Microsoft.VisualCpp.PGO.X64", - "Microsoft.VC.14.34.17.4.PGO.X64.base", - "Microsoft.VisualCpp.PGO.Headers", - "Microsoft.VC.14.34.17.4.PGO.Headers.base", - "Microsoft.VisualCpp.CRT.x86.Store", - "Microsoft.VC.14.34.17.4.CRT.x86.Store.base", - "Microsoft.VisualCpp.CRT.x86.OneCore.Desktop", - "Microsoft.VC.14.34.17.4.CRT.x86.OneCore.Desktop.base", - "Microsoft.VisualCpp.CRT.x64.Store", - "Microsoft.VC.14.34.17.4.CRT.x64.Store.base", - "Microsoft.VisualCpp.CRT.x64.OneCore.Desktop", - "Microsoft.VC.14.34.17.4.CRT.x64.OneCore.Desktop.base", - "Microsoft.VisualCpp.CRT.Redist.x86.OneCore.Desktop", - "Microsoft.VC.14.34.17.4.CRT.Redist.x86.OneCore.Desktop.base", - "Microsoft.VisualCpp.CRT.Redist.x64.OneCore.Desktop", - "Microsoft.VC.14.34.17.4.CRT.Redist.x64.OneCore.Desktop.base", - "Microsoft.VisualStudio.PackageGroup.VC.Tools.x86", - "Microsoft.VisualCpp.Tools.Hostx86.Targetx64.Res", - "Microsoft.VisualCpp.Tools.HostX86.TargetX64", - "Microsoft.VC.14.34.17.4.Tools.HostX86.TargetX64.base", - "Microsoft.VC.14.34.17.4.Props.x64", - "Microsoft.VC.14.34.17.4.Tools.Hostx86.Targetx64.Res.base", - "Microsoft.VisualCpp.Tools.HostX86.TargetX86.Res", - "Microsoft.VisualCpp.Tools.HostX86.TargetX86", - "Microsoft.VC.14.34.17.4.Tools.HostX86.TargetX86.base", - "Microsoft.VC.14.34.17.4.Servicing.Compilers", - "Microsoft.VC.14.34.17.4.Props.x86", - "Microsoft.VC.14.34.17.4.Props", - "Microsoft.VC.14.34.17.4.Tools.HostX86.TargetX86.Res.base", - "Microsoft.VisualCpp.Tools.Core.Resources", - "Microsoft.VisualCpp.Tools.Core.x86", - "Microsoft.VC.14.34.17.4.Tools.Core.Props", - "Microsoft.VisualCpp.DIA.SDK", - "Microsoft.VisualCpp.Servicing.DIASDK", - "Microsoft.VisualCpp.CRT.x86.Desktop", - "Microsoft.VC.14.34.17.4.CRT.x86.Desktop.base", - "Microsoft.VisualCpp.CRT.x64.Desktop", - "Microsoft.VC.14.34.17.4.CRT.x64.Desktop.base", - "Microsoft.VisualCpp.CRT.Source", - "Microsoft.VC.14.34.17.4.CRT.Source.base", - "Microsoft.VisualCpp.CRT.Redist.X86", - "Microsoft.VC.14.34.17.4.CRT.Redist.X86.base", - "Microsoft.VisualCpp.CRT.Redist.X64", - "Microsoft.VisualCpp.CRT.Redist.Resources", - "Microsoft.VC.14.34.17.4.CRT.Redist.X64.base", - "Microsoft.VisualCpp.CRT.Headers", - "Microsoft.VC.14.34.17.4.CRT.Headers.base", - "Microsoft.VC.14.34.17.4.Servicing.CrtHeaders", - "Microsoft.VC.14.34.17.4.Servicing", - "Microsoft.VisualStudio.Component.VC.CoreIde", - "Microsoft.VisualStudio.VC.Ide.Pro", - "Microsoft.VisualStudio.VC.Ide.Pro.Resources", - "Microsoft.VisualStudio.VC.Templates.General", - "Microsoft.VisualStudio.VC.Templates.General.Resources", - "Microsoft.VisualStudio.VC.Items.Pro", - "Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Reduced", - "Microsoft.VisualStudio.VC.Ide.x64", - "Microsoft.VisualStudio.PackageGroup.VC.CoreIDE.Express", - "Microsoft.VisualStudio.VC.vcvars", - "Microsoft.VS.VC.vcvars.x86.Shortcuts", - "Microsoft.VS.VC.vcvars.x64.Shortcuts", - "Microsoft.VS.VC.vcvars.arm64_x64.Shortcuts", - "Microsoft.VisualStudio.VC.MSBuild.v170.X64.v143", - "Microsoft.VisualStudio.VC.MSBuild.v170.X64", - "Microsoft.VisualStudio.VC.MSBuild.v170.ARM.v143", - "Microsoft.VisualStudio.VC.MSBuild.v170.ARM", - "Microsoft.VisualStudio.VC.MSBuild.v170.x86.v143", - "Microsoft.VisualStudio.VC.MSBuild.v170.X86", - "Microsoft.VisualStudio.VC.MSBuild.v170.Base", - "Microsoft.VisualStudio.VC.MSBuild.v170.Base.Resources", - "Microsoft.VisualStudio.VC.Ide.WinXPlus", - "Microsoft.VisualStudio.VC.Ide.Dskx", - "Microsoft.VisualStudio.VC.Ide.Dskx.Resources", - "Microsoft.VisualStudio.VC.Ide.Base", - "Microsoft.VisualStudio.VC.Ide.LanguageService", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.Scripts", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.PythonDistro", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.10", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.9", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.8", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.7", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.6", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.5", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.4", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.3", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.2", - "Microsoft.VisualStudio.VC.Ide.SecurityIssueAnalysis.3rdPartyLibs.1", - "Microsoft.VisualStudio.VC.Ide.VCPkgDatabase", - "Microsoft.VisualStudio.VC.Ide.Core", - "Microsoft.VisualStudio.VC.Ide.ProjectSystem", - "Microsoft.VisualStudio.VC.Ide.ProjectSystem.Resources", - "Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine", - "Microsoft.VisualStudio.VC.Ide.Core.VCProjectEngine.Resources", - "Microsoft.VisualStudio.VC.Ide.LanguageService.Resources", - "Microsoft.VisualStudio.VC.Llvm.Base", - "Microsoft.VisualStudio.VC.Ide.Base.Resources", - "Microsoft.Net.PackageGroup.4.8.1.Redist", - "Microsoft.VisualStudio.Component.IntelliCode", - "Microsoft.VisualStudio.IntelliCode.CSharp", - "Microsoft.VisualStudio.IntelliCode", - "Component.Microsoft.VisualStudio.LiveShare.2022", - "Microsoft.VisualStudio.Component.Debugger.JustInTime", - "Microsoft.VisualStudio.Debugger.ImmersiveActivateHelper.Msi", - "Microsoft.VisualStudio.Debugger.JustInTime", - "Microsoft.VisualStudio.Debugger.JustInTime.Msi", - "Microsoft.VisualStudio.LiveShare.2022", - "Microsoft.Icecap.Analysis", - "Microsoft.Icecap.Analysis.Resources", - "Microsoft.Icecap.Analysis.Resources.Targeted", - "Microsoft.Icecap.Collection.Msi", - "Microsoft.Icecap.Collection.Msi.Targeted", - "Microsoft.Icecap.Collection.Msi.Resources", - "Microsoft.Icecap.Collection.Msi.Resources.Targeted", - "Microsoft.DiagnosticsHub.Instrumentation", - "Microsoft.DiagnosticsHub.Instrumentation.Targeted", - "Microsoft.DiagnosticsHub.CpuSampling", - "Microsoft.DiagnosticsHub.CpuSampling.Targeted", - "Microsoft.PackageGroup.DiagnosticsHub.Platform", - "Microsoft.VisualStudio.InstrumentationEngine.ARM64", - "Microsoft.VisualStudio.InstrumentationEngine", - "Microsoft.DiagnosticsHub.Runtime.ExternalDependencies", - "SQLiteCore", - "SQLiteCore.Targeted", - "Microsoft.DiagnosticsHub.Runtime.ExternalDependencies.Targeted", - "Microsoft.DiagnosticsHub.Runtime", - "Microsoft.DiagnosticsHub.Runtime.Targeted", - "Microsoft.DiagnosticsHub.Collection.ExternalDependencies.arm64", - "Microsoft.DiagnosticsHub.Collection", - "Microsoft.DiagnosticsHub.Collection.Service", - "Microsoft.VisualStudio.VC.Ide.MDD", - "Microsoft.VisualStudio.VC.Ide.Linux.ConnectionManager", - "Microsoft.VisualStudio.VisualC.Utilities", - "Microsoft.VisualStudio.VisualC.Utilities.Resources", - "Microsoft.VisualStudio.VC.Ide.Linux.ConnectionManager.Resources", - "Microsoft.VisualStudio.VC.Ide.ResourceEditor", - "Microsoft.VisualStudio.VC.Ide.ResourceEditor.Resources", - "Microsoft.VisualStudio.PackageGroup.TestTools.Core", - "Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V2.CLI", - "Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI", - "Microsoft.VisualStudio.TestTools.Pex.Common", - "Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.V1.CLI", - "Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.Legacy", - "Microsoft.VisualStudio.PackageGroup.MinShell.Interop", - "Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Msi", - "Microsoft.VisualStudio.TestTools.TP.Legacy.Tips.Common", - "Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips", - "Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Tips.Resources", - "Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.TestSettings", - "Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Professional", - "Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Common", - "Microsoft.VisualStudio.TestTools.TP.Legacy.Common.Res", - "Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core", - "Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Core.Resources", - "Microsoft.VisualStudio.TestTools.TestPlatform.Legacy.Agent", - "Microsoft.VisualStudio.PackageGroup.TestTools.TestPlatform.IDE", - "Microsoft.VisualStudio.Cache.Service", - "Microsoft.VisualStudio.TestTools.TestWIExtension", - "Microsoft.VisualStudio.TestTools.TestPlatform.V1.CLI", - "Microsoft.VisualStudio.TestTools.TestPlatform.IDE", - "Microsoft.VisualStudio.PackageGroup.TestTools.CodeCoverage", - "Microsoft.VisualStudio.PackageGroup.TestTools.DataCollectors", - "Microsoft.VisualStudio.Component.NuGet", - "Microsoft.CredentialProvider", - "Microsoft.VisualStudio.NuGet.Licenses", - "Microsoft.VisualStudio.Component.TextTemplating", - "Microsoft.VisualStudio.TextTemplating.MSBuild", - "Microsoft.VisualStudio.TextTemplating.Integration", - "Microsoft.VisualStudio.TextTemplating.Core", - "Microsoft.VisualStudio.TextTemplating.Integration.Resources", - "Microsoft.VisualCpp.CRT.ClickOnce.Msi", - "Microsoft.VisualStudio.Component.Roslyn.LanguageServices", - "Microsoft.VisualStudio.InteractiveWindow", - "Microsoft.DiaSymReader.Native", - "Microsoft.VisualCpp.Redist.14", - "Microsoft.VisualCpp.Redist.14", - "Microsoft.VisualCpp.Servicing.Redist", - "Microsoft.VisualStudio.PackageGroup.StaticAnalysis", - "Microsoft.VisualStudio.StaticAnalysis.IDE", - "Microsoft.VisualStudio.StaticAnalysis.IDE.Resources", - "Microsoft.VisualStudio.StaticAnalysis.FxCop.Resources", - "Microsoft.VisualStudio.StaticAnalysis.auxil", - "Microsoft.VisualStudio.StaticAnalysis.auxil.Resources", - "Roslyn.VisualStudio.Setup.ServiceHub", - "Microsoft.Component.MSBuild", - "Microsoft.NuGet.Build.Tasks.Setup", - "Microsoft.VisualStudio.Component.Roslyn.Compiler", - "Microsoft.CodeAnalysis.Compilers", - "Microsoft.VisualStudio.Component.JavaScript.TypeScript", - "Microsoft.VisualStudio.JavaScript.ProjectSystem", - "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions", - "Microsoft.VisualStudio.ProTools", - "sqlsysclrtypes", - "SQLCommon", - "Microsoft.VisualStudio.ProTools.Resources", - "Microsoft.VisualStudio.Web.Scaffolding", - "Microsoft.VisualStudio.WebToolsExtensions", - "Microsoft.VisualStudio.ConnectedServices.Core", - "Microsoft.VisualStudio.WebTools", - "Microsoft.VisualStudio.WebToolsExtensions.MSBuild", - "Microsoft.VisualStudio.WebTools.Resources", - "Microsoft.VisualStudio.WebTools.WSP.FSA", - "Microsoft.VisualStudio.WebTools.WSP.FSA.Resources", - "Microsoft.VisualStudio.PackageGroup.Debugger.Script", - "Microsoft.VisualStudio.Component.TypeScript.TSServer", - "Microsoft.VisualStudio.Package.TypeScript.TSServer", - "Microsoft.VisualStudio.PackageGroup.JavaScript.Language", - "Microsoft.VisualStudio.Package.NodeJs", - "TypeScript.Build", - "TypeScript.LanguageService", - "TypeScript.Tools", - "Microsoft.VisualStudio.PackageGroup.Community", - "Microsoft.VisualStudio.Community.VB.x86", - "Microsoft.VisualStudio.Community.VB.x64", - "Microsoft.VisualStudio.PackageGroup.Core", - "Microsoft.VisualStudio.CodeSense.Community", - "Microsoft.VisualStudio.TestTools.TeamFoundationClient", - "Microsoft.VisualStudio.PackageGroup.Debugger.Core", - "Microsoft.VisualStudio.Debugger.BrokeredServices", - "Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost", - "Microsoft.VisualStudio.Debugger.AzureAttach", - "Microsoft.VisualStudio.Web.Azure.Common", - "Microsoft.WebTools.Shared", - "Microsoft.WebTools.DotNet.Core.ItemTemplates", - "Microsoft.VisualStudio.PackageGroup.Debugger.TimeTravel.Replay", - "Microsoft.VisualStudio.VC.Ide.Debugger", - "Microsoft.VisualStudio.VC.Ide.Debugger.Concord", - "Microsoft.VisualStudio.VC.Ide.Debugger.Concord.Resources", - "Microsoft.VisualStudio.VC.Ide.Debugger.Resources", - "Microsoft.VisualStudio.VC.Ide.Common", - "Microsoft.VisualStudio.VC.Ide.Common.Resources", - "Microsoft.VisualStudio.Debugger.CollectionAgents", - "Microsoft.VisualStudio.Debugger.Parallel", - "Microsoft.VisualStudio.Debugger.Parallel.Resources", - "Microsoft.VisualStudio.Debugger.Managed", - "Microsoft.CodeAnalysis.ExpressionEvaluator", - "Microsoft.CodeAnalysis.VisualStudio.Setup", - "Microsoft.VisualStudio.Debugger.Concord.Managed", - "Microsoft.VisualStudio.Debugger.Concord.Managed.Resources", - "Microsoft.VisualStudio.Debugger.Managed.Resources", - "Microsoft.VisualStudio.Debugger.TargetComposition", - "Microsoft.VisualStudio.Debugger.TargetComposition.Remote.arm64", - "Microsoft.VisualStudio.Debugger.TargetComposition.Remote", - "Microsoft.VisualStudio.Debugger.TargetComposition.Remote", - "Microsoft.VisualStudio.Debugger.Remote", - "Microsoft.VisualStudio.Debugger.Concord.Remote", - "Microsoft.VisualStudio.Debugger.Concord.Remote.Resources", - "Microsoft.VisualStudio.Debugger.Remote", - "Microsoft.VisualStudio.Debugger.Remote.ARM64", - "Microsoft.VisualStudio.Debugger.Concord.Remote.ARM64", - "Microsoft.VisualStudio.Debugger.Concord.Remote.Resources.ARM64", - "Microsoft.VisualStudio.Debugger.Remote.ARM", - "Microsoft.VisualStudio.Debugger.Concord.Remote.ARM", - "Microsoft.VisualStudio.Debugger.Concord.Remote.Resources.ARM", - "Microsoft.VisualStudio.Debugger.Remote.Resources.ARM", - "Microsoft.VisualStudio.Debugger.Remote.Resources.ARM64", - "Microsoft.VisualStudio.Debugger.Concord.Remote", - "Microsoft.VisualStudio.Debugger.Concord.Remote.Resources", - "Microsoft.VisualStudio.Debugger.Remote.Resources", - "Microsoft.VisualStudio.Debugger.Remote.Resources", - "Microsoft.VisualStudio.Debugger", - "Microsoft.VisualStudio.VC.MSVCDis", - "Microsoft.IntelliTrace.DiagnosticsHub", - "Microsoft.VisualStudio.Debugger.Concord", - "Microsoft.VisualStudio.Debugger.Concord.Resources", - "Microsoft.VisualStudio.Debugger.Resources", - "Microsoft.VisualStudio.Debugger.Package.DiagHub.Client", - "Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client", - "Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client", - "Microsoft.VisualStudio.Debugger.Remote.DiagnosticsHub.Client", - "Microsoft.PackageGroup.ClientDiagnostics", - "Microsoft.VisualStudio.AppResponsiveness", - "Microsoft.VisualStudio.AppResponsiveness.Targeted", - "Microsoft.VisualStudio.AppResponsiveness.Resources", - "Microsoft.VisualStudio.ClientDiagnostics", - "Microsoft.VisualStudio.ClientDiagnostics.Targeted", - "Microsoft.VisualStudio.ClientDiagnostics.Resources", - "Microsoft.VisualStudio.PackageGroup.CommunityCore", - "Microsoft.VisualStudio.ProjectSystem.Full", - "Microsoft.VisualStudio.LiveShareApi", - "Microsoft.VisualStudio.ProjectSystem.Query", - "Microsoft.VisualStudio.ProjectSystem", - "Microsoft.VisualStudio.Community.x86", - "Microsoft.VisualStudio.Community.x64", - "Microsoft.VisualStudio.Community.Msi.Resources", - "Microsoft.VisualStudio.Community.Msi", - "Microsoft.VisualStudio.Community.Shared.Msi", - "Microsoft.VisualStudio.Devenv.Msi", - "Microsoft.VisualStudio.Devenv.Shared.Msi", - "Microsoft.VisualStudio.MinShell.Interop.Msi", - "Microsoft.VisualStudio.MinShell.Interop.Shared.Msi", - "Microsoft.VisualStudio.Editors", - "Microsoft.VisualStudio.Workload.CoreEditor", - "Microsoft.VisualStudio.Component.CoreEditor", - "Microsoft.VisualStudio.PackageGroup.CoreEditor", - "Microsoft.WebView2", - "Microsoft.VisualStudio.ScriptedHost", - "Microsoft.VisualStudio.ScriptedHost.Targeted", - "Microsoft.VisualCpp.Tools.Common.UtilsPrereq", - "Microsoft.VisualCpp.Tools.Common.Utils", - "Microsoft.VisualCpp.Tools.Common.Utils.Resources", - "Microsoft.VisualStudio.PackageGroup.VsDevCmd", - "Microsoft.VisualStudio.VsDevCmd.Ext.NetFxSdk", - "Microsoft.VisualStudio.VsDevCmd.Core.WinSdk", - "Microsoft.VisualStudio.VsDevCmd.Core.DotNet", - "Microsoft.VisualStudio.VC.DevCmd", - "Microsoft.VisualStudio.VC.DevCmd.Resources", - "Microsoft.VisualStudio.VirtualTree", - "Microsoft.DiaSymReader", - "Microsoft.Build.Dependencies", - "Microsoft.Build.FileTracker.Msi", - "Microsoft.Build", - "Microsoft.VisualStudio.PackageGroup.NuGet", - "Microsoft.DataAI.NuGetRecommender", - "Microsoft.VisualStudio.NuGet.Core", - "Microsoft.Build.Arm64", - "Microsoft.Build.UnGAC", - "Microsoft.VisualStudio.TextMateGrammars", - "Microsoft.VisualStudio.Platform.Markdown", - "Microsoft.VisualStudio.Platform.CrossRepositorySearch", - "Microsoft.VisualStudio.PackageGroup.TeamExplorer.Common", - "Microsoft.VisualStudio.TeamExplorer", - "Microsoft.VisualStudio.PackageGroup.ServiceHub", - "Microsoft.ServiceHub.Node", - "Microsoft.ServiceHub.Managed", - "Microsoft.ServiceHub.arm64", - "Microsoft.VisualStudio.ProjectServices", - "Microsoft.VisualStudio.OpenFolder.VSIX", - "Microsoft.VisualStudio.FileHandler.Msi", - "Microsoft.VisualStudio.FileHandler.Msi", - "Microsoft.VisualStudio.PackageGroup.MinShell", - "Microsoft.VisualStudio.MinShell.Msi", - "Microsoft.VisualStudio.MinShell.Shared.Msi", - "Microsoft.VisualStudio.MinShell.Msi.Resources", - "Microsoft.VisualStudio.MinShell.Interop", - "CoreEditorFonts", - "Microsoft.VisualStudio.Log", - "Microsoft.VisualStudio.Log.Targeted", - "Microsoft.VisualStudio.Log.Resources", - "Microsoft.VisualStudio.Finalizer", - "Microsoft.VisualStudio.Devenv", - "Microsoft.VisualStudio.Devenv.Resources", - "Microsoft.VisualStudio.CoreEditor", - "Microsoft.VisualStudio.Navigation.RichCodeNav", - "Microsoft.VisualStudio.Platform.NavigateTo", - "Microsoft.VisualStudio.Connected", - "SQLitePCLRaw", - "SQLitePCLRaw.Targeted", - "Microsoft.VisualStudio.Connected.Auto", - "Microsoft.VisualStudio.Connected.Auto.Resources", - "Microsoft.VisualStudio.AzureSDK", - "Microsoft.VisualStudio.PerfLib", - "Microsoft.VisualStudio.Connected.Resources", - "Microsoft.Net.PackageGroup.4.8.Redist", - "Microsoft.VisualStudio.PackageGroup.Progression", - "Microsoft.VisualStudio.PerformanceProvider", - "Microsoft.VisualStudio.GraphModel", - "Microsoft.VisualStudio.GraphProvider", - "Microsoft.VisualStudio.Community.VB.Targeted", - "Microsoft.VisualStudio.Community.VB.Neutral", - "Microsoft.VisualStudio.Community.CSharp.Targeted", - "Microsoft.VisualStudio.Community.CSharp.Neutral", - "Microsoft.VisualStudio.Community.ProductArch.TargetedExtra", - "Microsoft.VisualStudio.Community.ProductArch.Targeted", - "Microsoft.VisualStudio.Community.ProductArch.NeutralExtra", - "Microsoft.DiaSymReader.PortablePdb", - "Microsoft.IntelliTrace.CollectorCab", - "Microsoft.VisualStudio.Community.VB.Resources.Targeted", - "Microsoft.VisualStudio.Community.VB.Resources.Neutral", - "Microsoft.VisualStudio.Community.CSharp.Resources.Targeted", - "Microsoft.VisualStudio.Community.CSharp.Resources.Neutral", - "Microsoft.VisualStudio.Community.ProductArch.Resources.Targeted", - "Microsoft.VisualStudio.Community.ProductArch.Resources.NeutralExtra", - "Microsoft.VisualStudio.Net.Eula.Resources", - "Microsoft.VisualStudio.Community.ProductArch.Resources.Neutral", - "Microsoft.VisualStudio.WebSiteProject.DTE", - "Microsoft.VisualStudio.Diagnostics.AspNetHelper", - "Microsoft.VisualStudio.Diagnostics.AspNetHelper.Standard", - "Microsoft.MSHtml", - "Microsoft.VisualStudio.Platform.CallHierarchy", - "Microsoft.VisualStudio.Community.ProductArch.Neutral", - "Microsoft.VisualStudio.MinShell", - "Microsoft.VisualStudio.VsWebProtocolSelector.Msi", - "Microsoft.Net.6.WindowsDesktop.Runtime", - "Microsoft.Net.6.Runtime", - "Microsoft.VisualStudio.PackageGroup.Setup.Common", - "Microsoft.VisualStudio.Setup.WMIProvider", - "Microsoft.VisualStudio.Setup.Configuration.Interop", - "Microsoft.VisualStudio.Setup.Configuration", - "Microsoft.VisualStudio.Extensibility.Container", - "Microsoft.VisualStudio.LanguageServer", - "Microsoft.VisualStudio.Platform.Terminal", - "Microsoft.VisualStudio.MefHosting", - "Microsoft.VisualStudio.Initializer", - "Microsoft.VisualStudio.ExtensionManager", - "Microsoft.VisualStudio.Platform.Editor", - "Microsoft.VisualStudio.MinShell.Targeted", - "Microsoft.VisualStudio.NativeImageSupport", - "Microsoft.VisualStudio.Devenv.Config", - "Microsoft.VisualStudio.MinShell.Resources.arm64", - "Microsoft.VisualStudio.MinShell.Auto", - "Microsoft.VisualStudio.MinShell.Auto.Resources", - "Microsoft.VisualStudio.Branding.Community" - ] - } -] diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/certs.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/certs.js deleted file mode 100644 index f03f1de0d7f7b..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/certs.js +++ /dev/null @@ -1,151 +0,0 @@ -module.exports['ca.key'] = ` ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAtTbG0k2UFUyCdZuip0TTEtXRHh57qosegrpHPBreSNTxt7OT -KfOUZp2rToTHeN9w0ZbV2eKRI5AuFx8Cmlm73/KIHKzSNTBATGMeeHnGaxvL/W/s -KJdTDRNf7/qCXHQ+gsuEWWCFzOZuHmmAQa2IBX2HAQTqXJI8+2iJ9gytFfJLxjqy -6O4u9ugZVHSyQJWs49tGRcWMlNm7EMStADFvJn3S11xe/kwIA2mSI/eddDnzL0Mx -AkR9dQBL66xOABLL5v3QQdhipfHluX6HLbDd/1YsFTuOpgvLRlr72rTAFrQZCokV -hXPiqstn5zJFW5arHakvMR0+OPaICF5feh/4qQIDAQABAoIBAHWg6exnWUF+GY0Y -CrwDS/QFASpI5UNt7M809bqJQlMKjyEMmvF3YJQ/soxUWlsWx1f1TjmR/V6VX6W4 -hmsE5pRXDY13jTfja0lqacQQYAD02TRY63XpzIpHUlYnSWmUN2OVkgKmShQYW9C3 -8P4xE4Nk2TaLJ0oRzy3uzOb/kXcVaJfknBRUnOhuaTSs+w4l4pPXueYA7xuHgVsL -Qq0S4kK+PmdwCMB7gzlAAQhCM3vQ1U4cjC9JIIKSmPy7BcvD0kBfVPIFQ2byGpA1 -VkWBLSyeig0YxA5oIshK5cLiDIfBIiCSEzm4AMhVhGf0tbGEwiPljxKjbarYUUIi -ATMk83UCgYEA7kKeOveuPbMqxmT42swfa9OU5jLUjH+VExU0Kv3BbEjv/OGt0fac -/cs1Ze3vnrtCHudVajocFjydb8B4c62DbA4/T+LcUw/HaMaORbOoICQidi/zZ1Lj -gjg8Ip2WKXEhSAwqUpaFd6w16NZOxiTh+NDaRKywwbe8j57eDH4uR6MCgYEAwrTS -q5ra6+WDGUFMs0y3GMbL8j14PGhxBQBYSTM//NysI+EM6eeKn1cV3BbphEw//jgE -0pVokkjvLAQWWEG2dZyRxRE3YAMgOAIPx5zbJCim3iBVuoqY9ckLg2jF8Fqqubsb -3Rf2/Xzn/rFqsXdhsjGcJpdN66T9aEjwEkAnc0MCgYA5cOYk4UGormFJo147oaqR -nFjxhp+nn7qY9yu0kajoKk1xchct337J0Qv2nv5+DjdKrArzqT7MPaDXKFfhy5s7 -mdO5tr/XZp50rCnws/d8iDmmtLjB2EHxSw10avmg1B1p+UTa1F8pEuOMVt529r1j -9zYoCFo02c8j8PEnoeQWcQKBgQCVBCuQZu5SSM/zTkTTnU0sy0lf1qflI9IMD92B -+JVqg8HDnAR0KF+x38a9MVP7ixgXCuy19t+XxfY269HmLjTlArWV671D4GCSPRGy -plwZ6nr72ieCo3y57+q94jxL3jh3+bozlpnUG/q6tTKBLGs7JDjsWDSsuxOu8tO6 -RBttXQKBgB6LQFOTjDMfsFHKsnQXFUZId3GG/iLg3WCWxEo88T5Rq3JIR0zDpW8H -cKhl/sPY+JVHsxizNCMPtp7Hn7GrB6D/v9LbO0jpG2U0BFiJ6zhiDopbP9B0EAW4 -5JJ+JGKRKoCxs3DmSVyns0gU4j4rVte97UWyVy5TZ8Acr/qrgOA1 ------END RSA PRIVATE KEY----- -` - -module.exports['ca.crt'] = ` ------BEGIN CERTIFICATE----- -MIIDmzCCAoOgAwIBAgIUDA0GrvcnG41XT6LYFeNwvq8YV1UwDQYJKoZIhvcNAQEL -BQAwXTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRAwDgYDVQQKDAdOb2RlLmpz -MREwDwYDVQQLDAhub2RlLWd5cDEcMBoGA1UEAwwTbm9kZS1neXAubm9kZWpzLm9y -ZzAeFw0yMjA1MTEwNDIyMjRaFw00OTA5MjUwNDIyMjRaMF0xCzAJBgNVBAYTAlVT -MQswCQYDVQQIDAJDQTEQMA4GA1UECgwHTm9kZS5qczERMA8GA1UECwwIbm9kZS1n -eXAxHDAaBgNVBAMME25vZGUtZ3lwLm5vZGVqcy5vcmcwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQC1NsbSTZQVTIJ1m6KnRNMS1dEeHnuqix6Cukc8Gt5I -1PG3s5Mp85RmnatOhMd433DRltXZ4pEjkC4XHwKaWbvf8ogcrNI1MEBMYx54ecZr -G8v9b+wol1MNE1/v+oJcdD6Cy4RZYIXM5m4eaYBBrYgFfYcBBOpckjz7aIn2DK0V -8kvGOrLo7i726BlUdLJAlazj20ZFxYyU2bsQxK0AMW8mfdLXXF7+TAgDaZIj9510 -OfMvQzECRH11AEvrrE4AEsvm/dBB2GKl8eW5foctsN3/ViwVO46mC8tGWvvatMAW -tBkKiRWFc+Kqy2fnMkVblqsdqS8xHT449ogIXl96H/ipAgMBAAGjUzBRMB0GA1Ud -DgQWBBT6LcYYABEOAMv4hI/5bC82rGlD/DAfBgNVHSMEGDAWgBT6LcYYABEOAMv4 -hI/5bC82rGlD/DAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQA9 -D+qoKw0njub+NaFRS2DFbSiKb5JKTxVjU5aNusFONFLSXBuRpnYyjjkXpJy8JMWz -g8GFDEPP6kiSb8xaPNrFcUzb4PFzJabNTuaLJpBpd2gNBj5AeYwwpRa2DPv/b4yw -y2mfULuCWS09ZAguI2OcaARlAsFxYN0IuQ6pN1AvGFGee67ve9l2VF/hhwEi4lCk -MM0CWlP6COJ8TX7X0MTtexVOgo9m3hBuTSYEZClYFIdSOk10xkPl8Y3Iz/x6mzfK -Uu2l2ZtYvSdAX1CQMds3ZWt0ChNNEjOKPv4g2QSDhGkiqrmi4wUS81g68wKqOpqn -GbN8uKxIfyMjqZKaujPR ------END CERTIFICATE----- -` - -module.exports['server.key'] = ` ------BEGIN PRIVATE KEY----- -MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDpxqKqzq8PuOuo -M09X1gdh6V1nMmJ6Oqk/d8ZSAHhGBTjB5BBILtrxJPAdsNCRc8gPCtSuAzu9r0ct -D2znJjto8HO3a0s/4mlqMQ8iSvfH0c8nGLPxRXg0C9tR0VOyqJrqAPn9X6utxVQj -H2jLjZngZllhqlxIUxYuXO7MZfC2MQ4DRsp6GaJTftcOxTxevMdT6lK0yl3mDn0W -DyV9aWR5oCVXKIRK7jmF9bi9ETHwJHffFrduaaKYLQ/UOEtNek/pJsz0DNO0ePkm -DAt0GQkX3hmKd0VRgGEtaO+MAGbrDucPuDylMkC1GJm1lq6+6rkyQRNoAd8/yOJD -GihBJmLPAgMBAAECggEBAL3+WM/3IGHnyWavJMnfQaq6rdWkJlLugAT8BCs7BITr -04AJKY5wvjID8j4/KJM+BRbsl4NBT3lPDcq6YajO8rPL0E/+nG60RTYv3vvg79Xv -V6uPsRbifdnW1Q1+0cY+r4CFAKeC7JVS7ZmJ+nKMh8XPiM8OVOfW1w0hLFbkdqiq -UetA5H0oiJr0rFWh9Gfzc0avpmawXmZJqK8lKWB1rt2teu3bQWqn20dGr2IyCipz -KlGh3QImYogjqWEqPyowPGxnq8KWQ40Pjx61dy6cqYrw77yxLHGR8Az+TlRQZf/K -BeT3UkXCU5BTyC3PKZJpcYB/GMB8GBKRdNK+8H3OXskCgYEA963tUnLoiCwJjxvv -gIiMY5mIUAMnTDsCxSYekfkDvt4qdttn/+Y8/5/lXMSlCt+WZcXH0V8gmVOMqfHB -QRXWpi0uJnl9sUllb80Mw5PnS317UlJIbkro3crVUhIbrn9tKVFP1GO9xszNda8E -MkHV8FGmSaihXGnA8KEkTKg1CisCgYEA8aEjATIpDXyxQM4M9B1S0jI/nHOrg2lr -dMKQWJVruuvwrrZl6CFNIm2/PBXyHjCXqROXs7aXkE3vfRSypYNKBZl7BX08c0nE -koMVXwhGbSbUXjFx5bcUKaG/2eOK+ZV4ivNQokq1iIK+WKINAfP69ewzD7EAgbBg -KY7owSxka+0CgYB4Urh+W3B35tzl9y5NBQkewdGk/UM0F17rI++p/o1BRnDeuQw3 -F0T+8lDc1nNPavuHiaPfJRWTJzGoxdeapN9Yb46CBnd3jy6GN9lBkjLFS7qDbZHe -cunaBdXIPx/Pj/waHHRpu+LQF2KhD1s8hxtF2oSsOA3b9UxUGhSmYPkTbQKBgEP8 -muTTQEnTM+yQDYUCWzNZgBx9T10CZIHN3N+P62gEywvdtn7CH/n39z7ozd9AvOuN -37lpPuwTgbcoA7weXM2Gid7ZhhDKSM0QpQrAQVClBEwcjXedM8cjA+BC7e+b5vbx -z1ZavwlSAEzgC9jo1Uws0ZEwtHvJLMWEuGjiHL9hAoGAWEbj2cxhpCKTK3C8Qf+C -BscBwAZKmUasdWQBUzRFpR1UAO3fFBatjMPwrFYnt+ZgiCXTGFcoEa7mjoP/r5Mh -j1nRCoPQVcbmB1B9AtiaEa1AA+BqYF1r2aErbcsGrCV5OHU7TYFk1dep1SAQP/0W -9MQ+1Af5ttYSFYlJLnWJo4M= ------END PRIVATE KEY----- -` - -module.exports['server.crt'] = ` ------BEGIN CERTIFICATE----- -MIIDPjCCAiagAwIBAgIJALrth9K8D7HIMA0GCSqGSIb3DQEBCwUAMF0xCzAJBgNV -BAYTAlVTMQswCQYDVQQIDAJDQTEQMA4GA1UECgwHTm9kZS5qczERMA8GA1UECwwI -bm9kZS1neXAxHDAaBgNVBAMME25vZGUtZ3lwLm5vZGVqcy5vcmcwHhcNMjMwOTI4 -MDUxODM2WhcNMzMwOTI1MDUxODM2WjBgMQswCQYDVQQGEwJVUzETMBEGA1UECAwK -Q2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEQMA4GA1UECgwHTm9k -ZS5qczESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEA6caiqs6vD7jrqDNPV9YHYeldZzJiejqpP3fGUgB4RgU4weQQSC7a -8STwHbDQkXPIDwrUrgM7va9HLQ9s5yY7aPBzt2tLP+JpajEPIkr3x9HPJxiz8UV4 -NAvbUdFTsqia6gD5/V+rrcVUIx9oy42Z4GZZYapcSFMWLlzuzGXwtjEOA0bKehmi -U37XDsU8XrzHU+pStMpd5g59Fg8lfWlkeaAlVyiESu45hfW4vREx8CR33xa3bmmi -mC0P1DhLTXpP6SbM9AzTtHj5JgwLdBkJF94ZindFUYBhLWjvjABm6w7nD7g8pTJA -tRiZtZauvuq5MkETaAHfP8jiQxooQSZizwIDAQABMA0GCSqGSIb3DQEBCwUAA4IB -AQBwgEyrqJOV8SC7PVTtEOqfSyrM7lJjVcmwXEIFPVCPxXnDtLS9+OaQe9ybjOR/ -Bi/AvZK4gwsV9G5Bvbl0/sphYEKYLEpP76jhdETcBwhaEgK3itumoREeriut4bZI -OM6b1O45CoD67Lm87CUwLOdcNzPu4k7mat+xog5aFwaQuRjLBmmZcjl41QjVr9ti -La4PCMh7NwVMtHRqbYvgq785PsKAh+j4FSX1sj9NRzRPoJJ2qsre1Qn5tL/i6ovj -6s+3GxOQ5I1UzJX22PZFu003a582ha1CEFM0VaeDzzwbGNcV5SP+g2nw55zx9YRR -Rg8nGmjRuRtbs+/XAre2eQ5p ------END CERTIFICATE----- -` - -module.exports['ca-bundle.crt'] = ` ------BEGIN CERTIFICATE----- -MIIDJjCCAg4CAhnOMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD -VQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZMBcGA1UECgwQU3Ryb25n -TG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRowGAYDVQQDDBFjYS5zdHJv -bmdsb29wLmNvbTAeFw0xNTEyMDgyMzM1MzNaFw00MzA0MjQyMzM1MzNaMBkxFzAV -BgNVBAMMDnN0cm9uZ2xvb3AuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB -CgKCAQEAwOYI7OZ2FX/YjRgLZoDQlbPc5UZXU/j0e1wwiJNPtPEax9Y5Uoza0Pnt -Ikzkc2SfvQ+IJrhXo385tI0W5juuqbHnE7UrjUuPjUX6NHevkxcs/flmjan5wnZM -cPsGhH71WDuUEEflvZihf2Se2x+xgZtMhc5XGmVmRuZFYKvkgUhA2/w8/QrK+jPT -n9QRJxZjWNh2RBdC1B7u4jffSmOSUljYFH1I2eTeY+Rdi6YUIYSU9gEoZxsv3Tia -SomfMF5jt2Mouo6MzA+IhLvvFjcrcph1Qxgi9RkfdCMMd+Ipm9YWELkyG1bDRpQy -0iyHD4gvVsAqz1Y2KdRSdc3Kt+nTqwIDAQABoxkwFzAVBgNVHREEDjAMhwQAAAAA -hwR/AAABMA0GCSqGSIb3DQEBBQUAA4IBAQAhy4J0hML3NgmDRHdL5/iTucBe22Mf -jJjg2aifD1S187dHm+Il4qZNO2plWwAhN0h704f+8wpsaALxUvBIu6nvlvcMP5PH -jGN5JLe2Km3UaPvYOQU2SgacLilu+uBcIo2JSHLV6O7ziqUj5Gior6YxDLCtEZie -Ea8aX5/YjuACtEMJ1JjRqjgkM66XAoUe0E8onOK3FgTIO3tGoTJwRp0zS50pFuP0 -PsZtT04ck6mmXEXXknNoAyBCvPypfms9OHqcUIW9fiQnrGbS/Ri4QSQYj0DtFk/1 -na4fY1gf3zTHxH8259b/TOOaPfTnCEsOQtjUrWNR4xhmVZ+HJy4yytUW ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDbzCCAlcCAmm6MA0GCSqGSIb3DQEBCwUAMH0xCzAJBgNVBAYTAlVTMQswCQYD -VQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZMBcGA1UECgwQU3Ryb25n -TG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRowGAYDVQQDDBFjYS5zdHJv -bmdsb29wLmNvbTAeFw0xNTEyMDgyMzM1MzNaFw00MzA0MjQyMzM1MzNaMH0xCzAJ -BgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZ -MBcGA1UECgwQU3Ryb25nTG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRow -GAYDVQQDDBFjYS5zdHJvbmdsb29wLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBANfj86jkvvYDjHBgiqWhk9Cj+bqiMq3MqnV0CBO4iuK33Fo6XssE -H+yVdXlIBFbFe6t655MdBVOR2Sfj7WqNh96vhu6PyDHiwcQlTaiLU6nhIed1J4Wv -lvnJHFmp8Wbtx5AgLT4UYu03ftvXEl2DLi3vhSL2tRM1ebXHB/KPbRWkb25DPX0P -foOHot3f2dgNe2x6kponf7E/QDmAu3s7Nlkfh+ryDhgGU7wocXEhXbprNqRqOGNo -xbXgUI+/9XDxYT/7Gn5LF/fPjtN+aB0SKMnTsDhprVlZie83mlqJ46fOOrR+vrsQ -mi/1m/TadrARtZoIExC/cQRdVM05EK4tUa8CAwEAATANBgkqhkiG9w0BAQsFAAOC -AQEAQ7k5WhyhDTIGYCNzRnrMHWSzGqa1y4tJMW06wafJNRqTm1cthq1ibc6Hfq5a -K10K0qMcgauRTfQ1MWrVCTW/KnJ1vkhiTOH+RvxapGn84gSaRmV6KZen0+gMsgae -KEGe/3Hn+PmDVV+PTamHgPACfpTww38WHIe/7Ce9gHfG7MZ8cKHNZhDy0IAYPln+ -YRwMLd7JNQffHAbWb2CE1mcea4H/12U8JZW5tHCF6y9V+7IuDzqwIrLKcW3lG17n -VUG6ODF/Ryqn3V5X+TL91YyXi6c34y34IpC7MQDV/67U7+5Bp5CfeDPWW2wVSrW+ -uGZtfEvhbNm6m2i4UNmpCXxUZQ== ------END CERTIFICATE----- -` diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi deleted file mode 100644 index e767534082f8c..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi +++ /dev/null @@ -1,6 +0,0 @@ -# Test configuration -{ - 'variables': { - 'build_with_electron': true - } -} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/test-charmap.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/test-charmap.py deleted file mode 100644 index 63aa77bb482ef..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/fixtures/test-charmap.py +++ /dev/null @@ -1,31 +0,0 @@ -import sys -import locale - -try: - reload(sys) -except NameError: # Python 3 - pass - - -def main(): - encoding = locale.getdefaultlocale()[1] - if not encoding: - return False - - try: - sys.setdefaultencoding(encoding) - except AttributeError: # Python 3 - pass - - textmap = { - "cp936": "\u4e2d\u6587", - "cp1252": "Lat\u012Bna", - "cp932": "\u306b\u307b\u3093\u3054", - } - if encoding in textmap: - print(textmap[encoding]) - return True - - -if __name__ == "__main__": - print(main()) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/process-exec-sync.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/process-exec-sync.js deleted file mode 100644 index 21763bc26de10..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/process-exec-sync.js +++ /dev/null @@ -1,140 +0,0 @@ -'use strict' - -const fs = require('graceful-fs') -const childProcess = require('child_process') - -function startsWith (str, search, pos) { - if (String.prototype.startsWith) { - return str.startsWith(search, pos) - } - - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search -} - -function processExecSync (file, args, options) { - var child, error, timeout, tmpdir, command - command = makeCommand(file, args) - - /* - this function emulates child_process.execSync for legacy node <= 0.10.x - derived from https://github.com/gvarsanyi/sync-exec/blob/master/js/sync-exec.js - */ - - options = options || {} - // init timeout - timeout = Date.now() + options.timeout - // init tmpdir - var osTempBase = '/tmp' - var os = determineOS() - osTempBase = '/tmp' - - if (process.env.TMP) { - osTempBase = process.env.TMP - } - - if (osTempBase[osTempBase.length - 1] !== '/') { - osTempBase += '/' - } - - tmpdir = osTempBase + 'processExecSync.' + Date.now() + Math.random() - fs.mkdirSync(tmpdir) - - // init command - if (os === 'linux') { - command = '(' + command + ' > ' + tmpdir + '/stdout 2> ' + tmpdir + - '/stderr); echo $? > ' + tmpdir + '/status' - } else { - command = '(' + command + ' > ' + tmpdir + '/stdout 2> ' + tmpdir + - '/stderr) | echo %errorlevel% > ' + tmpdir + '/status | exit' - } - - // init child - child = childProcess.exec(command, options) - - var maxTry = 100000 // increases the test time by 6 seconds on win-2016-node-0.10 - var tryCount = 0 - while (tryCount < maxTry) { - try { - var x = fs.readFileSync(tmpdir + '/status') - if (x.toString() === '0') { - break - } - } catch (ignore) {} - tryCount++ - if (Date.now() > timeout) { - error = child - break - } - } - - ['stdout', 'stderr', 'status'].forEach(function (file) { - child[file] = fs.readFileSync(tmpdir + '/' + file, options.encoding) - setTimeout(unlinkFile, 500, tmpdir + '/' + file) - }) - - child.status = Number(child.status) - if (child.status !== 0) { - error = child - } - - try { - fs.rmdirSync(tmpdir) - } catch (ignore) {} - if (error) { - throw error - } - return child.stdout -} - -function makeCommand (file, args) { - var command, quote - command = file - if (args.length > 0) { - for (var i in args) { - command = command + ' ' - if (args[i][0] === '-') { - command = command + args[i] - } else { - if (!quote) { - command = command + '"' - quote = true - } - command = command + args[i] - if (quote) { - if (args.length === (parseInt(i) + 1)) { - command = command + '"' - } - } - } - } - } - return command -} - -function determineOS () { - var os = '' - var tmpVar = '' - if (process.env.OSTYPE) { - tmpVar = process.env.OSTYPE - } else if (process.env.OS) { - tmpVar = process.env.OS - } else { - // default is linux - tmpVar = 'linux' - } - - if (startsWith(tmpVar, 'linux')) { - os = 'linux' - } - if (startsWith(tmpVar, 'win')) { - os = 'win' - } - - return os -} - -function unlinkFile (file) { - fs.unlinkSync(file) -} - -module.exports = processExecSync diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/reporter.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/reporter.js deleted file mode 100644 index 9964b1b5d504c..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/reporter.js +++ /dev/null @@ -1,75 +0,0 @@ -const Mocha = require('mocha') - -class Reporter { - constructor (runner) { - this.failedTests = [] - - runner.on(Mocha.Runner.constants.EVENT_RUN_BEGIN, () => { - console.log('Starting tests') - }) - - runner.on(Mocha.Runner.constants.EVENT_RUN_END, () => { - console.log('Tests finished') - console.log() - console.log('****************') - console.log('* TESTS REPORT *') - console.log('****************') - console.log() - console.log(`Executed ${runner.stats.suites} suites with ${runner.stats.tests} tests in ${runner.stats.duration} ms`) - console.log(` Passed: ${runner.stats.passes}`) - console.log(` Skipped: ${runner.stats.pending}`) - console.log(` Failed: ${runner.stats.failures}`) - if (this.failedTests.length > 0) { - console.log() - console.log(' Failed test details') - this.failedTests.forEach((failedTest, index) => { - console.log() - console.log(` ${index + 1}.'${failedTest.test.fullTitle()}'`) - console.log(` Name: ${failedTest.error.name}`) - console.log(` Message: ${failedTest.error.message}`) - console.log(` Code: ${failedTest.error.code}`) - console.log(` Stack: ${failedTest.error.stack}`) - }) - } - console.log() - }) - - runner.on(Mocha.Runner.constants.EVENT_SUITE_BEGIN, (suite) => { - if (suite.root) { - return - } - console.log(`Starting suite '${suite.title}'`) - }) - - runner.on(Mocha.Runner.constants.EVENT_SUITE_END, (suite) => { - if (suite.root) { - return - } - console.log(`Suite '${suite.title}' finished`) - console.log() - }) - - runner.on(Mocha.Runner.constants.EVENT_TEST_BEGIN, (test) => { - console.log(`Starting test '${test.title}'`) - }) - - runner.on(Mocha.Runner.constants.EVENT_TEST_PASS, (test) => { - console.log(`Test '${test.title}' passed in ${test.duration} ms`) - }) - - runner.on(Mocha.Runner.constants.EVENT_TEST_PENDING, (test) => { - console.log(`Test '${test.title}' skipped in ${test.duration} ms`) - }) - - runner.on(Mocha.Runner.constants.EVENT_TEST_FAIL, (test, error) => { - this.failedTests.push({ test, error }) - console.log(`Test '${test.title}' failed in ${test.duration} ms with ${error}`) - }) - - runner.on(Mocha.Runner.constants.EVENT_TEST_END, (test) => { - console.log() - }) - } -} - -module.exports = Reporter diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/simple-proxy.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/simple-proxy.js deleted file mode 100644 index cb0dfcfec7edc..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/simple-proxy.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const http = require('http') -const https = require('https') -const server = http.createServer(handler) -const port = +process.argv[2] -const prefix = process.argv[3] -const upstream = process.argv[4] -var calls = 0 - -server.listen(port) - -function handler (req, res) { - if (req.url.indexOf(prefix) !== 0) { - throw new Error('request url [' + req.url + '] does not start with [' + prefix + ']') - } - - var upstreamUrl = upstream + req.url.substring(prefix.length) - https.get(upstreamUrl, function (ures) { - ures.on('end', function () { - if (++calls === 2) { - server.close() - } - }) - ures.pipe(res) - }) -} diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-addon.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-addon.js deleted file mode 100644 index 43556620a85ab..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-addon.js +++ /dev/null @@ -1,152 +0,0 @@ -'use strict' - -const { describe, it } = require('mocha') -const assert = require('assert') -const path = require('path') -const fs = require('graceful-fs') -const childProcess = require('child_process') -const os = require('os') -const addonPath = path.resolve(__dirname, 'node_modules', 'hello_world') -const nodeGyp = path.resolve(__dirname, '..', 'bin', 'node-gyp.js') -const execFileSync = childProcess.execFileSync || require('./process-exec-sync') -const execFile = childProcess.execFile - -function runHello (hostProcess) { - if (!hostProcess) { - hostProcess = process.execPath - } - var testCode = "console.log(require('hello_world').hello())" - return execFileSync(hostProcess, ['-e', testCode], { cwd: __dirname }).toString() -} - -function getEncoding () { - var code = 'import locale;print(locale.getdefaultlocale()[1])' - return execFileSync('python', ['-c', code]).toString().trim() -} - -function checkCharmapValid () { - var data - try { - data = execFileSync('python', ['fixtures/test-charmap.py'], - { cwd: __dirname }) - } catch (err) { - return false - } - var lines = data.toString().trim().split('\n') - return lines.pop() === 'True' -} - -describe('addon', function () { - this.timeout(300000) - - it('build simple addon', function (done) { - // Set the loglevel otherwise the output disappears when run via 'npm test' - var cmd = [nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose'] - var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) { - var logLines = stderr.toString().trim().split(/\r?\n/) - var lastLine = logLines[logLines.length - 1] - assert.strictEqual(err, null) - assert.strictEqual(lastLine, 'gyp info ok', 'should end in ok') - assert.strictEqual(runHello().trim(), 'world') - done() - }) - proc.stdout.setEncoding('utf-8') - proc.stderr.setEncoding('utf-8') - }) - - it('build simple addon in path with non-ascii characters', function (done) { - if (!checkCharmapValid()) { - return this.skip('python console app can\'t encode non-ascii character.') - } - - var testDirNames = { - cp936: '文件夹', - cp1252: 'Latīna', - cp932: 'フォルダ' - } - // Select non-ascii characters by current encoding - var testDirName = testDirNames[getEncoding()] - // If encoding is UTF-8 or other then no need to test - if (!testDirName) { - return this.skip('no need to test') - } - - this.timeout(300000) - - var data - var configPath = path.join(addonPath, 'build', 'config.gypi') - try { - data = fs.readFileSync(configPath, 'utf8') - } catch (err) { - assert.fail(err) - return - } - var config = JSON.parse(data.replace(/#.+\n/, '')) - var nodeDir = config.variables.nodedir - var testNodeDir = path.join(addonPath, testDirName) - // Create symbol link to path with non-ascii characters - try { - fs.symlinkSync(nodeDir, testNodeDir, 'dir') - } catch (err) { - switch (err.code) { - case 'EEXIST': break - case 'EPERM': - assert.fail(err, null, 'Please try to running console as an administrator') - return - default: - assert.fail(err) - return - } - } - - var cmd = [ - nodeGyp, - 'rebuild', - '-C', - addonPath, - '--loglevel=verbose', - '-nodedir=' + testNodeDir - ] - var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) { - try { - fs.unlink(testNodeDir) - } catch (err) { - assert.fail(err) - } - - var logLines = stderr.toString().trim().split(/\r?\n/) - var lastLine = logLines[logLines.length - 1] - assert.strictEqual(err, null) - assert.strictEqual(lastLine, 'gyp info ok', 'should end in ok') - assert.strictEqual(runHello().trim(), 'world') - done() - }) - proc.stdout.setEncoding('utf-8') - proc.stderr.setEncoding('utf-8') - }) - - it('addon works with renamed host executable', function (done) { - // No `fs.copyFileSync` before node8. - if (process.version.substr(1).split('.')[0] < 8) { - return this.skip('skipping test for old node version') - } - - this.timeout(300000) - - var notNodePath = path.join(os.tmpdir(), 'notnode' + path.extname(process.execPath)) - fs.copyFileSync(process.execPath, notNodePath) - - var cmd = [nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose'] - var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) { - var logLines = stderr.toString().trim().split(/\r?\n/) - var lastLine = logLines[logLines.length - 1] - assert.strictEqual(err, null) - assert.strictEqual(lastLine, 'gyp info ok', 'should end in ok') - assert.strictEqual(runHello(notNodePath).trim(), 'world') - fs.unlinkSync(notNodePath) - done() - }) - proc.stdout.setEncoding('utf-8') - proc.stderr.setEncoding('utf-8') - }) -}) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-configure-python.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-configure-python.js deleted file mode 100644 index ab1e5511fad98..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-configure-python.js +++ /dev/null @@ -1,81 +0,0 @@ -'use strict' - -const { describe, it } = require('mocha') -const assert = require('assert') -const path = require('path') -const devDir = require('./common').devDir() -const gyp = require('../lib/node-gyp') -const requireInject = require('require-inject') -const configure = requireInject('../lib/configure', { - 'graceful-fs': { - openSync: function () { return 0 }, - closeSync: function () { }, - writeFile: function (file, data, cb) { cb() }, - stat: function (file, cb) { cb(null, {}) }, - mkdir: function (dir, options, cb) { cb() }, - promises: { - writeFile: function (file, data) { return Promise.resolve(null) } - }, - unlink: function (path, cb) { cb() }, - symlink: function (target, path, cb) { cb() } - } -}) - -const EXPECTED_PYPATH = path.join(__dirname, '..', 'gyp', 'pylib') -const SEPARATOR = process.platform === 'win32' ? ';' : ':' -const SPAWN_RESULT = cb => ({ on: function () { cb() } }) - -require('npmlog').level = 'warn' - -describe('configure-python', function () { - it('configure PYTHONPATH with no existing env', function (done) { - delete process.env.PYTHONPATH - - var prog = gyp() - prog.parseArgv([]) - prog.spawn = function () { - assert.strictEqual(process.env.PYTHONPATH, EXPECTED_PYPATH) - return SPAWN_RESULT(done) - } - prog.devDir = devDir - configure(prog, [], assert.fail) - }) - - it('configure PYTHONPATH with existing env of one dir', function (done) { - var existingPath = path.join('a', 'b') - process.env.PYTHONPATH = existingPath - - var prog = gyp() - prog.parseArgv([]) - prog.spawn = function () { - assert.strictEqual(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR)) - - var dirs = process.env.PYTHONPATH.split(SEPARATOR) - assert.deepStrictEqual(dirs, [EXPECTED_PYPATH, existingPath]) - - return SPAWN_RESULT(done) - } - prog.devDir = devDir - configure(prog, [], assert.fail) - }) - - it('configure PYTHONPATH with existing env of multiple dirs', function (done) { - var pythonDir1 = path.join('a', 'b') - var pythonDir2 = path.join('b', 'c') - var existingPath = [pythonDir1, pythonDir2].join(SEPARATOR) - process.env.PYTHONPATH = existingPath - - var prog = gyp() - prog.parseArgv([]) - prog.spawn = function () { - assert.strictEqual(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR)) - - var dirs = process.env.PYTHONPATH.split(SEPARATOR) - assert.deepStrictEqual(dirs, [EXPECTED_PYPATH, pythonDir1, pythonDir2]) - - return SPAWN_RESULT(done) - } - prog.devDir = devDir - configure(prog, [], assert.fail) - }) -}) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-create-config-gypi.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-create-config-gypi.js deleted file mode 100644 index 725819b6aa102..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-create-config-gypi.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict' - -const path = require('path') -const { describe, it } = require('mocha') -const assert = require('assert') -const gyp = require('../lib/node-gyp') -const createConfigGypi = require('../lib/create-config-gypi') -const { parseConfigGypi, getCurrentConfigGypi } = createConfigGypi.test - -describe('create-config-gypi', function () { - it('config.gypi with no options', async function () { - const prog = gyp() - prog.parseArgv([]) - - const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} }) - assert.strictEqual(config.target_defaults.default_configuration, 'Release') - assert.strictEqual(config.variables.target_arch, process.arch) - }) - - it('config.gypi with --debug', async function () { - const prog = gyp() - prog.parseArgv(['_', '_', '--debug']) - - const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} }) - assert.strictEqual(config.target_defaults.default_configuration, 'Debug') - }) - - it('config.gypi with custom options', async function () { - const prog = gyp() - prog.parseArgv(['_', '_', '--shared-libxml2']) - - const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} }) - assert.strictEqual(config.variables.shared_libxml2, true) - }) - - it('config.gypi with nodedir', async function () { - const nodeDir = path.join(__dirname, 'fixtures', 'nodedir') - - const prog = gyp() - prog.parseArgv(['_', '_', `--nodedir=${nodeDir}`]) - - const config = await getCurrentConfigGypi({ gyp: prog, nodeDir, vsInfo: {} }) - assert.strictEqual(config.variables.build_with_electron, true) - }) - - it('config.gypi with --force-process-config', async function () { - const nodeDir = path.join(__dirname, 'fixtures', 'nodedir') - - const prog = gyp() - prog.parseArgv(['_', '_', '--force-process-config', `--nodedir=${nodeDir}`]) - - const config = await getCurrentConfigGypi({ gyp: prog, nodeDir, vsInfo: {} }) - assert.strictEqual(config.variables.build_with_electron, undefined) - }) - - it('config.gypi parsing', function () { - const str = "# Some comments\n{'variables': {'multiline': 'A'\n'B'}}" - const config = parseConfigGypi(str) - assert.deepStrictEqual(config, { variables: { multiline: 'AB' } }) - }) -}) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-download.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-download.js deleted file mode 100644 index 1dd5a51b062c0..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-download.js +++ /dev/null @@ -1,210 +0,0 @@ -'use strict' - -const { describe, it, after } = require('mocha') -const assert = require('assert') -const fs = require('fs') -const path = require('path') -const util = require('util') -const http = require('http') -const https = require('https') -const install = require('../lib/install') -const semver = require('semver') -const devDir = require('./common').devDir() -const rimraf = require('rimraf') -const gyp = require('../lib/node-gyp') -const log = require('npmlog') -const certs = require('./fixtures/certs') - -log.level = 'warn' - -describe('download', function () { - it('download over http', async function () { - const server = http.createServer((req, res) => { - assert.strictEqual(req.headers['user-agent'], `node-gyp v42 (node ${process.version})`) - res.end('ok') - }) - - after(() => new Promise((resolve) => server.close(resolve))) - - const host = 'localhost' - await new Promise((resolve) => server.listen(0, host, resolve)) - const { port } = server.address() - const gyp = { - opts: {}, - version: '42' - } - const url = `http://${host}:${port}` - const res = await install.test.download(gyp, url) - assert.strictEqual(await res.text(), 'ok') - }) - - it('download over https with custom ca', async function () { - const cafile = path.join(__dirname, 'fixtures/ca.crt') - const cacontents = certs['ca.crt'] - const cert = certs['server.crt'] - const key = certs['server.key'] - await fs.promises.writeFile(cafile, cacontents, 'utf8') - const ca = await install.test.readCAFile(cafile) - - assert.strictEqual(ca.length, 1) - - const options = { ca: ca, cert: cert, key: key } - const server = https.createServer(options, (req, res) => { - assert.strictEqual(req.headers['user-agent'], `node-gyp v42 (node ${process.version})`) - res.end('ok') - }) - - after(async () => { - await new Promise((resolve) => server.close(resolve)) - await fs.promises.unlink(cafile) - }) - - server.on('clientError', (err) => { throw err }) - - const host = 'localhost' - await new Promise((resolve) => server.listen(0, host, resolve)) - const { port } = server.address() - const gyp = { - opts: { cafile }, - version: '42' - } - const url = `https://${host}:${port}` - const res = await install.test.download(gyp, url) - assert.strictEqual(await res.text(), 'ok') - }) - - it('download over http with proxy', async function () { - const server = http.createServer((_, res) => { - res.end('ok') - }) - - const pserver = http.createServer((req, res) => { - assert.strictEqual(req.headers['user-agent'], `node-gyp v42 (node ${process.version})`) - res.end('proxy ok') - }) - - after(() => Promise.all([ - new Promise((resolve) => server.close(resolve)), - new Promise((resolve) => pserver.close(resolve)) - ])) - - const host = 'localhost' - await new Promise((resolve) => server.listen(0, host, resolve)) - const { port } = server.address() - await new Promise((resolve) => pserver.listen(port + 1, host, resolve)) - const gyp = { - opts: { - proxy: `http://${host}:${port + 1}`, - noproxy: 'bad' - }, - version: '42' - } - const url = `http://${host}:${port}` - const res = await install.test.download(gyp, url) - assert.strictEqual(await res.text(), 'proxy ok') - }) - - it('download over http with noproxy', async function () { - const server = http.createServer((req, res) => { - assert.strictEqual(req.headers['user-agent'], `node-gyp v42 (node ${process.version})`) - res.end('ok') - }) - - const pserver = http.createServer((_, res) => { - res.end('proxy ok') - }) - - after(() => Promise.all([ - new Promise((resolve) => server.close(resolve)), - new Promise((resolve) => pserver.close(resolve)) - ])) - - const host = 'localhost' - await new Promise((resolve) => server.listen(0, host, resolve)) - const { port } = server.address() - await new Promise((resolve) => pserver.listen(port + 1, host, resolve)) - const gyp = { - opts: { - proxy: `http://${host}:${port + 1}`, - noproxy: host - }, - version: '42' - } - const url = `http://${host}:${port}` - const res = await install.test.download(gyp, url) - assert.strictEqual(await res.text(), 'ok') - }) - - it('download with missing cafile', async function () { - const gyp = { - opts: { cafile: 'no.such.file' } - } - try { - await install.test.download(gyp, {}, 'http://bad/') - } catch (e) { - assert.ok(/no.such.file/.test(e.message)) - } - }) - - it('check certificate splitting', async function () { - const cafile = path.join(__dirname, 'fixtures/ca-bundle.crt') - const cacontents = certs['ca-bundle.crt'] - await fs.promises.writeFile(cafile, cacontents, 'utf8') - after(async () => { - await fs.promises.unlink(cafile) - }) - const cas = await install.test.readCAFile(path.join(__dirname, 'fixtures/ca-bundle.crt')) - assert.strictEqual(cas.length, 2) - assert.notStrictEqual(cas[0], cas[1]) - }) - - // only run this test if we are running a version of Node with predictable version path behavior - - it('download headers (actual)', async function () { - if (process.env.FAST_TEST || - process.release.name !== 'node' || - semver.prerelease(process.version) !== null || - semver.satisfies(process.version, '<10')) { - return this.skip('Skipping actual download of headers due to test environment configuration') - } - - this.timeout(300000) - - const expectedDir = path.join(devDir, process.version.replace(/^v/, '')) - await util.promisify(rimraf)(expectedDir) - - const prog = gyp() - prog.parseArgv([]) - prog.devDir = devDir - log.level = 'warn' - await util.promisify(install)(prog, []) - - const data = await fs.promises.readFile(path.join(expectedDir, 'installVersion'), 'utf8') - assert.strictEqual(data, '11\n', 'correct installVersion') - - const list = await fs.promises.readdir(path.join(expectedDir, 'include/node')) - assert.ok(list.includes('common.gypi')) - assert.ok(list.includes('config.gypi')) - assert.ok(list.includes('node.h')) - assert.ok(list.includes('node_version.h')) - assert.ok(list.includes('openssl')) - assert.ok(list.includes('uv')) - assert.ok(list.includes('uv.h')) - assert.ok(list.includes('v8-platform.h')) - assert.ok(list.includes('v8.h')) - assert.ok(list.includes('zlib.h')) - - const lines = (await fs.promises.readFile(path.join(expectedDir, 'include/node/node_version.h'), 'utf8')).split('\n') - - // extract the 3 version parts from the defines to build a valid version string and - // and check them against our current env version - const version = ['major', 'minor', 'patch'].reduce((version, type) => { - const re = new RegExp(`^#define\\sNODE_${type.toUpperCase()}_VERSION`) - const line = lines.find((l) => re.test(l)) - const i = line ? parseInt(line.replace(/^[^0-9]+([0-9]+).*$/, '$1'), 10) : 'ERROR' - return `${version}${type !== 'major' ? '.' : 'v'}${i}` - }, '') - - assert.strictEqual(version, process.version) - }) -}) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-accessible-sync.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-accessible-sync.js deleted file mode 100644 index 7edbc0c76446e..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-accessible-sync.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict' - -const { describe, it } = require('mocha') -const assert = require('assert') -const path = require('path') -const requireInject = require('require-inject') -const configure = requireInject('../lib/configure', { - 'graceful-fs': { - closeSync: function () { return undefined }, - openSync: function (path) { - if (readableFiles.some(function (f) { return f === path })) { - return 0 - } else { - var error = new Error('ENOENT - not found') - throw error - } - } - } -}) - -const dir = path.sep + 'testdir' -const readableFile = 'readable_file' -const anotherReadableFile = 'another_readable_file' -const readableFileInDir = 'somedir' + path.sep + readableFile -const readableFiles = [ - path.resolve(dir, readableFile), - path.resolve(dir, anotherReadableFile), - path.resolve(dir, readableFileInDir) -] - -describe('find-accessible-sync', function () { - it('find accessible - empty array', function () { - var candidates = [] - var found = configure.test.findAccessibleSync('test', dir, candidates) - assert.strictEqual(found, undefined) - }) - - it('find accessible - single item array, readable', function () { - var candidates = [readableFile] - var found = configure.test.findAccessibleSync('test', dir, candidates) - assert.strictEqual(found, path.resolve(dir, readableFile)) - }) - - it('find accessible - single item array, readable in subdir', function () { - var candidates = [readableFileInDir] - var found = configure.test.findAccessibleSync('test', dir, candidates) - assert.strictEqual(found, path.resolve(dir, readableFileInDir)) - }) - - it('find accessible - single item array, unreadable', function () { - var candidates = ['unreadable_file'] - var found = configure.test.findAccessibleSync('test', dir, candidates) - assert.strictEqual(found, undefined) - }) - - it('find accessible - multi item array, no matches', function () { - var candidates = ['non_existent_file', 'unreadable_file'] - var found = configure.test.findAccessibleSync('test', dir, candidates) - assert.strictEqual(found, undefined) - }) - - it('find accessible - multi item array, single match', function () { - var candidates = ['non_existent_file', readableFile] - var found = configure.test.findAccessibleSync('test', dir, candidates) - assert.strictEqual(found, path.resolve(dir, readableFile)) - }) - - it('find accessible - multi item array, return first match', function () { - var candidates = ['non_existent_file', anotherReadableFile, readableFile] - var found = configure.test.findAccessibleSync('test', dir, candidates) - assert.strictEqual(found, path.resolve(dir, anotherReadableFile)) - }) -}) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-node-directory.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-node-directory.js deleted file mode 100644 index ca299f6330646..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-node-directory.js +++ /dev/null @@ -1,115 +0,0 @@ -'use strict' - -const { describe, it } = require('mocha') -const assert = require('assert') -const path = require('path') -const findNodeDirectory = require('../lib/find-node-directory') - -const platforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32', 'aix', 'os400'] - -describe('find-node-directory', function () { - // we should find the directory based on the directory - // the script is running in and it should match the layout - // in a build tree where npm is installed in - // .... /deps/npm - it('test find-node-directory - node install', function () { - for (var next = 0; next < platforms.length; next++) { - var processObj = { execPath: '/x/y/bin/node', platform: platforms[next] } - assert.strictEqual( - findNodeDirectory('/x/deps/npm/node_modules/node-gyp/lib', processObj), - path.join('/x')) - } - }) - - // we should find the directory based on the directory - // the script is running in and it should match the layout - // in an installed tree where npm is installed in - // .... /lib/node_modules/npm or .../node_modules/npm - // depending on the patform - it('test find-node-directory - node build', function () { - for (var next = 0; next < platforms.length; next++) { - var processObj = { execPath: '/x/y/bin/node', platform: platforms[next] } - if (platforms[next] === 'win32') { - assert.strictEqual( - findNodeDirectory('/y/node_modules/npm/node_modules/node-gyp/lib', - processObj), path.join('/y')) - } else { - assert.strictEqual( - findNodeDirectory('/y/lib/node_modules/npm/node_modules/node-gyp/lib', - processObj), path.join('/y')) - } - } - }) - - // we should find the directory based on the execPath - // for node and match because it was in the bin directory - it('test find-node-directory - node in bin directory', function () { - for (var next = 0; next < platforms.length; next++) { - var processObj = { execPath: '/x/y/bin/node', platform: platforms[next] } - assert.strictEqual( - findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj), - path.join('/x/y')) - } - }) - - // we should find the directory based on the execPath - // for node and match because it was in the Release directory - it('test find-node-directory - node in build release dir', function () { - for (var next = 0; next < platforms.length; next++) { - var processObj - if (platforms[next] === 'win32') { - processObj = { execPath: '/x/y/Release/node', platform: platforms[next] } - } else { - processObj = { - execPath: '/x/y/out/Release/node', - platform: platforms[next] - } - } - - assert.strictEqual( - findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj), - path.join('/x/y')) - } - }) - - // we should find the directory based on the execPath - // for node and match because it was in the Debug directory - it('test find-node-directory - node in Debug release dir', function () { - for (var next = 0; next < platforms.length; next++) { - var processObj - if (platforms[next] === 'win32') { - processObj = { execPath: '/a/b/Debug/node', platform: platforms[next] } - } else { - processObj = { execPath: '/a/b/out/Debug/node', platform: platforms[next] } - } - - assert.strictEqual( - findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj), - path.join('/a/b')) - } - }) - - // we should not find it as it will not match based on the execPath nor - // the directory from which the script is running - it('test find-node-directory - not found', function () { - for (var next = 0; next < platforms.length; next++) { - var processObj = { execPath: '/x/y/z/y', platform: next } - assert.strictEqual(findNodeDirectory('/a/b/c/d', processObj), '') - } - }) - - // we should find the directory based on the directory - // the script is running in and it should match the layout - // in a build tree where npm is installed in - // .... /deps/npm - // same test as above but make sure additional directory entries - // don't cause an issue - it('test find-node-directory - node install', function () { - for (var next = 0; next < platforms.length; next++) { - var processObj = { execPath: '/x/y/bin/node', platform: platforms[next] } - assert.strictEqual( - findNodeDirectory('/x/y/z/a/b/c/deps/npm/node_modules/node-gyp/lib', - processObj), path.join('/x/y/z/a/b/c')) - } - }) -}) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-python.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-python.js deleted file mode 100644 index 592c480f24fef..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-python.js +++ /dev/null @@ -1,213 +0,0 @@ -'use strict' - -delete process.env.PYTHON - -const { describe, it } = require('mocha') -const assert = require('assert') -const findPython = require('../lib/find-python') -const execFile = require('child_process').execFile -const PythonFinder = findPython.test.PythonFinder - -require('npmlog').level = 'warn' - -describe('find-python', function () { - it('find python', function () { - findPython.test.findPython(null, function (err, found) { - assert.strictEqual(err, null) - var proc = execFile(found, ['-V'], function (err, stdout, stderr) { - assert.strictEqual(err, null) - assert.ok(/Python 3/.test(stdout)) - assert.strictEqual(stderr, '') - }) - proc.stdout.setEncoding('utf-8') - proc.stderr.setEncoding('utf-8') - }) - }) - - function poison (object, property) { - function fail () { - console.error(Error(`Property ${property} should not have been accessed.`)) - process.abort() - } - var descriptor = { - configurable: false, - enumerable: false, - get: fail, - set: fail - } - Object.defineProperty(object, property, descriptor) - } - - function TestPythonFinder () { - PythonFinder.apply(this, arguments) - } - TestPythonFinder.prototype = Object.create(PythonFinder.prototype) - // Silence npmlog - remove for debugging - TestPythonFinder.prototype.log = { - silly: () => {}, - verbose: () => {}, - info: () => {}, - warn: () => {}, - error: () => {} - } - delete TestPythonFinder.prototype.env.NODE_GYP_FORCE_PYTHON - - it('find python - python', function () { - var f = new TestPythonFinder('python', done) - f.execFile = function (program, args, opts, cb) { - f.execFile = function (program, args, opts, cb) { - poison(f, 'execFile') - assert.strictEqual(program, '/path/python') - assert.ok(/sys\.version_info/.test(args[1])) - cb(null, '3.9.1') - } - assert.strictEqual(program, - process.platform === 'win32' ? '"python"' : 'python') - assert.ok(/sys\.executable/.test(args[1])) - cb(null, '/path/python') - } - f.findPython() - - function done (err, python) { - assert.strictEqual(err, null) - assert.strictEqual(python, '/path/python') - } - }) - - it('find python - python too old', function () { - var f = new TestPythonFinder(null, done) - f.execFile = function (program, args, opts, cb) { - if (/sys\.executable/.test(args[args.length - 1])) { - cb(null, '/path/python') - } else if (/sys\.version_info/.test(args[args.length - 1])) { - cb(null, '2.3.4') - } else { - assert.fail() - } - } - f.findPython() - - function done (err) { - assert.ok(/Could not find any Python/.test(err)) - assert.ok(/not supported/i.test(f.errorLog)) - } - }) - - it('find python - no python', function () { - var f = new TestPythonFinder(null, done) - f.execFile = function (program, args, opts, cb) { - if (/sys\.executable/.test(args[args.length - 1])) { - cb(new Error('not found')) - } else if (/sys\.version_info/.test(args[args.length - 1])) { - cb(new Error('not a Python executable')) - } else { - assert.fail() - } - } - f.findPython() - - function done (err) { - assert.ok(/Could not find any Python/.test(err)) - assert.ok(/not in PATH/.test(f.errorLog)) - } - }) - - it('find python - no python2, no python, unix', function () { - var f = new TestPythonFinder(null, done) - f.checkPyLauncher = assert.fail - f.win = false - - f.execFile = function (program, args, opts, cb) { - if (/sys\.executable/.test(args[args.length - 1])) { - cb(new Error('not found')) - } else { - assert.fail() - } - } - f.findPython() - - function done (err) { - assert.ok(/Could not find any Python/.test(err)) - assert.ok(/not in PATH/.test(f.errorLog)) - } - }) - - it('find python - no python, use python launcher', function () { - var f = new TestPythonFinder(null, done) - f.win = true - - f.execFile = function (program, args, opts, cb) { - if (program === 'py.exe') { - assert.notStrictEqual(args.indexOf('-3'), -1) - assert.notStrictEqual(args.indexOf('-c'), -1) - return cb(null, 'Z:\\snake.exe') - } - if (/sys\.executable/.test(args[args.length - 1])) { - cb(new Error('not found')) - } else if (f.winDefaultLocations.includes(program)) { - cb(new Error('not found')) - } else if (/sys\.version_info/.test(args[args.length - 1])) { - if (program === 'Z:\\snake.exe') { - cb(null, '3.9.0') - } else { - assert.fail() - } - } else { - assert.fail() - } - } - f.findPython() - - function done (err, python) { - assert.strictEqual(err, null) - assert.strictEqual(python, 'Z:\\snake.exe') - } - }) - - it('find python - no python, no python launcher, good guess', function () { - var f = new TestPythonFinder(null, done) - f.win = true - const expectedProgram = f.winDefaultLocations[0] - - f.execFile = function (program, args, opts, cb) { - if (program === 'py.exe') { - return cb(new Error('not found')) - } - if (/sys\.executable/.test(args[args.length - 1])) { - cb(new Error('not found')) - } else if (program === expectedProgram && - /sys\.version_info/.test(args[args.length - 1])) { - cb(null, '3.7.3') - } else { - assert.fail() - } - } - f.findPython() - - function done (err, python) { - assert.strictEqual(err, null) - assert.ok(python === expectedProgram) - } - }) - - it('find python - no python, no python launcher, bad guess', function () { - var f = new TestPythonFinder(null, done) - f.win = true - - f.execFile = function (program, args, opts, cb) { - if (/sys\.executable/.test(args[args.length - 1])) { - cb(new Error('not found')) - } else if (/sys\.version_info/.test(args[args.length - 1])) { - cb(new Error('not a Python executable')) - } else { - assert.fail() - } - } - f.findPython() - - function done (err) { - assert.ok(/Could not find any Python/.test(err)) - assert.ok(/not in PATH/.test(f.errorLog)) - } - }) -}) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-visualstudio.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-visualstudio.js deleted file mode 100644 index 29d9a7dba5f55..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-find-visualstudio.js +++ /dev/null @@ -1,670 +0,0 @@ -'use strict' - -const { describe, it } = require('mocha') -const assert = require('assert') -const fs = require('fs') -const path = require('path') -const findVisualStudio = require('../lib/find-visualstudio') -const VisualStudioFinder = findVisualStudio.test.VisualStudioFinder - -const semverV1 = { major: 1, minor: 0, patch: 0 } - -delete process.env.VCINSTALLDIR - -function poison (object, property) { - function fail () { - console.error(Error(`Property ${property} should not have been accessed.`)) - process.abort() - } - var descriptor = { - configurable: false, - enumerable: false, - get: fail, - set: fail - } - Object.defineProperty(object, property, descriptor) -} - -function TestVisualStudioFinder () { VisualStudioFinder.apply(this, arguments) } -TestVisualStudioFinder.prototype = Object.create(VisualStudioFinder.prototype) -// Silence npmlog - remove for debugging -TestVisualStudioFinder.prototype.log = { - silly: () => {}, - verbose: () => {}, - info: () => {}, - warn: () => {}, - error: () => {} -} - -describe('find-visualstudio', function () { - it('VS2013', function () { - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info, { - msBuild: 'C:\\MSBuild12\\MSBuild.exe', - path: 'C:\\VS2013', - sdk: null, - toolset: 'v120', - version: '12.0', - versionMajor: 12, - versionMinor: 0, - versionYear: 2013 - }) - }) - - finder.findVisualStudio2017OrNewer = (cb) => { - finder.parseData(new Error(), '', '', cb) - } - finder.regSearchKeys = (keys, value, addOpts, cb) => { - for (var i = 0; i < keys.length; ++i) { - const fullName = `${keys[i]}\\${value}` - switch (fullName) { - case 'HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7\\14.0': - case 'HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\14.0': - continue - case 'HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7\\12.0': - assert.ok(true, `expected search for registry value ${fullName}`) - return cb(null, 'C:\\VS2013\\VC\\') - case 'HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions\\12.0\\MSBuildToolsPath': - assert.ok(true, `expected search for registry value ${fullName}`) - return cb(null, 'C:\\MSBuild12\\') - default: - assert.fail(`unexpected search for registry value ${fullName}`) - } - } - return cb(new Error()) - } - finder.findVisualStudio() - }) - - it('VS2013 should not be found on new node versions', function () { - const finder = new TestVisualStudioFinder({ - major: 10, - minor: 0, - patch: 0 - }, null, (err, info) => { - assert.ok(/find .* Visual Studio/i.test(err), 'expect error') - assert.ok(!info, 'no data') - }) - - finder.findVisualStudio2017OrNewer = (cb) => { - const file = path.join(__dirname, 'fixtures', 'VS_2017_Unusable.txt') - const data = fs.readFileSync(file) - finder.parseData(null, data, '', cb) - } - finder.regSearchKeys = (keys, value, addOpts, cb) => { - for (var i = 0; i < keys.length; ++i) { - const fullName = `${keys[i]}\\${value}` - switch (fullName) { - case 'HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7\\14.0': - case 'HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\14.0': - continue - default: - assert.fail(`unexpected search for registry value ${fullName}`) - } - } - return cb(new Error()) - } - finder.findVisualStudio() - }) - - it('VS2015', function () { - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info, { - msBuild: 'C:\\MSBuild14\\MSBuild.exe', - path: 'C:\\VS2015', - sdk: null, - toolset: 'v140', - version: '14.0', - versionMajor: 14, - versionMinor: 0, - versionYear: 2015 - }) - }) - - finder.findVisualStudio2017OrNewer = (cb) => { - finder.parseData(new Error(), '', '', cb) - } - finder.regSearchKeys = (keys, value, addOpts, cb) => { - for (var i = 0; i < keys.length; ++i) { - const fullName = `${keys[i]}\\${value}` - switch (fullName) { - case 'HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7\\14.0': - assert.ok(true, `expected search for registry value ${fullName}`) - return cb(null, 'C:\\VS2015\\VC\\') - case 'HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions\\14.0\\MSBuildToolsPath': - assert.ok(true, `expected search for registry value ${fullName}`) - return cb(null, 'C:\\MSBuild14\\') - default: - assert.fail(`unexpected search for registry value ${fullName}`) - } - } - return cb(new Error()) - } - finder.findVisualStudio() - }) - - it('error from PowerShell', function () { - const finder = new TestVisualStudioFinder(semverV1, null, null) - - finder.parseData(new Error(), '', '', (info) => { - assert.ok(/use PowerShell/i.test(finder.errorLog[0]), 'expect error') - assert.ok(!info, 'no data') - }) - }) - - it('empty output from PowerShell', function () { - const finder = new TestVisualStudioFinder(semverV1, null, null) - - finder.parseData(null, '', '', (info) => { - assert.ok(/use PowerShell/i.test(finder.errorLog[0]), 'expect error') - assert.ok(!info, 'no data') - }) - }) - - it('output from PowerShell not JSON', function () { - const finder = new TestVisualStudioFinder(semverV1, null, null) - - finder.parseData(null, 'AAAABBBB', '', (info) => { - assert.ok(/use PowerShell/i.test(finder.errorLog[0]), 'expect error') - assert.ok(!info, 'no data') - }) - }) - - it('wrong JSON from PowerShell', function () { - const finder = new TestVisualStudioFinder(semverV1, null, null) - - finder.parseData(null, '{}', '', (info) => { - assert.ok(/use PowerShell/i.test(finder.errorLog[0]), 'expect error') - assert.ok(!info, 'no data') - }) - }) - - it('empty JSON from PowerShell', function () { - const finder = new TestVisualStudioFinder(semverV1, null, null) - - finder.parseData(null, '[]', '', (info) => { - assert.ok(/find .* Visual Studio/i.test(finder.errorLog[0]), 'expect error') - assert.ok(!info, 'no data') - }) - }) - - it('future version', function () { - const finder = new TestVisualStudioFinder(semverV1, null, null) - - finder.parseData(null, JSON.stringify([{ - packages: [ - 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', - 'Microsoft.VisualStudio.Component.Windows10SDK.17763', - 'Microsoft.VisualStudio.VC.MSBuild.Base' - ], - path: 'C:\\VS', - version: '9999.9999.9999.9999' - }]), '', (info) => { - assert.ok(/unknown version/i.test(finder.errorLog[0]), 'expect error') - assert.ok(/find .* Visual Studio/i.test(finder.errorLog[1]), 'expect error') - assert.ok(!info, 'no data') - }) - }) - - it('single unusable VS2017', function () { - const finder = new TestVisualStudioFinder(semverV1, null, null) - - const file = path.join(__dirname, 'fixtures', 'VS_2017_Unusable.txt') - const data = fs.readFileSync(file) - finder.parseData(null, data, '', (info) => { - assert.ok(/checking/i.test(finder.errorLog[0]), 'expect error') - assert.ok(/find .* Visual Studio/i.test(finder.errorLog[2]), 'expect error') - assert.ok(!info, 'no data') - }) - }) - - it('minimal VS2017 Build Tools', function () { - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info, { - msBuild: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\' + - 'BuildTools\\MSBuild\\15.0\\Bin\\MSBuild.exe', - path: - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools', - sdk: '10.0.17134.0', - toolset: 'v141', - version: '15.9.28307.665', - versionMajor: 15, - versionMinor: 9, - versionYear: 2017 - }) - }) - - poison(finder, 'regSearchKeys') - finder.findVisualStudio2017OrNewer = (cb) => { - const file = path.join(__dirname, 'fixtures', - 'VS_2017_BuildTools_minimal.txt') - const data = fs.readFileSync(file) - finder.parseData(null, data, '', cb) - } - finder.findVisualStudio() - }) - - it('VS2017 Community with C++ workload', function () { - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info, { - msBuild: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\' + - 'Community\\MSBuild\\15.0\\Bin\\MSBuild.exe', - path: - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community', - sdk: '10.0.17763.0', - toolset: 'v141', - version: '15.9.28307.665', - versionMajor: 15, - versionMinor: 9, - versionYear: 2017 - }) - }) - - poison(finder, 'regSearchKeys') - finder.findVisualStudio2017OrNewer = (cb) => { - const file = path.join(__dirname, 'fixtures', - 'VS_2017_Community_workload.txt') - const data = fs.readFileSync(file) - finder.parseData(null, data, '', cb) - } - finder.findVisualStudio() - }) - - it('VS2017 Express', function () { - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info, { - msBuild: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\' + - 'WDExpress\\MSBuild\\15.0\\Bin\\MSBuild.exe', - path: - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\WDExpress', - sdk: '10.0.17763.0', - toolset: 'v141', - version: '15.9.28307.858', - versionMajor: 15, - versionMinor: 9, - versionYear: 2017 - }) - }) - - poison(finder, 'regSearchKeys') - finder.findVisualStudio2017OrNewer = (cb) => { - const file = path.join(__dirname, 'fixtures', 'VS_2017_Express.txt') - const data = fs.readFileSync(file) - finder.parseData(null, data, '', cb) - } - finder.findVisualStudio() - }) - - it('VS2019 Preview with C++ workload', function () { - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info, { - msBuild: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\' + - 'Preview\\MSBuild\\Current\\Bin\\MSBuild.exe', - path: - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview', - sdk: '10.0.17763.0', - toolset: 'v142', - version: '16.0.28608.199', - versionMajor: 16, - versionMinor: 0, - versionYear: 2019 - }) - }) - - poison(finder, 'regSearchKeys') - finder.findVisualStudio2017OrNewer = (cb) => { - const file = path.join(__dirname, 'fixtures', - 'VS_2019_Preview.txt') - const data = fs.readFileSync(file) - finder.parseData(null, data, '', cb) - } - finder.findVisualStudio() - }) - - it('minimal VS2019 Build Tools', function () { - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info, { - msBuild: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\' + - 'BuildTools\\MSBuild\\Current\\Bin\\MSBuild.exe', - path: - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools', - sdk: '10.0.17134.0', - toolset: 'v142', - version: '16.1.28922.388', - versionMajor: 16, - versionMinor: 1, - versionYear: 2019 - }) - }) - - poison(finder, 'regSearchKeys') - finder.findVisualStudio2017OrNewer = (cb) => { - const file = path.join(__dirname, 'fixtures', - 'VS_2019_BuildTools_minimal.txt') - const data = fs.readFileSync(file) - finder.parseData(null, data, '', cb) - } - finder.findVisualStudio() - }) - - it('VS2019 Community with C++ workload', function () { - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info, { - msBuild: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\' + - 'Community\\MSBuild\\Current\\Bin\\MSBuild.exe', - path: - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community', - sdk: '10.0.17763.0', - toolset: 'v142', - version: '16.1.28922.388', - versionMajor: 16, - versionMinor: 1, - versionYear: 2019 - }) - }) - - poison(finder, 'regSearchKeys') - finder.findVisualStudio2017OrNewer = (cb) => { - const file = path.join(__dirname, 'fixtures', - 'VS_2019_Community_workload.txt') - const data = fs.readFileSync(file) - finder.parseData(null, data, '', cb) - } - finder.findVisualStudio() - }) - - it('VS2022 Preview with C++ workload', function () { - const msBuildPath = process.arch === 'arm64' - ? 'C:\\Program Files\\Microsoft Visual Studio\\2022\\' + - 'Community\\MSBuild\\Current\\Bin\\arm64\\MSBuild.exe' - : 'C:\\Program Files\\Microsoft Visual Studio\\2022\\' + - 'Community\\MSBuild\\Current\\Bin\\MSBuild.exe' - - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info, { - msBuild: msBuildPath, - path: - 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community', - sdk: '10.0.22621.0', - toolset: 'v143', - version: '17.4.33213.308', - versionMajor: 17, - versionMinor: 4, - versionYear: 2022 - }) - }) - - poison(finder, 'regSearchKeys') - finder.msBuildPathExists = (path) => { - return true - } - finder.findVisualStudio2017OrNewer = (cb) => { - const file = path.join(__dirname, 'fixtures', - 'VS_2022_Community_workload.txt') - const data = fs.readFileSync(file) - finder.parseData(null, data, '', cb) - } - finder.findVisualStudio() - }) - - function allVsVersions (finder) { - finder.findVisualStudio2017OrNewer = (cb) => { - const data0 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures', - 'VS_2017_Unusable.txt'))) - const data1 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures', - 'VS_2017_BuildTools_minimal.txt'))) - const data2 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures', - 'VS_2017_Community_workload.txt'))) - const data3 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures', - 'VS_2017_Express.txt'))) - const data4 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures', - 'VS_2019_Preview.txt'))) - const data5 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures', - 'VS_2019_BuildTools_minimal.txt'))) - const data6 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures', - 'VS_2019_Community_workload.txt'))) - const data7 = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures', - 'VS_2022_Community_workload.txt'))) - const data = JSON.stringify(data0.concat(data1, data2, data3, data4, - data5, data6, data7)) - finder.parseData(null, data, '', cb) - } - finder.regSearchKeys = (keys, value, addOpts, cb) => { - for (var i = 0; i < keys.length; ++i) { - const fullName = `${keys[i]}\\${value}` - switch (fullName) { - case 'HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7\\14.0': - case 'HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7\\12.0': - continue - case 'HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\12.0': - return cb(null, 'C:\\VS2013\\VC\\') - case 'HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions\\12.0\\MSBuildToolsPath': - return cb(null, 'C:\\MSBuild12\\') - case 'HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\14.0': - return cb(null, 'C:\\VS2015\\VC\\') - case 'HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions\\14.0\\MSBuildToolsPath': - return cb(null, 'C:\\MSBuild14\\') - default: - assert.fail(`unexpected search for registry value ${fullName}`) - } - } - return cb(new Error()) - } - } - - it('fail when looking for invalid path', function () { - const finder = new TestVisualStudioFinder(semverV1, 'AABB', (err, info) => { - assert.ok(/find .* Visual Studio/i.test(err), 'expect error') - assert.ok(!info, 'no data') - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('look for VS2013 by version number', function () { - const finder = new TestVisualStudioFinder(semverV1, '2013', (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.versionYear, 2013) - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('look for VS2013 by installation path', function () { - const finder = new TestVisualStudioFinder(semverV1, 'C:\\VS2013', - (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.path, 'C:\\VS2013') - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('look for VS2015 by version number', function () { - const finder = new TestVisualStudioFinder(semverV1, '2015', (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.versionYear, 2015) - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('look for VS2015 by installation path', function () { - const finder = new TestVisualStudioFinder(semverV1, 'C:\\VS2015', - (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.path, 'C:\\VS2015') - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('look for VS2017 by version number', function () { - const finder = new TestVisualStudioFinder(semverV1, '2017', (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.versionYear, 2017) - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('look for VS2017 by installation path', function () { - const finder = new TestVisualStudioFinder(semverV1, - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community', - (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.path, - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community') - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('look for VS2019 by version number', function () { - const finder = new TestVisualStudioFinder(semverV1, '2019', (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.versionYear, 2019) - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('look for VS2019 by installation path', function () { - const finder = new TestVisualStudioFinder(semverV1, - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools', - (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.path, - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools') - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('look for VS2022 by version number', function () { - const finder = new TestVisualStudioFinder(semverV1, '2022', (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.versionYear, 2022) - }) - - finder.msBuildPathExists = (path) => { - return true - } - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('msvs_version match should be case insensitive', function () { - const finder = new TestVisualStudioFinder(semverV1, - 'c:\\program files (x86)\\microsoft visual studio\\2019\\BUILDTOOLS', - (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.path, - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools') - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('latest version should be found by default', function () { - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.versionYear, 2022) - }) - - finder.msBuildPathExists = (path) => { - return true - } - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('run on a usable VS Command Prompt', function () { - process.env.VCINSTALLDIR = 'C:\\VS2015\\VC' - // VSINSTALLDIR is not defined on Visual C++ Build Tools 2015 - delete process.env.VSINSTALLDIR - - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.path, 'C:\\VS2015') - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('VCINSTALLDIR match should be case insensitive', function () { - process.env.VCINSTALLDIR = - 'c:\\program files (x86)\\microsoft visual studio\\2019\\BUILDTOOLS\\VC' - - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.path, - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools') - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('run on a unusable VS Command Prompt', function () { - process.env.VCINSTALLDIR = - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildToolsUnusable\\VC' - - const finder = new TestVisualStudioFinder(semverV1, null, (err, info) => { - assert.ok(/find .* Visual Studio/i.test(err), 'expect error') - assert.ok(!info, 'no data') - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('run on a VS Command Prompt with matching msvs_version', function () { - process.env.VCINSTALLDIR = 'C:\\VS2015\\VC' - - const finder = new TestVisualStudioFinder(semverV1, 'C:\\VS2015', - (err, info) => { - assert.strictEqual(err, null) - assert.deepStrictEqual(info.path, 'C:\\VS2015') - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) - - it('run on a VS Command Prompt with mismatched msvs_version', function () { - process.env.VCINSTALLDIR = - 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC' - - const finder = new TestVisualStudioFinder(semverV1, 'C:\\VS2015', - (err, info) => { - assert.ok(/find .* Visual Studio/i.test(err), 'expect error') - assert.ok(!info, 'no data') - }) - - allVsVersions(finder) - finder.findVisualStudio() - }) -}) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-install.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-install.js deleted file mode 100644 index 08e130dfb6a44..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-install.js +++ /dev/null @@ -1,139 +0,0 @@ -'use strict' - -const { describe, it, after } = require('mocha') -const assert = require('assert') -const path = require('path') -const os = require('os') -const util = require('util') -const { test: { download, install } } = require('../lib/install') -const rimraf = require('rimraf') -const gyp = require('../lib/node-gyp') -const log = require('npmlog') -const semver = require('semver') -const stream = require('stream') -const streamPipeline = util.promisify(stream.pipeline) - -log.level = 'error' // we expect a warning - -const TIMEOUT = 20 * 60 * 1000 - -describe('install', function () { - it('EACCES retry once', async () => { - const fs = { - promises: { - stat (_) { - const err = new Error() - err.code = 'EACCES' - assert.ok(true) - throw err - } - } - } - - const Gyp = { - devDir: __dirname, - opts: { - ensure: true - }, - commands: { - install (argv, cb) { - install(fs, Gyp, argv).then(cb, cb) - }, - remove (_, cb) { - cb() - } - } - } - - try { - await install(fs, Gyp, []) - } catch (err) { - assert.ok(true) - if (/"pre" versions of node cannot be installed/.test(err.message)) { - assert.ok(true) - } - } - }) - - // only run these tests if we are running a version of Node with predictable version path behavior - const skipParallelInstallTests = process.env.FAST_TEST || - process.release.name !== 'node' || - semver.prerelease(process.version) !== null || - semver.satisfies(process.version, '<10') - - async function parallelInstallsTest (test, fs, devDir, prog) { - if (skipParallelInstallTests) { - return test.skip('Skipping parallel installs test due to test environment configuration') - } - - after(async () => { - await util.promisify(rimraf)(devDir) - }) - - const expectedDir = path.join(devDir, process.version.replace(/^v/, '')) - await util.promisify(rimraf)(expectedDir) - - await Promise.all([ - install(fs, prog, []), - install(fs, prog, []), - install(fs, prog, []), - install(fs, prog, []), - install(fs, prog, []), - install(fs, prog, []), - install(fs, prog, []), - install(fs, prog, []), - install(fs, prog, []), - install(fs, prog, []) - ]) - } - - it('parallel installs (ensure=true)', async function () { - this.timeout(TIMEOUT) - - const fs = require('graceful-fs') - const devDir = await util.promisify(fs.mkdtemp)(path.join(os.tmpdir(), 'node-gyp-test-')) - - const prog = gyp() - prog.parseArgv([]) - prog.devDir = devDir - prog.opts.ensure = true - log.level = 'warn' - - await parallelInstallsTest(this, fs, devDir, prog) - }) - - it('parallel installs (ensure=false)', async function () { - this.timeout(TIMEOUT) - - const fs = require('graceful-fs') - const devDir = await util.promisify(fs.mkdtemp)(path.join(os.tmpdir(), 'node-gyp-test-')) - - const prog = gyp() - prog.parseArgv([]) - prog.devDir = devDir - prog.opts.ensure = false - log.level = 'warn' - - await parallelInstallsTest(this, fs, devDir, prog) - }) - - it('parallel installs (tarball)', async function () { - this.timeout(TIMEOUT) - - const fs = require('graceful-fs') - const devDir = await util.promisify(fs.mkdtemp)(path.join(os.tmpdir(), 'node-gyp-test-')) - - const prog = gyp() - prog.parseArgv([]) - prog.devDir = devDir - prog.opts.tarball = path.join(devDir, 'node-headers.tar.gz') - log.level = 'warn' - - await streamPipeline( - (await download(prog, `https://nodejs.org/dist/${process.version}/node-${process.version}.tar.gz`)).body, - fs.createWriteStream(prog.opts.tarball) - ) - - await parallelInstallsTest(this, fs, devDir, prog) - }) -}) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-options.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-options.js deleted file mode 100644 index 24e79c80a1843..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-options.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict' - -const { describe, it } = require('mocha') -const assert = require('assert') -const gyp = require('../lib/node-gyp') - -describe('options', function () { - it('options in environment', () => { - // `npm test` dumps a ton of npm_config_* variables in the environment. - Object.keys(process.env) - .filter((key) => /^npm_config_/.test(key)) - .forEach((key) => { delete process.env[key] }) - - // in some platforms, certain keys are stubborn and cannot be removed - const keys = Object.keys(process.env) - .filter((key) => /^npm_config_/.test(key)) - .map((key) => key.substring('npm_config_'.length)) - .concat('argv', 'x') - - // Zero-length keys should get filtered out. - process.env.npm_config_ = '42' - // Other keys should get added. - process.env.npm_config_x = '42' - // Except loglevel. - process.env.npm_config_loglevel = 'debug' - - const g = gyp() - g.parseArgv(['rebuild']) // Also sets opts.argv. - - assert.deepStrictEqual(Object.keys(g.opts).sort(), keys.sort()) - }) - - it('options with spaces in environment', () => { - process.env.npm_config_force_process_config = 'true' - - const g = gyp() - g.parseArgv(['rebuild']) // Also sets opts.argv. - - assert.strictEqual(g.opts['force-process-config'], 'true') - }) -}) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-process-release.js b/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-process-release.js deleted file mode 100644 index 0f40666473028..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/test/test-process-release.js +++ /dev/null @@ -1,401 +0,0 @@ -'use strict' - -const { describe, it } = require('mocha') -const assert = require('assert') -const processRelease = require('../lib/process-release') - -describe('process-release', function () { - it('test process release - process.version = 0.8.20', function () { - var release = processRelease([], { opts: {} }, 'v0.8.20', null) - - assert.strictEqual(release.semver.version, '0.8.20') - delete release.semver - - assert.deepStrictEqual(release, { - version: '0.8.20', - name: 'node', - baseUrl: 'https://nodejs.org/dist/v0.8.20/', - tarballUrl: 'https://nodejs.org/dist/v0.8.20/node-v0.8.20.tar.gz', - shasumsUrl: 'https://nodejs.org/dist/v0.8.20/SHASUMS256.txt', - versionDir: '0.8.20', - ia32: { libUrl: 'https://nodejs.org/dist/v0.8.20/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.8.20/x64/node.lib', libPath: 'x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/dist/v0.8.20/arm64/node.lib', libPath: 'arm64/node.lib' } - }) - }) - - it('test process release - process.version = 0.10.21', function () { - var release = processRelease([], { opts: {} }, 'v0.10.21', null) - - assert.strictEqual(release.semver.version, '0.10.21') - delete release.semver - - assert.deepStrictEqual(release, { - version: '0.10.21', - name: 'node', - baseUrl: 'https://nodejs.org/dist/v0.10.21/', - tarballUrl: 'https://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gz', - shasumsUrl: 'https://nodejs.org/dist/v0.10.21/SHASUMS256.txt', - versionDir: '0.10.21', - ia32: { libUrl: 'https://nodejs.org/dist/v0.10.21/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.10.21/x64/node.lib', libPath: 'x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/dist/v0.10.21/arm64/node.lib', libPath: 'arm64/node.lib' } - }) - }) - - // prior to -headers.tar.gz - it('test process release - process.version = 0.12.9', function () { - var release = processRelease([], { opts: {} }, 'v0.12.9', null) - - assert.strictEqual(release.semver.version, '0.12.9') - delete release.semver - - assert.deepStrictEqual(release, { - version: '0.12.9', - name: 'node', - baseUrl: 'https://nodejs.org/dist/v0.12.9/', - tarballUrl: 'https://nodejs.org/dist/v0.12.9/node-v0.12.9.tar.gz', - shasumsUrl: 'https://nodejs.org/dist/v0.12.9/SHASUMS256.txt', - versionDir: '0.12.9', - ia32: { libUrl: 'https://nodejs.org/dist/v0.12.9/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.12.9/x64/node.lib', libPath: 'x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/dist/v0.12.9/arm64/node.lib', libPath: 'arm64/node.lib' } - }) - }) - - // prior to -headers.tar.gz - it('test process release - process.version = 0.10.41', function () { - var release = processRelease([], { opts: {} }, 'v0.10.41', null) - - assert.strictEqual(release.semver.version, '0.10.41') - delete release.semver - - assert.deepStrictEqual(release, { - version: '0.10.41', - name: 'node', - baseUrl: 'https://nodejs.org/dist/v0.10.41/', - tarballUrl: 'https://nodejs.org/dist/v0.10.41/node-v0.10.41.tar.gz', - shasumsUrl: 'https://nodejs.org/dist/v0.10.41/SHASUMS256.txt', - versionDir: '0.10.41', - ia32: { libUrl: 'https://nodejs.org/dist/v0.10.41/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.10.41/x64/node.lib', libPath: 'x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/dist/v0.10.41/arm64/node.lib', libPath: 'arm64/node.lib' } - }) - }) - - // has -headers.tar.gz - it('test process release - process.release ~ node@0.10.42', function () { - var release = processRelease([], { opts: {} }, 'v0.10.42', null) - - assert.strictEqual(release.semver.version, '0.10.42') - delete release.semver - - assert.deepStrictEqual(release, { - version: '0.10.42', - name: 'node', - baseUrl: 'https://nodejs.org/dist/v0.10.42/', - tarballUrl: 'https://nodejs.org/dist/v0.10.42/node-v0.10.42-headers.tar.gz', - shasumsUrl: 'https://nodejs.org/dist/v0.10.42/SHASUMS256.txt', - versionDir: '0.10.42', - ia32: { libUrl: 'https://nodejs.org/dist/v0.10.42/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.10.42/x64/node.lib', libPath: 'x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/dist/v0.10.42/arm64/node.lib', libPath: 'arm64/node.lib' } - }) - }) - - // has -headers.tar.gz - it('test process release - process.release ~ node@0.12.10', function () { - var release = processRelease([], { opts: {} }, 'v0.12.10', null) - - assert.strictEqual(release.semver.version, '0.12.10') - delete release.semver - - assert.deepStrictEqual(release, { - version: '0.12.10', - name: 'node', - baseUrl: 'https://nodejs.org/dist/v0.12.10/', - tarballUrl: 'https://nodejs.org/dist/v0.12.10/node-v0.12.10-headers.tar.gz', - shasumsUrl: 'https://nodejs.org/dist/v0.12.10/SHASUMS256.txt', - versionDir: '0.12.10', - ia32: { libUrl: 'https://nodejs.org/dist/v0.12.10/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.12.10/x64/node.lib', libPath: 'x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/dist/v0.12.10/arm64/node.lib', libPath: 'arm64/node.lib' } - }) - }) - - it('test process release - process.release ~ node@4.1.23', function () { - var release = processRelease([], { opts: {} }, 'v4.1.23', { - name: 'node', - headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz' - }) - - assert.strictEqual(release.semver.version, '4.1.23') - delete release.semver - - assert.deepStrictEqual(release, { - version: '4.1.23', - name: 'node', - baseUrl: 'https://nodejs.org/dist/v4.1.23/', - tarballUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz', - shasumsUrl: 'https://nodejs.org/dist/v4.1.23/SHASUMS256.txt', - versionDir: '4.1.23', - ia32: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-arm64/node.lib', libPath: 'win-arm64/node.lib' } - }) - }) - - it('test process release - process.release ~ node@4.1.23 / corp build', function () { - var release = processRelease([], { opts: {} }, 'v4.1.23', { - name: 'node', - headersUrl: 'https://some.custom.location/node-v4.1.23-headers.tar.gz' - }) - - assert.strictEqual(release.semver.version, '4.1.23') - delete release.semver - - assert.deepStrictEqual(release, { - version: '4.1.23', - name: 'node', - baseUrl: 'https://some.custom.location/', - tarballUrl: 'https://some.custom.location/node-v4.1.23-headers.tar.gz', - shasumsUrl: 'https://some.custom.location/SHASUMS256.txt', - versionDir: '4.1.23', - ia32: { libUrl: 'https://some.custom.location/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://some.custom.location/win-x64/node.lib', libPath: 'win-x64/node.lib' }, - arm64: { libUrl: 'https://some.custom.location/win-arm64/node.lib', libPath: 'win-arm64/node.lib' } - }) - }) - - it('test process release - process.release ~ node@12.8.0 Windows', function () { - var release = processRelease([], { opts: {} }, 'v12.8.0', { - name: 'node', - sourceUrl: 'https://nodejs.org/download/release/v12.8.0/node-v12.8.0.tar.gz', - headersUrl: 'https://nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz', - libUrl: 'https://nodejs.org/download/release/v12.8.0/win-x64/node.lib' - }) - - assert.strictEqual(release.semver.version, '12.8.0') - delete release.semver - - assert.deepStrictEqual(release, { - version: '12.8.0', - name: 'node', - baseUrl: 'https://nodejs.org/download/release/v12.8.0/', - tarballUrl: 'https://nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz', - shasumsUrl: 'https://nodejs.org/download/release/v12.8.0/SHASUMS256.txt', - versionDir: '12.8.0', - ia32: { libUrl: 'https://nodejs.org/download/release/v12.8.0/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://nodejs.org/download/release/v12.8.0/win-x64/node.lib', libPath: 'win-x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/download/release/v12.8.0/win-arm64/node.lib', libPath: 'win-arm64/node.lib' } - }) - }) - - it('test process release - process.release ~ node@12.8.0 Windows ARM64', function () { - var release = processRelease([], { opts: {} }, 'v12.8.0', { - name: 'node', - sourceUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/node-v12.8.0.tar.gz', - headersUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz', - libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-arm64/node.lib' - }) - - assert.strictEqual(release.semver.version, '12.8.0') - delete release.semver - - assert.deepStrictEqual(release, { - version: '12.8.0', - name: 'node', - baseUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/', - tarballUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz', - shasumsUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/SHASUMS256.txt', - versionDir: '12.8.0', - ia32: { libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-x64/node.lib', libPath: 'win-x64/node.lib' }, - arm64: { libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-arm64/node.lib', libPath: 'win-arm64/node.lib' } - }) - }) - - it('test process release - process.release ~ node@4.1.23 --target=0.10.40', function () { - var release = processRelease([], { opts: { target: '0.10.40' } }, 'v4.1.23', { - name: 'node', - headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz' - }) - - assert.strictEqual(release.semver.version, '0.10.40') - delete release.semver - - assert.deepStrictEqual(release, { - version: '0.10.40', - name: 'node', - baseUrl: 'https://nodejs.org/dist/v0.10.40/', - tarballUrl: 'https://nodejs.org/dist/v0.10.40/node-v0.10.40.tar.gz', - shasumsUrl: 'https://nodejs.org/dist/v0.10.40/SHASUMS256.txt', - versionDir: '0.10.40', - ia32: { libUrl: 'https://nodejs.org/dist/v0.10.40/node.lib', libPath: 'node.lib' }, - x64: { libUrl: 'https://nodejs.org/dist/v0.10.40/x64/node.lib', libPath: 'x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/dist/v0.10.40/arm64/node.lib', libPath: 'arm64/node.lib' } - }) - }) - - it('test process release - process.release ~ node@4.1.23 --dist-url=https://foo.bar/baz', function () { - var release = processRelease([], { opts: { 'dist-url': 'https://foo.bar/baz' } }, 'v4.1.23', { - name: 'node', - headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz' - }) - - assert.strictEqual(release.semver.version, '4.1.23') - delete release.semver - - assert.deepStrictEqual(release, { - version: '4.1.23', - name: 'node', - baseUrl: 'https://foo.bar/baz/v4.1.23/', - tarballUrl: 'https://foo.bar/baz/v4.1.23/node-v4.1.23-headers.tar.gz', - shasumsUrl: 'https://foo.bar/baz/v4.1.23/SHASUMS256.txt', - versionDir: '4.1.23', - ia32: { libUrl: 'https://foo.bar/baz/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://foo.bar/baz/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' }, - arm64: { libUrl: 'https://foo.bar/baz/v4.1.23/win-arm64/node.lib', libPath: 'win-arm64/node.lib' } - }) - }) - - it('test process release - process.release ~ frankenstein@4.1.23', function () { - var release = processRelease([], { opts: {} }, 'v4.1.23', { - name: 'frankenstein', - headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23-headers.tar.gz' - }) - - assert.strictEqual(release.semver.version, '4.1.23') - delete release.semver - - assert.deepStrictEqual(release, { - version: '4.1.23', - name: 'frankenstein', - baseUrl: 'https://frankensteinjs.org/dist/v4.1.23/', - tarballUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23-headers.tar.gz', - shasumsUrl: 'https://frankensteinjs.org/dist/v4.1.23/SHASUMS256.txt', - versionDir: 'frankenstein-4.1.23', - ia32: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-x86/frankenstein.lib', libPath: 'win-x86/frankenstein.lib' }, - x64: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-x64/frankenstein.lib', libPath: 'win-x64/frankenstein.lib' }, - arm64: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-arm64/frankenstein.lib', libPath: 'win-arm64/frankenstein.lib' } - }) - }) - - it('test process release - process.release ~ frankenstein@4.1.23 --dist-url=http://foo.bar/baz/', function () { - var release = processRelease([], { opts: { 'dist-url': 'http://foo.bar/baz/' } }, 'v4.1.23', { - name: 'frankenstein', - headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23.tar.gz' - }) - - assert.strictEqual(release.semver.version, '4.1.23') - delete release.semver - - assert.deepStrictEqual(release, { - version: '4.1.23', - name: 'frankenstein', - baseUrl: 'http://foo.bar/baz/v4.1.23/', - tarballUrl: 'http://foo.bar/baz/v4.1.23/frankenstein-v4.1.23-headers.tar.gz', - shasumsUrl: 'http://foo.bar/baz/v4.1.23/SHASUMS256.txt', - versionDir: 'frankenstein-4.1.23', - ia32: { libUrl: 'http://foo.bar/baz/v4.1.23/win-x86/frankenstein.lib', libPath: 'win-x86/frankenstein.lib' }, - x64: { libUrl: 'http://foo.bar/baz/v4.1.23/win-x64/frankenstein.lib', libPath: 'win-x64/frankenstein.lib' }, - arm64: { libUrl: 'http://foo.bar/baz/v4.1.23/win-arm64/frankenstein.lib', libPath: 'win-arm64/frankenstein.lib' } - }) - }) - - it('test process release - process.release ~ node@4.0.0-rc.4', function () { - var release = processRelease([], { opts: {} }, 'v4.0.0-rc.4', { - name: 'node', - headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz' - }) - - assert.strictEqual(release.semver.version, '4.0.0-rc.4') - delete release.semver - - assert.deepStrictEqual(release, { - version: '4.0.0-rc.4', - name: 'node', - baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/', - tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz', - shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt', - versionDir: '4.0.0-rc.4', - ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-arm64/node.lib', libPath: 'win-arm64/node.lib' } - }) - }) - - it('test process release - process.release ~ node@4.0.0-rc.4 passed as argv[0]', function () { - // note the missing 'v' on the arg, it should normalise when checking - // whether we're on the default or not - var release = processRelease(['4.0.0-rc.4'], { opts: {} }, 'v4.0.0-rc.4', { - name: 'node', - headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz' - }) - - assert.strictEqual(release.semver.version, '4.0.0-rc.4') - delete release.semver - - assert.deepStrictEqual(release, { - version: '4.0.0-rc.4', - name: 'node', - baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/', - tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz', - shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt', - versionDir: '4.0.0-rc.4', - ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-arm64/node.lib', libPath: 'win-arm64/node.lib' } - }) - }) - - it('test process release - process.release ~ node@4.0.0-rc.4 - bogus string passed as argv[0]', function () { - // additional arguments can be passed in on the commandline that should be ignored if they - // are not specifying a valid version @ position 0 - var release = processRelease(['this is no version!'], { opts: {} }, 'v4.0.0-rc.4', { - name: 'node', - headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz' - }) - - assert.strictEqual(release.semver.version, '4.0.0-rc.4') - delete release.semver - - assert.deepStrictEqual(release, { - version: '4.0.0-rc.4', - name: 'node', - baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/', - tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz', - shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt', - versionDir: '4.0.0-rc.4', - ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' }, - arm64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-arm64/node.lib', libPath: 'win-arm64/node.lib' } - }) - }) - - it('test process release - NODEJS_ORG_MIRROR', function () { - process.env.NODEJS_ORG_MIRROR = 'http://foo.bar' - - var release = processRelease([], { opts: {} }, 'v4.1.23', { - name: 'node', - headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz' - }) - - assert.strictEqual(release.semver.version, '4.1.23') - delete release.semver - - assert.deepStrictEqual(release, { - version: '4.1.23', - name: 'node', - baseUrl: 'http://foo.bar/v4.1.23/', - tarballUrl: 'http://foo.bar/v4.1.23/node-v4.1.23-headers.tar.gz', - shasumsUrl: 'http://foo.bar/v4.1.23/SHASUMS256.txt', - versionDir: '4.1.23', - ia32: { libUrl: 'http://foo.bar/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' }, - x64: { libUrl: 'http://foo.bar/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' }, - arm64: { libUrl: 'http://foo.bar/v4.1.23/win-arm64/node.lib', libPath: 'win-arm64/node.lib' } - }) - - delete process.env.NODEJS_ORG_MIRROR - }) -}) diff --git a/node_modules/@npmcli/run-script/node_modules/node-gyp/update-gyp.py b/node_modules/@npmcli/run-script/node_modules/node-gyp/update-gyp.py deleted file mode 100755 index 70e2d100288ec..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/node-gyp/update-gyp.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import os -import shutil -import subprocess -import tarfile -import tempfile -import urllib.request - -BASE_URL = "https://github.com/nodejs/gyp-next/archive/" -CHECKOUT_PATH = os.path.dirname(os.path.realpath(__file__)) -CHECKOUT_GYP_PATH = os.path.join(CHECKOUT_PATH, "gyp") - -parser = argparse.ArgumentParser() -parser.add_argument("tag", help="gyp tag to update to") -args = parser.parse_args() - -tar_url = BASE_URL + args.tag + ".tar.gz" - -changed_files = subprocess.check_output(["git", "diff", "--name-only"]).strip() -if changed_files: - raise Exception("Can't update gyp while you have uncommitted changes in node-gyp") - -with tempfile.TemporaryDirectory() as tmp_dir: - tar_file = os.path.join(tmp_dir, "gyp.tar.gz") - unzip_target = os.path.join(tmp_dir, "gyp") - with open(tar_file, "wb") as f: - print("Downloading gyp-next@" + args.tag + " into temporary directory...") - print("From: " + tar_url) - with urllib.request.urlopen(tar_url) as in_file: - f.write(in_file.read()) - - print("Unzipping...") - with tarfile.open(tar_file, "r:gz") as tar_ref: - def is_within_directory(directory, target): - - abs_directory = os.path.abspath(directory) - abs_target = os.path.abspath(target) - - prefix = os.path.commonprefix([abs_directory, abs_target]) - - return prefix == abs_directory - - def safe_extract(tar, path=".", members=None, *, numeric_owner=False): - - for member in tar.getmembers(): - member_path = os.path.join(path, member.name) - if not is_within_directory(path, member_path): - raise Exception("Attempted Path Traversal in Tar File") - - tar.extractall(path, members, numeric_owner=numeric_owner) - - safe_extract(tar_ref, unzip_target) - - print("Moving to current checkout (" + CHECKOUT_PATH + ")...") - if os.path.exists(CHECKOUT_GYP_PATH): - shutil.rmtree(CHECKOUT_GYP_PATH) - shutil.move( - os.path.join(unzip_target, os.listdir(unzip_target)[0]), CHECKOUT_GYP_PATH - ) - -subprocess.check_output(["git", "add", "gyp"], cwd=CHECKOUT_PATH) -subprocess.check_output(["git", "commit", "-m", "feat(gyp): update gyp to " + args.tag]) diff --git a/node_modules/@npmcli/run-script/node_modules/nopt/LICENSE b/node_modules/@npmcli/run-script/node_modules/nopt/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/nopt/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/nopt/bin/nopt.js b/node_modules/@npmcli/run-script/node_modules/nopt/bin/nopt.js deleted file mode 100755 index bb04291c607ac..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/nopt/bin/nopt.js +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env node -var nopt = require('../lib/nopt') -var path = require('path') -var types = { num: Number, - bool: Boolean, - help: Boolean, - list: Array, - 'num-list': [Number, Array], - 'str-list': [String, Array], - 'bool-list': [Boolean, Array], - str: String, - clear: Boolean, - config: Boolean, - length: Number, - file: path, -} -var shorthands = { s: ['--str', 'astring'], - b: ['--bool'], - nb: ['--no-bool'], - tft: ['--bool-list', '--no-bool-list', '--bool-list', 'true'], - '?': ['--help'], - h: ['--help'], - H: ['--help'], - n: ['--num', '125'], - c: ['--config'], - l: ['--length'], - f: ['--file'], -} -var parsed = nopt(types - , shorthands - , process.argv - , 2) - -console.log('parsed', parsed) - -if (parsed.help) { - console.log('') - console.log('nopt cli tester') - console.log('') - console.log('types') - console.log(Object.keys(types).map(function M (t) { - var type = types[t] - if (Array.isArray(type)) { - return [t, type.map(function (mappedType) { - return mappedType.name - })] - } - return [t, type && type.name] - }).reduce(function (s, i) { - s[i[0]] = i[1] - return s - }, {})) - console.log('') - console.log('shorthands') - console.log(shorthands) -} diff --git a/node_modules/@npmcli/run-script/node_modules/nopt/lib/nopt.js b/node_modules/@npmcli/run-script/node_modules/nopt/lib/nopt.js deleted file mode 100644 index 5829c2fe0f637..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/nopt/lib/nopt.js +++ /dev/null @@ -1,515 +0,0 @@ -// info about each config option. - -var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG - ? function () { - console.error.apply(console, arguments) - } - : function () {} - -var url = require('url') -var path = require('path') -var Stream = require('stream').Stream -var abbrev = require('abbrev') -var os = require('os') - -module.exports = exports = nopt -exports.clean = clean - -exports.typeDefs = - { String: { type: String, validate: validateString }, - Boolean: { type: Boolean, validate: validateBoolean }, - url: { type: url, validate: validateUrl }, - Number: { type: Number, validate: validateNumber }, - path: { type: path, validate: validatePath }, - Stream: { type: Stream, validate: validateStream }, - Date: { type: Date, validate: validateDate }, - } - -function nopt (types, shorthands, args, slice) { - args = args || process.argv - types = types || {} - shorthands = shorthands || {} - if (typeof slice !== 'number') { - slice = 2 - } - - debug(types, shorthands, args, slice) - - args = args.slice(slice) - var data = {} - var argv = { - remain: [], - cooked: args, - original: args.slice(0), - } - - parse(args, data, argv.remain, types, shorthands) - // now data is full - clean(data, types, exports.typeDefs) - data.argv = argv - Object.defineProperty(data.argv, 'toString', { value: function () { - return this.original.map(JSON.stringify).join(' ') - }, - enumerable: false }) - return data -} - -function clean (data, types, typeDefs) { - typeDefs = typeDefs || exports.typeDefs - var remove = {} - var typeDefault = [false, true, null, String, Array] - - Object.keys(data).forEach(function (k) { - if (k === 'argv') { - return - } - var val = data[k] - var isArray = Array.isArray(val) - var type = types[k] - if (!isArray) { - val = [val] - } - if (!type) { - type = typeDefault - } - if (type === Array) { - type = typeDefault.concat(Array) - } - if (!Array.isArray(type)) { - type = [type] - } - - debug('val=%j', val) - debug('types=', type) - val = val.map(function (v) { - // if it's an unknown value, then parse false/true/null/numbers/dates - if (typeof v === 'string') { - debug('string %j', v) - v = v.trim() - if ((v === 'null' && ~type.indexOf(null)) - || (v === 'true' && - (~type.indexOf(true) || ~type.indexOf(Boolean))) - || (v === 'false' && - (~type.indexOf(false) || ~type.indexOf(Boolean)))) { - v = JSON.parse(v) - debug('jsonable %j', v) - } else if (~type.indexOf(Number) && !isNaN(v)) { - debug('convert to number', v) - v = +v - } else if (~type.indexOf(Date) && !isNaN(Date.parse(v))) { - debug('convert to date', v) - v = new Date(v) - } - } - - if (!Object.prototype.hasOwnProperty.call(types, k)) { - return v - } - - // allow `--no-blah` to set 'blah' to null if null is allowed - if (v === false && ~type.indexOf(null) && - !(~type.indexOf(false) || ~type.indexOf(Boolean))) { - v = null - } - - var d = {} - d[k] = v - debug('prevalidated val', d, v, types[k]) - if (!validate(d, k, v, types[k], typeDefs)) { - if (exports.invalidHandler) { - exports.invalidHandler(k, v, types[k], data) - } else if (exports.invalidHandler !== false) { - debug('invalid: ' + k + '=' + v, types[k]) - } - return remove - } - debug('validated v', d, v, types[k]) - return d[k] - }).filter(function (v) { - return v !== remove - }) - - // if we allow Array specifically, then an empty array is how we - // express 'no value here', not null. Allow it. - if (!val.length && type.indexOf(Array) === -1) { - debug('VAL HAS NO LENGTH, DELETE IT', val, k, type.indexOf(Array)) - delete data[k] - } else if (isArray) { - debug(isArray, data[k], val) - data[k] = val - } else { - data[k] = val[0] - } - - debug('k=%s val=%j', k, val, data[k]) - }) -} - -function validateString (data, k, val) { - data[k] = String(val) -} - -function validatePath (data, k, val) { - if (val === true) { - return false - } - if (val === null) { - return true - } - - val = String(val) - - var isWin = process.platform === 'win32' - var homePattern = isWin ? /^~(\/|\\)/ : /^~\// - var home = os.homedir() - - if (home && val.match(homePattern)) { - data[k] = path.resolve(home, val.slice(2)) - } else { - data[k] = path.resolve(val) - } - return true -} - -function validateNumber (data, k, val) { - debug('validate Number %j %j %j', k, val, isNaN(val)) - if (isNaN(val)) { - return false - } - data[k] = +val -} - -function validateDate (data, k, val) { - var s = Date.parse(val) - debug('validate Date %j %j %j', k, val, s) - if (isNaN(s)) { - return false - } - data[k] = new Date(val) -} - -function validateBoolean (data, k, val) { - if (val instanceof Boolean) { - val = val.valueOf() - } else if (typeof val === 'string') { - if (!isNaN(val)) { - val = !!(+val) - } else if (val === 'null' || val === 'false') { - val = false - } else { - val = true - } - } else { - val = !!val - } - data[k] = val -} - -function validateUrl (data, k, val) { - // Changing this would be a breaking change in the npm cli - /* eslint-disable-next-line node/no-deprecated-api */ - val = url.parse(String(val)) - if (!val.host) { - return false - } - data[k] = val.href -} - -function validateStream (data, k, val) { - if (!(val instanceof Stream)) { - return false - } - data[k] = val -} - -function validate (data, k, val, type, typeDefs) { - // arrays are lists of types. - if (Array.isArray(type)) { - for (let i = 0, l = type.length; i < l; i++) { - if (type[i] === Array) { - continue - } - if (validate(data, k, val, type[i], typeDefs)) { - return true - } - } - delete data[k] - return false - } - - // an array of anything? - if (type === Array) { - return true - } - - // Original comment: - // NaN is poisonous. Means that something is not allowed. - // New comment: Changing this to an isNaN check breaks a lot of tests. - // Something is being assumed here that is not actually what happens in - // practice. Fixing it is outside the scope of getting linting to pass in - // this repo. Leaving as-is for now. - /* eslint-disable-next-line no-self-compare */ - if (type !== type) { - debug('Poison NaN', k, val, type) - delete data[k] - return false - } - - // explicit list of values - if (val === type) { - debug('Explicitly allowed %j', val) - // if (isArray) (data[k] = data[k] || []).push(val) - // else data[k] = val - data[k] = val - return true - } - - // now go through the list of typeDefs, validate against each one. - var ok = false - var types = Object.keys(typeDefs) - for (let i = 0, l = types.length; i < l; i++) { - debug('test type %j %j %j', k, val, types[i]) - var t = typeDefs[types[i]] - if (t && ( - (type && type.name && t.type && t.type.name) ? - (type.name === t.type.name) : - (type === t.type) - )) { - var d = {} - ok = t.validate(d, k, val) !== false - val = d[k] - if (ok) { - // if (isArray) (data[k] = data[k] || []).push(val) - // else data[k] = val - data[k] = val - break - } - } - } - debug('OK? %j (%j %j %j)', ok, k, val, types[types.length - 1]) - - if (!ok) { - delete data[k] - } - return ok -} - -function parse (args, data, remain, types, shorthands) { - debug('parse', args, data, remain) - - var abbrevs = abbrev(Object.keys(types)) - var shortAbbr = abbrev(Object.keys(shorthands)) - - for (var i = 0; i < args.length; i++) { - var arg = args[i] - debug('arg', arg) - - if (arg.match(/^-{2,}$/)) { - // done with keys. - // the rest are args. - remain.push.apply(remain, args.slice(i + 1)) - args[i] = '--' - break - } - var hadEq = false - if (arg.charAt(0) === '-' && arg.length > 1) { - var at = arg.indexOf('=') - if (at > -1) { - hadEq = true - var v = arg.slice(at + 1) - arg = arg.slice(0, at) - args.splice(i, 1, arg, v) - } - - // see if it's a shorthand - // if so, splice and back up to re-parse it. - var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs) - debug('arg=%j shRes=%j', arg, shRes) - if (shRes) { - debug(arg, shRes) - args.splice.apply(args, [i, 1].concat(shRes)) - if (arg !== shRes[0]) { - i-- - continue - } - } - arg = arg.replace(/^-+/, '') - var no = null - while (arg.toLowerCase().indexOf('no-') === 0) { - no = !no - arg = arg.slice(3) - } - - if (abbrevs[arg]) { - arg = abbrevs[arg] - } - - var argType = types[arg] - var isTypeArray = Array.isArray(argType) - if (isTypeArray && argType.length === 1) { - isTypeArray = false - argType = argType[0] - } - - var isArray = argType === Array || - isTypeArray && argType.indexOf(Array) !== -1 - - // allow unknown things to be arrays if specified multiple times. - if ( - !Object.prototype.hasOwnProperty.call(types, arg) && - Object.prototype.hasOwnProperty.call(data, arg) - ) { - if (!Array.isArray(data[arg])) { - data[arg] = [data[arg]] - } - isArray = true - } - - var val - var la = args[i + 1] - - var isBool = typeof no === 'boolean' || - argType === Boolean || - isTypeArray && argType.indexOf(Boolean) !== -1 || - (typeof argType === 'undefined' && !hadEq) || - (la === 'false' && - (argType === null || - isTypeArray && ~argType.indexOf(null))) - - if (isBool) { - // just set and move along - val = !no - // however, also support --bool true or --bool false - if (la === 'true' || la === 'false') { - val = JSON.parse(la) - la = null - if (no) { - val = !val - } - i++ - } - - // also support "foo":[Boolean, "bar"] and "--foo bar" - if (isTypeArray && la) { - if (~argType.indexOf(la)) { - // an explicit type - val = la - i++ - } else if (la === 'null' && ~argType.indexOf(null)) { - // null allowed - val = null - i++ - } else if (!la.match(/^-{2,}[^-]/) && - !isNaN(la) && - ~argType.indexOf(Number)) { - // number - val = +la - i++ - } else if (!la.match(/^-[^-]/) && ~argType.indexOf(String)) { - // string - val = la - i++ - } - } - - if (isArray) { - (data[arg] = data[arg] || []).push(val) - } else { - data[arg] = val - } - - continue - } - - if (argType === String) { - if (la === undefined) { - la = '' - } else if (la.match(/^-{1,2}[^-]+/)) { - la = '' - i-- - } - } - - if (la && la.match(/^-{2,}$/)) { - la = undefined - i-- - } - - val = la === undefined ? true : la - if (isArray) { - (data[arg] = data[arg] || []).push(val) - } else { - data[arg] = val - } - - i++ - continue - } - remain.push(arg) - } -} - -function resolveShort (arg, shorthands, shortAbbr, abbrevs) { - // handle single-char shorthands glommed together, like - // npm ls -glp, but only if there is one dash, and only if - // all of the chars are single-char shorthands, and it's - // not a match to some other abbrev. - arg = arg.replace(/^-+/, '') - - // if it's an exact known option, then don't go any further - if (abbrevs[arg] === arg) { - return null - } - - // if it's an exact known shortopt, same deal - if (shorthands[arg]) { - // make it an array, if it's a list of words - if (shorthands[arg] && !Array.isArray(shorthands[arg])) { - shorthands[arg] = shorthands[arg].split(/\s+/) - } - - return shorthands[arg] - } - - // first check to see if this arg is a set of single-char shorthands - var singles = shorthands.___singles - if (!singles) { - singles = Object.keys(shorthands).filter(function (s) { - return s.length === 1 - }).reduce(function (l, r) { - l[r] = true - return l - }, {}) - shorthands.___singles = singles - debug('shorthand singles', singles) - } - - var chrs = arg.split('').filter(function (c) { - return singles[c] - }) - - if (chrs.join('') === arg) { - return chrs.map(function (c) { - return shorthands[c] - }).reduce(function (l, r) { - return l.concat(r) - }, []) - } - - // if it's an arg abbrev, and not a literal shorthand, then prefer the arg - if (abbrevs[arg] && !shorthands[arg]) { - return null - } - - // if it's an abbr for a shorthand, then use that - if (shortAbbr[arg]) { - arg = shortAbbr[arg] - } - - // make it an array, if it's a list of words - if (shorthands[arg] && !Array.isArray(shorthands[arg])) { - shorthands[arg] = shorthands[arg].split(/\s+/) - } - - return shorthands[arg] -} diff --git a/node_modules/@npmcli/run-script/node_modules/nopt/package.json b/node_modules/@npmcli/run-script/node_modules/nopt/package.json deleted file mode 100644 index a3cd13d8c714b..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/nopt/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "nopt", - "version": "6.0.0", - "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", - "author": "GitHub Inc.", - "main": "lib/nopt.js", - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "test": "tap", - "lint": "eslint \"**/*.js\"", - "postlint": "template-oss-check", - "template-oss-apply": "template-oss-apply --force", - "lintfix": "npm run lint -- --fix", - "snap": "tap", - "posttest": "npm run lint" - }, - "repository": { - "type": "git", - "url": "https://github.com/npm/nopt.git" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.0" - }, - "devDependencies": { - "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.5.0", - "tap": "^16.3.0" - }, - "tap": { - "lines": 87, - "functions": 91, - "branches": 81, - "statements": 87 - }, - "files": [ - "bin/", - "lib/" - ], - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - }, - "templateOSS": { - "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "windowsCI": false, - "version": "3.5.0" - } -} diff --git a/node_modules/@npmcli/run-script/node_modules/npmlog/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/npmlog/LICENSE.md deleted file mode 100644 index 5fc208ff122e0..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/npmlog/LICENSE.md +++ /dev/null @@ -1,20 +0,0 @@ - - -ISC License - -Copyright npm, Inc. - -Permission to use, copy, modify, and/or distribute this -software for any purpose with or without fee is hereby -granted, provided that the above copyright notice and this -permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL -WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO -EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE -USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/npmlog/lib/log.js b/node_modules/@npmcli/run-script/node_modules/npmlog/lib/log.js deleted file mode 100644 index be650c6a42608..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/npmlog/lib/log.js +++ /dev/null @@ -1,404 +0,0 @@ -'use strict' -var Progress = require('are-we-there-yet') -var Gauge = require('gauge') -var EE = require('events').EventEmitter -var log = exports = module.exports = new EE() -var util = require('util') - -var setBlocking = require('set-blocking') -var consoleControl = require('console-control-strings') - -setBlocking(true) -var stream = process.stderr -Object.defineProperty(log, 'stream', { - set: function (newStream) { - stream = newStream - if (this.gauge) { - this.gauge.setWriteTo(stream, stream) - } - }, - get: function () { - return stream - }, -}) - -// by default, decide based on tty-ness. -var colorEnabled -log.useColor = function () { - return colorEnabled != null ? colorEnabled : stream.isTTY -} - -log.enableColor = function () { - colorEnabled = true - this.gauge.setTheme({ hasColor: colorEnabled, hasUnicode: unicodeEnabled }) -} -log.disableColor = function () { - colorEnabled = false - this.gauge.setTheme({ hasColor: colorEnabled, hasUnicode: unicodeEnabled }) -} - -// default level -log.level = 'info' - -log.gauge = new Gauge(stream, { - enabled: false, // no progress bars unless asked - theme: { hasColor: log.useColor() }, - template: [ - { type: 'progressbar', length: 20 }, - { type: 'activityIndicator', kerning: 1, length: 1 }, - { type: 'section', default: '' }, - ':', - { type: 'logline', kerning: 1, default: '' }, - ], -}) - -log.tracker = new Progress.TrackerGroup() - -// we track this separately as we may need to temporarily disable the -// display of the status bar for our own loggy purposes. -log.progressEnabled = log.gauge.isEnabled() - -var unicodeEnabled - -log.enableUnicode = function () { - unicodeEnabled = true - this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: unicodeEnabled }) -} - -log.disableUnicode = function () { - unicodeEnabled = false - this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: unicodeEnabled }) -} - -log.setGaugeThemeset = function (themes) { - this.gauge.setThemeset(themes) -} - -log.setGaugeTemplate = function (template) { - this.gauge.setTemplate(template) -} - -log.enableProgress = function () { - if (this.progressEnabled) { - return - } - - this.progressEnabled = true - this.tracker.on('change', this.showProgress) - if (this._paused) { - return - } - - this.gauge.enable() -} - -log.disableProgress = function () { - if (!this.progressEnabled) { - return - } - this.progressEnabled = false - this.tracker.removeListener('change', this.showProgress) - this.gauge.disable() -} - -var trackerConstructors = ['newGroup', 'newItem', 'newStream'] - -var mixinLog = function (tracker) { - // mixin the public methods from log into the tracker - // (except: conflicts and one's we handle specially) - Object.keys(log).forEach(function (P) { - if (P[0] === '_') { - return - } - - if (trackerConstructors.filter(function (C) { - return C === P - }).length) { - return - } - - if (tracker[P]) { - return - } - - if (typeof log[P] !== 'function') { - return - } - - var func = log[P] - tracker[P] = function () { - return func.apply(log, arguments) - } - }) - // if the new tracker is a group, make sure any subtrackers get - // mixed in too - if (tracker instanceof Progress.TrackerGroup) { - trackerConstructors.forEach(function (C) { - var func = tracker[C] - tracker[C] = function () { - return mixinLog(func.apply(tracker, arguments)) - } - }) - } - return tracker -} - -// Add tracker constructors to the top level log object -trackerConstructors.forEach(function (C) { - log[C] = function () { - return mixinLog(this.tracker[C].apply(this.tracker, arguments)) - } -}) - -log.clearProgress = function (cb) { - if (!this.progressEnabled) { - return cb && process.nextTick(cb) - } - - this.gauge.hide(cb) -} - -log.showProgress = function (name, completed) { - if (!this.progressEnabled) { - return - } - - var values = {} - if (name) { - values.section = name - } - - var last = log.record[log.record.length - 1] - if (last) { - values.subsection = last.prefix - var disp = log.disp[last.level] || last.level - var logline = this._format(disp, log.style[last.level]) - if (last.prefix) { - logline += ' ' + this._format(last.prefix, this.prefixStyle) - } - - logline += ' ' + last.message.split(/\r?\n/)[0] - values.logline = logline - } - values.completed = completed || this.tracker.completed() - this.gauge.show(values) -}.bind(log) // bind for use in tracker's on-change listener - -// temporarily stop emitting, but don't drop -log.pause = function () { - this._paused = true - if (this.progressEnabled) { - this.gauge.disable() - } -} - -log.resume = function () { - if (!this._paused) { - return - } - - this._paused = false - - var b = this._buffer - this._buffer = [] - b.forEach(function (m) { - this.emitLog(m) - }, this) - if (this.progressEnabled) { - this.gauge.enable() - } -} - -log._buffer = [] - -var id = 0 -log.record = [] -log.maxRecordSize = 10000 -log.log = function (lvl, prefix, message) { - var l = this.levels[lvl] - if (l === undefined) { - return this.emit('error', new Error(util.format( - 'Undefined log level: %j', lvl))) - } - - var a = new Array(arguments.length - 2) - var stack = null - for (var i = 2; i < arguments.length; i++) { - var arg = a[i - 2] = arguments[i] - - // resolve stack traces to a plain string. - if (typeof arg === 'object' && arg instanceof Error && arg.stack) { - Object.defineProperty(arg, 'stack', { - value: stack = arg.stack + '', - enumerable: true, - writable: true, - }) - } - } - if (stack) { - a.unshift(stack + '\n') - } - message = util.format.apply(util, a) - - var m = { - id: id++, - level: lvl, - prefix: String(prefix || ''), - message: message, - messageRaw: a, - } - - this.emit('log', m) - this.emit('log.' + lvl, m) - if (m.prefix) { - this.emit(m.prefix, m) - } - - this.record.push(m) - var mrs = this.maxRecordSize - var n = this.record.length - mrs - if (n > mrs / 10) { - var newSize = Math.floor(mrs * 0.9) - this.record = this.record.slice(-1 * newSize) - } - - this.emitLog(m) -}.bind(log) - -log.emitLog = function (m) { - if (this._paused) { - this._buffer.push(m) - return - } - if (this.progressEnabled) { - this.gauge.pulse(m.prefix) - } - - var l = this.levels[m.level] - if (l === undefined) { - return - } - - if (l < this.levels[this.level]) { - return - } - - if (l > 0 && !isFinite(l)) { - return - } - - // If 'disp' is null or undefined, use the lvl as a default - // Allows: '', 0 as valid disp - var disp = log.disp[m.level] != null ? log.disp[m.level] : m.level - this.clearProgress() - m.message.split(/\r?\n/).forEach(function (line) { - var heading = this.heading - if (heading) { - this.write(heading, this.headingStyle) - this.write(' ') - } - this.write(disp, log.style[m.level]) - var p = m.prefix || '' - if (p) { - this.write(' ') - } - - this.write(p, this.prefixStyle) - this.write(' ' + line + '\n') - }, this) - this.showProgress() -} - -log._format = function (msg, style) { - if (!stream) { - return - } - - var output = '' - if (this.useColor()) { - style = style || {} - var settings = [] - if (style.fg) { - settings.push(style.fg) - } - - if (style.bg) { - settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1)) - } - - if (style.bold) { - settings.push('bold') - } - - if (style.underline) { - settings.push('underline') - } - - if (style.inverse) { - settings.push('inverse') - } - - if (settings.length) { - output += consoleControl.color(settings) - } - - if (style.beep) { - output += consoleControl.beep() - } - } - output += msg - if (this.useColor()) { - output += consoleControl.color('reset') - } - - return output -} - -log.write = function (msg, style) { - if (!stream) { - return - } - - stream.write(this._format(msg, style)) -} - -log.addLevel = function (lvl, n, style, disp) { - // If 'disp' is null or undefined, use the lvl as a default - if (disp == null) { - disp = lvl - } - - this.levels[lvl] = n - this.style[lvl] = style - if (!this[lvl]) { - this[lvl] = function () { - var a = new Array(arguments.length + 1) - a[0] = lvl - for (var i = 0; i < arguments.length; i++) { - a[i + 1] = arguments[i] - } - - return this.log.apply(this, a) - }.bind(this) - } - this.disp[lvl] = disp -} - -log.prefixStyle = { fg: 'magenta' } -log.headingStyle = { fg: 'white', bg: 'black' } - -log.style = {} -log.levels = {} -log.disp = {} -log.addLevel('silly', -Infinity, { inverse: true }, 'sill') -log.addLevel('verbose', 1000, { fg: 'cyan', bg: 'black' }, 'verb') -log.addLevel('info', 2000, { fg: 'green' }) -log.addLevel('timing', 2500, { fg: 'green', bg: 'black' }) -log.addLevel('http', 3000, { fg: 'green', bg: 'black' }) -log.addLevel('notice', 3500, { fg: 'cyan', bg: 'black' }) -log.addLevel('warn', 4000, { fg: 'black', bg: 'yellow' }, 'WARN') -log.addLevel('error', 5000, { fg: 'red', bg: 'black' }, 'ERR!') -log.addLevel('silent', Infinity) - -// allow 'error' prefix -log.on('error', function () {}) diff --git a/node_modules/@npmcli/run-script/node_modules/npmlog/package.json b/node_modules/@npmcli/run-script/node_modules/npmlog/package.json deleted file mode 100644 index bdb5a384781ce..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/npmlog/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "author": "GitHub Inc.", - "name": "npmlog", - "description": "logger for npm", - "version": "6.0.2", - "repository": { - "type": "git", - "url": "https://github.com/npm/npmlog.git" - }, - "main": "lib/log.js", - "files": [ - "bin/", - "lib/" - ], - "scripts": { - "test": "tap", - "npmclilint": "npmcli-lint", - "lint": "eslint \"**/*.js\"", - "lintfix": "npm run lint -- --fix", - "posttest": "npm run lint", - "postsnap": "npm run lintfix --", - "postlint": "template-oss-check", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "snap": "tap", - "template-oss-apply": "template-oss-apply --force" - }, - "dependencies": { - "are-we-there-yet": "^3.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^4.0.3", - "set-blocking": "^2.0.0" - }, - "devDependencies": { - "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.4.1", - "tap": "^16.0.1" - }, - "license": "ISC", - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - }, - "tap": { - "branches": 95 - }, - "templateOSS": { - "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.4.1" - } -} diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/CONTRIBUTING.md b/node_modules/@npmcli/run-script/node_modules/readable-stream/CONTRIBUTING.md deleted file mode 100644 index f478d58dca85b..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/CONTRIBUTING.md +++ /dev/null @@ -1,38 +0,0 @@ -# Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -* (a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -* (b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -* (c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -* (d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. - -## Moderation Policy - -The [Node.js Moderation Policy] applies to this WG. - -## Code of Conduct - -The [Node.js Code of Conduct][] applies to this WG. - -[Node.js Code of Conduct]: -https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md -[Node.js Moderation Policy]: -https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/GOVERNANCE.md b/node_modules/@npmcli/run-script/node_modules/readable-stream/GOVERNANCE.md deleted file mode 100644 index 16ffb93f24bec..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/GOVERNANCE.md +++ /dev/null @@ -1,136 +0,0 @@ -### Streams Working Group - -The Node.js Streams is jointly governed by a Working Group -(WG) -that is responsible for high-level guidance of the project. - -The WG has final authority over this project including: - -* Technical direction -* Project governance and process (including this policy) -* Contribution policy -* GitHub repository hosting -* Conduct guidelines -* Maintaining the list of additional Collaborators - -For the current list of WG members, see the project -[README.md](./README.md#current-project-team-members). - -### Collaborators - -The readable-stream GitHub repository is -maintained by the WG and additional Collaborators who are added by the -WG on an ongoing basis. - -Individuals making significant and valuable contributions are made -Collaborators and given commit-access to the project. These -individuals are identified by the WG and their addition as -Collaborators is discussed during the WG meeting. - -_Note:_ If you make a significant contribution and are not considered -for commit-access log an issue or contact a WG member directly and it -will be brought up in the next WG meeting. - -Modifications of the contents of the readable-stream repository are -made on -a collaborative basis. Anybody with a GitHub account may propose a -modification via pull request and it will be considered by the project -Collaborators. All pull requests must be reviewed and accepted by a -Collaborator with sufficient expertise who is able to take full -responsibility for the change. In the case of pull requests proposed -by an existing Collaborator, an additional Collaborator is required -for sign-off. Consensus should be sought if additional Collaborators -participate and there is disagreement around a particular -modification. See _Consensus Seeking Process_ below for further detail -on the consensus model used for governance. - -Collaborators may opt to elevate significant or controversial -modifications, or modifications that have not found consensus to the -WG for discussion by assigning the ***WG-agenda*** tag to a pull -request or issue. The WG should serve as the final arbiter where -required. - -For the current list of Collaborators, see the project -[README.md](./README.md#members). - -### WG Membership - -WG seats are not time-limited. There is no fixed size of the WG. -However, the expected target is between 6 and 12, to ensure adequate -coverage of important areas of expertise, balanced with the ability to -make decisions efficiently. - -There is no specific set of requirements or qualifications for WG -membership beyond these rules. - -The WG may add additional members to the WG by unanimous consensus. - -A WG member may be removed from the WG by voluntary resignation, or by -unanimous consensus of all other WG members. - -Changes to WG membership should be posted in the agenda, and may be -suggested as any other agenda item (see "WG Meetings" below). - -If an addition or removal is proposed during a meeting, and the full -WG is not in attendance to participate, then the addition or removal -is added to the agenda for the subsequent meeting. This is to ensure -that all members are given the opportunity to participate in all -membership decisions. If a WG member is unable to attend a meeting -where a planned membership decision is being made, then their consent -is assumed. - -No more than 1/3 of the WG members may be affiliated with the same -employer. If removal or resignation of a WG member, or a change of -employment by a WG member, creates a situation where more than 1/3 of -the WG membership shares an employer, then the situation must be -immediately remedied by the resignation or removal of one or more WG -members affiliated with the over-represented employer(s). - -### WG Meetings - -The WG meets occasionally on a Google Hangout On Air. A designated moderator -approved by the WG runs the meeting. Each meeting should be -published to YouTube. - -Items are added to the WG agenda that are considered contentious or -are modifications of governance, contribution policy, WG membership, -or release process. - -The intention of the agenda is not to approve or review all patches; -that should happen continuously on GitHub and be handled by the larger -group of Collaborators. - -Any community member or contributor can ask that something be added to -the next meeting's agenda by logging a GitHub Issue. Any Collaborator, -WG member or the moderator can add the item to the agenda by adding -the ***WG-agenda*** tag to the issue. - -Prior to each WG meeting the moderator will share the Agenda with -members of the WG. WG members can add any items they like to the -agenda at the beginning of each meeting. The moderator and the WG -cannot veto or remove items. - -The WG may invite persons or representatives from certain projects to -participate in a non-voting capacity. - -The moderator is responsible for summarizing the discussion of each -agenda item and sends it as a pull request after the meeting. - -### Consensus Seeking Process - -The WG follows a -[Consensus -Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) -decision-making model. - -When an agenda item has appeared to reach a consensus the moderator -will ask "Does anyone object?" as a final call for dissent from the -consensus. - -If an agenda item cannot reach a consensus a WG member can call for -either a closing vote or a vote to table the issue to the next -meeting. The call for a vote must be seconded by a majority of the WG -or else the discussion will continue. Simple majority wins. - -Note that changes to WG membership require a majority consensus. See -"WG Membership" above. diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/LICENSE b/node_modules/@npmcli/run-script/node_modules/readable-stream/LICENSE deleted file mode 100644 index 2873b3b2e5950..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/LICENSE +++ /dev/null @@ -1,47 +0,0 @@ -Node.js is licensed for use as follows: - -""" -Copyright Node.js contributors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. -""" - -This license applies to parts of Node.js originating from the -https://github.com/joyent/node repository: - -""" -Copyright Joyent, Inc. and other Node contributors. All rights reserved. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. -""" diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/errors-browser.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/errors-browser.js deleted file mode 100644 index fb8e73e1893b1..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/errors-browser.js +++ /dev/null @@ -1,127 +0,0 @@ -'use strict'; - -function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } - -var codes = {}; - -function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - - function getMessage(arg1, arg2, arg3) { - if (typeof message === 'string') { - return message; - } else { - return message(arg1, arg2, arg3); - } - } - - var NodeError = - /*#__PURE__*/ - function (_Base) { - _inheritsLoose(NodeError, _Base); - - function NodeError(arg1, arg2, arg3) { - return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; - } - - return NodeError; - }(Base); - - NodeError.prototype.name = Base.name; - NodeError.prototype.code = code; - codes[code] = NodeError; -} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js - - -function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function (i) { - return String(i); - }); - - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); - } else { - return "of ".concat(thing, " ").concat(expected[0]); - } - } else { - return "of ".concat(thing, " ").concat(String(expected)); - } -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith - - -function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith - - -function endsWith(str, search, this_len) { - if (this_len === undefined || this_len > str.length) { - this_len = str.length; - } - - return str.substring(this_len - search.length, this_len) === search; -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes - - -function includes(str, search, start) { - if (typeof start !== 'number') { - start = 0; - } - - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; - } -} - -createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { - return 'The value "' + value + '" is invalid for option "' + name + '"'; -}, TypeError); -createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { - // determiner: 'must be' or 'must not be' - var determiner; - - if (typeof expected === 'string' && startsWith(expected, 'not ')) { - determiner = 'must not be'; - expected = expected.replace(/^not /, ''); - } else { - determiner = 'must be'; - } - - var msg; - - if (endsWith(name, ' argument')) { - // For cases like 'first argument' - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); - } else { - var type = includes(name, '.') ? 'property' : 'argument'; - msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); - } - - msg += ". Received type ".concat(typeof actual); - return msg; -}, TypeError); -createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); -createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { - return 'The ' + name + ' method is not implemented'; -}); -createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); -createErrorType('ERR_STREAM_DESTROYED', function (name) { - return 'Cannot call ' + name + ' after a stream was destroyed'; -}); -createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); -createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); -createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); -createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); -createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { - return 'Unknown encoding: ' + arg; -}, TypeError); -createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); -module.exports.codes = codes; diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/errors.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/errors.js deleted file mode 100644 index 8471526d6e7f7..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/errors.js +++ /dev/null @@ -1,116 +0,0 @@ -'use strict'; - -const codes = {}; - -function createErrorType(code, message, Base) { - if (!Base) { - Base = Error - } - - function getMessage (arg1, arg2, arg3) { - if (typeof message === 'string') { - return message - } else { - return message(arg1, arg2, arg3) - } - } - - class NodeError extends Base { - constructor (arg1, arg2, arg3) { - super(getMessage(arg1, arg2, arg3)); - } - } - - NodeError.prototype.name = Base.name; - NodeError.prototype.code = code; - - codes[code] = NodeError; -} - -// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js -function oneOf(expected, thing) { - if (Array.isArray(expected)) { - const len = expected.length; - expected = expected.map((i) => String(i)); - if (len > 2) { - return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` + - expected[len - 1]; - } else if (len === 2) { - return `one of ${thing} ${expected[0]} or ${expected[1]}`; - } else { - return `of ${thing} ${expected[0]}`; - } - } else { - return `of ${thing} ${String(expected)}`; - } -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith -function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith -function endsWith(str, search, this_len) { - if (this_len === undefined || this_len > str.length) { - this_len = str.length; - } - return str.substring(this_len - search.length, this_len) === search; -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes -function includes(str, search, start) { - if (typeof start !== 'number') { - start = 0; - } - - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; - } -} - -createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { - return 'The value "' + value + '" is invalid for option "' + name + '"' -}, TypeError); -createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { - // determiner: 'must be' or 'must not be' - let determiner; - if (typeof expected === 'string' && startsWith(expected, 'not ')) { - determiner = 'must not be'; - expected = expected.replace(/^not /, ''); - } else { - determiner = 'must be'; - } - - let msg; - if (endsWith(name, ' argument')) { - // For cases like 'first argument' - msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`; - } else { - const type = includes(name, '.') ? 'property' : 'argument'; - msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`; - } - - msg += `. Received type ${typeof actual}`; - return msg; -}, TypeError); -createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); -createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { - return 'The ' + name + ' method is not implemented' -}); -createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); -createErrorType('ERR_STREAM_DESTROYED', function (name) { - return 'Cannot call ' + name + ' after a stream was destroyed'; -}); -createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); -createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); -createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); -createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); -createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { - return 'Unknown encoding: ' + arg -}, TypeError); -createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); - -module.exports.codes = codes; diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/experimentalWarning.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/experimentalWarning.js deleted file mode 100644 index 78e841495bf24..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/experimentalWarning.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -var experimentalWarnings = new Set(); - -function emitExperimentalWarning(feature) { - if (experimentalWarnings.has(feature)) return; - var msg = feature + ' is an experimental feature. This feature could ' + - 'change at any time'; - experimentalWarnings.add(feature); - process.emitWarning(msg, 'ExperimentalWarning'); -} - -function noop() {} - -module.exports.emitExperimentalWarning = process.emitWarning - ? emitExperimentalWarning - : noop; diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_duplex.js deleted file mode 100644 index 19abfa604d5ef..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_duplex.js +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -'use strict'; - -/**/ -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) keys.push(key); - return keys; -}; -/**/ - -module.exports = Duplex; -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); -require('inherits')(Duplex, Readable); -{ - // Allow the keys array to be GC'ed. - var keys = objectKeys(Writable.prototype); - for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } -} -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - this.allowHalfOpen = true; - if (options) { - if (options.readable === false) this.readable = false; - if (options.writable === false) this.writable = false; - if (options.allowHalfOpen === false) { - this.allowHalfOpen = false; - this.once('end', onend); - } - } -} -Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.highWaterMark; - } -}); -Object.defineProperty(Duplex.prototype, 'writableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState && this._writableState.getBuffer(); - } -}); -Object.defineProperty(Duplex.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); - -// the no-half-open enforcer -function onend() { - // If the writable side ended, then we're ok. - if (this._writableState.ended) return; - - // no more data can be written. - // But allow more writes to happen in this tick. - process.nextTick(onEndNT, this); -} -function onEndNT(self) { - self.end(); -} -Object.defineProperty(Duplex.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined || this._writableState === undefined) { - return false; - } - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (this._readableState === undefined || this._writableState === undefined) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } -}); \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_passthrough.js deleted file mode 100644 index 24a6bdde2903f..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_passthrough.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -'use strict'; - -module.exports = PassThrough; -var Transform = require('./_stream_transform'); -require('inherits')(PassThrough, Transform); -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - Transform.call(this, options); -} -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_readable.js deleted file mode 100644 index df1f608d53260..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_readable.js +++ /dev/null @@ -1,1027 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -module.exports = Readable; - -/**/ -var Duplex; -/**/ - -Readable.ReadableState = ReadableState; - -/**/ -var EE = require('events').EventEmitter; -var EElistenerCount = function EElistenerCount(emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ -var Stream = require('./internal/streams/stream'); -/**/ - -var Buffer = require('buffer').Buffer; -var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -/**/ -var debugUtil = require('util'); -var debug; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function debug() {}; -} -/**/ - -var BufferList = require('./internal/streams/buffer_list'); -var destroyImpl = require('./internal/streams/destroy'); -var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; -var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; - -// Lazy loaded to improve the startup performance. -var StringDecoder; -var createReadableStreamAsyncIterator; -var from; -require('inherits')(Readable, Stream); -var errorOrDestroy = destroyImpl.errorOrDestroy; -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); - - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; -} -function ReadableState(options, stream, isDuplex) { - Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; - - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); - - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - this.paused = true; - - // Should close be emitted on destroy. Defaults to true. - this.emitClose = options.emitClose !== false; - - // Should .destroy() be called after 'end' (and potentially 'finish') - this.autoDestroy = !!options.autoDestroy; - - // has it been destroyed - this.destroyed = false; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); - if (!(this instanceof Readable)) return new Readable(options); - - // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5 - var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); - - // legacy - this.readable = true; - if (options) { - if (typeof options.read === 'function') this._read = options.read; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - } - Stream.call(this); -} -Object.defineProperty(Readable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined) { - return false; - } - return this._readableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - } -}); -Readable.prototype.destroy = destroyImpl.destroy; -Readable.prototype._undestroy = destroyImpl.undestroy; -Readable.prototype._destroy = function (err, cb) { - cb(err); -}; - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function (chunk) { - return readableAddChunk(this, chunk, null, true, false); -}; -function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - debug('readableAddChunk', chunk); - var state = stream._readableState; - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); - if (er) { - errorOrDestroy(stream, er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - if (addToFront) { - if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); - } else if (state.destroyed) { - return false; - } else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - maybeReadMore(stream, state); - } - } - - // We can push more data if we are below the highWaterMark. - // Also, if we have no data yet, we can stand some more bytes. - // This is to work around cases where hwm=0, such as the repl. - return !state.ended && (state.length < state.highWaterMark || state.length === 0); -} -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - state.awaitDrain = 0; - stream.emit('data', chunk); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - if (state.needReadable) emitReadable(stream); - } - maybeReadMore(stream, state); -} -function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); - } - return er; -} -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; - -// backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - var decoder = new StringDecoder(enc); - this._readableState.decoder = decoder; - // If setEncoding(null), decoder.encoding equals utf8 - this._readableState.encoding = this._readableState.decoder.encoding; - - // Iterate over current buffer to convert already stored Buffers: - var p = this._readableState.buffer.head; - var content = ''; - while (p !== null) { - content += decoder.write(p.data); - p = p.next; - } - this._readableState.buffer.clear(); - if (content !== '') this._readableState.buffer.push(content); - this._readableState.length = content.length; - return this; -}; - -// Don't raise the hwm > 1GB -var MAX_HWM = 0x40000000; -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; -} - -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; - // Don't have enough - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (n !== 0) state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state); - } - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark; - n = 0; - } else { - state.length -= n; - state.awaitDrain = 0; - } - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this); - } - if (ret !== null) this.emit('data', ret); - return ret; -}; -function onEofChunk(stream, state) { - debug('onEofChunk'); - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - if (state.sync) { - // if we are sync, wait until next tick to emit the data. - // Otherwise we risk emitting data in the flow() - // the readable code triggers during a read() call - emitReadable(stream); - } else { - // emit 'readable' now to make sure it gets picked up. - state.needReadable = false; - if (!state.emittedReadable) { - state.emittedReadable = true; - emitReadable_(stream); - } - } -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - debug('emitReadable', state.needReadable, state.emittedReadable); - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - process.nextTick(emitReadable_, stream); - } -} -function emitReadable_(stream) { - var state = stream._readableState; - debug('emitReadable_', state.destroyed, state.length, state.ended); - if (!state.destroyed && (state.length || state.ended)) { - stream.emit('readable'); - state.emittedReadable = false; - } - - // The stream needs another readable event if - // 1. It is not flowing, as the flow mechanism will take - // care of it. - // 2. It is not ended. - // 3. It is below the highWaterMark, so we can schedule - // another readable later. - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; - flow(stream); -} - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(maybeReadMore_, stream, state); - } -} -function maybeReadMore_(stream, state) { - // Attempt to read more data if we should. - // - // The conditions for reading more data are (one of): - // - Not enough data buffered (state.length < state.highWaterMark). The loop - // is responsible for filling the buffer with enough data if such data - // is available. If highWaterMark is 0 and we are not in the flowing mode - // we should _not_ attempt to buffer any extra data. We'll get more data - // when the stream consumer calls read() instead. - // - No data in the buffer, and the stream is in flowing mode. In this mode - // the loop below is responsible for ensuring read() is called. Failing to - // call read here would abort the flow and there's no other mechanism for - // continuing the flow if the stream consumer has just subscribed to the - // 'data' event. - // - // In addition to the above conditions to keep reading data, the following - // conditions prevent the data from being read: - // - The stream has ended (state.ended). - // - There is already a pending 'read' operation (state.reading). This is a - // case where the the stream has called the implementation defined _read() - // method, but they are processing the call asynchronously and have _not_ - // called push() with new data. In this case we skip performing more - // read()s. The execution ends in this method again after the _read() ends - // up calling push() with more data. - while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { - var len = state.length; - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); -}; -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); - dest.on('unpipe', onunpipe); - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - cleanedUp = true; - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - debug('dest.write', ret); - if (ret === false) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', state.awaitDrain); - state.awaitDrain++; - } - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); - } - - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror); - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - return dest; -}; -function pipeOnDrain(src) { - return function pipeOnDrainFunctionResult() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - if (!dest) dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, { - hasUnpiped: false - }); - return this; - } - - // try to find the right one. - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - dest.emit('unpipe', this, unpipeInfo); - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - var state = this._readableState; - if (ev === 'data') { - // update readableListening so that resume() may be a no-op - // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0; - - // Try start flowing on next tick if stream isn't explicitly paused - if (state.flowing !== false) this.resume(); - } else if (ev === 'readable') { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.flowing = false; - state.emittedReadable = false; - debug('on readable', state.length, state.reading); - if (state.length) { - emitReadable(this); - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this); - } - } - } - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; -Readable.prototype.removeListener = function (ev, fn) { - var res = Stream.prototype.removeListener.call(this, ev, fn); - if (ev === 'readable') { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } - return res; -}; -Readable.prototype.removeAllListeners = function (ev) { - var res = Stream.prototype.removeAllListeners.apply(this, arguments); - if (ev === 'readable' || ev === undefined) { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } - return res; -}; -function updateReadableListening(self) { - var state = self._readableState; - state.readableListening = self.listenerCount('readable') > 0; - if (state.resumeScheduled && !state.paused) { - // flowing needs to be set to true now, otherwise - // the upcoming resume will not flow. - state.flowing = true; - - // crude way to check if we should resume - } else if (self.listenerCount('data') > 0) { - self.resume(); - } -} -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - // we flow only if there is no one listening - // for readable, but we still have to call - // resume() - state.flowing = !state.readableListening; - resume(this, state); - } - state.paused = false; - return this; -}; -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(resume_, stream, state); - } -} -function resume_(stream, state) { - debug('resume', state.reading); - if (!state.reading) { - stream.read(0); - } - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); -} -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - if (this._readableState.flowing !== false) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - this._readableState.paused = true; - return this; -}; -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - while (state.flowing && stream.read() !== null); -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - var _this = this; - var state = this._readableState; - var paused = false; - stream.on('end', function () { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } - _this.push(null); - }); - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); - - // don't skip over falsy values in objectMode - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function methodWrap(method) { - return function methodWrapReturnFunction() { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } - - // proxy certain important events. - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - this._read = function (n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - return this; -}; -if (typeof Symbol === 'function') { - Readable.prototype[Symbol.asyncIterator] = function () { - if (createReadableStreamAsyncIterator === undefined) { - createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); - } - return createReadableStreamAsyncIterator(this); - }; -} -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.highWaterMark; - } -}); -Object.defineProperty(Readable.prototype, 'readableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState && this._readableState.buffer; - } -}); -Object.defineProperty(Readable.prototype, 'readableFlowing', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.flowing; - }, - set: function set(state) { - if (this._readableState) { - this._readableState.flowing = state; - } - } -}); - -// exposed for testing purposes only. -Readable._fromList = fromList; -Object.defineProperty(Readable.prototype, 'readableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.length; - } -}); - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = state.buffer.consume(n, state.decoder); - } - return ret; -} -function endReadable(stream) { - var state = stream._readableState; - debug('endReadable', state.endEmitted); - if (!state.endEmitted) { - state.ended = true; - process.nextTick(endReadableNT, state, stream); - } -} -function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length); - - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the writable side is ready for autoDestroy as well - var wState = stream._writableState; - if (!wState || wState.autoDestroy && wState.finished) { - stream.destroy(); - } - } - } -} -if (typeof Symbol === 'function') { - Readable.from = function (iterable, opts) { - if (from === undefined) { - from = require('./internal/streams/from'); - } - return from(Readable, iterable, opts); - }; -} -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_transform.js deleted file mode 100644 index 1ccb7157be8b8..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_transform.js +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -'use strict'; - -module.exports = Transform; -var _require$codes = require('../errors').codes, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, - ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; -var Duplex = require('./_stream_duplex'); -require('inherits')(Transform, Duplex); -function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - if (cb === null) { - return this.emit('error', new ERR_MULTIPLE_CALLBACK()); - } - ts.writechunk = null; - ts.writecb = null; - if (data != null) - // single equals check for both `null` and `undefined` - this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } -} -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; - if (typeof options.flush === 'function') this._flush = options.flush; - } - - // When the writable side finishes, then flush out anything remaining. - this.on('prefinish', prefinish); -} -function prefinish() { - var _this = this; - if (typeof this._flush === 'function' && !this._readableState.destroyed) { - this._flush(function (er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } -} -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); -}; -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function (n) { - var ts = this._transformState; - if (ts.writechunk !== null && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; -Transform.prototype._destroy = function (err, cb) { - Duplex.prototype._destroy.call(this, err, function (err2) { - cb(err2); - }); -}; -function done(stream, er, data) { - if (er) return stream.emit('error', er); - if (data != null) - // single equals check for both `null` and `undefined` - stream.push(data); - - // TODO(BridgeAR): Write a test for these two error cases - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); - if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); - return stream.push(null); -} \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_writable.js deleted file mode 100644 index 292415e23a192..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/_stream_writable.js +++ /dev/null @@ -1,641 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. - -'use strict'; - -module.exports = Writable; - -/* */ -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} - -// It seems a linked list but it is not -// there will be only 2 of these for each stream -function CorkedRequest(state) { - var _this = this; - this.next = null; - this.entry = null; - this.finish = function () { - onCorkedFinish(_this, state); - }; -} -/* */ - -/**/ -var Duplex; -/**/ - -Writable.WritableState = WritableState; - -/**/ -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ - -/**/ -var Stream = require('./internal/streams/stream'); -/**/ - -var Buffer = require('buffer').Buffer; -var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} -var destroyImpl = require('./internal/streams/destroy'); -var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; -var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, - ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; -var errorOrDestroy = destroyImpl.errorOrDestroy; -require('inherits')(Writable, Stream); -function nop() {} -function WritableState(options, stream, isDuplex) { - Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; - - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream, - // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); - - // if _final has been called - this.finalCalled = false; - - // drain event flag. - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // has it been destroyed - this.destroyed = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function (er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; - - // Should close be emitted on destroy. Defaults to true. - this.emitClose = options.emitClose !== false; - - // Should .destroy() be called after 'finish' (and potentially 'end') - this.autoDestroy = !!options.autoDestroy; - - // count buffered requests - this.bufferedRequestCount = 0; - - // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - this.corkedRequestsFree = new CorkedRequest(this); -} -WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; -}; -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function writableStateBufferGetter() { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') - }); - } catch (_) {} -})(); - -// Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. -var realHasInstance; -if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function value(object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - return object && object._writableState instanceof WritableState; - } - }); -} else { - realHasInstance = function realHasInstance(object) { - return object instanceof this; - }; -} -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - - // Checking for a Stream.Duplex instance is faster here instead of inside - // the WritableState constructor, at least with V8 6.5 - var isDuplex = this instanceof Duplex; - if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); - - // legacy. - this.writable = true; - if (options) { - if (typeof options.write === 'function') this._write = options.write; - if (typeof options.writev === 'function') this._writev = options.writev; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - if (typeof options.final === 'function') this._final = options.final; - } - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); -}; -function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); - // TODO: defer error events consistently everywhere, not just the cb - errorOrDestroy(stream, er); - process.nextTick(cb, er); -} - -// Checks that a user-supplied chunk is valid, especially for the particular -// mode the stream is in. Currently this means that `null` is never accepted -// and undefined/non-string values are only allowed in object mode. -function validChunk(stream, state, chunk, cb) { - var er; - if (chunk === null) { - er = new ERR_STREAM_NULL_VALUES(); - } else if (typeof chunk !== 'string' && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); - } - if (er) { - errorOrDestroy(stream, er); - process.nextTick(cb, er); - return false; - } - return true; -} -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - if (typeof cb !== 'function') cb = nop; - if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - return ret; -}; -Writable.prototype.cork = function () { - this._writableState.corked++; -}; -Writable.prototype.uncork = function () { - var state = this._writableState; - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; - return this; -}; -Object.defineProperty(Writable.prototype, 'writableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState && this._writableState.getBuffer(); - } -}); -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); - } - return chunk; -} -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.highWaterMark; - } -}); - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; - } - } - var len = state.objectMode ? 1 : chunk.length; - state.length += len; - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true; - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - return ret; -} -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - process.nextTick(cb, er); - // this can emit finish, and it will always happen - // after error - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - // this can emit finish, but finish must - // always follow error - finishMaybe(stream, state); - } -} -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); - onwriteStateUpdate(state); - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state) || stream.destroyed; - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); - } - } -} -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - var count = 0; - var allBuffers = true; - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, '', holder.finish); - - // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - state.bufferedRequestCount = 0; - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - break; - } - } - if (entry === null) state.lastBufferedRequest = null; - } - state.bufferedRequest = entry; - state.bufferProcessing = false; -} -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); -}; -Writable.prototype._writev = null; -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending) endWritable(this, state, cb); - return this; -}; -Object.defineProperty(Writable.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; - if (err) { - errorOrDestroy(stream, err); - } - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); -} -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } - } -} -function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the readable side is ready for autoDestroy as well - var rState = stream._readableState; - if (!rState || rState.autoDestroy && rState.endEmitted) { - stream.destroy(); - } - } - } - } - return need; -} -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) process.nextTick(cb);else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; -} -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - - // reuse the free corkReq. - state.corkedRequestsFree.next = corkReq; -} -Object.defineProperty(Writable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._writableState === undefined) { - return false; - } - return this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._writableState.destroyed = value; - } -}); -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; -Writable.prototype._destroy = function (err, cb) { - cb(err); -}; \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/async_iterator.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/async_iterator.js deleted file mode 100644 index 742c5a4674794..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/async_iterator.js +++ /dev/null @@ -1,180 +0,0 @@ -'use strict'; - -var _Object$setPrototypeO; -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -var finished = require('./end-of-stream'); -var kLastResolve = Symbol('lastResolve'); -var kLastReject = Symbol('lastReject'); -var kError = Symbol('error'); -var kEnded = Symbol('ended'); -var kLastPromise = Symbol('lastPromise'); -var kHandlePromise = Symbol('handlePromise'); -var kStream = Symbol('stream'); -function createIterResult(value, done) { - return { - value: value, - done: done - }; -} -function readAndResolve(iter) { - var resolve = iter[kLastResolve]; - if (resolve !== null) { - var data = iter[kStream].read(); - // we defer if data is null - // we can be expecting either 'end' or - // 'error' - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve(createIterResult(data, false)); - } - } -} -function onReadable(iter) { - // we wait for the next tick, because it might - // emit an error with process.nextTick - process.nextTick(readAndResolve, iter); -} -function wrapForNext(lastPromise, iter) { - return function (resolve, reject) { - lastPromise.then(function () { - if (iter[kEnded]) { - resolve(createIterResult(undefined, true)); - return; - } - iter[kHandlePromise](resolve, reject); - }, reject); - }; -} -var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); -var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, - next: function next() { - var _this = this; - // if we have detected an error in the meanwhile - // reject straight away - var error = this[kError]; - if (error !== null) { - return Promise.reject(error); - } - if (this[kEnded]) { - return Promise.resolve(createIterResult(undefined, true)); - } - if (this[kStream].destroyed) { - // We need to defer via nextTick because if .destroy(err) is - // called, the error will be emitted via nextTick, and - // we cannot guarantee that there is no error lingering around - // waiting to be emitted. - return new Promise(function (resolve, reject) { - process.nextTick(function () { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve(createIterResult(undefined, true)); - } - }); - }); - } - - // if we have multiple next() calls - // we will wait for the previous Promise to finish - // this logic is optimized to support for await loops, - // where next() is only called once at a time - var lastPromise = this[kLastPromise]; - var promise; - if (lastPromise) { - promise = new Promise(wrapForNext(lastPromise, this)); - } else { - // fast path needed to support multiple this.push() - // without triggering the next() queue - var data = this[kStream].read(); - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } - promise = new Promise(this[kHandlePromise]); - } - this[kLastPromise] = promise; - return promise; - } -}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { - return this; -}), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; - // destroy(err, cb) is a private API - // we can guarantee we have that here, because we control the - // Readable class this is attached to - return new Promise(function (resolve, reject) { - _this2[kStream].destroy(null, function (err) { - if (err) { - reject(err); - return; - } - resolve(createIterResult(undefined, true)); - }); - }); -}), _Object$setPrototypeO), AsyncIteratorPrototype); -var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { - var _Object$create; - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve, reject) { - var data = iterator[kStream].read(); - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve; - iterator[kLastReject] = reject; - } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function (err) { - if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - var reject = iterator[kLastReject]; - // reject if we are waiting for data in the Promise - // returned by next() and store the error - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); - } - iterator[kError] = err; - return; - } - var resolve = iterator[kLastResolve]; - if (resolve !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(undefined, true)); - } - iterator[kEnded] = true; - }); - stream.on('readable', onReadable.bind(null, iterator)); - return iterator; -}; -module.exports = createReadableStreamAsyncIterator; \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/buffer_list.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/buffer_list.js deleted file mode 100644 index 69bda497d35f3..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/buffer_list.js +++ /dev/null @@ -1,183 +0,0 @@ -'use strict'; - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _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, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -var _require = require('buffer'), - Buffer = _require.Buffer; -var _require2 = require('util'), - inspect = _require2.inspect; -var custom = inspect && inspect.custom || 'inspect'; -function copyBuffer(src, target, offset) { - Buffer.prototype.copy.call(src, target, offset); -} -module.exports = /*#__PURE__*/function () { - function BufferList() { - _classCallCheck(this, BufferList); - this.head = null; - this.tail = null; - this.length = 0; - } - _createClass(BufferList, [{ - key: "push", - value: function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - } - }, { - key: "unshift", - value: function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - } - }, { - key: "shift", - value: function shift() { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; - } - }, { - key: "clear", - value: function clear() { - this.head = this.tail = null; - this.length = 0; - } - }, { - key: "join", - value: function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - while (p = p.next) ret += s + p.data; - return ret; - } - }, { - key: "concat", - value: function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - } - - // Consumes a specified amount of bytes or characters from the buffered data. - }, { - key: "consume", - value: function consume(n, hasStrings) { - var ret; - if (n < this.head.data.length) { - // `slice` is the same for buffers and strings. - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - // First chunk is a perfect match. - ret = this.shift(); - } else { - // Result spans more than one buffer. - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } - return ret; - } - }, { - key: "first", - value: function first() { - return this.head.data; - } - - // Consumes a specified amount of characters from the buffered data. - }, { - key: "_getString", - value: function _getString(n) { - var p = this.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } - - // Consumes a specified amount of bytes from the buffered data. - }, { - key: "_getBuffer", - value: function _getBuffer(n) { - var ret = Buffer.allocUnsafe(n); - var p = this.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = buf.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } - - // Make sure the linked list only shows the minimal necessary information. - }, { - key: custom, - value: function value(_, options) { - return inspect(this, _objectSpread(_objectSpread({}, options), {}, { - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - })); - } - }]); - return BufferList; -}(); \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/destroy.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/destroy.js deleted file mode 100644 index 31a17c4dc4638..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/destroy.js +++ /dev/null @@ -1,96 +0,0 @@ -'use strict'; - -// undocumented cb() API, needed for core, not for public API -function destroy(err, cb) { - var _this = this; - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err) { - if (!this._writableState) { - process.nextTick(emitErrorNT, this, err); - } else if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - process.nextTick(emitErrorNT, this, err); - } - } - return this; - } - - // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - - if (this._readableState) { - this._readableState.destroyed = true; - } - - // if this is a duplex stream mark the writable part as destroyed as well - if (this._writableState) { - this._writableState.destroyed = true; - } - this._destroy(err || null, function (err) { - if (!cb && err) { - if (!_this._writableState) { - process.nextTick(emitErrorAndCloseNT, _this, err); - } else if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - process.nextTick(emitErrorAndCloseNT, _this, err); - } else { - process.nextTick(emitCloseNT, _this); - } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err); - } else { - process.nextTick(emitCloseNT, _this); - } - }); - return this; -} -function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); -} -function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) return; - if (self._readableState && !self._readableState.emitClose) return; - self.emit('close'); -} -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } -} -function emitErrorNT(self, err) { - self.emit('error', err); -} -function errorOrDestroy(stream, err) { - // We have tests that rely on errors being emitted - // in the same tick, so changing this is semver major. - // For now when you opt-in to autoDestroy we allow - // the error to be emitted nextTick. In a future - // semver major update we should change the default to this. - - var rState = stream._readableState; - var wState = stream._writableState; - if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); -} -module.exports = { - destroy: destroy, - undestroy: undestroy, - errorOrDestroy: errorOrDestroy -}; \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/end-of-stream.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/end-of-stream.js deleted file mode 100644 index 59c671b5af769..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +++ /dev/null @@ -1,86 +0,0 @@ -// Ported from https://github.com/mafintosh/end-of-stream with -// permission from the author, Mathias Buus (@mafintosh). - -'use strict'; - -var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - callback.apply(this, args); - }; -} -function noop() {} -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} -function eos(stream, opts, callback) { - if (typeof opts === 'function') return eos(stream, null, opts); - if (!opts) opts = {}; - callback = once(callback || noop); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable = opts.writable || opts.writable !== false && stream.writable; - var onlegacyfinish = function onlegacyfinish() { - if (!stream.writable) onfinish(); - }; - var writableEnded = stream._writableState && stream._writableState.finished; - var onfinish = function onfinish() { - writable = false; - writableEnded = true; - if (!readable) callback.call(stream); - }; - var readableEnded = stream._readableState && stream._readableState.endEmitted; - var onend = function onend() { - readable = false; - readableEnded = true; - if (!writable) callback.call(stream); - }; - var onerror = function onerror(err) { - callback.call(stream, err); - }; - var onclose = function onclose() { - var err; - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - if (writable && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - }; - var onrequest = function onrequest() { - stream.req.on('finish', onfinish); - }; - if (isRequest(stream)) { - stream.on('complete', onfinish); - stream.on('abort', onclose); - if (stream.req) onrequest();else stream.on('request', onrequest); - } else if (writable && !stream._writableState) { - // legacy streams - stream.on('end', onlegacyfinish); - stream.on('close', onlegacyfinish); - } - stream.on('end', onend); - stream.on('finish', onfinish); - if (opts.error !== false) stream.on('error', onerror); - stream.on('close', onclose); - return function () { - stream.removeListener('complete', onfinish); - stream.removeListener('abort', onclose); - stream.removeListener('request', onrequest); - if (stream.req) stream.req.removeListener('finish', onfinish); - stream.removeListener('end', onlegacyfinish); - stream.removeListener('close', onlegacyfinish); - stream.removeListener('finish', onfinish); - stream.removeListener('end', onend); - stream.removeListener('error', onerror); - stream.removeListener('close', onclose); - }; -} -module.exports = eos; \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from-browser.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from-browser.js deleted file mode 100644 index a4ce56f3c90f6..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from-browser.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function () { - throw new Error('Readable.from is not available in the browser') -}; diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from.js deleted file mode 100644 index 0a34ee92e3df8..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/from.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -var ERR_INVALID_ARG_TYPE = require('../../../errors').codes.ERR_INVALID_ARG_TYPE; -function from(Readable, iterable, opts) { - var iterator; - if (iterable && typeof iterable.next === 'function') { - iterator = iterable; - } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable); - var readable = new Readable(_objectSpread({ - objectMode: true - }, opts)); - // Reading boolean to protect against _read - // being called before last iteration completion. - var reading = false; - readable._read = function () { - if (!reading) { - reading = true; - next(); - } - }; - function next() { - return _next2.apply(this, arguments); - } - function _next2() { - _next2 = _asyncToGenerator(function* () { - try { - var _yield$iterator$next = yield iterator.next(), - value = _yield$iterator$next.value, - done = _yield$iterator$next.done; - if (done) { - readable.push(null); - } else if (readable.push(yield value)) { - next(); - } else { - reading = false; - } - } catch (err) { - readable.destroy(err); - } - }); - return _next2.apply(this, arguments); - } - return readable; -} -module.exports = from; diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/pipeline.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/pipeline.js deleted file mode 100644 index e6f39241f98dd..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/pipeline.js +++ /dev/null @@ -1,86 +0,0 @@ -// Ported from https://github.com/mafintosh/pump with -// permission from the author, Mathias Buus (@mafintosh). - -'use strict'; - -var eos; -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - callback.apply(void 0, arguments); - }; -} -var _require$codes = require('../../../errors').codes, - ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; -function noop(err) { - // Rethrow the error if it exists to avoid swallowing it - if (err) throw err; -} -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} -function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on('close', function () { - closed = true; - }); - if (eos === undefined) eos = require('./end-of-stream'); - eos(stream, { - readable: reading, - writable: writing - }, function (err) { - if (err) return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function (err) { - if (closed) return; - if (destroyed) return; - destroyed = true; - - // request.destroy just do .end - .abort is what we want - if (isRequest(stream)) return stream.abort(); - if (typeof stream.destroy === 'function') return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED('pipe')); - }; -} -function call(fn) { - fn(); -} -function pipe(from, to) { - return from.pipe(to); -} -function popCallback(streams) { - if (!streams.length) return noop; - if (typeof streams[streams.length - 1] !== 'function') return noop; - return streams.pop(); -} -function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } - var callback = popCallback(streams); - if (Array.isArray(streams[0])) streams = streams[0]; - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams'); - } - var error; - var destroys = streams.map(function (stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function (err) { - if (!error) error = err; - if (err) destroys.forEach(call); - if (reading) return; - destroys.forEach(call); - callback(error); - }); - }); - return streams.reduce(pipe); -} -module.exports = pipeline; \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/state.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/state.js deleted file mode 100644 index 3fbf8927e0017..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/state.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; -function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; -} -function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : 'highWaterMark'; - throw new ERR_INVALID_OPT_VALUE(name, hwm); - } - return Math.floor(hwm); - } - - // Default value - return state.objectMode ? 16 : 16 * 1024; -} -module.exports = { - getHighWaterMark: getHighWaterMark -}; \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream-browser.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream-browser.js deleted file mode 100644 index 9332a3fdae706..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream-browser.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('events').EventEmitter; diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream.js deleted file mode 100644 index ce2ad5b6ee57f..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/lib/internal/streams/stream.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('stream'); diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/package.json b/node_modules/@npmcli/run-script/node_modules/readable-stream/package.json deleted file mode 100644 index ade59e71aa0f1..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "readable-stream", - "version": "3.6.2", - "description": "Streams3, a user-land copy of the stream library from Node.js", - "main": "readable.js", - "engines": { - "node": ">= 6" - }, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "devDependencies": { - "@babel/cli": "^7.2.0", - "@babel/core": "^7.2.0", - "@babel/polyfill": "^7.0.0", - "@babel/preset-env": "^7.2.0", - "airtap": "0.0.9", - "assert": "^1.4.0", - "bl": "^2.0.0", - "deep-strict-equal": "^0.2.0", - "events.once": "^2.0.2", - "glob": "^7.1.2", - "gunzip-maybe": "^1.4.1", - "hyperquest": "^2.1.3", - "lolex": "^2.6.0", - "nyc": "^11.0.0", - "pump": "^3.0.0", - "rimraf": "^2.6.2", - "tap": "^12.0.0", - "tape": "^4.9.0", - "tar-fs": "^1.16.2", - "util-promisify": "^2.1.0" - }, - "scripts": { - "test": "tap -J --no-esm test/parallel/*.js test/ours/*.js", - "ci": "TAP=1 tap --no-esm test/parallel/*.js test/ours/*.js | tee test.tap", - "test-browsers": "airtap --sauce-connect --loopback airtap.local -- test/browser.js", - "test-browser-local": "airtap --open --local -- test/browser.js", - "cover": "nyc npm test", - "report": "nyc report --reporter=lcov", - "update-browser-errors": "babel -o errors-browser.js errors.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/nodejs/readable-stream" - }, - "keywords": [ - "readable", - "stream", - "pipe" - ], - "browser": { - "util": false, - "worker_threads": false, - "./errors": "./errors-browser.js", - "./readable.js": "./readable-browser.js", - "./lib/internal/streams/from.js": "./lib/internal/streams/from-browser.js", - "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js" - }, - "nyc": { - "include": [ - "lib/**.js" - ] - }, - "license": "MIT" -} diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/readable-browser.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/readable-browser.js deleted file mode 100644 index adbf60de832f9..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/readable-browser.js +++ /dev/null @@ -1,9 +0,0 @@ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); -exports.finished = require('./lib/internal/streams/end-of-stream.js'); -exports.pipeline = require('./lib/internal/streams/pipeline.js'); diff --git a/node_modules/@npmcli/run-script/node_modules/readable-stream/readable.js b/node_modules/@npmcli/run-script/node_modules/readable-stream/readable.js deleted file mode 100644 index 9e0ca120ded82..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/readable-stream/readable.js +++ /dev/null @@ -1,16 +0,0 @@ -var Stream = require('stream'); -if (process.env.READABLE_STREAM === 'disable' && Stream) { - module.exports = Stream.Readable; - Object.assign(module.exports, Stream); - module.exports.Stream = Stream; -} else { - exports = module.exports = require('./lib/_stream_readable.js'); - exports.Stream = Stream || exports; - exports.Readable = exports; - exports.Writable = require('./lib/_stream_writable.js'); - exports.Duplex = require('./lib/_stream_duplex.js'); - exports.Transform = require('./lib/_stream_transform.js'); - exports.PassThrough = require('./lib/_stream_passthrough.js'); - exports.finished = require('./lib/internal/streams/end-of-stream.js'); - exports.pipeline = require('./lib/internal/streams/pipeline.js'); -} diff --git a/node_modules/@npmcli/run-script/node_modules/signal-exit/LICENSE.txt b/node_modules/@npmcli/run-script/node_modules/signal-exit/LICENSE.txt deleted file mode 100644 index eead04a12162d..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/signal-exit/LICENSE.txt +++ /dev/null @@ -1,16 +0,0 @@ -The ISC License - -Copyright (c) 2015, Contributors - -Permission to use, copy, modify, and/or distribute this software -for any purpose with or without fee is hereby granted, provided -that the above copyright notice and this permission notice -appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE -LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES -OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/signal-exit/index.js b/node_modules/@npmcli/run-script/node_modules/signal-exit/index.js deleted file mode 100644 index 93703f369265c..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/signal-exit/index.js +++ /dev/null @@ -1,202 +0,0 @@ -// Note: since nyc uses this module to output coverage, any lines -// that are in the direct sync flow of nyc's outputCoverage are -// ignored, since we can never get coverage for them. -// grab a reference to node's real process object right away -var process = global.process - -const processOk = function (process) { - return process && - typeof process === 'object' && - typeof process.removeListener === 'function' && - typeof process.emit === 'function' && - typeof process.reallyExit === 'function' && - typeof process.listeners === 'function' && - typeof process.kill === 'function' && - typeof process.pid === 'number' && - typeof process.on === 'function' -} - -// some kind of non-node environment, just no-op -/* istanbul ignore if */ -if (!processOk(process)) { - module.exports = function () { - return function () {} - } -} else { - var assert = require('assert') - var signals = require('./signals.js') - var isWin = /^win/i.test(process.platform) - - var EE = require('events') - /* istanbul ignore if */ - if (typeof EE !== 'function') { - EE = EE.EventEmitter - } - - var emitter - if (process.__signal_exit_emitter__) { - emitter = process.__signal_exit_emitter__ - } else { - emitter = process.__signal_exit_emitter__ = new EE() - emitter.count = 0 - emitter.emitted = {} - } - - // Because this emitter is a global, we have to check to see if a - // previous version of this library failed to enable infinite listeners. - // I know what you're about to say. But literally everything about - // signal-exit is a compromise with evil. Get used to it. - if (!emitter.infinite) { - emitter.setMaxListeners(Infinity) - emitter.infinite = true - } - - module.exports = function (cb, opts) { - /* istanbul ignore if */ - if (!processOk(global.process)) { - return function () {} - } - assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler') - - if (loaded === false) { - load() - } - - var ev = 'exit' - if (opts && opts.alwaysLast) { - ev = 'afterexit' - } - - var remove = function () { - emitter.removeListener(ev, cb) - if (emitter.listeners('exit').length === 0 && - emitter.listeners('afterexit').length === 0) { - unload() - } - } - emitter.on(ev, cb) - - return remove - } - - var unload = function unload () { - if (!loaded || !processOk(global.process)) { - return - } - loaded = false - - signals.forEach(function (sig) { - try { - process.removeListener(sig, sigListeners[sig]) - } catch (er) {} - }) - process.emit = originalProcessEmit - process.reallyExit = originalProcessReallyExit - emitter.count -= 1 - } - module.exports.unload = unload - - var emit = function emit (event, code, signal) { - /* istanbul ignore if */ - if (emitter.emitted[event]) { - return - } - emitter.emitted[event] = true - emitter.emit(event, code, signal) - } - - // { : , ... } - var sigListeners = {} - signals.forEach(function (sig) { - sigListeners[sig] = function listener () { - /* istanbul ignore if */ - if (!processOk(global.process)) { - return - } - // If there are no other listeners, an exit is coming! - // Simplest way: remove us and then re-send the signal. - // We know that this will kill the process, so we can - // safely emit now. - var listeners = process.listeners(sig) - if (listeners.length === emitter.count) { - unload() - emit('exit', null, sig) - /* istanbul ignore next */ - emit('afterexit', null, sig) - /* istanbul ignore next */ - if (isWin && sig === 'SIGHUP') { - // "SIGHUP" throws an `ENOSYS` error on Windows, - // so use a supported signal instead - sig = 'SIGINT' - } - /* istanbul ignore next */ - process.kill(process.pid, sig) - } - } - }) - - module.exports.signals = function () { - return signals - } - - var loaded = false - - var load = function load () { - if (loaded || !processOk(global.process)) { - return - } - loaded = true - - // This is the number of onSignalExit's that are in play. - // It's important so that we can count the correct number of - // listeners on signals, and don't wait for the other one to - // handle it instead of us. - emitter.count += 1 - - signals = signals.filter(function (sig) { - try { - process.on(sig, sigListeners[sig]) - return true - } catch (er) { - return false - } - }) - - process.emit = processEmit - process.reallyExit = processReallyExit - } - module.exports.load = load - - var originalProcessReallyExit = process.reallyExit - var processReallyExit = function processReallyExit (code) { - /* istanbul ignore if */ - if (!processOk(global.process)) { - return - } - process.exitCode = code || /* istanbul ignore next */ 0 - emit('exit', process.exitCode, null) - /* istanbul ignore next */ - emit('afterexit', process.exitCode, null) - /* istanbul ignore next */ - originalProcessReallyExit.call(process, process.exitCode) - } - - var originalProcessEmit = process.emit - var processEmit = function processEmit (ev, arg) { - if (ev === 'exit' && processOk(global.process)) { - /* istanbul ignore else */ - if (arg !== undefined) { - process.exitCode = arg - } - var ret = originalProcessEmit.apply(this, arguments) - /* istanbul ignore next */ - emit('exit', process.exitCode, null) - /* istanbul ignore next */ - emit('afterexit', process.exitCode, null) - /* istanbul ignore next */ - return ret - } else { - return originalProcessEmit.apply(this, arguments) - } - } -} diff --git a/node_modules/@npmcli/run-script/node_modules/signal-exit/package.json b/node_modules/@npmcli/run-script/node_modules/signal-exit/package.json deleted file mode 100644 index e1a00311f9fbe..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/signal-exit/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "signal-exit", - "version": "3.0.7", - "description": "when you want to fire an event no matter how a process exits.", - "main": "index.js", - "scripts": { - "test": "tap", - "snap": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" - }, - "files": [ - "index.js", - "signals.js" - ], - "repository": { - "type": "git", - "url": "https://github.com/tapjs/signal-exit.git" - }, - "keywords": [ - "signal", - "exit" - ], - "author": "Ben Coe ", - "license": "ISC", - "bugs": { - "url": "https://github.com/tapjs/signal-exit/issues" - }, - "homepage": "https://github.com/tapjs/signal-exit", - "devDependencies": { - "chai": "^3.5.0", - "coveralls": "^3.1.1", - "nyc": "^15.1.0", - "standard-version": "^9.3.1", - "tap": "^15.1.1" - } -} diff --git a/node_modules/@npmcli/run-script/node_modules/signal-exit/signals.js b/node_modules/@npmcli/run-script/node_modules/signal-exit/signals.js deleted file mode 100644 index 3bd67a8a554e3..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/signal-exit/signals.js +++ /dev/null @@ -1,53 +0,0 @@ -// This is not the set of all possible signals. -// -// It IS, however, the set of all signals that trigger -// an exit on either Linux or BSD systems. Linux is a -// superset of the signal names supported on BSD, and -// the unknown signals just fail to register, so we can -// catch that easily enough. -// -// Don't bother with SIGKILL. It's uncatchable, which -// means that we can't fire any callbacks anyway. -// -// If a user does happen to register a handler on a non- -// fatal signal like SIGWINCH or something, and then -// exit, it'll end up firing `process.emit('exit')`, so -// the handler will be fired anyway. -// -// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised -// artificially, inherently leave the process in a -// state from which it is not safe to try and enter JS -// listeners. -module.exports = [ - 'SIGABRT', - 'SIGALRM', - 'SIGHUP', - 'SIGINT', - 'SIGTERM' -] - -if (process.platform !== 'win32') { - module.exports.push( - 'SIGVTALRM', - 'SIGXCPU', - 'SIGXFSZ', - 'SIGUSR2', - 'SIGTRAP', - 'SIGSYS', - 'SIGQUIT', - 'SIGIOT' - // should detect profiler and enable/disable accordingly. - // see #21 - // 'SIGPROF' - ) -} - -if (process.platform === 'linux') { - module.exports.push( - 'SIGIO', - 'SIGPOLL', - 'SIGPWR', - 'SIGSTKFLT', - 'SIGUNUSED' - ) -} diff --git a/node_modules/@npmcli/run-script/node_modules/ssri/LICENSE.md b/node_modules/@npmcli/run-script/node_modules/ssri/LICENSE.md deleted file mode 100644 index e335388869f50..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/ssri/LICENSE.md +++ /dev/null @@ -1,16 +0,0 @@ -ISC License - -Copyright 2021 (c) npm, Inc. - -Permission to use, copy, modify, and/or distribute this software for -any purpose with or without fee is hereby granted, provided that the -above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER DISCLAIMS -ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE -USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/ssri/lib/index.js b/node_modules/@npmcli/run-script/node_modules/ssri/lib/index.js deleted file mode 100644 index 1443137cbc708..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/ssri/lib/index.js +++ /dev/null @@ -1,524 +0,0 @@ -'use strict' - -const crypto = require('crypto') -const MiniPass = require('minipass') - -const SPEC_ALGORITHMS = ['sha256', 'sha384', 'sha512'] - -// TODO: this should really be a hardcoded list of algorithms we support, -// rather than [a-z0-9]. -const BASE64_REGEX = /^[a-z0-9+/]+(?:=?=?)$/i -const SRI_REGEX = /^([a-z0-9]+)-([^?]+)([?\S*]*)$/ -const STRICT_SRI_REGEX = /^([a-z0-9]+)-([A-Za-z0-9+/=]{44,88})(\?[\x21-\x7E]*)?$/ -const VCHAR_REGEX = /^[\x21-\x7E]+$/ - -const defaultOpts = { - algorithms: ['sha512'], - error: false, - options: [], - pickAlgorithm: getPrioritizedHash, - sep: ' ', - single: false, - strict: false, -} - -const ssriOpts = (opts = {}) => ({ ...defaultOpts, ...opts }) - -const getOptString = options => !options || !options.length - ? '' - : `?${options.join('?')}` - -const _onEnd = Symbol('_onEnd') -const _getOptions = Symbol('_getOptions') -const _emittedSize = Symbol('_emittedSize') -const _emittedIntegrity = Symbol('_emittedIntegrity') -const _emittedVerified = Symbol('_emittedVerified') - -class IntegrityStream extends MiniPass { - constructor (opts) { - super() - this.size = 0 - this.opts = opts - - // may be overridden later, but set now for class consistency - this[_getOptions]() - - // options used for calculating stream. can't be changed. - const { algorithms = defaultOpts.algorithms } = opts - this.algorithms = Array.from( - new Set(algorithms.concat(this.algorithm ? [this.algorithm] : [])) - ) - this.hashes = this.algorithms.map(crypto.createHash) - } - - [_getOptions] () { - const { - integrity, - size, - options, - } = { ...defaultOpts, ...this.opts } - - // For verification - this.sri = integrity ? parse(integrity, this.opts) : null - this.expectedSize = size - this.goodSri = this.sri ? !!Object.keys(this.sri).length : false - this.algorithm = this.goodSri ? this.sri.pickAlgorithm(this.opts) : null - this.digests = this.goodSri ? this.sri[this.algorithm] : null - this.optString = getOptString(options) - } - - on (ev, handler) { - if (ev === 'size' && this[_emittedSize]) { - return handler(this[_emittedSize]) - } - - if (ev === 'integrity' && this[_emittedIntegrity]) { - return handler(this[_emittedIntegrity]) - } - - if (ev === 'verified' && this[_emittedVerified]) { - return handler(this[_emittedVerified]) - } - - return super.on(ev, handler) - } - - emit (ev, data) { - if (ev === 'end') { - this[_onEnd]() - } - return super.emit(ev, data) - } - - write (data) { - this.size += data.length - this.hashes.forEach(h => h.update(data)) - return super.write(data) - } - - [_onEnd] () { - if (!this.goodSri) { - this[_getOptions]() - } - const newSri = parse(this.hashes.map((h, i) => { - return `${this.algorithms[i]}-${h.digest('base64')}${this.optString}` - }).join(' '), this.opts) - // Integrity verification mode - const match = this.goodSri && newSri.match(this.sri, this.opts) - if (typeof this.expectedSize === 'number' && this.size !== this.expectedSize) { - /* eslint-disable-next-line max-len */ - const err = new Error(`stream size mismatch when checking ${this.sri}.\n Wanted: ${this.expectedSize}\n Found: ${this.size}`) - err.code = 'EBADSIZE' - err.found = this.size - err.expected = this.expectedSize - err.sri = this.sri - this.emit('error', err) - } else if (this.sri && !match) { - /* eslint-disable-next-line max-len */ - const err = new Error(`${this.sri} integrity checksum failed when using ${this.algorithm}: wanted ${this.digests} but got ${newSri}. (${this.size} bytes)`) - err.code = 'EINTEGRITY' - err.found = newSri - err.expected = this.digests - err.algorithm = this.algorithm - err.sri = this.sri - this.emit('error', err) - } else { - this[_emittedSize] = this.size - this.emit('size', this.size) - this[_emittedIntegrity] = newSri - this.emit('integrity', newSri) - if (match) { - this[_emittedVerified] = match - this.emit('verified', match) - } - } - } -} - -class Hash { - get isHash () { - return true - } - - constructor (hash, opts) { - opts = ssriOpts(opts) - const strict = !!opts.strict - this.source = hash.trim() - - // set default values so that we make V8 happy to - // always see a familiar object template. - this.digest = '' - this.algorithm = '' - this.options = [] - - // 3.1. Integrity metadata (called "Hash" by ssri) - // https://w3c.github.io/webappsec-subresource-integrity/#integrity-metadata-description - const match = this.source.match( - strict - ? STRICT_SRI_REGEX - : SRI_REGEX - ) - if (!match) { - return - } - if (strict && !SPEC_ALGORITHMS.some(a => a === match[1])) { - return - } - this.algorithm = match[1] - this.digest = match[2] - - const rawOpts = match[3] - if (rawOpts) { - this.options = rawOpts.slice(1).split('?') - } - } - - hexDigest () { - return this.digest && Buffer.from(this.digest, 'base64').toString('hex') - } - - toJSON () { - return this.toString() - } - - toString (opts) { - opts = ssriOpts(opts) - if (opts.strict) { - // Strict mode enforces the standard as close to the foot of the - // letter as it can. - if (!( - // The spec has very restricted productions for algorithms. - // https://www.w3.org/TR/CSP2/#source-list-syntax - SPEC_ALGORITHMS.some(x => x === this.algorithm) && - // Usually, if someone insists on using a "different" base64, we - // leave it as-is, since there's multiple standards, and the - // specified is not a URL-safe variant. - // https://www.w3.org/TR/CSP2/#base64_value - this.digest.match(BASE64_REGEX) && - // Option syntax is strictly visual chars. - // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-option-expression - // https://tools.ietf.org/html/rfc5234#appendix-B.1 - this.options.every(opt => opt.match(VCHAR_REGEX)) - )) { - return '' - } - } - const options = this.options && this.options.length - ? `?${this.options.join('?')}` - : '' - return `${this.algorithm}-${this.digest}${options}` - } -} - -class Integrity { - get isIntegrity () { - return true - } - - toJSON () { - return this.toString() - } - - isEmpty () { - return Object.keys(this).length === 0 - } - - toString (opts) { - opts = ssriOpts(opts) - let sep = opts.sep || ' ' - if (opts.strict) { - // Entries must be separated by whitespace, according to spec. - sep = sep.replace(/\S+/g, ' ') - } - return Object.keys(this).map(k => { - return this[k].map(hash => { - return Hash.prototype.toString.call(hash, opts) - }).filter(x => x.length).join(sep) - }).filter(x => x.length).join(sep) - } - - concat (integrity, opts) { - opts = ssriOpts(opts) - const other = typeof integrity === 'string' - ? integrity - : stringify(integrity, opts) - return parse(`${this.toString(opts)} ${other}`, opts) - } - - hexDigest () { - return parse(this, { single: true }).hexDigest() - } - - // add additional hashes to an integrity value, but prevent - // *changing* an existing integrity hash. - merge (integrity, opts) { - opts = ssriOpts(opts) - const other = parse(integrity, opts) - for (const algo in other) { - if (this[algo]) { - if (!this[algo].find(hash => - other[algo].find(otherhash => - hash.digest === otherhash.digest))) { - throw new Error('hashes do not match, cannot update integrity') - } - } else { - this[algo] = other[algo] - } - } - } - - match (integrity, opts) { - opts = ssriOpts(opts) - const other = parse(integrity, opts) - const algo = other.pickAlgorithm(opts) - return ( - this[algo] && - other[algo] && - this[algo].find(hash => - other[algo].find(otherhash => - hash.digest === otherhash.digest - ) - ) - ) || false - } - - pickAlgorithm (opts) { - opts = ssriOpts(opts) - const pickAlgorithm = opts.pickAlgorithm - const keys = Object.keys(this) - return keys.reduce((acc, algo) => { - return pickAlgorithm(acc, algo) || acc - }) - } -} - -module.exports.parse = parse -function parse (sri, opts) { - if (!sri) { - return null - } - opts = ssriOpts(opts) - if (typeof sri === 'string') { - return _parse(sri, opts) - } else if (sri.algorithm && sri.digest) { - const fullSri = new Integrity() - fullSri[sri.algorithm] = [sri] - return _parse(stringify(fullSri, opts), opts) - } else { - return _parse(stringify(sri, opts), opts) - } -} - -function _parse (integrity, opts) { - // 3.4.3. Parse metadata - // https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata - if (opts.single) { - return new Hash(integrity, opts) - } - const hashes = integrity.trim().split(/\s+/).reduce((acc, string) => { - const hash = new Hash(string, opts) - if (hash.algorithm && hash.digest) { - const algo = hash.algorithm - if (!acc[algo]) { - acc[algo] = [] - } - acc[algo].push(hash) - } - return acc - }, new Integrity()) - return hashes.isEmpty() ? null : hashes -} - -module.exports.stringify = stringify -function stringify (obj, opts) { - opts = ssriOpts(opts) - if (obj.algorithm && obj.digest) { - return Hash.prototype.toString.call(obj, opts) - } else if (typeof obj === 'string') { - return stringify(parse(obj, opts), opts) - } else { - return Integrity.prototype.toString.call(obj, opts) - } -} - -module.exports.fromHex = fromHex -function fromHex (hexDigest, algorithm, opts) { - opts = ssriOpts(opts) - const optString = getOptString(opts.options) - return parse( - `${algorithm}-${ - Buffer.from(hexDigest, 'hex').toString('base64') - }${optString}`, opts - ) -} - -module.exports.fromData = fromData -function fromData (data, opts) { - opts = ssriOpts(opts) - const algorithms = opts.algorithms - const optString = getOptString(opts.options) - return algorithms.reduce((acc, algo) => { - const digest = crypto.createHash(algo).update(data).digest('base64') - const hash = new Hash( - `${algo}-${digest}${optString}`, - opts - ) - /* istanbul ignore else - it would be VERY strange if the string we - * just calculated with an algo did not have an algo or digest. - */ - if (hash.algorithm && hash.digest) { - const hashAlgo = hash.algorithm - if (!acc[hashAlgo]) { - acc[hashAlgo] = [] - } - acc[hashAlgo].push(hash) - } - return acc - }, new Integrity()) -} - -module.exports.fromStream = fromStream -function fromStream (stream, opts) { - opts = ssriOpts(opts) - const istream = integrityStream(opts) - return new Promise((resolve, reject) => { - stream.pipe(istream) - stream.on('error', reject) - istream.on('error', reject) - let sri - istream.on('integrity', s => { - sri = s - }) - istream.on('end', () => resolve(sri)) - istream.on('data', () => {}) - }) -} - -module.exports.checkData = checkData -function checkData (data, sri, opts) { - opts = ssriOpts(opts) - sri = parse(sri, opts) - if (!sri || !Object.keys(sri).length) { - if (opts.error) { - throw Object.assign( - new Error('No valid integrity hashes to check against'), { - code: 'EINTEGRITY', - } - ) - } else { - return false - } - } - const algorithm = sri.pickAlgorithm(opts) - const digest = crypto.createHash(algorithm).update(data).digest('base64') - const newSri = parse({ algorithm, digest }) - const match = newSri.match(sri, opts) - if (match || !opts.error) { - return match - } else if (typeof opts.size === 'number' && (data.length !== opts.size)) { - /* eslint-disable-next-line max-len */ - const err = new Error(`data size mismatch when checking ${sri}.\n Wanted: ${opts.size}\n Found: ${data.length}`) - err.code = 'EBADSIZE' - err.found = data.length - err.expected = opts.size - err.sri = sri - throw err - } else { - /* eslint-disable-next-line max-len */ - const err = new Error(`Integrity checksum failed when using ${algorithm}: Wanted ${sri}, but got ${newSri}. (${data.length} bytes)`) - err.code = 'EINTEGRITY' - err.found = newSri - err.expected = sri - err.algorithm = algorithm - err.sri = sri - throw err - } -} - -module.exports.checkStream = checkStream -function checkStream (stream, sri, opts) { - opts = ssriOpts(opts) - opts.integrity = sri - sri = parse(sri, opts) - if (!sri || !Object.keys(sri).length) { - return Promise.reject(Object.assign( - new Error('No valid integrity hashes to check against'), { - code: 'EINTEGRITY', - } - )) - } - const checker = integrityStream(opts) - return new Promise((resolve, reject) => { - stream.pipe(checker) - stream.on('error', reject) - checker.on('error', reject) - let verified - checker.on('verified', s => { - verified = s - }) - checker.on('end', () => resolve(verified)) - checker.on('data', () => {}) - }) -} - -module.exports.integrityStream = integrityStream -function integrityStream (opts = {}) { - return new IntegrityStream(opts) -} - -module.exports.create = createIntegrity -function createIntegrity (opts) { - opts = ssriOpts(opts) - const algorithms = opts.algorithms - const optString = getOptString(opts.options) - - const hashes = algorithms.map(crypto.createHash) - - return { - update: function (chunk, enc) { - hashes.forEach(h => h.update(chunk, enc)) - return this - }, - digest: function (enc) { - const integrity = algorithms.reduce((acc, algo) => { - const digest = hashes.shift().digest('base64') - const hash = new Hash( - `${algo}-${digest}${optString}`, - opts - ) - /* istanbul ignore else - it would be VERY strange if the hash we - * just calculated with an algo did not have an algo or digest. - */ - if (hash.algorithm && hash.digest) { - const hashAlgo = hash.algorithm - if (!acc[hashAlgo]) { - acc[hashAlgo] = [] - } - acc[hashAlgo].push(hash) - } - return acc - }, new Integrity()) - - return integrity - }, - } -} - -const NODE_HASHES = new Set(crypto.getHashes()) - -// This is a Best Effort™ at a reasonable priority for hash algos -const DEFAULT_PRIORITY = [ - 'md5', 'whirlpool', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512', - // TODO - it's unclear _which_ of these Node will actually use as its name - // for the algorithm, so we guesswork it based on the OpenSSL names. - 'sha3', - 'sha3-256', 'sha3-384', 'sha3-512', - 'sha3_256', 'sha3_384', 'sha3_512', -].filter(algo => NODE_HASHES.has(algo)) - -function getPrioritizedHash (algo1, algo2) { - /* eslint-disable-next-line max-len */ - return DEFAULT_PRIORITY.indexOf(algo1.toLowerCase()) >= DEFAULT_PRIORITY.indexOf(algo2.toLowerCase()) - ? algo1 - : algo2 -} diff --git a/node_modules/@npmcli/run-script/node_modules/ssri/package.json b/node_modules/@npmcli/run-script/node_modules/ssri/package.json deleted file mode 100644 index 91c1f919788cd..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/ssri/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "ssri", - "version": "9.0.1", - "description": "Standard Subresource Integrity library -- parses, serializes, generates, and verifies integrity metadata according to the SRI spec.", - "main": "lib/index.js", - "files": [ - "bin/", - "lib/" - ], - "scripts": { - "prerelease": "npm t", - "postrelease": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "posttest": "npm run lint", - "test": "tap", - "coverage": "tap", - "lint": "eslint \"**/*.js\"", - "postlint": "template-oss-check", - "template-oss-apply": "template-oss-apply --force", - "lintfix": "npm run lint -- --fix", - "preversion": "npm test", - "postversion": "npm publish", - "snap": "tap" - }, - "tap": { - "check-coverage": true - }, - "repository": { - "type": "git", - "url": "https://github.com/npm/ssri.git" - }, - "keywords": [ - "w3c", - "web", - "security", - "integrity", - "checksum", - "hashing", - "subresource integrity", - "sri", - "sri hash", - "sri string", - "sri generator", - "html" - ], - "author": "GitHub Inc.", - "license": "ISC", - "dependencies": { - "minipass": "^3.1.1" - }, - "devDependencies": { - "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.5.0", - "tap": "^16.0.1" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - }, - "templateOSS": { - "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.5.0" - } -} diff --git a/node_modules/@npmcli/run-script/node_modules/unique-filename/LICENSE b/node_modules/@npmcli/run-script/node_modules/unique-filename/LICENSE deleted file mode 100644 index 69619c125ea7e..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/unique-filename/LICENSE +++ /dev/null @@ -1,5 +0,0 @@ -Copyright npm, Inc - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/unique-filename/lib/index.js b/node_modules/@npmcli/run-script/node_modules/unique-filename/lib/index.js deleted file mode 100644 index d067d2e709809..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/unique-filename/lib/index.js +++ /dev/null @@ -1,7 +0,0 @@ -var path = require('path') - -var uniqueSlug = require('unique-slug') - -module.exports = function (filepath, prefix, uniq) { - return path.join(filepath, (prefix ? prefix + '-' : '') + uniqueSlug(uniq)) -} diff --git a/node_modules/@npmcli/run-script/node_modules/unique-filename/package.json b/node_modules/@npmcli/run-script/node_modules/unique-filename/package.json deleted file mode 100644 index bfdec2c3722a0..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/unique-filename/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "unique-filename", - "version": "2.0.1", - "description": "Generate a unique filename for use in temporary directories or caches.", - "main": "lib/index.js", - "scripts": { - "test": "tap", - "lint": "eslint \"**/*.js\"", - "postlint": "template-oss-check", - "template-oss-apply": "template-oss-apply --force", - "lintfix": "npm run lint -- --fix", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "snap": "tap", - "posttest": "npm run lint" - }, - "repository": { - "type": "git", - "url": "https://github.com/npm/unique-filename.git" - }, - "keywords": [], - "author": "GitHub Inc.", - "license": "ISC", - "bugs": { - "url": "https://github.com/iarna/unique-filename/issues" - }, - "homepage": "https://github.com/iarna/unique-filename", - "devDependencies": { - "@npmcli/eslint-config": "^3.1.0", - "@npmcli/template-oss": "3.5.0", - "tap": "^16.3.0" - }, - "dependencies": { - "unique-slug": "^3.0.0" - }, - "files": [ - "bin/", - "lib/" - ], - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - }, - "templateOSS": { - "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.5.0" - } -} diff --git a/node_modules/@npmcli/run-script/node_modules/unique-slug/LICENSE b/node_modules/@npmcli/run-script/node_modules/unique-slug/LICENSE deleted file mode 100644 index 7953647e7760b..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/unique-slug/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright npm, Inc - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/unique-slug/lib/index.js b/node_modules/@npmcli/run-script/node_modules/unique-slug/lib/index.js deleted file mode 100644 index 1bac84d95d730..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/unique-slug/lib/index.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict' -var MurmurHash3 = require('imurmurhash') - -module.exports = function (uniq) { - if (uniq) { - var hash = new MurmurHash3(uniq) - return ('00000000' + hash.result().toString(16)).slice(-8) - } else { - return (Math.random().toString(16) + '0000000').slice(2, 10) - } -} diff --git a/node_modules/@npmcli/run-script/node_modules/unique-slug/package.json b/node_modules/@npmcli/run-script/node_modules/unique-slug/package.json deleted file mode 100644 index 3194408f27fda..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/unique-slug/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "unique-slug", - "version": "3.0.0", - "description": "Generate a unique character string suitible for use in files and URLs.", - "main": "lib/index.js", - "scripts": { - "test": "tap", - "lint": "eslint \"**/*.js\"", - "postlint": "template-oss-check", - "template-oss-apply": "template-oss-apply --force", - "lintfix": "npm run lint -- --fix", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "snap": "tap", - "posttest": "npm run lint" - }, - "keywords": [], - "author": "GitHub Inc.", - "license": "ISC", - "devDependencies": { - "@npmcli/eslint-config": "^3.1.0", - "@npmcli/template-oss": "3.5.0", - "tap": "^16.3.0" - }, - "repository": { - "type": "git", - "url": "https://github.com/npm/unique-slug.git" - }, - "dependencies": { - "imurmurhash": "^0.1.4" - }, - "files": [ - "bin/", - "lib/" - ], - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - }, - "templateOSS": { - "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.5.0" - } -} diff --git a/node_modules/@npmcli/run-script/package.json b/node_modules/@npmcli/run-script/package.json index 7e7d256157156..21f00c7f1cbfb 100644 --- a/node_modules/@npmcli/run-script/package.json +++ b/node_modules/@npmcli/run-script/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/run-script", - "version": "7.0.1", + "version": "7.0.2", "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", "author": "GitHub Inc.", "license": "ISC", @@ -16,14 +16,14 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.18.0", + "@npmcli/template-oss": "4.19.0", "require-inject": "^1.4.4", "tap": "^16.0.1" }, "dependencies": { "@npmcli/node-gyp": "^3.0.0", "@npmcli/promise-spawn": "^7.0.0", - "node-gyp": "^9.0.0", + "node-gyp": "^10.0.0", "read-package-json-fast": "^3.0.0", "which": "^4.0.0" }, @@ -41,13 +41,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "ciVersions": [ - "16.14.0", - "16.x", - "18.0.0", - "18.x" - ], - "version": "4.18.0", + "version": "4.19.0", "publish": "true" }, "tap": { diff --git a/node_modules/@tootallnate/once/LICENSE b/node_modules/@tootallnate/once/LICENSE deleted file mode 100644 index c4c56a2a53b2f..0000000000000 --- a/node_modules/@tootallnate/once/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Nathan Rajlich - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@tootallnate/once/dist/index.js b/node_modules/@tootallnate/once/dist/index.js deleted file mode 100644 index ca6385b1b82f8..0000000000000 --- a/node_modules/@tootallnate/once/dist/index.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function once(emitter, name, { signal } = {}) { - return new Promise((resolve, reject) => { - function cleanup() { - signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', cleanup); - emitter.removeListener(name, onEvent); - emitter.removeListener('error', onError); - } - function onEvent(...args) { - cleanup(); - resolve(args); - } - function onError(err) { - cleanup(); - reject(err); - } - signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', cleanup); - emitter.on(name, onEvent); - emitter.on('error', onError); - }); -} -exports.default = once; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@tootallnate/once/dist/overloaded-parameters.js b/node_modules/@tootallnate/once/dist/overloaded-parameters.js deleted file mode 100644 index 207186d9e7cca..0000000000000 --- a/node_modules/@tootallnate/once/dist/overloaded-parameters.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=overloaded-parameters.js.map \ No newline at end of file diff --git a/node_modules/@tootallnate/once/dist/types.js b/node_modules/@tootallnate/once/dist/types.js deleted file mode 100644 index 11e638d1ee44a..0000000000000 --- a/node_modules/@tootallnate/once/dist/types.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@tootallnate/once/package.json b/node_modules/@tootallnate/once/package.json deleted file mode 100644 index 69ce947d9c310..0000000000000 --- a/node_modules/@tootallnate/once/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@tootallnate/once", - "version": "2.0.0", - "description": "Creates a Promise that waits for a single event", - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "prebuild": "rimraf dist", - "build": "tsc", - "test": "jest", - "prepublishOnly": "npm run build" - }, - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/once.git" - }, - "keywords": [], - "author": "Nathan Rajlich (http://n8.io/)", - "license": "MIT", - "bugs": { - "url": "https://github.com/TooTallNate/once/issues" - }, - "devDependencies": { - "@types/jest": "^27.0.2", - "@types/node": "^12.12.11", - "abort-controller": "^3.0.0", - "jest": "^27.2.1", - "rimraf": "^3.0.0", - "ts-jest": "^27.0.5", - "typescript": "^4.4.3" - }, - "engines": { - "node": ">= 10" - }, - "jest": { - "preset": "ts-jest", - "globals": { - "ts-jest": { - "diagnostics": false, - "isolatedModules": true - } - }, - "verbose": false, - "testEnvironment": "node", - "testMatch": [ - "/test/**/*.test.ts" - ] - } -} diff --git a/node_modules/agent-base/dist/src/index.js b/node_modules/agent-base/dist/src/index.js deleted file mode 100644 index bfd9e22071e7e..0000000000000 --- a/node_modules/agent-base/dist/src/index.js +++ /dev/null @@ -1,203 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const events_1 = require("events"); -const debug_1 = __importDefault(require("debug")); -const promisify_1 = __importDefault(require("./promisify")); -const debug = debug_1.default('agent-base'); -function isAgent(v) { - return Boolean(v) && typeof v.addRequest === 'function'; -} -function isSecureEndpoint() { - const { stack } = new Error(); - if (typeof stack !== 'string') - return false; - return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1); -} -function createAgent(callback, opts) { - return new createAgent.Agent(callback, opts); -} -(function (createAgent) { - /** - * Base `http.Agent` implementation. - * No pooling/keep-alive is implemented by default. - * - * @param {Function} callback - * @api public - */ - class Agent extends events_1.EventEmitter { - constructor(callback, _opts) { - super(); - let opts = _opts; - if (typeof callback === 'function') { - this.callback = callback; - } - else if (callback) { - opts = callback; - } - // Timeout for the socket to be returned from the callback - this.timeout = null; - if (opts && typeof opts.timeout === 'number') { - this.timeout = opts.timeout; - } - // These aren't actually used by `agent-base`, but are required - // for the TypeScript definition files in `@types/node` :/ - this.maxFreeSockets = 1; - this.maxSockets = 1; - this.maxTotalSockets = Infinity; - this.sockets = {}; - this.freeSockets = {}; - this.requests = {}; - this.options = {}; - } - get defaultPort() { - if (typeof this.explicitDefaultPort === 'number') { - return this.explicitDefaultPort; - } - return isSecureEndpoint() ? 443 : 80; - } - set defaultPort(v) { - this.explicitDefaultPort = v; - } - get protocol() { - if (typeof this.explicitProtocol === 'string') { - return this.explicitProtocol; - } - return isSecureEndpoint() ? 'https:' : 'http:'; - } - set protocol(v) { - this.explicitProtocol = v; - } - callback(req, opts, fn) { - throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`'); - } - /** - * Called by node-core's "_http_client.js" module when creating - * a new HTTP request with this Agent instance. - * - * @api public - */ - addRequest(req, _opts) { - const opts = Object.assign({}, _opts); - if (typeof opts.secureEndpoint !== 'boolean') { - opts.secureEndpoint = isSecureEndpoint(); - } - if (opts.host == null) { - opts.host = 'localhost'; - } - if (opts.port == null) { - opts.port = opts.secureEndpoint ? 443 : 80; - } - if (opts.protocol == null) { - opts.protocol = opts.secureEndpoint ? 'https:' : 'http:'; - } - if (opts.host && opts.path) { - // If both a `host` and `path` are specified then it's most - // likely the result of a `url.parse()` call... we need to - // remove the `path` portion so that `net.connect()` doesn't - // attempt to open that as a unix socket file. - delete opts.path; - } - delete opts.agent; - delete opts.hostname; - delete opts._defaultAgent; - delete opts.defaultPort; - delete opts.createConnection; - // Hint to use "Connection: close" - // XXX: non-documented `http` module API :( - req._last = true; - req.shouldKeepAlive = false; - let timedOut = false; - let timeoutId = null; - const timeoutMs = opts.timeout || this.timeout; - const onerror = (err) => { - if (req._hadError) - return; - req.emit('error', err); - // For Safety. Some additional errors might fire later on - // and we need to make sure we don't double-fire the error event. - req._hadError = true; - }; - const ontimeout = () => { - timeoutId = null; - timedOut = true; - const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`); - err.code = 'ETIMEOUT'; - onerror(err); - }; - const callbackError = (err) => { - if (timedOut) - return; - if (timeoutId !== null) { - clearTimeout(timeoutId); - timeoutId = null; - } - onerror(err); - }; - const onsocket = (socket) => { - if (timedOut) - return; - if (timeoutId != null) { - clearTimeout(timeoutId); - timeoutId = null; - } - if (isAgent(socket)) { - // `socket` is actually an `http.Agent` instance, so - // relinquish responsibility for this `req` to the Agent - // from here on - debug('Callback returned another Agent instance %o', socket.constructor.name); - socket.addRequest(req, opts); - return; - } - if (socket) { - socket.once('free', () => { - this.freeSocket(socket, opts); - }); - req.onSocket(socket); - return; - } - const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``); - onerror(err); - }; - if (typeof this.callback !== 'function') { - onerror(new Error('`callback` is not defined')); - return; - } - if (!this.promisifiedCallback) { - if (this.callback.length >= 3) { - debug('Converting legacy callback function to promise'); - this.promisifiedCallback = promisify_1.default(this.callback); - } - else { - this.promisifiedCallback = this.callback; - } - } - if (typeof timeoutMs === 'number' && timeoutMs > 0) { - timeoutId = setTimeout(ontimeout, timeoutMs); - } - if ('port' in opts && typeof opts.port !== 'number') { - opts.port = Number(opts.port); - } - try { - debug('Resolving socket for %o request: %o', opts.protocol, `${req.method} ${req.path}`); - Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError); - } - catch (err) { - Promise.reject(err).catch(callbackError); - } - } - freeSocket(socket, opts) { - debug('Freeing socket %o %o', socket.constructor.name, opts); - socket.destroy(); - } - destroy() { - debug('Destroying agent %o', this.constructor.name); - } - } - createAgent.Agent = Agent; - // So that `instanceof` works correctly - createAgent.prototype = createAgent.Agent.prototype; -})(createAgent || (createAgent = {})); -module.exports = createAgent; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/agent-base/dist/src/promisify.js b/node_modules/agent-base/dist/src/promisify.js deleted file mode 100644 index b2f6132a7beaa..0000000000000 --- a/node_modules/agent-base/dist/src/promisify.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function promisify(fn) { - return function (req, opts) { - return new Promise((resolve, reject) => { - fn.call(this, req, opts, (err, rtn) => { - if (err) { - reject(err); - } - else { - resolve(rtn); - } - }); - }); - }; -} -exports.default = promisify; -//# sourceMappingURL=promisify.js.map \ No newline at end of file diff --git a/node_modules/agent-base/package.json b/node_modules/agent-base/package.json deleted file mode 100644 index fadce3ad99f22..0000000000000 --- a/node_modules/agent-base/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "agent-base", - "version": "6.0.2", - "description": "Turn a function into an `http.Agent` instance", - "main": "dist/src/index", - "typings": "dist/src/index", - "files": [ - "dist/src", - "src" - ], - "scripts": { - "prebuild": "rimraf dist", - "build": "tsc", - "postbuild": "cpy --parents src test '!**/*.ts' dist", - "test": "mocha --reporter spec dist/test/*.js", - "test-lint": "eslint src --ext .js,.ts", - "prepublishOnly": "npm run build" - }, - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/node-agent-base.git" - }, - "keywords": [ - "http", - "agent", - "base", - "barebones", - "https" - ], - "author": "Nathan Rajlich (http://n8.io/)", - "license": "MIT", - "bugs": { - "url": "https://github.com/TooTallNate/node-agent-base/issues" - }, - "dependencies": { - "debug": "4" - }, - "devDependencies": { - "@types/debug": "4", - "@types/mocha": "^5.2.7", - "@types/node": "^14.0.20", - "@types/semver": "^7.1.0", - "@types/ws": "^6.0.3", - "@typescript-eslint/eslint-plugin": "1.6.0", - "@typescript-eslint/parser": "1.1.0", - "async-listen": "^1.2.0", - "cpy-cli": "^2.0.0", - "eslint": "5.16.0", - "eslint-config-airbnb": "17.1.0", - "eslint-config-prettier": "4.1.0", - "eslint-import-resolver-typescript": "1.1.1", - "eslint-plugin-import": "2.16.0", - "eslint-plugin-jsx-a11y": "6.2.1", - "eslint-plugin-react": "7.12.4", - "mocha": "^6.2.0", - "rimraf": "^3.0.0", - "semver": "^7.1.2", - "typescript": "^3.5.3", - "ws": "^3.0.0" - }, - "engines": { - "node": ">= 6.0.0" - } -} diff --git a/node_modules/agentkeepalive/History.md b/node_modules/agentkeepalive/History.md deleted file mode 100644 index 6877834dd92a5..0000000000000 --- a/node_modules/agentkeepalive/History.md +++ /dev/null @@ -1,268 +0,0 @@ - -4.5.0 / 2023-08-06 -================== - -**others** - * [[`1e5e312`](http://github.com/node-modules/agentkeepalive/commit/1e5e312f36491243372dbfee0dd47607e7b3d94a)] - deps: remove debug and depd (#114) (fengmk2 <>) - -4.4.0 / 2023-08-05 -================== - -**features** - * [[`c7c1e93`](http://github.com/node-modules/agentkeepalive/commit/c7c1e93beba7310d7c2cc9647dd211a686d21cac)] - feat: return socket from createConnection (#113) (Nabeel Bukhari <>) - -4.3.0 / 2023-03-06 -================== - -**others** - * [[`6f9852b`](http://github.com/node-modules/agentkeepalive/commit/6f9852bf6f674846103e403fd9c84e92fc24f820)] - deps: depd@2.0.0 (#109) (Brian DeHamer <>) - * [[`fd4bd9b`](http://github.com/node-modules/agentkeepalive/commit/fd4bd9b0e0f051de3cb49559d1b0d534a0ded18c)] - test: use npm install (#110) (fengmk2 <>) - * [[`d52822c`](http://github.com/node-modules/agentkeepalive/commit/d52822c1243c689df1c8232a3bb14139cf87fae5)] - chore: update contributors (fengmk2 <>) - -4.2.1 / 2022-02-21 -================== - -**fixes** - * [[`8b13b5c`](http://github.com/node-modules/agentkeepalive/commit/8b13b5ca797f4779a0a8d393ad8ecb622cd27987)] - fix: explicitly set `| undefined` in type definitions (#99) (Benoit Lemoine <>) - -4.2.0 / 2021-12-31 -================== - -**fixes** - * [[`f418c67`](http://github.com/node-modules/agentkeepalive/commit/f418c67a63c061c7261592d4553bc455e0b0d306)] - fix: change `freeSocketTimeout` default value to 4000 (#102) (fengmk2 <>) - -**others** - * [[`bc2a1ce`](http://github.com/node-modules/agentkeepalive/commit/bc2a1cea0884b4d18b0d244bf00006d9107963df)] - doc(readme): making `timeout`'s default clear (#100) (Aaron <>) - -4.1.4 / 2021-02-05 -================== - -**fixes** - * [[`4d04794`](http://github.com/node-modules/agentkeepalive/commit/4d047946b1547b4edff92ea40205aee4f0c8aa46)] - fix(types): correct `Https` constructor argument (#89) (Simen Bekkhus <>) - -4.1.3 / 2020-06-15 -================== - -**fixes** - * [[`4ba9f9c`](http://github.com/node-modules/agentkeepalive/commit/4ba9f9c844f2a6b8037ce56599d25c69ef054d91)] - fix: compatible with node v12.16.3 (#91) (killa <>) - -4.1.2 / 2020-04-25 -================== - -**fixes** - * [[`de66b02`](http://github.com/node-modules/agentkeepalive/commit/de66b0206d064a97129c2c31bcdabd4d64557b91)] - fix: detect http request timeout handler (#88) (fengmk2 <>) - -4.1.1 / 2020-04-25 -================== - -**fixes** - * [[`bbd20c0`](http://github.com/node-modules/agentkeepalive/commit/bbd20c03b8cf7dfb00b3aad1ada26d4ab90d2d6e)] - fix: definition error (#87) (吖猩 <>) - -**others** - * [[`3b01699`](http://github.com/node-modules/agentkeepalive/commit/3b01699b8e90022d5f56898dd709e4fe7ee7cdaa)] - test: run test on node 12 (#84) (Igor Savin <>) - -4.1.0 / 2019-10-12 -================== - -**features** - * [[`fe33b80`](http://github.com/node-modules/agentkeepalive/commit/fe33b800acc09109388bfe65107550952b6fc7b0)] - feat: Add `reusedSocket` property on client request (#82) (Weijia Wang <>) - -**others** - * [[`77ba744`](http://github.com/node-modules/agentkeepalive/commit/77ba744667bb6b9e5986a53e5222f62094db12b9)] - docs: fix grammar in readme (#81) (Herrington Darkholme <<2883231+HerringtonDarkholme@users.noreply.github.com>>) - -4.0.2 / 2019-02-19 -================== - -**fixes** - * [[`56d4a9b`](http://github.com/node-modules/agentkeepalive/commit/56d4a9b2a4499ea28943ddb590358d7831a02cb1)] - fix: HttpAgent export = internal (#74) (Andrew Leedham <>) - -4.0.1 / 2019-02-19 -================== - -**fixes** - * [[`bad1ac0`](http://github.com/node-modules/agentkeepalive/commit/bad1ac0e710fbc486717e14e68c59266d35df6a8)] - fix: HttpsAgent Type Definition (#71) (#72) (Andrew Leedham <>) - * [[`f48a4a7`](http://github.com/node-modules/agentkeepalive/commit/f48a4a701ea6fbe43781c91e1c0aaad6e328ac7f)] - fix: export interface (#70) (Vinay <>) - -**others** - * [[`9124343`](http://github.com/node-modules/agentkeepalive/commit/91243437cfdd324cb97f39dee76746d5e5f4cd72)] - chore: add agent.options.keepAlive instead agent.keepAlive (fengmk2 <>) - * [[`d177d40`](http://github.com/node-modules/agentkeepalive/commit/d177d40422fe7296990b4e270cf498e3f33c18fa)] - test: add request timeout bigger than agent timeout cases (fengmk2 <>) - -4.0.0 / 2018-10-23 -================== - -**features** - * [[`5c9f3bb`](http://github.com/node-modules/agentkeepalive/commit/5c9f3bbd60555744edcf777105b148982a1a42b6)] - feat: impl the new Agent extend http.Agent (fengmk2 <>) - -**others** - * [[`498c8f1`](http://github.com/node-modules/agentkeepalive/commit/498c8f13cf76600d3dd6e1c91cdf2d8292355dff)] - chore: move LICENSE from readme to file (fengmk2 <>) - * [[`4f39894`](http://github.com/node-modules/agentkeepalive/commit/4f398942ba2f90cf4501239e56ac4e6344931a01)] - bugfix: support agent.options.timeout on https agent (fengmk2 <>) - -3.5.2 / 2018-10-19 -================== - -**fixes** - * [[`5751fc1`](http://github.com/node-modules/agentkeepalive/commit/5751fc1180ed6544602c681ffbd08ca66a0cb12c)] - fix: sockLen being miscalculated when removing sockets (#60) (Ehden Sinai <>) - -3.5.1 / 2018-07-31 -================== - -**fixes** - * [[`495f1ab`](http://github.com/node-modules/agentkeepalive/commit/495f1ab625d43945d72f68096b97db723d4f0657)] - fix: add the lost npm files (#66) (Henry Zhuang <>) - -3.5.0 / 2018-07-31 -================== - -**features** - * [[`16f5aea`](http://github.com/node-modules/agentkeepalive/commit/16f5aeadfda57f1c602652f1472a63cc83cd05bf)] - feat: add typing define. (#65) (Henry Zhuang <>) - -**others** - * [[`28fa062`](http://github.com/node-modules/agentkeepalive/commit/28fa06246fb5103f88ebeeb8563757a9078b8157)] - docs: add "per host" to description of maxFreeSockets (tony-gutierrez <>) - * [[`7df2577`](http://github.com/node-modules/agentkeepalive/commit/7df25774f00a1031ca4daad2878a17e0539072a2)] - test: run test on node 10 (#63) (fengmk2 <>) - -3.4.1 / 2018-03-08 -================== - -**fixes** - * [[`4d3a3b1`](http://github.com/node-modules/agentkeepalive/commit/4d3a3b1f7b16595febbbd39eeed72b2663549014)] - fix: Handle ipv6 addresses in host-header correctly with TLS (#53) (Mattias Holmlund <>) - -**others** - * [[`55a7a5c`](http://github.com/node-modules/agentkeepalive/commit/55a7a5cd33e97f9a8370083dcb041c5552f10ac9)] - test: stop timer after test end (fengmk2 <>) - -3.4.0 / 2018-02-27 -================== - -**features** - * [[`bc7cadb`](http://github.com/node-modules/agentkeepalive/commit/bc7cadb30ecd2071e2b341ac53ae1a2b8155c43d)] - feat: use socket custom freeSocketKeepAliveTimeout first (#59) (fengmk2 <>) - -**others** - * [[`138eda8`](http://github.com/node-modules/agentkeepalive/commit/138eda81e10b632aaa87bea0cb66d8667124c4e8)] - doc: fix `keepAliveMsecs` params description (#55) (Hongcai Deng <>) - -3.3.0 / 2017-06-20 -================== - - * feat: add statusChanged getter (#51) - * chore: format License - -3.2.0 / 2017-06-10 -================== - - * feat: add expiring active sockets - * test: add node 8 (#49) - -3.1.0 / 2017-02-20 -================== - - * feat: timeout support humanize ms (#48) - -3.0.0 / 2016-12-20 -================== - - * fix: emit agent socket close event - * test: add remove excess calls to removeSocket - * test: use egg-ci - * test: refactor test with eslint rules - * feat: merge _http_agent.js from 7.2.1 - -2.2.0 / 2016-06-26 -================== - - * feat: Add browser shim (noop) for isomorphic use. (#39) - * chore: add security check badge - -2.1.1 / 2016-04-06 -================== - - * https: fix ssl socket leak when keepalive is used - * chore: remove circle ci image - -2.1.0 / 2016-04-02 -================== - - * fix: opened sockets number overflow maxSockets - -2.0.5 / 2016-03-16 -================== - - * fix: pick _evictSession to httpsAgent - -2.0.4 / 2016-03-13 -================== - - * test: add Circle ci - * test: add appveyor ci build - * refactor: make sure only one error listener - * chore: use codecov - * fix: handle idle socket error - * test: run on more node versions - -2.0.3 / 2015-08-03 -================== - - * fix: add default error handler to avoid Unhandled error event throw - -2.0.2 / 2015-04-25 -================== - - * fix: remove socket from freeSockets on 'timeout' (@pmalouin) - -2.0.1 / 2015-04-19 -================== - - * fix: add timeoutSocketCount to getCurrentStatus() - * feat(getCurrentStatus): add getCurrentStatus - -2.0.0 / 2015-04-01 -================== - - * fix: socket.destroyed always be undefined on 0.10.x - * Make it compatible with node v0.10.x (@lattmann) - -1.2.1 / 2015-03-23 -================== - - * patch from iojs: don't overwrite servername option - * patch commits from joyent/node - * add max sockets test case - * add nagle algorithm delayed link - -1.2.0 / 2014-09-02 -================== - - * allow set keepAliveTimeout = 0 - * support timeout on working socket. fixed #6 - -1.1.0 / 2014-08-28 -================== - - * add some socket counter for deep monitor - -1.0.0 / 2014-08-13 -================== - - * update _http_agent, only support 0.11+, only support node 0.11.0+ - -0.2.2 / 2013-11-19 -================== - - * support node 0.8 and node 0.10 - -0.2.1 / 2013-11-08 -================== - - * fix socket does not timeout bug, it will hang on life, must use 0.2.x on node 0.11 - -0.2.0 / 2013-11-06 -================== - - * use keepalive agent on node 0.11+ impl - -0.1.5 / 2013-06-24 -================== - - * support coveralls - * add node 0.10 test - * add 0.8.22 original https.js - * add original http.js module to diff - * update jscover - * mv pem to fixtures - * add https agent usage diff --git a/node_modules/agentkeepalive/LICENSE b/node_modules/agentkeepalive/LICENSE deleted file mode 100644 index 941258ca703b3..0000000000000 --- a/node_modules/agentkeepalive/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License - -Copyright(c) node-modules and other contributors. -Copyright(c) 2012 - 2015 fengmk2 - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/agentkeepalive/browser.js b/node_modules/agentkeepalive/browser.js deleted file mode 100644 index 29c9398aa567f..0000000000000 --- a/node_modules/agentkeepalive/browser.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = noop; -module.exports.HttpsAgent = noop; - -// Noop function for browser since native api's don't use agents. -function noop () {} diff --git a/node_modules/agentkeepalive/index.js b/node_modules/agentkeepalive/index.js deleted file mode 100644 index 6ca1513463724..0000000000000 --- a/node_modules/agentkeepalive/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -module.exports = require('./lib/agent'); -module.exports.HttpsAgent = require('./lib/https_agent'); -module.exports.constants = require('./lib/constants'); diff --git a/node_modules/agentkeepalive/lib/agent.js b/node_modules/agentkeepalive/lib/agent.js deleted file mode 100644 index 8bd354effa05e..0000000000000 --- a/node_modules/agentkeepalive/lib/agent.js +++ /dev/null @@ -1,402 +0,0 @@ -'use strict'; - -const OriginalAgent = require('http').Agent; -const ms = require('humanize-ms'); -const debug = require('util').debuglog('agentkeepalive'); -const { - INIT_SOCKET, - CURRENT_ID, - CREATE_ID, - SOCKET_CREATED_TIME, - SOCKET_NAME, - SOCKET_REQUEST_COUNT, - SOCKET_REQUEST_FINISHED_COUNT, -} = require('./constants'); - -// OriginalAgent come from -// - https://github.com/nodejs/node/blob/v8.12.0/lib/_http_agent.js -// - https://github.com/nodejs/node/blob/v10.12.0/lib/_http_agent.js - -// node <= 10 -let defaultTimeoutListenerCount = 1; -const majorVersion = parseInt(process.version.split('.', 1)[0].substring(1)); -if (majorVersion >= 11 && majorVersion <= 12) { - defaultTimeoutListenerCount = 2; -} else if (majorVersion >= 13) { - defaultTimeoutListenerCount = 3; -} - -function deprecate(message) { - console.log('[agentkeepalive:deprecated] %s', message); -} - -class Agent extends OriginalAgent { - constructor(options) { - options = options || {}; - options.keepAlive = options.keepAlive !== false; - // default is keep-alive and 4s free socket timeout - // see https://medium.com/ssense-tech/reduce-networking-errors-in-nodejs-23b4eb9f2d83 - if (options.freeSocketTimeout === undefined) { - options.freeSocketTimeout = 4000; - } - // Legacy API: keepAliveTimeout should be rename to `freeSocketTimeout` - if (options.keepAliveTimeout) { - deprecate('options.keepAliveTimeout is deprecated, please use options.freeSocketTimeout instead'); - options.freeSocketTimeout = options.keepAliveTimeout; - delete options.keepAliveTimeout; - } - // Legacy API: freeSocketKeepAliveTimeout should be rename to `freeSocketTimeout` - if (options.freeSocketKeepAliveTimeout) { - deprecate('options.freeSocketKeepAliveTimeout is deprecated, please use options.freeSocketTimeout instead'); - options.freeSocketTimeout = options.freeSocketKeepAliveTimeout; - delete options.freeSocketKeepAliveTimeout; - } - - // Sets the socket to timeout after timeout milliseconds of inactivity on the socket. - // By default is double free socket timeout. - if (options.timeout === undefined) { - // make sure socket default inactivity timeout >= 8s - options.timeout = Math.max(options.freeSocketTimeout * 2, 8000); - } - - // support humanize format - options.timeout = ms(options.timeout); - options.freeSocketTimeout = ms(options.freeSocketTimeout); - options.socketActiveTTL = options.socketActiveTTL ? ms(options.socketActiveTTL) : 0; - - super(options); - - this[CURRENT_ID] = 0; - - // create socket success counter - this.createSocketCount = 0; - this.createSocketCountLastCheck = 0; - - this.createSocketErrorCount = 0; - this.createSocketErrorCountLastCheck = 0; - - this.closeSocketCount = 0; - this.closeSocketCountLastCheck = 0; - - // socket error event count - this.errorSocketCount = 0; - this.errorSocketCountLastCheck = 0; - - // request finished counter - this.requestCount = 0; - this.requestCountLastCheck = 0; - - // including free socket timeout counter - this.timeoutSocketCount = 0; - this.timeoutSocketCountLastCheck = 0; - - this.on('free', socket => { - // https://github.com/nodejs/node/pull/32000 - // Node.js native agent will check socket timeout eqs agent.options.timeout. - // Use the ttl or freeSocketTimeout to overwrite. - const timeout = this.calcSocketTimeout(socket); - if (timeout > 0 && socket.timeout !== timeout) { - socket.setTimeout(timeout); - } - }); - } - - get freeSocketKeepAliveTimeout() { - deprecate('agent.freeSocketKeepAliveTimeout is deprecated, please use agent.options.freeSocketTimeout instead'); - return this.options.freeSocketTimeout; - } - - get timeout() { - deprecate('agent.timeout is deprecated, please use agent.options.timeout instead'); - return this.options.timeout; - } - - get socketActiveTTL() { - deprecate('agent.socketActiveTTL is deprecated, please use agent.options.socketActiveTTL instead'); - return this.options.socketActiveTTL; - } - - calcSocketTimeout(socket) { - /** - * return <= 0: should free socket - * return > 0: should update socket timeout - * return undefined: not find custom timeout - */ - let freeSocketTimeout = this.options.freeSocketTimeout; - const socketActiveTTL = this.options.socketActiveTTL; - if (socketActiveTTL) { - // check socketActiveTTL - const aliveTime = Date.now() - socket[SOCKET_CREATED_TIME]; - const diff = socketActiveTTL - aliveTime; - if (diff <= 0) { - return diff; - } - if (freeSocketTimeout && diff < freeSocketTimeout) { - freeSocketTimeout = diff; - } - } - // set freeSocketTimeout - if (freeSocketTimeout) { - // set free keepalive timer - // try to use socket custom freeSocketTimeout first, support headers['keep-alive'] - // https://github.com/node-modules/urllib/blob/b76053020923f4d99a1c93cf2e16e0c5ba10bacf/lib/urllib.js#L498 - const customFreeSocketTimeout = socket.freeSocketTimeout || socket.freeSocketKeepAliveTimeout; - return customFreeSocketTimeout || freeSocketTimeout; - } - } - - keepSocketAlive(socket) { - const result = super.keepSocketAlive(socket); - // should not keepAlive, do nothing - if (!result) return result; - - const customTimeout = this.calcSocketTimeout(socket); - if (typeof customTimeout === 'undefined') { - return true; - } - if (customTimeout <= 0) { - debug('%s(requests: %s, finished: %s) free but need to destroy by TTL, request count %s, diff is %s', - socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT], customTimeout); - return false; - } - if (socket.timeout !== customTimeout) { - socket.setTimeout(customTimeout); - } - return true; - } - - // only call on addRequest - reuseSocket(...args) { - // reuseSocket(socket, req) - super.reuseSocket(...args); - const socket = args[0]; - const req = args[1]; - req.reusedSocket = true; - const agentTimeout = this.options.timeout; - if (getSocketTimeout(socket) !== agentTimeout) { - // reset timeout before use - socket.setTimeout(agentTimeout); - debug('%s reset timeout to %sms', socket[SOCKET_NAME], agentTimeout); - } - socket[SOCKET_REQUEST_COUNT]++; - debug('%s(requests: %s, finished: %s) reuse on addRequest, timeout %sms', - socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT], - getSocketTimeout(socket)); - } - - [CREATE_ID]() { - const id = this[CURRENT_ID]++; - if (this[CURRENT_ID] === Number.MAX_SAFE_INTEGER) this[CURRENT_ID] = 0; - return id; - } - - [INIT_SOCKET](socket, options) { - // bugfix here. - // https on node 8, 10 won't set agent.options.timeout by default - // TODO: need to fix on node itself - if (options.timeout) { - const timeout = getSocketTimeout(socket); - if (!timeout) { - socket.setTimeout(options.timeout); - } - } - - if (this.options.keepAlive) { - // Disable Nagle's algorithm: http://blog.caustik.com/2012/04/08/scaling-node-js-to-100k-concurrent-connections/ - // https://fengmk2.com/benchmark/nagle-algorithm-delayed-ack-mock.html - socket.setNoDelay(true); - } - this.createSocketCount++; - if (this.options.socketActiveTTL) { - socket[SOCKET_CREATED_TIME] = Date.now(); - } - // don't show the hole '-----BEGIN CERTIFICATE----' key string - socket[SOCKET_NAME] = `sock[${this[CREATE_ID]()}#${options._agentKey}]`.split('-----BEGIN', 1)[0]; - socket[SOCKET_REQUEST_COUNT] = 1; - socket[SOCKET_REQUEST_FINISHED_COUNT] = 0; - installListeners(this, socket, options); - } - - createConnection(options, oncreate) { - let called = false; - const onNewCreate = (err, socket) => { - if (called) return; - called = true; - - if (err) { - this.createSocketErrorCount++; - return oncreate(err); - } - this[INIT_SOCKET](socket, options); - oncreate(err, socket); - }; - - const newSocket = super.createConnection(options, onNewCreate); - if (newSocket) onNewCreate(null, newSocket); - return newSocket; - } - - get statusChanged() { - const changed = this.createSocketCount !== this.createSocketCountLastCheck || - this.createSocketErrorCount !== this.createSocketErrorCountLastCheck || - this.closeSocketCount !== this.closeSocketCountLastCheck || - this.errorSocketCount !== this.errorSocketCountLastCheck || - this.timeoutSocketCount !== this.timeoutSocketCountLastCheck || - this.requestCount !== this.requestCountLastCheck; - if (changed) { - this.createSocketCountLastCheck = this.createSocketCount; - this.createSocketErrorCountLastCheck = this.createSocketErrorCount; - this.closeSocketCountLastCheck = this.closeSocketCount; - this.errorSocketCountLastCheck = this.errorSocketCount; - this.timeoutSocketCountLastCheck = this.timeoutSocketCount; - this.requestCountLastCheck = this.requestCount; - } - return changed; - } - - getCurrentStatus() { - return { - createSocketCount: this.createSocketCount, - createSocketErrorCount: this.createSocketErrorCount, - closeSocketCount: this.closeSocketCount, - errorSocketCount: this.errorSocketCount, - timeoutSocketCount: this.timeoutSocketCount, - requestCount: this.requestCount, - freeSockets: inspect(this.freeSockets), - sockets: inspect(this.sockets), - requests: inspect(this.requests), - }; - } -} - -// node 8 don't has timeout attribute on socket -// https://github.com/nodejs/node/pull/21204/files#diff-e6ef024c3775d787c38487a6309e491dR408 -function getSocketTimeout(socket) { - return socket.timeout || socket._idleTimeout; -} - -function installListeners(agent, socket, options) { - debug('%s create, timeout %sms', socket[SOCKET_NAME], getSocketTimeout(socket)); - - // listener socket events: close, timeout, error, free - function onFree() { - // create and socket.emit('free') logic - // https://github.com/nodejs/node/blob/master/lib/_http_agent.js#L311 - // no req on the socket, it should be the new socket - if (!socket._httpMessage && socket[SOCKET_REQUEST_COUNT] === 1) return; - - socket[SOCKET_REQUEST_FINISHED_COUNT]++; - agent.requestCount++; - debug('%s(requests: %s, finished: %s) free', - socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT]); - - // should reuse on pedding requests? - const name = agent.getName(options); - if (socket.writable && agent.requests[name] && agent.requests[name].length) { - // will be reuse on agent free listener - socket[SOCKET_REQUEST_COUNT]++; - debug('%s(requests: %s, finished: %s) will be reuse on agent free event', - socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT]); - } - } - socket.on('free', onFree); - - function onClose(isError) { - debug('%s(requests: %s, finished: %s) close, isError: %s', - socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT], isError); - agent.closeSocketCount++; - } - socket.on('close', onClose); - - // start socket timeout handler - function onTimeout() { - // onTimeout and emitRequestTimeout(_http_client.js) - // https://github.com/nodejs/node/blob/v12.x/lib/_http_client.js#L711 - const listenerCount = socket.listeners('timeout').length; - // node <= 10, default listenerCount is 1, onTimeout - // 11 < node <= 12, default listenerCount is 2, onTimeout and emitRequestTimeout - // node >= 13, default listenerCount is 3, onTimeout, - // onTimeout(https://github.com/nodejs/node/pull/32000/files#diff-5f7fb0850412c6be189faeddea6c5359R333) - // and emitRequestTimeout - const timeout = getSocketTimeout(socket); - const req = socket._httpMessage; - const reqTimeoutListenerCount = req && req.listeners('timeout').length || 0; - debug('%s(requests: %s, finished: %s) timeout after %sms, listeners %s, defaultTimeoutListenerCount %s, hasHttpRequest %s, HttpRequest timeoutListenerCount %s', - socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT], - timeout, listenerCount, defaultTimeoutListenerCount, !!req, reqTimeoutListenerCount); - if (debug.enabled) { - debug('timeout listeners: %s', socket.listeners('timeout').map(f => f.name).join(', ')); - } - agent.timeoutSocketCount++; - const name = agent.getName(options); - if (agent.freeSockets[name] && agent.freeSockets[name].indexOf(socket) !== -1) { - // free socket timeout, destroy quietly - socket.destroy(); - // Remove it from freeSockets list immediately to prevent new requests - // from being sent through this socket. - agent.removeSocket(socket, options); - debug('%s is free, destroy quietly', socket[SOCKET_NAME]); - } else { - // if there is no any request socket timeout handler, - // agent need to handle socket timeout itself. - // - // custom request socket timeout handle logic must follow these rules: - // 1. Destroy socket first - // 2. Must emit socket 'agentRemove' event tell agent remove socket - // from freeSockets list immediately. - // Otherise you may be get 'socket hang up' error when reuse - // free socket and timeout happen in the same time. - if (reqTimeoutListenerCount === 0) { - const error = new Error('Socket timeout'); - error.code = 'ERR_SOCKET_TIMEOUT'; - error.timeout = timeout; - // must manually call socket.end() or socket.destroy() to end the connection. - // https://nodejs.org/dist/latest-v10.x/docs/api/net.html#net_socket_settimeout_timeout_callback - socket.destroy(error); - agent.removeSocket(socket, options); - debug('%s destroy with timeout error', socket[SOCKET_NAME]); - } - } - } - socket.on('timeout', onTimeout); - - function onError(err) { - const listenerCount = socket.listeners('error').length; - debug('%s(requests: %s, finished: %s) error: %s, listenerCount: %s', - socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT], - err, listenerCount); - agent.errorSocketCount++; - if (listenerCount === 1) { - // if socket don't contain error event handler, don't catch it, emit it again - debug('%s emit uncaught error event', socket[SOCKET_NAME]); - socket.removeListener('error', onError); - socket.emit('error', err); - } - } - socket.on('error', onError); - - function onRemove() { - debug('%s(requests: %s, finished: %s) agentRemove', - socket[SOCKET_NAME], - socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT]); - // We need this function for cases like HTTP 'upgrade' - // (defined by WebSockets) where we need to remove a socket from the - // pool because it'll be locked up indefinitely - socket.removeListener('close', onClose); - socket.removeListener('error', onError); - socket.removeListener('free', onFree); - socket.removeListener('timeout', onTimeout); - socket.removeListener('agentRemove', onRemove); - } - socket.on('agentRemove', onRemove); -} - -module.exports = Agent; - -function inspect(obj) { - const res = {}; - for (const key in obj) { - res[key] = obj[key].length; - } - return res; -} diff --git a/node_modules/agentkeepalive/lib/constants.js b/node_modules/agentkeepalive/lib/constants.js deleted file mode 100644 index ca7ab97eacd9c..0000000000000 --- a/node_modules/agentkeepalive/lib/constants.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -module.exports = { - // agent - CURRENT_ID: Symbol('agentkeepalive#currentId'), - CREATE_ID: Symbol('agentkeepalive#createId'), - INIT_SOCKET: Symbol('agentkeepalive#initSocket'), - CREATE_HTTPS_CONNECTION: Symbol('agentkeepalive#createHttpsConnection'), - // socket - SOCKET_CREATED_TIME: Symbol('agentkeepalive#socketCreatedTime'), - SOCKET_NAME: Symbol('agentkeepalive#socketName'), - SOCKET_REQUEST_COUNT: Symbol('agentkeepalive#socketRequestCount'), - SOCKET_REQUEST_FINISHED_COUNT: Symbol('agentkeepalive#socketRequestFinishedCount'), -}; diff --git a/node_modules/agentkeepalive/lib/https_agent.js b/node_modules/agentkeepalive/lib/https_agent.js deleted file mode 100644 index 344fb32cadd86..0000000000000 --- a/node_modules/agentkeepalive/lib/https_agent.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; - -const OriginalHttpsAgent = require('https').Agent; -const HttpAgent = require('./agent'); -const { - INIT_SOCKET, - CREATE_HTTPS_CONNECTION, -} = require('./constants'); - -class HttpsAgent extends HttpAgent { - constructor(options) { - super(options); - - this.defaultPort = 443; - this.protocol = 'https:'; - this.maxCachedSessions = this.options.maxCachedSessions; - /* istanbul ignore next */ - if (this.maxCachedSessions === undefined) { - this.maxCachedSessions = 100; - } - - this._sessionCache = { - map: {}, - list: [], - }; - } - - createConnection(options, oncreate) { - const socket = this[CREATE_HTTPS_CONNECTION](options, oncreate); - this[INIT_SOCKET](socket, options); - return socket; - } -} - -// https://github.com/nodejs/node/blob/master/lib/https.js#L89 -HttpsAgent.prototype[CREATE_HTTPS_CONNECTION] = OriginalHttpsAgent.prototype.createConnection; - -[ - 'getName', - '_getSession', - '_cacheSession', - // https://github.com/nodejs/node/pull/4982 - '_evictSession', -].forEach(function(method) { - /* istanbul ignore next */ - if (typeof OriginalHttpsAgent.prototype[method] === 'function') { - HttpsAgent.prototype[method] = OriginalHttpsAgent.prototype[method]; - } -}); - -module.exports = HttpsAgent; diff --git a/node_modules/agentkeepalive/package.json b/node_modules/agentkeepalive/package.json deleted file mode 100644 index d8e9aa7160d0b..0000000000000 --- a/node_modules/agentkeepalive/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "agentkeepalive", - "version": "4.5.0", - "description": "Missing keepalive http.Agent", - "main": "index.js", - "browser": "browser.js", - "files": [ - "index.js", - "index.d.ts", - "browser.js", - "lib" - ], - "scripts": { - "contributor": "git-contributor", - "test": "npm run lint && egg-bin test --full-trace", - "test-local": "egg-bin test --full-trace", - "cov": "cross-env NODE_DEBUG=agentkeepalive egg-bin cov --full-trace", - "ci": "npm run lint && npm run cov", - "lint": "eslint lib test index.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/node-modules/agentkeepalive.git" - }, - "bugs": { - "url": "https://github.com/node-modules/agentkeepalive/issues" - }, - "keywords": [ - "http", - "https", - "agent", - "keepalive", - "agentkeepalive", - "HttpAgent", - "HttpsAgent" - ], - "dependencies": { - "humanize-ms": "^1.2.1" - }, - "devDependencies": { - "coffee": "^5.3.0", - "cross-env": "^6.0.3", - "egg-bin": "^4.9.0", - "eslint": "^5.7.0", - "eslint-config-egg": "^7.1.0", - "git-contributor": "^2.0.0", - "mm": "^2.4.1", - "pedding": "^1.1.0", - "typescript": "^3.8.3" - }, - "engines": { - "node": ">= 8.0.0" - }, - "author": "fengmk2 (https://github.com/fengmk2)", - "license": "MIT" -} diff --git a/node_modules/concat-map/LICENSE b/node_modules/concat-map/LICENSE deleted file mode 100644 index ee27ba4b4412b..0000000000000 --- a/node_modules/concat-map/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/concat-map/example/map.js b/node_modules/concat-map/example/map.js deleted file mode 100644 index 33656217b61d8..0000000000000 --- a/node_modules/concat-map/example/map.js +++ /dev/null @@ -1,6 +0,0 @@ -var concatMap = require('../'); -var xs = [ 1, 2, 3, 4, 5, 6 ]; -var ys = concatMap(xs, function (x) { - return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; -}); -console.dir(ys); diff --git a/node_modules/concat-map/index.js b/node_modules/concat-map/index.js deleted file mode 100644 index b29a7812e5055..0000000000000 --- a/node_modules/concat-map/index.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function (xs, fn) { - var res = []; - for (var i = 0; i < xs.length; i++) { - var x = fn(xs[i], i); - if (isArray(x)) res.push.apply(res, x); - else res.push(x); - } - return res; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; diff --git a/node_modules/concat-map/package.json b/node_modules/concat-map/package.json deleted file mode 100644 index d3640e6b027b9..0000000000000 --- a/node_modules/concat-map/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name" : "concat-map", - "description" : "concatenative mapdashery", - "version" : "0.0.1", - "repository" : { - "type" : "git", - "url" : "git://github.com/substack/node-concat-map.git" - }, - "main" : "index.js", - "keywords" : [ - "concat", - "concatMap", - "map", - "functional", - "higher-order" - ], - "directories" : { - "example" : "example", - "test" : "test" - }, - "scripts" : { - "test" : "tape test/*.js" - }, - "devDependencies" : { - "tape" : "~2.4.0" - }, - "license" : "MIT", - "author" : { - "name" : "James Halliday", - "email" : "mail@substack.net", - "url" : "http://substack.net" - }, - "testling" : { - "files" : "test/*.js", - "browsers" : { - "ie" : [ 6, 7, 8, 9 ], - "ff" : [ 3.5, 10, 15.0 ], - "chrome" : [ 10, 22 ], - "safari" : [ 5.1 ], - "opera" : [ 12 ] - } - } -} diff --git a/node_modules/concat-map/test/map.js b/node_modules/concat-map/test/map.js deleted file mode 100644 index fdbd7022f6da1..0000000000000 --- a/node_modules/concat-map/test/map.js +++ /dev/null @@ -1,39 +0,0 @@ -var concatMap = require('../'); -var test = require('tape'); - -test('empty or not', function (t) { - var xs = [ 1, 2, 3, 4, 5, 6 ]; - var ixes = []; - var ys = concatMap(xs, function (x, ix) { - ixes.push(ix); - return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; - }); - t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); - t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); - t.end(); -}); - -test('always something', function (t) { - var xs = [ 'a', 'b', 'c', 'd' ]; - var ys = concatMap(xs, function (x) { - return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; - }); - t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); - t.end(); -}); - -test('scalars', function (t) { - var xs = [ 'a', 'b', 'c', 'd' ]; - var ys = concatMap(xs, function (x) { - return x === 'b' ? [ 'B', 'B', 'B' ] : x; - }); - t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); - t.end(); -}); - -test('undefs', function (t) { - var xs = [ 'a', 'b', 'c', 'd' ]; - var ys = concatMap(xs, function () {}); - t.same(ys, [ undefined, undefined, undefined, undefined ]); - t.end(); -}); diff --git a/node_modules/fs.realpath/LICENSE b/node_modules/fs.realpath/LICENSE deleted file mode 100644 index 5bd884c252ac4..0000000000000 --- a/node_modules/fs.realpath/LICENSE +++ /dev/null @@ -1,43 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ----- - -This library bundles a version of the `fs.realpath` and `fs.realpathSync` -methods from Node.js v0.10 under the terms of the Node.js MIT license. - -Node's license follows, also included at the header of `old.js` which contains -the licensed code: - - Copyright Joyent, Inc. and other Node contributors. - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. diff --git a/node_modules/fs.realpath/index.js b/node_modules/fs.realpath/index.js deleted file mode 100644 index b09c7c7e6364d..0000000000000 --- a/node_modules/fs.realpath/index.js +++ /dev/null @@ -1,66 +0,0 @@ -module.exports = realpath -realpath.realpath = realpath -realpath.sync = realpathSync -realpath.realpathSync = realpathSync -realpath.monkeypatch = monkeypatch -realpath.unmonkeypatch = unmonkeypatch - -var fs = require('fs') -var origRealpath = fs.realpath -var origRealpathSync = fs.realpathSync - -var version = process.version -var ok = /^v[0-5]\./.test(version) -var old = require('./old.js') - -function newError (er) { - return er && er.syscall === 'realpath' && ( - er.code === 'ELOOP' || - er.code === 'ENOMEM' || - er.code === 'ENAMETOOLONG' - ) -} - -function realpath (p, cache, cb) { - if (ok) { - return origRealpath(p, cache, cb) - } - - if (typeof cache === 'function') { - cb = cache - cache = null - } - origRealpath(p, cache, function (er, result) { - if (newError(er)) { - old.realpath(p, cache, cb) - } else { - cb(er, result) - } - }) -} - -function realpathSync (p, cache) { - if (ok) { - return origRealpathSync(p, cache) - } - - try { - return origRealpathSync(p, cache) - } catch (er) { - if (newError(er)) { - return old.realpathSync(p, cache) - } else { - throw er - } - } -} - -function monkeypatch () { - fs.realpath = realpath - fs.realpathSync = realpathSync -} - -function unmonkeypatch () { - fs.realpath = origRealpath - fs.realpathSync = origRealpathSync -} diff --git a/node_modules/fs.realpath/old.js b/node_modules/fs.realpath/old.js deleted file mode 100644 index b40305e73fd58..0000000000000 --- a/node_modules/fs.realpath/old.js +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var pathModule = require('path'); -var isWindows = process.platform === 'win32'; -var fs = require('fs'); - -// JavaScript implementation of realpath, ported from node pre-v6 - -var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); - -function rethrow() { - // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and - // is fairly slow to generate. - var callback; - if (DEBUG) { - var backtrace = new Error; - callback = debugCallback; - } else - callback = missingCallback; - - return callback; - - function debugCallback(err) { - if (err) { - backtrace.message = err.message; - err = backtrace; - missingCallback(err); - } - } - - function missingCallback(err) { - if (err) { - if (process.throwDeprecation) - throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs - else if (!process.noDeprecation) { - var msg = 'fs: missing callback ' + (err.stack || err.message); - if (process.traceDeprecation) - console.trace(msg); - else - console.error(msg); - } - } - } -} - -function maybeCallback(cb) { - return typeof cb === 'function' ? cb : rethrow(); -} - -var normalize = pathModule.normalize; - -// Regexp that finds the next partion of a (partial) path -// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] -if (isWindows) { - var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; -} else { - var nextPartRe = /(.*?)(?:[\/]+|$)/g; -} - -// Regex to find the device root, including trailing slash. E.g. 'c:\\'. -if (isWindows) { - var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; -} else { - var splitRootRe = /^[\/]*/; -} - -exports.realpathSync = function realpathSync(p, cache) { - // make p is absolute - p = pathModule.resolve(p); - - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return cache[p]; - } - - var original = p, - seenLinks = {}, - knownHard = {}; - - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; - - start(); - - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; - - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstatSync(base); - knownHard[base] = true; - } - } - - // walk down the path, swapping out linked pathparts for their real - // values - // NB: p.length changes. - while (pos < p.length) { - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; - - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - continue; - } - - var resolvedLink; - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // some known symbolic link. no need to stat again. - resolvedLink = cache[base]; - } else { - var stat = fs.lstatSync(base); - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - continue; - } - - // read the link if it wasn't read before - // dev/ino always return 0 on windows, so skip the check. - var linkTarget = null; - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - linkTarget = seenLinks[id]; - } - } - if (linkTarget === null) { - fs.statSync(base); - linkTarget = fs.readlinkSync(base); - } - resolvedLink = pathModule.resolve(previous, linkTarget); - // track this, if given a cache. - if (cache) cache[base] = resolvedLink; - if (!isWindows) seenLinks[id] = linkTarget; - } - - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); - } - - if (cache) cache[original] = p; - - return p; -}; - - -exports.realpath = function realpath(p, cache, cb) { - if (typeof cb !== 'function') { - cb = maybeCallback(cache); - cache = null; - } - - // make p is absolute - p = pathModule.resolve(p); - - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return process.nextTick(cb.bind(null, null, cache[p])); - } - - var original = p, - seenLinks = {}, - knownHard = {}; - - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; - - start(); - - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; - - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstat(base, function(err) { - if (err) return cb(err); - knownHard[base] = true; - LOOP(); - }); - } else { - process.nextTick(LOOP); - } - } - - // walk down the path, swapping out linked pathparts for their real - // values - function LOOP() { - // stop if scanned past end of path - if (pos >= p.length) { - if (cache) cache[original] = p; - return cb(null, p); - } - - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; - - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - return process.nextTick(LOOP); - } - - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // known symbolic link. no need to stat again. - return gotResolvedLink(cache[base]); - } - - return fs.lstat(base, gotStat); - } - - function gotStat(err, stat) { - if (err) return cb(err); - - // if not a symlink, skip to the next path part - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - return process.nextTick(LOOP); - } - - // stat & read the link if not read before - // call gotTarget as soon as the link target is known - // dev/ino always return 0 on windows, so skip the check. - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - return gotTarget(null, seenLinks[id], base); - } - } - fs.stat(base, function(err) { - if (err) return cb(err); - - fs.readlink(base, function(err, target) { - if (!isWindows) seenLinks[id] = target; - gotTarget(err, target); - }); - }); - } - - function gotTarget(err, target, base) { - if (err) return cb(err); - - var resolvedLink = pathModule.resolve(previous, target); - if (cache) cache[base] = resolvedLink; - gotResolvedLink(resolvedLink); - } - - function gotResolvedLink(resolvedLink) { - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); - } -}; diff --git a/node_modules/fs.realpath/package.json b/node_modules/fs.realpath/package.json deleted file mode 100644 index 3edc57d21c713..0000000000000 --- a/node_modules/fs.realpath/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "fs.realpath", - "version": "1.0.0", - "description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails", - "main": "index.js", - "dependencies": {}, - "devDependencies": {}, - "scripts": { - "test": "tap test/*.js --cov" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/fs.realpath.git" - }, - "keywords": [ - "realpath", - "fs", - "polyfill" - ], - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC", - "files": [ - "old.js", - "index.js" - ] -} diff --git a/node_modules/http-proxy-agent/dist/agent.js b/node_modules/http-proxy-agent/dist/agent.js deleted file mode 100644 index aca8280431488..0000000000000 --- a/node_modules/http-proxy-agent/dist/agent.js +++ /dev/null @@ -1,145 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const net_1 = __importDefault(require("net")); -const tls_1 = __importDefault(require("tls")); -const url_1 = __importDefault(require("url")); -const debug_1 = __importDefault(require("debug")); -const once_1 = __importDefault(require("@tootallnate/once")); -const agent_base_1 = require("agent-base"); -const debug = (0, debug_1.default)('http-proxy-agent'); -function isHTTPS(protocol) { - return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false; -} -/** - * The `HttpProxyAgent` implements an HTTP Agent subclass that connects - * to the specified "HTTP proxy server" in order to proxy HTTP requests. - * - * @api public - */ -class HttpProxyAgent extends agent_base_1.Agent { - constructor(_opts) { - let opts; - if (typeof _opts === 'string') { - opts = url_1.default.parse(_opts); - } - else { - opts = _opts; - } - if (!opts) { - throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!'); - } - debug('Creating new HttpProxyAgent instance: %o', opts); - super(opts); - const proxy = Object.assign({}, opts); - // If `true`, then connect to the proxy server over TLS. - // Defaults to `false`. - this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol); - // Prefer `hostname` over `host`, and set the `port` if needed. - proxy.host = proxy.hostname || proxy.host; - if (typeof proxy.port === 'string') { - proxy.port = parseInt(proxy.port, 10); - } - if (!proxy.port && proxy.host) { - proxy.port = this.secureProxy ? 443 : 80; - } - if (proxy.host && proxy.path) { - // If both a `host` and `path` are specified then it's most likely - // the result of a `url.parse()` call... we need to remove the - // `path` portion so that `net.connect()` doesn't attempt to open - // that as a Unix socket file. - delete proxy.path; - delete proxy.pathname; - } - this.proxy = proxy; - } - /** - * Called when the node-core HTTP client library is creating a - * new HTTP request. - * - * @api protected - */ - callback(req, opts) { - return __awaiter(this, void 0, void 0, function* () { - const { proxy, secureProxy } = this; - const parsed = url_1.default.parse(req.path); - if (!parsed.protocol) { - parsed.protocol = 'http:'; - } - if (!parsed.hostname) { - parsed.hostname = opts.hostname || opts.host || null; - } - if (parsed.port == null && typeof opts.port) { - parsed.port = String(opts.port); - } - if (parsed.port === '80') { - // if port is 80, then we can remove the port so that the - // ":80" portion is not on the produced URL - parsed.port = ''; - } - // Change the `http.ClientRequest` instance's "path" field - // to the absolute path of the URL that will be requested. - req.path = url_1.default.format(parsed); - // Inject the `Proxy-Authorization` header if necessary. - if (proxy.auth) { - req.setHeader('Proxy-Authorization', `Basic ${Buffer.from(proxy.auth).toString('base64')}`); - } - // Create a socket connection to the proxy server. - let socket; - if (secureProxy) { - debug('Creating `tls.Socket`: %o', proxy); - socket = tls_1.default.connect(proxy); - } - else { - debug('Creating `net.Socket`: %o', proxy); - socket = net_1.default.connect(proxy); - } - // At this point, the http ClientRequest's internal `_header` field - // might have already been set. If this is the case then we'll need - // to re-generate the string since we just changed the `req.path`. - if (req._header) { - let first; - let endOfHeaders; - debug('Regenerating stored HTTP header string for request'); - req._header = null; - req._implicitHeader(); - if (req.output && req.output.length > 0) { - // Node < 12 - debug('Patching connection write() output buffer with updated header'); - first = req.output[0]; - endOfHeaders = first.indexOf('\r\n\r\n') + 4; - req.output[0] = req._header + first.substring(endOfHeaders); - debug('Output buffer: %o', req.output); - } - else if (req.outputData && req.outputData.length > 0) { - // Node >= 12 - debug('Patching connection write() output buffer with updated header'); - first = req.outputData[0].data; - endOfHeaders = first.indexOf('\r\n\r\n') + 4; - req.outputData[0].data = - req._header + first.substring(endOfHeaders); - debug('Output buffer: %o', req.outputData[0].data); - } - } - // Wait for the socket's `connect` event, so that this `callback()` - // function throws instead of the `http` request machinery. This is - // important for i.e. `PacProxyAgent` which determines a failed proxy - // connection via the `callback()` function throwing. - yield (0, once_1.default)(socket, 'connect'); - return socket; - }); - } -} -exports.default = HttpProxyAgent; -//# sourceMappingURL=agent.js.map \ No newline at end of file diff --git a/node_modules/http-proxy-agent/dist/index.js b/node_modules/http-proxy-agent/dist/index.js deleted file mode 100644 index 0a71180594605..0000000000000 --- a/node_modules/http-proxy-agent/dist/index.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const agent_1 = __importDefault(require("./agent")); -function createHttpProxyAgent(opts) { - return new agent_1.default(opts); -} -(function (createHttpProxyAgent) { - createHttpProxyAgent.HttpProxyAgent = agent_1.default; - createHttpProxyAgent.prototype = agent_1.default.prototype; -})(createHttpProxyAgent || (createHttpProxyAgent = {})); -module.exports = createHttpProxyAgent; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/http-proxy-agent/package.json b/node_modules/http-proxy-agent/package.json deleted file mode 100644 index 659d6e11e80e4..0000000000000 --- a/node_modules/http-proxy-agent/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "http-proxy-agent", - "version": "5.0.0", - "description": "An HTTP(s) proxy `http.Agent` implementation for HTTP", - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "prebuild": "rimraf dist", - "build": "tsc", - "test": "mocha", - "test-lint": "eslint src --ext .js,.ts", - "prepublishOnly": "npm run build" - }, - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/node-http-proxy-agent.git" - }, - "keywords": [ - "http", - "proxy", - "endpoint", - "agent" - ], - "author": "Nathan Rajlich (http://n8.io/)", - "license": "MIT", - "bugs": { - "url": "https://github.com/TooTallNate/node-http-proxy-agent/issues" - }, - "dependencies": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - }, - "devDependencies": { - "@types/debug": "4", - "@types/node": "^12.19.2", - "@typescript-eslint/eslint-plugin": "1.6.0", - "@typescript-eslint/parser": "1.1.0", - "eslint": "5.16.0", - "eslint-config-airbnb": "17.1.0", - "eslint-config-prettier": "4.1.0", - "eslint-import-resolver-typescript": "1.1.1", - "eslint-plugin-import": "2.16.0", - "eslint-plugin-jsx-a11y": "6.2.1", - "eslint-plugin-react": "7.12.4", - "mocha": "^6.2.2", - "proxy": "1", - "rimraf": "^3.0.0", - "typescript": "^4.4.3" - }, - "engines": { - "node": ">= 6" - } -} diff --git a/node_modules/https-proxy-agent/dist/agent.js b/node_modules/https-proxy-agent/dist/agent.js deleted file mode 100644 index 75d11364ed300..0000000000000 --- a/node_modules/https-proxy-agent/dist/agent.js +++ /dev/null @@ -1,177 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const net_1 = __importDefault(require("net")); -const tls_1 = __importDefault(require("tls")); -const url_1 = __importDefault(require("url")); -const assert_1 = __importDefault(require("assert")); -const debug_1 = __importDefault(require("debug")); -const agent_base_1 = require("agent-base"); -const parse_proxy_response_1 = __importDefault(require("./parse-proxy-response")); -const debug = debug_1.default('https-proxy-agent:agent'); -/** - * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to - * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests. - * - * Outgoing HTTP requests are first tunneled through the proxy server using the - * `CONNECT` HTTP request method to establish a connection to the proxy server, - * and then the proxy server connects to the destination target and issues the - * HTTP request from the proxy server. - * - * `https:` requests have their socket connection upgraded to TLS once - * the connection to the proxy server has been established. - * - * @api public - */ -class HttpsProxyAgent extends agent_base_1.Agent { - constructor(_opts) { - let opts; - if (typeof _opts === 'string') { - opts = url_1.default.parse(_opts); - } - else { - opts = _opts; - } - if (!opts) { - throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!'); - } - debug('creating new HttpsProxyAgent instance: %o', opts); - super(opts); - const proxy = Object.assign({}, opts); - // If `true`, then connect to the proxy server over TLS. - // Defaults to `false`. - this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol); - // Prefer `hostname` over `host`, and set the `port` if needed. - proxy.host = proxy.hostname || proxy.host; - if (typeof proxy.port === 'string') { - proxy.port = parseInt(proxy.port, 10); - } - if (!proxy.port && proxy.host) { - proxy.port = this.secureProxy ? 443 : 80; - } - // ALPN is supported by Node.js >= v5. - // attempt to negotiate http/1.1 for proxy servers that support http/2 - if (this.secureProxy && !('ALPNProtocols' in proxy)) { - proxy.ALPNProtocols = ['http 1.1']; - } - if (proxy.host && proxy.path) { - // If both a `host` and `path` are specified then it's most likely - // the result of a `url.parse()` call... we need to remove the - // `path` portion so that `net.connect()` doesn't attempt to open - // that as a Unix socket file. - delete proxy.path; - delete proxy.pathname; - } - this.proxy = proxy; - } - /** - * Called when the node-core HTTP client library is creating a - * new HTTP request. - * - * @api protected - */ - callback(req, opts) { - return __awaiter(this, void 0, void 0, function* () { - const { proxy, secureProxy } = this; - // Create a socket connection to the proxy server. - let socket; - if (secureProxy) { - debug('Creating `tls.Socket`: %o', proxy); - socket = tls_1.default.connect(proxy); - } - else { - debug('Creating `net.Socket`: %o', proxy); - socket = net_1.default.connect(proxy); - } - const headers = Object.assign({}, proxy.headers); - const hostname = `${opts.host}:${opts.port}`; - let payload = `CONNECT ${hostname} HTTP/1.1\r\n`; - // Inject the `Proxy-Authorization` header if necessary. - if (proxy.auth) { - headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`; - } - // The `Host` header should only include the port - // number when it is not the default port. - let { host, port, secureEndpoint } = opts; - if (!isDefaultPort(port, secureEndpoint)) { - host += `:${port}`; - } - headers.Host = host; - headers.Connection = 'close'; - for (const name of Object.keys(headers)) { - payload += `${name}: ${headers[name]}\r\n`; - } - const proxyResponsePromise = parse_proxy_response_1.default(socket); - socket.write(`${payload}\r\n`); - const { statusCode, buffered } = yield proxyResponsePromise; - if (statusCode === 200) { - req.once('socket', resume); - if (opts.secureEndpoint) { - // The proxy is connecting to a TLS server, so upgrade - // this socket connection to a TLS connection. - debug('Upgrading socket connection to TLS'); - const servername = opts.servername || opts.host; - return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket, - servername })); - } - return socket; - } - // Some other status code that's not 200... need to re-play the HTTP - // header "data" events onto the socket once the HTTP machinery is - // attached so that the node core `http` can parse and handle the - // error status code. - // Close the original socket, and a new "fake" socket is returned - // instead, so that the proxy doesn't get the HTTP request - // written to it (which may contain `Authorization` headers or other - // sensitive data). - // - // See: https://hackerone.com/reports/541502 - socket.destroy(); - const fakeSocket = new net_1.default.Socket({ writable: false }); - fakeSocket.readable = true; - // Need to wait for the "socket" event to re-play the "data" events. - req.once('socket', (s) => { - debug('replaying proxy buffer for failed request'); - assert_1.default(s.listenerCount('data') > 0); - // Replay the "buffered" Buffer onto the fake `socket`, since at - // this point the HTTP module machinery has been hooked up for - // the user. - s.push(buffered); - s.push(null); - }); - return fakeSocket; - }); - } -} -exports.default = HttpsProxyAgent; -function resume(socket) { - socket.resume(); -} -function isDefaultPort(port, secure) { - return Boolean((!secure && port === 80) || (secure && port === 443)); -} -function isHTTPS(protocol) { - return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false; -} -function omit(obj, ...keys) { - const ret = {}; - let key; - for (key in obj) { - if (!keys.includes(key)) { - ret[key] = obj[key]; - } - } - return ret; -} -//# sourceMappingURL=agent.js.map \ No newline at end of file diff --git a/node_modules/https-proxy-agent/dist/index.js b/node_modules/https-proxy-agent/dist/index.js deleted file mode 100644 index b03e7631a45a4..0000000000000 --- a/node_modules/https-proxy-agent/dist/index.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const agent_1 = __importDefault(require("./agent")); -function createHttpsProxyAgent(opts) { - return new agent_1.default(opts); -} -(function (createHttpsProxyAgent) { - createHttpsProxyAgent.HttpsProxyAgent = agent_1.default; - createHttpsProxyAgent.prototype = agent_1.default.prototype; -})(createHttpsProxyAgent || (createHttpsProxyAgent = {})); -module.exports = createHttpsProxyAgent; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/https-proxy-agent/dist/parse-proxy-response.js b/node_modules/https-proxy-agent/dist/parse-proxy-response.js deleted file mode 100644 index aa5ce3cc2d371..0000000000000 --- a/node_modules/https-proxy-agent/dist/parse-proxy-response.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const debug_1 = __importDefault(require("debug")); -const debug = debug_1.default('https-proxy-agent:parse-proxy-response'); -function parseProxyResponse(socket) { - return new Promise((resolve, reject) => { - // we need to buffer any HTTP traffic that happens with the proxy before we get - // the CONNECT response, so that if the response is anything other than an "200" - // response code, then we can re-play the "data" events on the socket once the - // HTTP parser is hooked up... - let buffersLength = 0; - const buffers = []; - function read() { - const b = socket.read(); - if (b) - ondata(b); - else - socket.once('readable', read); - } - function cleanup() { - socket.removeListener('end', onend); - socket.removeListener('error', onerror); - socket.removeListener('close', onclose); - socket.removeListener('readable', read); - } - function onclose(err) { - debug('onclose had error %o', err); - } - function onend() { - debug('onend'); - } - function onerror(err) { - cleanup(); - debug('onerror %o', err); - reject(err); - } - function ondata(b) { - buffers.push(b); - buffersLength += b.length; - const buffered = Buffer.concat(buffers, buffersLength); - const endOfHeaders = buffered.indexOf('\r\n\r\n'); - if (endOfHeaders === -1) { - // keep buffering - debug('have not received end of HTTP headers yet...'); - read(); - return; - } - const firstLine = buffered.toString('ascii', 0, buffered.indexOf('\r\n')); - const statusCode = +firstLine.split(' ')[1]; - debug('got proxy server response: %o', firstLine); - resolve({ - statusCode, - buffered - }); - } - socket.on('error', onerror); - socket.on('close', onclose); - socket.on('end', onend); - read(); - }); -} -exports.default = parseProxyResponse; -//# sourceMappingURL=parse-proxy-response.js.map \ No newline at end of file diff --git a/node_modules/https-proxy-agent/package.json b/node_modules/https-proxy-agent/package.json deleted file mode 100644 index fb2aba1b94695..0000000000000 --- a/node_modules/https-proxy-agent/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "https-proxy-agent", - "version": "5.0.1", - "description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS", - "main": "dist/index", - "types": "dist/index", - "files": [ - "dist" - ], - "scripts": { - "prebuild": "rimraf dist", - "build": "tsc", - "test": "mocha --reporter spec", - "test-lint": "eslint src --ext .js,.ts", - "prepublishOnly": "npm run build" - }, - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/node-https-proxy-agent.git" - }, - "keywords": [ - "https", - "proxy", - "endpoint", - "agent" - ], - "author": "Nathan Rajlich (http://n8.io/)", - "license": "MIT", - "bugs": { - "url": "https://github.com/TooTallNate/node-https-proxy-agent/issues" - }, - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "devDependencies": { - "@types/debug": "4", - "@types/node": "^12.12.11", - "@typescript-eslint/eslint-plugin": "1.6.0", - "@typescript-eslint/parser": "1.1.0", - "eslint": "5.16.0", - "eslint-config-airbnb": "17.1.0", - "eslint-config-prettier": "4.1.0", - "eslint-import-resolver-typescript": "1.1.1", - "eslint-plugin-import": "2.16.0", - "eslint-plugin-jsx-a11y": "6.2.1", - "eslint-plugin-react": "7.12.4", - "mocha": "^6.2.2", - "proxy": "1", - "rimraf": "^3.0.0", - "typescript": "^3.5.3" - }, - "engines": { - "node": ">= 6" - } -} diff --git a/node_modules/humanize-ms/History.md b/node_modules/humanize-ms/History.md deleted file mode 100644 index b159587050119..0000000000000 --- a/node_modules/humanize-ms/History.md +++ /dev/null @@ -1,25 +0,0 @@ - -1.2.1 / 2017-05-19 -================== - - * fix: package.json to reduce vulnerabilities (#3) - -1.2.0 / 2016-05-21 -================== - - * feat: warn with stack - -1.1.0 / 2016-04-04 -================== - - * deps: upgrade ms to 0.7.0 - -1.0.1 / 2014-12-31 -================== - - * feat(index.js): warn when result is undefined - -1.0.0 / 2014-08-14 -================== - - * init diff --git a/node_modules/humanize-ms/LICENSE b/node_modules/humanize-ms/LICENSE deleted file mode 100644 index 89de354795ec7..0000000000000 --- a/node_modules/humanize-ms/LICENSE +++ /dev/null @@ -1,17 +0,0 @@ -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/humanize-ms/index.js b/node_modules/humanize-ms/index.js deleted file mode 100644 index 660df81def512..0000000000000 --- a/node_modules/humanize-ms/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/*! - * humanize-ms - index.js - * Copyright(c) 2014 dead_horse - * MIT Licensed - */ - -'use strict'; - -/** - * Module dependencies. - */ - -var util = require('util'); -var ms = require('ms'); - -module.exports = function (t) { - if (typeof t === 'number') return t; - var r = ms(t); - if (r === undefined) { - var err = new Error(util.format('humanize-ms(%j) result undefined', t)); - console.warn(err.stack); - } - return r; -}; diff --git a/node_modules/humanize-ms/package.json b/node_modules/humanize-ms/package.json deleted file mode 100644 index da4ab7f571a68..0000000000000 --- a/node_modules/humanize-ms/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "humanize-ms", - "version": "1.2.1", - "description": "transform humanize time to ms", - "main": "index.js", - "files": [ - "index.js" - ], - "scripts": { - "test": "make test" - }, - "keywords": [ - "humanize", - "ms" - ], - "author": { - "name": "dead-horse", - "email": "dead_horse@qq.com", - "url": "http://deadhorse.me" - }, - "repository": { - "type": "git", - "url": "https://github.com/node-modules/humanize-ms" - }, - "license": "MIT", - "dependencies": { - "ms": "^2.0.0" - }, - "devDependencies": { - "autod": "*", - "beautify-benchmark": "~0.2.4", - "benchmark": "~1.0.0", - "istanbul": "*", - "mocha": "*", - "should": "*" - } -} diff --git a/node_modules/infer-owner/LICENSE b/node_modules/infer-owner/LICENSE deleted file mode 100644 index 20a4762540923..0000000000000 --- a/node_modules/infer-owner/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) npm, Inc. and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/infer-owner/index.js b/node_modules/infer-owner/index.js deleted file mode 100644 index a7bddcbd2288b..0000000000000 --- a/node_modules/infer-owner/index.js +++ /dev/null @@ -1,71 +0,0 @@ -const cache = new Map() -const fs = require('fs') -const { dirname, resolve } = require('path') - - -const lstat = path => new Promise((res, rej) => - fs.lstat(path, (er, st) => er ? rej(er) : res(st))) - -const inferOwner = path => { - path = resolve(path) - if (cache.has(path)) - return Promise.resolve(cache.get(path)) - - const statThen = st => { - const { uid, gid } = st - cache.set(path, { uid, gid }) - return { uid, gid } - } - const parent = dirname(path) - const parentTrap = parent === path ? null : er => { - return inferOwner(parent).then((owner) => { - cache.set(path, owner) - return owner - }) - } - return lstat(path).then(statThen, parentTrap) -} - -const inferOwnerSync = path => { - path = resolve(path) - if (cache.has(path)) - return cache.get(path) - - const parent = dirname(path) - - // avoid obscuring call site by re-throwing - // "catch" the error by returning from a finally, - // only if we're not at the root, and the parent call works. - let threw = true - try { - const st = fs.lstatSync(path) - threw = false - const { uid, gid } = st - cache.set(path, { uid, gid }) - return { uid, gid } - } finally { - if (threw && parent !== path) { - const owner = inferOwnerSync(parent) - cache.set(path, owner) - return owner // eslint-disable-line no-unsafe-finally - } - } -} - -const inflight = new Map() -module.exports = path => { - path = resolve(path) - if (inflight.has(path)) - return Promise.resolve(inflight.get(path)) - const p = inferOwner(path).then(owner => { - inflight.delete(path) - return owner - }) - inflight.set(path, p) - return p -} -module.exports.sync = inferOwnerSync -module.exports.clearCache = () => { - cache.clear() - inflight.clear() -} diff --git a/node_modules/infer-owner/package.json b/node_modules/infer-owner/package.json deleted file mode 100644 index c4b2b6e6df206..0000000000000 --- a/node_modules/infer-owner/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "infer-owner", - "version": "1.0.4", - "description": "Infer the owner of a path based on the owner of its nearest existing parent", - "author": "Isaac Z. Schlueter (https://izs.me)", - "license": "ISC", - "scripts": { - "test": "tap -J test/*.js --100", - "snap": "TAP_SNAPSHOT=1 tap -J test/*.js --100", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags" - }, - "devDependencies": { - "mutate-fs": "^2.1.1", - "tap": "^12.4.2" - }, - "main": "index.js", - "repository": "https://github.com/npm/infer-owner", - "publishConfig": { - "access": "public" - }, - "files": [ - "index.js" - ] -} diff --git a/node_modules/inflight/LICENSE b/node_modules/inflight/LICENSE deleted file mode 100644 index 05eeeb88c2ef4..0000000000000 --- a/node_modules/inflight/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/inflight/inflight.js b/node_modules/inflight/inflight.js deleted file mode 100644 index 48202b3ca41d9..0000000000000 --- a/node_modules/inflight/inflight.js +++ /dev/null @@ -1,54 +0,0 @@ -var wrappy = require('wrappy') -var reqs = Object.create(null) -var once = require('once') - -module.exports = wrappy(inflight) - -function inflight (key, cb) { - if (reqs[key]) { - reqs[key].push(cb) - return null - } else { - reqs[key] = [cb] - return makeres(key) - } -} - -function makeres (key) { - return once(function RES () { - var cbs = reqs[key] - var len = cbs.length - var args = slice(arguments) - - // XXX It's somewhat ambiguous whether a new callback added in this - // pass should be queued for later execution if something in the - // list of callbacks throws, or if it should just be discarded. - // However, it's such an edge case that it hardly matters, and either - // choice is likely as surprising as the other. - // As it happens, we do go ahead and schedule it for later execution. - try { - for (var i = 0; i < len; i++) { - cbs[i].apply(null, args) - } - } finally { - if (cbs.length > len) { - // added more in the interim. - // de-zalgo, just in case, but don't call again. - cbs.splice(0, len) - process.nextTick(function () { - RES.apply(null, args) - }) - } else { - delete reqs[key] - } - } - }) -} - -function slice (args) { - var length = args.length - var array = [] - - for (var i = 0; i < length; i++) array[i] = args[i] - return array -} diff --git a/node_modules/inflight/package.json b/node_modules/inflight/package.json deleted file mode 100644 index 6084d3509a5d6..0000000000000 --- a/node_modules/inflight/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "inflight", - "version": "1.0.6", - "description": "Add callbacks to requests in flight to avoid async duplication", - "main": "inflight.js", - "files": [ - "inflight.js" - ], - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - }, - "devDependencies": { - "tap": "^7.1.2" - }, - "scripts": { - "test": "tap test.js --100" - }, - "repository": { - "type": "git", - "url": "https://github.com/npm/inflight.git" - }, - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "bugs": { - "url": "https://github.com/isaacs/inflight/issues" - }, - "homepage": "https://github.com/isaacs/inflight", - "license": "ISC" -} diff --git a/node_modules/inherits/LICENSE b/node_modules/inherits/LICENSE deleted file mode 100644 index dea3013d6710e..0000000000000 --- a/node_modules/inherits/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - diff --git a/node_modules/inherits/inherits.js b/node_modules/inherits/inherits.js deleted file mode 100644 index f71f2d93294a6..0000000000000 --- a/node_modules/inherits/inherits.js +++ /dev/null @@ -1,9 +0,0 @@ -try { - var util = require('util'); - /* istanbul ignore next */ - if (typeof util.inherits !== 'function') throw ''; - module.exports = util.inherits; -} catch (e) { - /* istanbul ignore next */ - module.exports = require('./inherits_browser.js'); -} diff --git a/node_modules/inherits/inherits_browser.js b/node_modules/inherits/inherits_browser.js deleted file mode 100644 index 86bbb3dc29e48..0000000000000 --- a/node_modules/inherits/inherits_browser.js +++ /dev/null @@ -1,27 +0,0 @@ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }) - } - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } -} diff --git a/node_modules/inherits/package.json b/node_modules/inherits/package.json deleted file mode 100644 index 37b4366b83e63..0000000000000 --- a/node_modules/inherits/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "inherits", - "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", - "version": "2.0.4", - "keywords": [ - "inheritance", - "class", - "klass", - "oop", - "object-oriented", - "inherits", - "browser", - "browserify" - ], - "main": "./inherits.js", - "browser": "./inherits_browser.js", - "repository": "git://github.com/isaacs/inherits", - "license": "ISC", - "scripts": { - "test": "tap" - }, - "devDependencies": { - "tap": "^14.2.4" - }, - "files": [ - "inherits.js", - "inherits_browser.js" - ] -} diff --git a/node_modules/once/LICENSE b/node_modules/once/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/once/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/once/once.js b/node_modules/once/once.js deleted file mode 100644 index 235406736d9d9..0000000000000 --- a/node_modules/once/once.js +++ /dev/null @@ -1,42 +0,0 @@ -var wrappy = require('wrappy') -module.exports = wrappy(once) -module.exports.strict = wrappy(onceStrict) - -once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this) - }, - configurable: true - }) - - Object.defineProperty(Function.prototype, 'onceStrict', { - value: function () { - return onceStrict(this) - }, - configurable: true - }) -}) - -function once (fn) { - var f = function () { - if (f.called) return f.value - f.called = true - return f.value = fn.apply(this, arguments) - } - f.called = false - return f -} - -function onceStrict (fn) { - var f = function () { - if (f.called) - throw new Error(f.onceError) - f.called = true - return f.value = fn.apply(this, arguments) - } - var name = fn.name || 'Function wrapped with `once`' - f.onceError = name + " shouldn't be called more than once" - f.called = false - return f -} diff --git a/node_modules/once/package.json b/node_modules/once/package.json deleted file mode 100644 index 16815b2fa1119..0000000000000 --- a/node_modules/once/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "once", - "version": "1.4.0", - "description": "Run a function exactly one time", - "main": "once.js", - "directories": { - "test": "test" - }, - "dependencies": { - "wrappy": "1" - }, - "devDependencies": { - "tap": "^7.0.1" - }, - "scripts": { - "test": "tap test/*.js" - }, - "files": [ - "once.js" - ], - "repository": { - "type": "git", - "url": "git://github.com/isaacs/once" - }, - "keywords": [ - "once", - "function", - "one", - "single" - ], - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC" -} diff --git a/node_modules/path-is-absolute/index.js b/node_modules/path-is-absolute/index.js deleted file mode 100644 index 22aa6c3560799..0000000000000 --- a/node_modules/path-is-absolute/index.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -function posix(path) { - return path.charAt(0) === '/'; -} - -function win32(path) { - // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 - var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; - var result = splitDeviceRe.exec(path); - var device = result[1] || ''; - var isUnc = Boolean(device && device.charAt(1) !== ':'); - - // UNC paths are always absolute - return Boolean(result[2] || isUnc); -} - -module.exports = process.platform === 'win32' ? win32 : posix; -module.exports.posix = posix; -module.exports.win32 = win32; diff --git a/node_modules/path-is-absolute/license b/node_modules/path-is-absolute/license deleted file mode 100644 index 654d0bfe94343..0000000000000 --- a/node_modules/path-is-absolute/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/path-is-absolute/package.json b/node_modules/path-is-absolute/package.json deleted file mode 100644 index 91196d5e9c133..0000000000000 --- a/node_modules/path-is-absolute/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "path-is-absolute", - "version": "1.0.1", - "description": "Node.js 0.12 path.isAbsolute() ponyfill", - "license": "MIT", - "repository": "sindresorhus/path-is-absolute", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "xo && node test.js" - }, - "files": [ - "index.js" - ], - "keywords": [ - "path", - "paths", - "file", - "dir", - "absolute", - "isabsolute", - "is-absolute", - "built-in", - "util", - "utils", - "core", - "ponyfill", - "polyfill", - "shim", - "is", - "detect", - "check" - ], - "devDependencies": { - "xo": "^0.16.0" - } -} diff --git a/node_modules/rimraf/LICENSE b/node_modules/rimraf/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/rimraf/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/rimraf/bin.js b/node_modules/rimraf/bin.js deleted file mode 100755 index 023814cc93e84..0000000000000 --- a/node_modules/rimraf/bin.js +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env node - -const rimraf = require('./') - -const path = require('path') - -const isRoot = arg => /^(\/|[a-zA-Z]:\\)$/.test(path.resolve(arg)) -const filterOutRoot = arg => { - const ok = preserveRoot === false || !isRoot(arg) - if (!ok) { - console.error(`refusing to remove ${arg}`) - console.error('Set --no-preserve-root to allow this') - } - return ok -} - -let help = false -let dashdash = false -let noglob = false -let preserveRoot = true -const args = process.argv.slice(2).filter(arg => { - if (dashdash) - return !!arg - else if (arg === '--') - dashdash = true - else if (arg === '--no-glob' || arg === '-G') - noglob = true - else if (arg === '--glob' || arg === '-g') - noglob = false - else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/)) - help = true - else if (arg === '--preserve-root') - preserveRoot = true - else if (arg === '--no-preserve-root') - preserveRoot = false - else - return !!arg -}).filter(arg => !preserveRoot || filterOutRoot(arg)) - -const go = n => { - if (n >= args.length) - return - const options = noglob ? { glob: false } : {} - rimraf(args[n], options, er => { - if (er) - throw er - go(n+1) - }) -} - -if (help || args.length === 0) { - // If they didn't ask for help, then this is not a "success" - const log = help ? console.log : console.error - log('Usage: rimraf [ ...]') - log('') - log(' Deletes all files and folders at "path" recursively.') - log('') - log('Options:') - log('') - log(' -h, --help Display this usage info') - log(' -G, --no-glob Do not expand glob patterns in arguments') - log(' -g, --glob Expand glob patterns in arguments (default)') - log(' --preserve-root Do not remove \'/\' (default)') - log(' --no-preserve-root Do not treat \'/\' specially') - log(' -- Stop parsing flags') - process.exit(help ? 0 : 1) -} else - go(0) diff --git a/node_modules/rimraf/node_modules/brace-expansion/LICENSE b/node_modules/rimraf/node_modules/brace-expansion/LICENSE deleted file mode 100644 index de3226673c387..0000000000000 --- a/node_modules/rimraf/node_modules/brace-expansion/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2013 Julian Gruber - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/rimraf/node_modules/brace-expansion/index.js b/node_modules/rimraf/node_modules/brace-expansion/index.js deleted file mode 100644 index 0478be81eabc2..0000000000000 --- a/node_modules/rimraf/node_modules/brace-expansion/index.js +++ /dev/null @@ -1,201 +0,0 @@ -var concatMap = require('concat-map'); -var balanced = require('balanced-match'); - -module.exports = expandTop; - -var escSlash = '\0SLASH'+Math.random()+'\0'; -var escOpen = '\0OPEN'+Math.random()+'\0'; -var escClose = '\0CLOSE'+Math.random()+'\0'; -var escComma = '\0COMMA'+Math.random()+'\0'; -var escPeriod = '\0PERIOD'+Math.random()+'\0'; - -function numeric(str) { - return parseInt(str, 10) == str - ? parseInt(str, 10) - : str.charCodeAt(0); -} - -function escapeBraces(str) { - return str.split('\\\\').join(escSlash) - .split('\\{').join(escOpen) - .split('\\}').join(escClose) - .split('\\,').join(escComma) - .split('\\.').join(escPeriod); -} - -function unescapeBraces(str) { - return str.split(escSlash).join('\\') - .split(escOpen).join('{') - .split(escClose).join('}') - .split(escComma).join(',') - .split(escPeriod).join('.'); -} - - -// Basically just str.split(","), but handling cases -// where we have nested braced sections, which should be -// treated as individual members, like {a,{b,c},d} -function parseCommaParts(str) { - if (!str) - return ['']; - - var parts = []; - var m = balanced('{', '}', str); - - if (!m) - return str.split(','); - - var pre = m.pre; - var body = m.body; - var post = m.post; - var p = pre.split(','); - - p[p.length-1] += '{' + body + '}'; - var postParts = parseCommaParts(post); - if (post.length) { - p[p.length-1] += postParts.shift(); - p.push.apply(p, postParts); - } - - parts.push.apply(parts, p); - - return parts; -} - -function expandTop(str) { - if (!str) - return []; - - // I don't know why Bash 4.3 does this, but it does. - // Anything starting with {} will have the first two bytes preserved - // but *only* at the top level, so {},a}b will not expand to anything, - // but a{},b}c will be expanded to [a}c,abc]. - // One could argue that this is a bug in Bash, but since the goal of - // this module is to match Bash's rules, we escape a leading {} - if (str.substr(0, 2) === '{}') { - str = '\\{\\}' + str.substr(2); - } - - return expand(escapeBraces(str), true).map(unescapeBraces); -} - -function identity(e) { - return e; -} - -function embrace(str) { - return '{' + str + '}'; -} -function isPadded(el) { - return /^-?0\d/.test(el); -} - -function lte(i, y) { - return i <= y; -} -function gte(i, y) { - return i >= y; -} - -function expand(str, isTop) { - var expansions = []; - - var m = balanced('{', '}', str); - if (!m || /\$$/.test(m.pre)) return [str]; - - var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); - var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = m.body.indexOf(',') >= 0; - if (!isSequence && !isOptions) { - // {a},b} - if (m.post.match(/,.*\}/)) { - str = m.pre + '{' + m.body + escClose + m.post; - return expand(str); - } - return [str]; - } - - var n; - if (isSequence) { - n = m.body.split(/\.\./); - } else { - n = parseCommaParts(m.body); - if (n.length === 1) { - // x{{a,b}}y ==> x{a}y x{b}y - n = expand(n[0], false).map(embrace); - if (n.length === 1) { - var post = m.post.length - ? expand(m.post, false) - : ['']; - return post.map(function(p) { - return m.pre + n[0] + p; - }); - } - } - } - - // at this point, n is the parts, and we know it's not a comma set - // with a single entry. - - // no need to expand pre, since it is guaranteed to be free of brace-sets - var pre = m.pre; - var post = m.post.length - ? expand(m.post, false) - : ['']; - - var N; - - if (isSequence) { - var x = numeric(n[0]); - var y = numeric(n[1]); - var width = Math.max(n[0].length, n[1].length) - var incr = n.length == 3 - ? Math.abs(numeric(n[2])) - : 1; - var test = lte; - var reverse = y < x; - if (reverse) { - incr *= -1; - test = gte; - } - var pad = n.some(isPadded); - - N = []; - - for (var i = x; test(i, y); i += incr) { - var c; - if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === '\\') - c = ''; - } else { - c = String(i); - if (pad) { - var need = width - c.length; - if (need > 0) { - var z = new Array(need + 1).join('0'); - if (i < 0) - c = '-' + z + c.slice(1); - else - c = z + c; - } - } - } - N.push(c); - } - } else { - N = concatMap(n, function(el) { return expand(el, false) }); - } - - for (var j = 0; j < N.length; j++) { - for (var k = 0; k < post.length; k++) { - var expansion = pre + N[j] + post[k]; - if (!isTop || isSequence || expansion) - expansions.push(expansion); - } - } - - return expansions; -} - diff --git a/node_modules/rimraf/node_modules/brace-expansion/package.json b/node_modules/rimraf/node_modules/brace-expansion/package.json deleted file mode 100644 index a18faa8fd67b8..0000000000000 --- a/node_modules/rimraf/node_modules/brace-expansion/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "brace-expansion", - "description": "Brace expansion as known from sh/bash", - "version": "1.1.11", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/brace-expansion.git" - }, - "homepage": "https://github.com/juliangruber/brace-expansion", - "main": "index.js", - "scripts": { - "test": "tape test/*.js", - "gentest": "bash test/generate.sh", - "bench": "matcha test/perf/bench.js" - }, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - }, - "devDependencies": { - "matcha": "^0.7.0", - "tape": "^4.6.0" - }, - "keywords": [], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT", - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/8..latest", - "firefox/20..latest", - "firefox/nightly", - "chrome/25..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - } -} diff --git a/node_modules/rimraf/node_modules/glob/LICENSE b/node_modules/rimraf/node_modules/glob/LICENSE deleted file mode 100644 index 42ca266df1d52..0000000000000 --- a/node_modules/rimraf/node_modules/glob/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -## Glob Logo - -Glob's logo created by Tanya Brassie , licensed -under a Creative Commons Attribution-ShareAlike 4.0 International License -https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/node_modules/rimraf/node_modules/glob/common.js b/node_modules/rimraf/node_modules/glob/common.js deleted file mode 100644 index 424c46e1dab1b..0000000000000 --- a/node_modules/rimraf/node_modules/glob/common.js +++ /dev/null @@ -1,238 +0,0 @@ -exports.setopts = setopts -exports.ownProp = ownProp -exports.makeAbs = makeAbs -exports.finish = finish -exports.mark = mark -exports.isIgnored = isIgnored -exports.childrenIgnored = childrenIgnored - -function ownProp (obj, field) { - return Object.prototype.hasOwnProperty.call(obj, field) -} - -var fs = require("fs") -var path = require("path") -var minimatch = require("minimatch") -var isAbsolute = require("path-is-absolute") -var Minimatch = minimatch.Minimatch - -function alphasort (a, b) { - return a.localeCompare(b, 'en') -} - -function setupIgnores (self, options) { - self.ignore = options.ignore || [] - - if (!Array.isArray(self.ignore)) - self.ignore = [self.ignore] - - if (self.ignore.length) { - self.ignore = self.ignore.map(ignoreMap) - } -} - -// ignore patterns are always in dot:true mode. -function ignoreMap (pattern) { - var gmatcher = null - if (pattern.slice(-3) === '/**') { - var gpattern = pattern.replace(/(\/\*\*)+$/, '') - gmatcher = new Minimatch(gpattern, { dot: true }) - } - - return { - matcher: new Minimatch(pattern, { dot: true }), - gmatcher: gmatcher - } -} - -function setopts (self, pattern, options) { - if (!options) - options = {} - - // base-matching: just use globstar for that. - if (options.matchBase && -1 === pattern.indexOf("/")) { - if (options.noglobstar) { - throw new Error("base matching requires globstar") - } - pattern = "**/" + pattern - } - - self.silent = !!options.silent - self.pattern = pattern - self.strict = options.strict !== false - self.realpath = !!options.realpath - self.realpathCache = options.realpathCache || Object.create(null) - self.follow = !!options.follow - self.dot = !!options.dot - self.mark = !!options.mark - self.nodir = !!options.nodir - if (self.nodir) - self.mark = true - self.sync = !!options.sync - self.nounique = !!options.nounique - self.nonull = !!options.nonull - self.nosort = !!options.nosort - self.nocase = !!options.nocase - self.stat = !!options.stat - self.noprocess = !!options.noprocess - self.absolute = !!options.absolute - self.fs = options.fs || fs - - self.maxLength = options.maxLength || Infinity - self.cache = options.cache || Object.create(null) - self.statCache = options.statCache || Object.create(null) - self.symlinks = options.symlinks || Object.create(null) - - setupIgnores(self, options) - - self.changedCwd = false - var cwd = process.cwd() - if (!ownProp(options, "cwd")) - self.cwd = cwd - else { - self.cwd = path.resolve(options.cwd) - self.changedCwd = self.cwd !== cwd - } - - self.root = options.root || path.resolve(self.cwd, "/") - self.root = path.resolve(self.root) - if (process.platform === "win32") - self.root = self.root.replace(/\\/g, "/") - - // TODO: is an absolute `cwd` supposed to be resolved against `root`? - // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') - self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) - if (process.platform === "win32") - self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") - self.nomount = !!options.nomount - - // disable comments and negation in Minimatch. - // Note that they are not supported in Glob itself anyway. - options.nonegate = true - options.nocomment = true - // always treat \ in patterns as escapes, not path separators - options.allowWindowsEscape = false - - self.minimatch = new Minimatch(pattern, options) - self.options = self.minimatch.options -} - -function finish (self) { - var nou = self.nounique - var all = nou ? [] : Object.create(null) - - for (var i = 0, l = self.matches.length; i < l; i ++) { - var matches = self.matches[i] - if (!matches || Object.keys(matches).length === 0) { - if (self.nonull) { - // do like the shell, and spit out the literal glob - var literal = self.minimatch.globSet[i] - if (nou) - all.push(literal) - else - all[literal] = true - } - } else { - // had matches - var m = Object.keys(matches) - if (nou) - all.push.apply(all, m) - else - m.forEach(function (m) { - all[m] = true - }) - } - } - - if (!nou) - all = Object.keys(all) - - if (!self.nosort) - all = all.sort(alphasort) - - // at *some* point we statted all of these - if (self.mark) { - for (var i = 0; i < all.length; i++) { - all[i] = self._mark(all[i]) - } - if (self.nodir) { - all = all.filter(function (e) { - var notDir = !(/\/$/.test(e)) - var c = self.cache[e] || self.cache[makeAbs(self, e)] - if (notDir && c) - notDir = c !== 'DIR' && !Array.isArray(c) - return notDir - }) - } - } - - if (self.ignore.length) - all = all.filter(function(m) { - return !isIgnored(self, m) - }) - - self.found = all -} - -function mark (self, p) { - var abs = makeAbs(self, p) - var c = self.cache[abs] - var m = p - if (c) { - var isDir = c === 'DIR' || Array.isArray(c) - var slash = p.slice(-1) === '/' - - if (isDir && !slash) - m += '/' - else if (!isDir && slash) - m = m.slice(0, -1) - - if (m !== p) { - var mabs = makeAbs(self, m) - self.statCache[mabs] = self.statCache[abs] - self.cache[mabs] = self.cache[abs] - } - } - - return m -} - -// lotta situps... -function makeAbs (self, f) { - var abs = f - if (f.charAt(0) === '/') { - abs = path.join(self.root, f) - } else if (isAbsolute(f) || f === '') { - abs = f - } else if (self.changedCwd) { - abs = path.resolve(self.cwd, f) - } else { - abs = path.resolve(f) - } - - if (process.platform === 'win32') - abs = abs.replace(/\\/g, '/') - - return abs -} - - -// Return true, if pattern ends with globstar '**', for the accompanying parent directory. -// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents -function isIgnored (self, path) { - if (!self.ignore.length) - return false - - return self.ignore.some(function(item) { - return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) - }) -} - -function childrenIgnored (self, path) { - if (!self.ignore.length) - return false - - return self.ignore.some(function(item) { - return !!(item.gmatcher && item.gmatcher.match(path)) - }) -} diff --git a/node_modules/rimraf/node_modules/glob/glob.js b/node_modules/rimraf/node_modules/glob/glob.js deleted file mode 100644 index 37a4d7e60775a..0000000000000 --- a/node_modules/rimraf/node_modules/glob/glob.js +++ /dev/null @@ -1,790 +0,0 @@ -// Approach: -// -// 1. Get the minimatch set -// 2. For each pattern in the set, PROCESS(pattern, false) -// 3. Store matches per-set, then uniq them -// -// PROCESS(pattern, inGlobStar) -// Get the first [n] items from pattern that are all strings -// Join these together. This is PREFIX. -// If there is no more remaining, then stat(PREFIX) and -// add to matches if it succeeds. END. -// -// If inGlobStar and PREFIX is symlink and points to dir -// set ENTRIES = [] -// else readdir(PREFIX) as ENTRIES -// If fail, END -// -// with ENTRIES -// If pattern[n] is GLOBSTAR -// // handle the case where the globstar match is empty -// // by pruning it out, and testing the resulting pattern -// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) -// // handle other cases. -// for ENTRY in ENTRIES (not dotfiles) -// // attach globstar + tail onto the entry -// // Mark that this entry is a globstar match -// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) -// -// else // not globstar -// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) -// Test ENTRY against pattern[n] -// If fails, continue -// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) -// -// Caveat: -// Cache all stats and readdirs results to minimize syscall. Since all -// we ever care about is existence and directory-ness, we can just keep -// `true` for files, and [children,...] for directories, or `false` for -// things that don't exist. - -module.exports = glob - -var rp = require('fs.realpath') -var minimatch = require('minimatch') -var Minimatch = minimatch.Minimatch -var inherits = require('inherits') -var EE = require('events').EventEmitter -var path = require('path') -var assert = require('assert') -var isAbsolute = require('path-is-absolute') -var globSync = require('./sync.js') -var common = require('./common.js') -var setopts = common.setopts -var ownProp = common.ownProp -var inflight = require('inflight') -var util = require('util') -var childrenIgnored = common.childrenIgnored -var isIgnored = common.isIgnored - -var once = require('once') - -function glob (pattern, options, cb) { - if (typeof options === 'function') cb = options, options = {} - if (!options) options = {} - - if (options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return globSync(pattern, options) - } - - return new Glob(pattern, options, cb) -} - -glob.sync = globSync -var GlobSync = glob.GlobSync = globSync.GlobSync - -// old api surface -glob.glob = glob - -function extend (origin, add) { - if (add === null || typeof add !== 'object') { - return origin - } - - var keys = Object.keys(add) - var i = keys.length - while (i--) { - origin[keys[i]] = add[keys[i]] - } - return origin -} - -glob.hasMagic = function (pattern, options_) { - var options = extend({}, options_) - options.noprocess = true - - var g = new Glob(pattern, options) - var set = g.minimatch.set - - if (!pattern) - return false - - if (set.length > 1) - return true - - for (var j = 0; j < set[0].length; j++) { - if (typeof set[0][j] !== 'string') - return true - } - - return false -} - -glob.Glob = Glob -inherits(Glob, EE) -function Glob (pattern, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - - if (options && options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return new GlobSync(pattern, options) - } - - if (!(this instanceof Glob)) - return new Glob(pattern, options, cb) - - setopts(this, pattern, options) - this._didRealPath = false - - // process each pattern in the minimatch set - var n = this.minimatch.set.length - - // The matches are stored as {: true,...} so that - // duplicates are automagically pruned. - // Later, we do an Object.keys() on these. - // Keep them as a list so we can fill in when nonull is set. - this.matches = new Array(n) - - if (typeof cb === 'function') { - cb = once(cb) - this.on('error', cb) - this.on('end', function (matches) { - cb(null, matches) - }) - } - - var self = this - this._processing = 0 - - this._emitQueue = [] - this._processQueue = [] - this.paused = false - - if (this.noprocess) - return this - - if (n === 0) - return done() - - var sync = true - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false, done) - } - sync = false - - function done () { - --self._processing - if (self._processing <= 0) { - if (sync) { - process.nextTick(function () { - self._finish() - }) - } else { - self._finish() - } - } - } -} - -Glob.prototype._finish = function () { - assert(this instanceof Glob) - if (this.aborted) - return - - if (this.realpath && !this._didRealpath) - return this._realpath() - - common.finish(this) - this.emit('end', this.found) -} - -Glob.prototype._realpath = function () { - if (this._didRealpath) - return - - this._didRealpath = true - - var n = this.matches.length - if (n === 0) - return this._finish() - - var self = this - for (var i = 0; i < this.matches.length; i++) - this._realpathSet(i, next) - - function next () { - if (--n === 0) - self._finish() - } -} - -Glob.prototype._realpathSet = function (index, cb) { - var matchset = this.matches[index] - if (!matchset) - return cb() - - var found = Object.keys(matchset) - var self = this - var n = found.length - - if (n === 0) - return cb() - - var set = this.matches[index] = Object.create(null) - found.forEach(function (p, i) { - // If there's a problem with the stat, then it means that - // one or more of the links in the realpath couldn't be - // resolved. just return the abs value in that case. - p = self._makeAbs(p) - rp.realpath(p, self.realpathCache, function (er, real) { - if (!er) - set[real] = true - else if (er.syscall === 'stat') - set[p] = true - else - self.emit('error', er) // srsly wtf right here - - if (--n === 0) { - self.matches[index] = set - cb() - } - }) - }) -} - -Glob.prototype._mark = function (p) { - return common.mark(this, p) -} - -Glob.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) -} - -Glob.prototype.abort = function () { - this.aborted = true - this.emit('abort') -} - -Glob.prototype.pause = function () { - if (!this.paused) { - this.paused = true - this.emit('pause') - } -} - -Glob.prototype.resume = function () { - if (this.paused) { - this.emit('resume') - this.paused = false - if (this._emitQueue.length) { - var eq = this._emitQueue.slice(0) - this._emitQueue.length = 0 - for (var i = 0; i < eq.length; i ++) { - var e = eq[i] - this._emitMatch(e[0], e[1]) - } - } - if (this._processQueue.length) { - var pq = this._processQueue.slice(0) - this._processQueue.length = 0 - for (var i = 0; i < pq.length; i ++) { - var p = pq[i] - this._processing-- - this._process(p[0], p[1], p[2], p[3]) - } - } - } -} - -Glob.prototype._process = function (pattern, index, inGlobStar, cb) { - assert(this instanceof Glob) - assert(typeof cb === 'function') - - if (this.aborted) - return - - this._processing++ - if (this.paused) { - this._processQueue.push([pattern, index, inGlobStar, cb]) - return - } - - //console.error('PROCESS %d', this._processing, pattern) - - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. - - // see if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index, cb) - return - - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break - - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break - } - - var remain = pattern.slice(n) - - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || - isAbsolute(pattern.map(function (p) { - return typeof p === 'string' ? p : '[*]' - }).join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix - - var abs = this._makeAbs(read) - - //if ignored, skip _processing - if (childrenIgnored(this, read)) - return cb() - - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) -} - -Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} - -Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - - // if the abs isn't a dir, then nothing can match! - if (!entries) - return cb() - - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' - - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) - } - if (m) - matchedEntries.push(e) - } - } - - //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) - - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return cb() - - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. - - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) - } - this._emitMatch(index, e) - } - // This was the last one, and no stats were needed - return cb() - } - - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - this._process([e].concat(remain), index, inGlobStar, cb) - } - cb() -} - -Glob.prototype._emitMatch = function (index, e) { - if (this.aborted) - return - - if (isIgnored(this, e)) - return - - if (this.paused) { - this._emitQueue.push([index, e]) - return - } - - var abs = isAbsolute(e) ? e : this._makeAbs(e) - - if (this.mark) - e = this._mark(e) - - if (this.absolute) - e = abs - - if (this.matches[index][e]) - return - - if (this.nodir) { - var c = this.cache[abs] - if (c === 'DIR' || Array.isArray(c)) - return - } - - this.matches[index][e] = true - - var st = this.statCache[abs] - if (st) - this.emit('stat', e, st) - - this.emit('match', e) -} - -Glob.prototype._readdirInGlobStar = function (abs, cb) { - if (this.aborted) - return - - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false, cb) - - var lstatkey = 'lstat\0' + abs - var self = this - var lstatcb = inflight(lstatkey, lstatcb_) - - if (lstatcb) - self.fs.lstat(abs, lstatcb) - - function lstatcb_ (er, lstat) { - if (er && er.code === 'ENOENT') - return cb() - - var isSym = lstat && lstat.isSymbolicLink() - self.symlinks[abs] = isSym - - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) { - self.cache[abs] = 'FILE' - cb() - } else - self._readdir(abs, false, cb) - } -} - -Glob.prototype._readdir = function (abs, inGlobStar, cb) { - if (this.aborted) - return - - cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) - if (!cb) - return - - //console.error('RD %j %j', +inGlobStar, abs) - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs, cb) - - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return cb() - - if (Array.isArray(c)) - return cb(null, c) - } - - var self = this - self.fs.readdir(abs, readdirCb(this, abs, cb)) -} - -function readdirCb (self, abs, cb) { - return function (er, entries) { - if (er) - self._readdirError(abs, er, cb) - else - self._readdirEntries(abs, entries, cb) - } -} - -Glob.prototype._readdirEntries = function (abs, entries, cb) { - if (this.aborted) - return - - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e - else - e = abs + '/' + e - this.cache[e] = true - } - } - - this.cache[abs] = entries - return cb(null, entries) -} - -Glob.prototype._readdirError = function (f, er, cb) { - if (this.aborted) - return - - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f) - this.cache[abs] = 'FILE' - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd) - error.path = this.cwd - error.code = er.code - this.emit('error', error) - this.abort() - } - break - - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break - - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) { - this.emit('error', er) - // If the error is handled, then we abort - // if not, we threw out of here - this.abort() - } - if (!this.silent) - console.error('glob error', er) - break - } - - return cb() -} - -Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} - - -Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - //console.error('pgs2', prefix, remain[0], entries) - - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return cb() - - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) - - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false, cb) - - var isSym = this.symlinks[abs] - var len = entries.length - - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return cb() - - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue - - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true, cb) - - var below = gspref.concat(entries[i], remain) - this._process(below, index, true, cb) - } - - cb() -} - -Glob.prototype._processSimple = function (prefix, index, cb) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var self = this - this._stat(prefix, function (er, exists) { - self._processSimple2(prefix, index, er, exists, cb) - }) -} -Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { - - //console.error('ps2', prefix, exists) - - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - // If it doesn't exist, then just mark the lack of results - if (!exists) - return cb() - - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' - } - } - - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') - - // Mark this as a match - this._emitMatch(index, prefix) - cb() -} - -// Returns either 'DIR', 'FILE', or false -Glob.prototype._stat = function (f, cb) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' - - if (f.length > this.maxLength) - return cb() - - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] - - if (Array.isArray(c)) - c = 'DIR' - - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return cb(null, c) - - if (needDir && c === 'FILE') - return cb() - - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. - } - - var exists - var stat = this.statCache[abs] - if (stat !== undefined) { - if (stat === false) - return cb(null, stat) - else { - var type = stat.isDirectory() ? 'DIR' : 'FILE' - if (needDir && type === 'FILE') - return cb() - else - return cb(null, type, stat) - } - } - - var self = this - var statcb = inflight('stat\0' + abs, lstatcb_) - if (statcb) - self.fs.lstat(abs, statcb) - - function lstatcb_ (er, lstat) { - if (lstat && lstat.isSymbolicLink()) { - // If it's a symlink, then treat it as the target, unless - // the target does not exist, then treat it as a file. - return self.fs.stat(abs, function (er, stat) { - if (er) - self._stat2(f, abs, null, lstat, cb) - else - self._stat2(f, abs, er, stat, cb) - }) - } else { - self._stat2(f, abs, er, lstat, cb) - } - } -} - -Glob.prototype._stat2 = function (f, abs, er, stat, cb) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return cb() - } - - var needDir = f.slice(-1) === '/' - this.statCache[abs] = stat - - if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) - return cb(null, false, stat) - - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' - this.cache[abs] = this.cache[abs] || c - - if (needDir && c === 'FILE') - return cb() - - return cb(null, c, stat) -} diff --git a/node_modules/rimraf/node_modules/glob/package.json b/node_modules/rimraf/node_modules/glob/package.json deleted file mode 100644 index 5940b649b7e65..0000000000000 --- a/node_modules/rimraf/node_modules/glob/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "name": "glob", - "description": "a little globber", - "version": "7.2.3", - "publishConfig": { - "tag": "v7-legacy" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/node-glob.git" - }, - "main": "glob.js", - "files": [ - "glob.js", - "sync.js", - "common.js" - ], - "engines": { - "node": "*" - }, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "devDependencies": { - "memfs": "^3.2.0", - "mkdirp": "0", - "rimraf": "^2.2.8", - "tap": "^15.0.6", - "tick": "0.0.6" - }, - "tap": { - "before": "test/00-setup.js", - "after": "test/zz-cleanup.js", - "jobs": 1 - }, - "scripts": { - "prepublish": "npm run benchclean", - "profclean": "rm -f v8.log profile.txt", - "test": "tap", - "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", - "bench": "bash benchmark.sh", - "prof": "bash prof.sh && cat profile.txt", - "benchclean": "node benchclean.js" - }, - "license": "ISC", - "funding": { - "url": "https://github.com/sponsors/isaacs" - } -} diff --git a/node_modules/rimraf/node_modules/glob/sync.js b/node_modules/rimraf/node_modules/glob/sync.js deleted file mode 100644 index 2c4f480192d28..0000000000000 --- a/node_modules/rimraf/node_modules/glob/sync.js +++ /dev/null @@ -1,486 +0,0 @@ -module.exports = globSync -globSync.GlobSync = GlobSync - -var rp = require('fs.realpath') -var minimatch = require('minimatch') -var Minimatch = minimatch.Minimatch -var Glob = require('./glob.js').Glob -var util = require('util') -var path = require('path') -var assert = require('assert') -var isAbsolute = require('path-is-absolute') -var common = require('./common.js') -var setopts = common.setopts -var ownProp = common.ownProp -var childrenIgnored = common.childrenIgnored -var isIgnored = common.isIgnored - -function globSync (pattern, options) { - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') - - return new GlobSync(pattern, options).found -} - -function GlobSync (pattern, options) { - if (!pattern) - throw new Error('must provide pattern') - - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') - - if (!(this instanceof GlobSync)) - return new GlobSync(pattern, options) - - setopts(this, pattern, options) - - if (this.noprocess) - return this - - var n = this.minimatch.set.length - this.matches = new Array(n) - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false) - } - this._finish() -} - -GlobSync.prototype._finish = function () { - assert.ok(this instanceof GlobSync) - if (this.realpath) { - var self = this - this.matches.forEach(function (matchset, index) { - var set = self.matches[index] = Object.create(null) - for (var p in matchset) { - try { - p = self._makeAbs(p) - var real = rp.realpathSync(p, self.realpathCache) - set[real] = true - } catch (er) { - if (er.syscall === 'stat') - set[self._makeAbs(p)] = true - else - throw er - } - } - }) - } - common.finish(this) -} - - -GlobSync.prototype._process = function (pattern, index, inGlobStar) { - assert.ok(this instanceof GlobSync) - - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. - - // See if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index) - return - - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break - - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break - } - - var remain = pattern.slice(n) - - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || - isAbsolute(pattern.map(function (p) { - return typeof p === 'string' ? p : '[*]' - }).join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix - - var abs = this._makeAbs(read) - - //if ignored, skip processing - if (childrenIgnored(this, read)) - return - - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar) -} - - -GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { - var entries = this._readdir(abs, inGlobStar) - - // if the abs isn't a dir, then nothing can match! - if (!entries) - return - - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' - - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) - } - if (m) - matchedEntries.push(e) - } - } - - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return - - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. - - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix.slice(-1) !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) - } - this._emitMatch(index, e) - } - // This was the last one, and no stats were needed - return - } - - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) - newPattern = [prefix, e] - else - newPattern = [e] - this._process(newPattern.concat(remain), index, inGlobStar) - } -} - - -GlobSync.prototype._emitMatch = function (index, e) { - if (isIgnored(this, e)) - return - - var abs = this._makeAbs(e) - - if (this.mark) - e = this._mark(e) - - if (this.absolute) { - e = abs - } - - if (this.matches[index][e]) - return - - if (this.nodir) { - var c = this.cache[abs] - if (c === 'DIR' || Array.isArray(c)) - return - } - - this.matches[index][e] = true - - if (this.stat) - this._stat(e) -} - - -GlobSync.prototype._readdirInGlobStar = function (abs) { - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false) - - var entries - var lstat - var stat - try { - lstat = this.fs.lstatSync(abs) - } catch (er) { - if (er.code === 'ENOENT') { - // lstat failed, doesn't exist - return null - } - } - - var isSym = lstat && lstat.isSymbolicLink() - this.symlinks[abs] = isSym - - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) - this.cache[abs] = 'FILE' - else - entries = this._readdir(abs, false) - - return entries -} - -GlobSync.prototype._readdir = function (abs, inGlobStar) { - var entries - - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs) - - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return null - - if (Array.isArray(c)) - return c - } - - try { - return this._readdirEntries(abs, this.fs.readdirSync(abs)) - } catch (er) { - this._readdirError(abs, er) - return null - } -} - -GlobSync.prototype._readdirEntries = function (abs, entries) { - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e - else - e = abs + '/' + e - this.cache[e] = true - } - } - - this.cache[abs] = entries - - // mark and cache dir-ness - return entries -} - -GlobSync.prototype._readdirError = function (f, er) { - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f) - this.cache[abs] = 'FILE' - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd) - error.path = this.cwd - error.code = er.code - throw error - } - break - - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break - - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) - throw er - if (!this.silent) - console.error('glob error', er) - break - } -} - -GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { - - var entries = this._readdir(abs, inGlobStar) - - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return - - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) - - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false) - - var len = entries.length - var isSym = this.symlinks[abs] - - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return - - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue - - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true) - - var below = gspref.concat(entries[i], remain) - this._process(below, index, true) - } -} - -GlobSync.prototype._processSimple = function (prefix, index) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var exists = this._stat(prefix) - - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - // If it doesn't exist, then just mark the lack of results - if (!exists) - return - - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' - } - } - - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') - - // Mark this as a match - this._emitMatch(index, prefix) -} - -// Returns either 'DIR', 'FILE', or false -GlobSync.prototype._stat = function (f) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' - - if (f.length > this.maxLength) - return false - - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] - - if (Array.isArray(c)) - c = 'DIR' - - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return c - - if (needDir && c === 'FILE') - return false - - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. - } - - var exists - var stat = this.statCache[abs] - if (!stat) { - var lstat - try { - lstat = this.fs.lstatSync(abs) - } catch (er) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return false - } - } - - if (lstat && lstat.isSymbolicLink()) { - try { - stat = this.fs.statSync(abs) - } catch (er) { - stat = lstat - } - } else { - stat = lstat - } - } - - this.statCache[abs] = stat - - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' - - this.cache[abs] = this.cache[abs] || c - - if (needDir && c === 'FILE') - return false - - return c -} - -GlobSync.prototype._mark = function (p) { - return common.mark(this, p) -} - -GlobSync.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) -} diff --git a/node_modules/rimraf/node_modules/minimatch/LICENSE b/node_modules/rimraf/node_modules/minimatch/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/rimraf/node_modules/minimatch/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/rimraf/node_modules/minimatch/minimatch.js b/node_modules/rimraf/node_modules/minimatch/minimatch.js deleted file mode 100644 index fda45ade7cfc3..0000000000000 --- a/node_modules/rimraf/node_modules/minimatch/minimatch.js +++ /dev/null @@ -1,947 +0,0 @@ -module.exports = minimatch -minimatch.Minimatch = Minimatch - -var path = (function () { try { return require('path') } catch (e) {}}()) || { - sep: '/' -} -minimatch.sep = path.sep - -var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = require('brace-expansion') - -var plTypes = { - '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, - '?': { open: '(?:', close: ')?' }, - '+': { open: '(?:', close: ')+' }, - '*': { open: '(?:', close: ')*' }, - '@': { open: '(?:', close: ')' } -} - -// any single thing other than / -// don't need to escape / when using new RegExp() -var qmark = '[^/]' - -// * => any number of characters -var star = qmark + '*?' - -// ** when dots are allowed. Anything goes, except .. and . -// not (^ or / followed by one or two dots followed by $ or /), -// followed by anything, any number of times. -var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' - -// not a ^ or / followed by a dot, -// followed by anything, any number of times. -var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' - -// characters that need to be escaped in RegExp. -var reSpecials = charSet('().*{}+?[]^$\\!') - -// "abc" -> { a:true, b:true, c:true } -function charSet (s) { - return s.split('').reduce(function (set, c) { - set[c] = true - return set - }, {}) -} - -// normalizes slashes. -var slashSplit = /\/+/ - -minimatch.filter = filter -function filter (pattern, options) { - options = options || {} - return function (p, i, list) { - return minimatch(p, pattern, options) - } -} - -function ext (a, b) { - b = b || {} - var t = {} - Object.keys(a).forEach(function (k) { - t[k] = a[k] - }) - Object.keys(b).forEach(function (k) { - t[k] = b[k] - }) - return t -} - -minimatch.defaults = function (def) { - if (!def || typeof def !== 'object' || !Object.keys(def).length) { - return minimatch - } - - var orig = minimatch - - var m = function minimatch (p, pattern, options) { - return orig(p, pattern, ext(def, options)) - } - - m.Minimatch = function Minimatch (pattern, options) { - return new orig.Minimatch(pattern, ext(def, options)) - } - m.Minimatch.defaults = function defaults (options) { - return orig.defaults(ext(def, options)).Minimatch - } - - m.filter = function filter (pattern, options) { - return orig.filter(pattern, ext(def, options)) - } - - m.defaults = function defaults (options) { - return orig.defaults(ext(def, options)) - } - - m.makeRe = function makeRe (pattern, options) { - return orig.makeRe(pattern, ext(def, options)) - } - - m.braceExpand = function braceExpand (pattern, options) { - return orig.braceExpand(pattern, ext(def, options)) - } - - m.match = function (list, pattern, options) { - return orig.match(list, pattern, ext(def, options)) - } - - return m -} - -Minimatch.defaults = function (def) { - return minimatch.defaults(def).Minimatch -} - -function minimatch (p, pattern, options) { - assertValidPattern(pattern) - - if (!options) options = {} - - // shortcut: comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - return false - } - - return new Minimatch(pattern, options).match(p) -} - -function Minimatch (pattern, options) { - if (!(this instanceof Minimatch)) { - return new Minimatch(pattern, options) - } - - assertValidPattern(pattern) - - if (!options) options = {} - - pattern = pattern.trim() - - // windows support: need to use /, not \ - if (!options.allowWindowsEscape && path.sep !== '/') { - pattern = pattern.split(path.sep).join('/') - } - - this.options = options - this.set = [] - this.pattern = pattern - this.regexp = null - this.negate = false - this.comment = false - this.empty = false - this.partial = !!options.partial - - // make the set of regexps etc. - this.make() -} - -Minimatch.prototype.debug = function () {} - -Minimatch.prototype.make = make -function make () { - var pattern = this.pattern - var options = this.options - - // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - this.comment = true - return - } - if (!pattern) { - this.empty = true - return - } - - // step 1: figure out negation, etc. - this.parseNegate() - - // step 2: expand braces - var set = this.globSet = this.braceExpand() - - if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) } - - this.debug(this.pattern, set) - - // step 3: now we have a set, so turn each one into a series of path-portion - // matching patterns. - // These will be regexps, except in the case of "**", which is - // set to the GLOBSTAR object for globstar behavior, - // and will not contain any / characters - set = this.globParts = set.map(function (s) { - return s.split(slashSplit) - }) - - this.debug(this.pattern, set) - - // glob --> regexps - set = set.map(function (s, si, set) { - return s.map(this.parse, this) - }, this) - - this.debug(this.pattern, set) - - // filter out everything that didn't compile properly. - set = set.filter(function (s) { - return s.indexOf(false) === -1 - }) - - this.debug(this.pattern, set) - - this.set = set -} - -Minimatch.prototype.parseNegate = parseNegate -function parseNegate () { - var pattern = this.pattern - var negate = false - var options = this.options - var negateOffset = 0 - - if (options.nonegate) return - - for (var i = 0, l = pattern.length - ; i < l && pattern.charAt(i) === '!' - ; i++) { - negate = !negate - negateOffset++ - } - - if (negateOffset) this.pattern = pattern.substr(negateOffset) - this.negate = negate -} - -// Brace expansion: -// a{b,c}d -> abd acd -// a{b,}c -> abc ac -// a{0..3}d -> a0d a1d a2d a3d -// a{b,c{d,e}f}g -> abg acdfg acefg -// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg -// -// Invalid sets are not expanded. -// a{2..}b -> a{2..}b -// a{b}c -> a{b}c -minimatch.braceExpand = function (pattern, options) { - return braceExpand(pattern, options) -} - -Minimatch.prototype.braceExpand = braceExpand - -function braceExpand (pattern, options) { - if (!options) { - if (this instanceof Minimatch) { - options = this.options - } else { - options = {} - } - } - - pattern = typeof pattern === 'undefined' - ? this.pattern : pattern - - assertValidPattern(pattern) - - // Thanks to Yeting Li for - // improving this regexp to avoid a ReDOS vulnerability. - if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { - // shortcut. no need to expand. - return [pattern] - } - - return expand(pattern) -} - -var MAX_PATTERN_LENGTH = 1024 * 64 -var assertValidPattern = function (pattern) { - if (typeof pattern !== 'string') { - throw new TypeError('invalid pattern') - } - - if (pattern.length > MAX_PATTERN_LENGTH) { - throw new TypeError('pattern is too long') - } -} - -// parse a component of the expanded set. -// At this point, no pattern may contain "/" in it -// so we're going to return a 2d array, where each entry is the full -// pattern, split on '/', and then turned into a regular expression. -// A regexp is made at the end which joins each array with an -// escaped /, and another full one which joins each regexp with |. -// -// Following the lead of Bash 4.1, note that "**" only has special meaning -// when it is the *only* thing in a path portion. Otherwise, any series -// of * is equivalent to a single *. Globstar behavior is enabled by -// default, and can be disabled by setting options.noglobstar. -Minimatch.prototype.parse = parse -var SUBPARSE = {} -function parse (pattern, isSub) { - assertValidPattern(pattern) - - var options = this.options - - // shortcuts - if (pattern === '**') { - if (!options.noglobstar) - return GLOBSTAR - else - pattern = '*' - } - if (pattern === '') return '' - - var re = '' - var hasMagic = !!options.nocase - var escaping = false - // ? => one single character - var patternListStack = [] - var negativeLists = [] - var stateChar - var inClass = false - var reClassStart = -1 - var classStart = -1 - // . and .. never match anything that doesn't start with ., - // even when options.dot is set. - var patternStart = pattern.charAt(0) === '.' ? '' // anything - // not (start or / followed by . or .. followed by / or end) - : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' - : '(?!\\.)' - var self = this - - function clearStateChar () { - if (stateChar) { - // we had some state-tracking character - // that wasn't consumed by this pass. - switch (stateChar) { - case '*': - re += star - hasMagic = true - break - case '?': - re += qmark - hasMagic = true - break - default: - re += '\\' + stateChar - break - } - self.debug('clearStateChar %j %j', stateChar, re) - stateChar = false - } - } - - for (var i = 0, len = pattern.length, c - ; (i < len) && (c = pattern.charAt(i)) - ; i++) { - this.debug('%s\t%s %s %j', pattern, i, re, c) - - // skip over any that are escaped. - if (escaping && reSpecials[c]) { - re += '\\' + c - escaping = false - continue - } - - switch (c) { - /* istanbul ignore next */ - case '/': { - // completely not allowed, even escaped. - // Should already be path-split by now. - return false - } - - case '\\': - clearStateChar() - escaping = true - continue - - // the various stateChar values - // for the "extglob" stuff. - case '?': - case '*': - case '+': - case '@': - case '!': - this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) - - // all of those are literals inside a class, except that - // the glob [!a] means [^a] in regexp - if (inClass) { - this.debug(' in class') - if (c === '!' && i === classStart + 1) c = '^' - re += c - continue - } - - // if we already have a stateChar, then it means - // that there was something like ** or +? in there. - // Handle the stateChar, then proceed with this one. - self.debug('call clearStateChar %j', stateChar) - clearStateChar() - stateChar = c - // if extglob is disabled, then +(asdf|foo) isn't a thing. - // just clear the statechar *now*, rather than even diving into - // the patternList stuff. - if (options.noext) clearStateChar() - continue - - case '(': - if (inClass) { - re += '(' - continue - } - - if (!stateChar) { - re += '\\(' - continue - } - - patternListStack.push({ - type: stateChar, - start: i - 1, - reStart: re.length, - open: plTypes[stateChar].open, - close: plTypes[stateChar].close - }) - // negation is (?:(?!js)[^/]*) - re += stateChar === '!' ? '(?:(?!(?:' : '(?:' - this.debug('plType %j %j', stateChar, re) - stateChar = false - continue - - case ')': - if (inClass || !patternListStack.length) { - re += '\\)' - continue - } - - clearStateChar() - hasMagic = true - var pl = patternListStack.pop() - // negation is (?:(?!js)[^/]*) - // The others are (?:) - re += pl.close - if (pl.type === '!') { - negativeLists.push(pl) - } - pl.reEnd = re.length - continue - - case '|': - if (inClass || !patternListStack.length || escaping) { - re += '\\|' - escaping = false - continue - } - - clearStateChar() - re += '|' - continue - - // these are mostly the same in regexp and glob - case '[': - // swallow any state-tracking char before the [ - clearStateChar() - - if (inClass) { - re += '\\' + c - continue - } - - inClass = true - classStart = i - reClassStart = re.length - re += c - continue - - case ']': - // a right bracket shall lose its special - // meaning and represent itself in - // a bracket expression if it occurs - // first in the list. -- POSIX.2 2.8.3.2 - if (i === classStart + 1 || !inClass) { - re += '\\' + c - escaping = false - continue - } - - // handle the case where we left a class open. - // "[z-a]" is valid, equivalent to "\[z-a\]" - // split where the last [ was, make sure we don't have - // an invalid re. if so, re-walk the contents of the - // would-be class to re-translate any characters that - // were passed through as-is - // TODO: It would probably be faster to determine this - // without a try/catch and a new RegExp, but it's tricky - // to do safely. For now, this is safe and works. - var cs = pattern.substring(classStart + 1, i) - try { - RegExp('[' + cs + ']') - } catch (er) { - // not a valid class! - var sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' - hasMagic = hasMagic || sp[1] - inClass = false - continue - } - - // finish up the class. - hasMagic = true - inClass = false - re += c - continue - - default: - // swallow any state char that wasn't consumed - clearStateChar() - - if (escaping) { - // no need - escaping = false - } else if (reSpecials[c] - && !(c === '^' && inClass)) { - re += '\\' - } - - re += c - - } // switch - } // for - - // handle the case where we left a class open. - // "[abc" is valid, equivalent to "\[abc" - if (inClass) { - // split where the last [ was, and escape it - // this is a huge pita. We now have to re-walk - // the contents of the would-be class to re-translate - // any characters that were passed through as-is - cs = pattern.substr(classStart + 1) - sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] - hasMagic = hasMagic || sp[1] - } - - // handle the case where we had a +( thing at the *end* - // of the pattern. - // each pattern list stack adds 3 chars, and we need to go through - // and escape any | chars that were passed through as-is for the regexp. - // Go through and escape them, taking care not to double-escape any - // | chars that were already escaped. - for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { - var tail = re.slice(pl.reStart + pl.open.length) - this.debug('setting tail', re, pl) - // maybe some even number of \, then maybe 1 \, followed by a | - tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { - if (!$2) { - // the | isn't already escaped, so escape it. - $2 = '\\' - } - - // need to escape all those slashes *again*, without escaping the - // one that we need for escaping the | character. As it works out, - // escaping an even number of slashes can be done by simply repeating - // it exactly after itself. That's why this trick works. - // - // I am sorry that you have to see this. - return $1 + $1 + $2 + '|' - }) - - this.debug('tail=%j\n %s', tail, tail, pl, re) - var t = pl.type === '*' ? star - : pl.type === '?' ? qmark - : '\\' + pl.type - - hasMagic = true - re = re.slice(0, pl.reStart) + t + '\\(' + tail - } - - // handle trailing things that only matter at the very end. - clearStateChar() - if (escaping) { - // trailing \\ - re += '\\\\' - } - - // only need to apply the nodot start if the re starts with - // something that could conceivably capture a dot - var addPatternStart = false - switch (re.charAt(0)) { - case '[': case '.': case '(': addPatternStart = true - } - - // Hack to work around lack of negative lookbehind in JS - // A pattern like: *.!(x).!(y|z) needs to ensure that a name - // like 'a.xyz.yz' doesn't match. So, the first negative - // lookahead, has to look ALL the way ahead, to the end of - // the pattern. - for (var n = negativeLists.length - 1; n > -1; n--) { - var nl = negativeLists[n] - - var nlBefore = re.slice(0, nl.reStart) - var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) - var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) - var nlAfter = re.slice(nl.reEnd) - - nlLast += nlAfter - - // Handle nested stuff like *(*.js|!(*.json)), where open parens - // mean that we should *not* include the ) in the bit that is considered - // "after" the negated section. - var openParensBefore = nlBefore.split('(').length - 1 - var cleanAfter = nlAfter - for (i = 0; i < openParensBefore; i++) { - cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') - } - nlAfter = cleanAfter - - var dollar = '' - if (nlAfter === '' && isSub !== SUBPARSE) { - dollar = '$' - } - var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast - re = newRe - } - - // if the re is not "" at this point, then we need to make sure - // it doesn't match against an empty path part. - // Otherwise a/* will match a/, which it should not. - if (re !== '' && hasMagic) { - re = '(?=.)' + re - } - - if (addPatternStart) { - re = patternStart + re - } - - // parsing just a piece of a larger pattern. - if (isSub === SUBPARSE) { - return [re, hasMagic] - } - - // skip the regexp for non-magical patterns - // unescape anything in it, though, so that it'll be - // an exact match against a file etc. - if (!hasMagic) { - return globUnescape(pattern) - } - - var flags = options.nocase ? 'i' : '' - try { - var regExp = new RegExp('^' + re + '$', flags) - } catch (er) /* istanbul ignore next - should be impossible */ { - // If it was an invalid regular expression, then it can't match - // anything. This trick looks for a character after the end of - // the string, which is of course impossible, except in multi-line - // mode, but it's not a /m regex. - return new RegExp('$.') - } - - regExp._glob = pattern - regExp._src = re - - return regExp -} - -minimatch.makeRe = function (pattern, options) { - return new Minimatch(pattern, options || {}).makeRe() -} - -Minimatch.prototype.makeRe = makeRe -function makeRe () { - if (this.regexp || this.regexp === false) return this.regexp - - // at this point, this.set is a 2d array of partial - // pattern strings, or "**". - // - // It's better to use .match(). This function shouldn't - // be used, really, but it's pretty convenient sometimes, - // when you just want to work with a regex. - var set = this.set - - if (!set.length) { - this.regexp = false - return this.regexp - } - var options = this.options - - var twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot - var flags = options.nocase ? 'i' : '' - - var re = set.map(function (pattern) { - return pattern.map(function (p) { - return (p === GLOBSTAR) ? twoStar - : (typeof p === 'string') ? regExpEscape(p) - : p._src - }).join('\\\/') - }).join('|') - - // must match entire pattern - // ending in a * or ** will make it less strict. - re = '^(?:' + re + ')$' - - // can match anything, as long as it's not this. - if (this.negate) re = '^(?!' + re + ').*$' - - try { - this.regexp = new RegExp(re, flags) - } catch (ex) /* istanbul ignore next - should be impossible */ { - this.regexp = false - } - return this.regexp -} - -minimatch.match = function (list, pattern, options) { - options = options || {} - var mm = new Minimatch(pattern, options) - list = list.filter(function (f) { - return mm.match(f) - }) - if (mm.options.nonull && !list.length) { - list.push(pattern) - } - return list -} - -Minimatch.prototype.match = function match (f, partial) { - if (typeof partial === 'undefined') partial = this.partial - this.debug('match', f, this.pattern) - // short-circuit in the case of busted things. - // comments, etc. - if (this.comment) return false - if (this.empty) return f === '' - - if (f === '/' && partial) return true - - var options = this.options - - // windows: need to use /, not \ - if (path.sep !== '/') { - f = f.split(path.sep).join('/') - } - - // treat the test path as a set of pathparts. - f = f.split(slashSplit) - this.debug(this.pattern, 'split', f) - - // just ONE of the pattern sets in this.set needs to match - // in order for it to be valid. If negating, then just one - // match means that we have failed. - // Either way, return on the first hit. - - var set = this.set - this.debug(this.pattern, 'set', set) - - // Find the basename of the path by looking for the last non-empty segment - var filename - var i - for (i = f.length - 1; i >= 0; i--) { - filename = f[i] - if (filename) break - } - - for (i = 0; i < set.length; i++) { - var pattern = set[i] - var file = f - if (options.matchBase && pattern.length === 1) { - file = [filename] - } - var hit = this.matchOne(file, pattern, partial) - if (hit) { - if (options.flipNegate) return true - return !this.negate - } - } - - // didn't get any hits. this is success if it's a negative - // pattern, failure otherwise. - if (options.flipNegate) return false - return this.negate -} - -// set partial to true to test if, for example, -// "/a/b" matches the start of "/*/b/*/d" -// Partial means, if you run out of file before you run -// out of pattern, then that's fine, as long as all -// the parts match. -Minimatch.prototype.matchOne = function (file, pattern, partial) { - var options = this.options - - this.debug('matchOne', - { 'this': this, file: file, pattern: pattern }) - - this.debug('matchOne', file.length, pattern.length) - - for (var fi = 0, - pi = 0, - fl = file.length, - pl = pattern.length - ; (fi < fl) && (pi < pl) - ; fi++, pi++) { - this.debug('matchOne loop') - var p = pattern[pi] - var f = file[fi] - - this.debug(pattern, p, f) - - // should be impossible. - // some invalid regexp stuff in the set. - /* istanbul ignore if */ - if (p === false) return false - - if (p === GLOBSTAR) { - this.debug('GLOBSTAR', [pattern, p, f]) - - // "**" - // a/**/b/**/c would match the following: - // a/b/x/y/z/c - // a/x/y/z/b/c - // a/b/x/b/x/c - // a/b/c - // To do this, take the rest of the pattern after - // the **, and see if it would match the file remainder. - // If so, return success. - // If not, the ** "swallows" a segment, and try again. - // This is recursively awful. - // - // a/**/b/**/c matching a/b/x/y/z/c - // - a matches a - // - doublestar - // - matchOne(b/x/y/z/c, b/**/c) - // - b matches b - // - doublestar - // - matchOne(x/y/z/c, c) -> no - // - matchOne(y/z/c, c) -> no - // - matchOne(z/c, c) -> no - // - matchOne(c, c) yes, hit - var fr = fi - var pr = pi + 1 - if (pr === pl) { - this.debug('** at the end') - // a ** at the end will just swallow the rest. - // We have found a match. - // however, it will not swallow /.x, unless - // options.dot is set. - // . and .. are *never* matched by **, for explosively - // exponential reasons. - for (; fi < fl; fi++) { - if (file[fi] === '.' || file[fi] === '..' || - (!options.dot && file[fi].charAt(0) === '.')) return false - } - return true - } - - // ok, let's see if we can swallow whatever we can. - while (fr < fl) { - var swallowee = file[fr] - - this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) - - // XXX remove this slice. Just pass the start index. - if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - this.debug('globstar found match!', fr, fl, swallowee) - // found a match. - return true - } else { - // can't swallow "." or ".." ever. - // can only swallow ".foo" when explicitly asked. - if (swallowee === '.' || swallowee === '..' || - (!options.dot && swallowee.charAt(0) === '.')) { - this.debug('dot detected!', file, fr, pattern, pr) - break - } - - // ** swallows a segment, and continue. - this.debug('globstar swallow a segment, and continue') - fr++ - } - } - - // no match was found. - // However, in partial mode, we can't say this is necessarily over. - // If there's more *pattern* left, then - /* istanbul ignore if */ - if (partial) { - // ran out of file - this.debug('\n>>> no match, partial?', file, fr, pattern, pr) - if (fr === fl) return true - } - return false - } - - // something other than ** - // non-magic patterns just have to match exactly - // patterns with magic have been turned into regexps. - var hit - if (typeof p === 'string') { - hit = f === p - this.debug('string match', p, f, hit) - } else { - hit = f.match(p) - this.debug('pattern match', p, f, hit) - } - - if (!hit) return false - } - - // Note: ending in / means that we'll get a final "" - // at the end of the pattern. This can only match a - // corresponding "" at the end of the file. - // If the file ends in /, then it can only match a - // a pattern that ends in /, unless the pattern just - // doesn't have any more for it. But, a/b/ should *not* - // match "a/b/*", even though "" matches against the - // [^/]*? pattern, except in partial mode, where it might - // simply not be reached yet. - // However, a/b/ should still satisfy a/* - - // now either we fell off the end of the pattern, or we're done. - if (fi === fl && pi === pl) { - // ran out of pattern and filename at the same time. - // an exact hit! - return true - } else if (fi === fl) { - // ran out of file, but still had pattern left. - // this is ok if we're doing the match as part of - // a glob fs traversal. - return partial - } else /* istanbul ignore else */ if (pi === pl) { - // ran out of pattern, still have file left. - // this is only acceptable if we're on the very last - // empty segment of a file with a trailing slash. - // a/* should match a/b/ - return (fi === fl - 1) && (file[fi] === '') - } - - // should be unreachable. - /* istanbul ignore next */ - throw new Error('wtf?') -} - -// replace stuff like \* with * -function globUnescape (s) { - return s.replace(/\\(.)/g, '$1') -} - -function regExpEscape (s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') -} diff --git a/node_modules/rimraf/node_modules/minimatch/package.json b/node_modules/rimraf/node_modules/minimatch/package.json deleted file mode 100644 index 566efdfe45cb8..0000000000000 --- a/node_modules/rimraf/node_modules/minimatch/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "author": "Isaac Z. Schlueter (http://blog.izs.me)", - "name": "minimatch", - "description": "a glob matcher in javascript", - "version": "3.1.2", - "publishConfig": { - "tag": "v3-legacy" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/minimatch.git" - }, - "main": "minimatch.js", - "scripts": { - "test": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --all; git push origin --tags" - }, - "engines": { - "node": "*" - }, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "devDependencies": { - "tap": "^15.1.6" - }, - "license": "ISC", - "files": [ - "minimatch.js" - ] -} diff --git a/node_modules/rimraf/package.json b/node_modules/rimraf/package.json deleted file mode 100644 index 1bf8d5e38775d..0000000000000 --- a/node_modules/rimraf/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "rimraf", - "version": "3.0.2", - "main": "rimraf.js", - "description": "A deep deletion module for node (like `rm -rf`)", - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC", - "repository": "git://github.com/isaacs/rimraf.git", - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags", - "test": "tap test/*.js" - }, - "bin": "./bin.js", - "dependencies": { - "glob": "^7.1.3" - }, - "files": [ - "LICENSE", - "README.md", - "bin.js", - "rimraf.js" - ], - "devDependencies": { - "mkdirp": "^0.5.1", - "tap": "^12.1.1" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } -} diff --git a/node_modules/rimraf/rimraf.js b/node_modules/rimraf/rimraf.js deleted file mode 100644 index 34da4171d7559..0000000000000 --- a/node_modules/rimraf/rimraf.js +++ /dev/null @@ -1,360 +0,0 @@ -const assert = require("assert") -const path = require("path") -const fs = require("fs") -let glob = undefined -try { - glob = require("glob") -} catch (_err) { - // treat glob as optional. -} - -const defaultGlobOpts = { - nosort: true, - silent: true -} - -// for EMFILE handling -let timeout = 0 - -const isWindows = (process.platform === "win32") - -const defaults = options => { - const methods = [ - 'unlink', - 'chmod', - 'stat', - 'lstat', - 'rmdir', - 'readdir' - ] - methods.forEach(m => { - options[m] = options[m] || fs[m] - m = m + 'Sync' - options[m] = options[m] || fs[m] - }) - - options.maxBusyTries = options.maxBusyTries || 3 - options.emfileWait = options.emfileWait || 1000 - if (options.glob === false) { - options.disableGlob = true - } - if (options.disableGlob !== true && glob === undefined) { - throw Error('glob dependency not found, set `options.disableGlob = true` if intentional') - } - options.disableGlob = options.disableGlob || false - options.glob = options.glob || defaultGlobOpts -} - -const rimraf = (p, options, cb) => { - if (typeof options === 'function') { - cb = options - options = {} - } - - assert(p, 'rimraf: missing path') - assert.equal(typeof p, 'string', 'rimraf: path should be a string') - assert.equal(typeof cb, 'function', 'rimraf: callback function required') - assert(options, 'rimraf: invalid options argument provided') - assert.equal(typeof options, 'object', 'rimraf: options should be object') - - defaults(options) - - let busyTries = 0 - let errState = null - let n = 0 - - const next = (er) => { - errState = errState || er - if (--n === 0) - cb(errState) - } - - const afterGlob = (er, results) => { - if (er) - return cb(er) - - n = results.length - if (n === 0) - return cb() - - results.forEach(p => { - const CB = (er) => { - if (er) { - if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && - busyTries < options.maxBusyTries) { - busyTries ++ - // try again, with the same exact callback as this one. - return setTimeout(() => rimraf_(p, options, CB), busyTries * 100) - } - - // this one won't happen if graceful-fs is used. - if (er.code === "EMFILE" && timeout < options.emfileWait) { - return setTimeout(() => rimraf_(p, options, CB), timeout ++) - } - - // already gone - if (er.code === "ENOENT") er = null - } - - timeout = 0 - next(er) - } - rimraf_(p, options, CB) - }) - } - - if (options.disableGlob || !glob.hasMagic(p)) - return afterGlob(null, [p]) - - options.lstat(p, (er, stat) => { - if (!er) - return afterGlob(null, [p]) - - glob(p, options.glob, afterGlob) - }) - -} - -// Two possible strategies. -// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR -// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR -// -// Both result in an extra syscall when you guess wrong. However, there -// are likely far more normal files in the world than directories. This -// is based on the assumption that a the average number of files per -// directory is >= 1. -// -// If anyone ever complains about this, then I guess the strategy could -// be made configurable somehow. But until then, YAGNI. -const rimraf_ = (p, options, cb) => { - assert(p) - assert(options) - assert(typeof cb === 'function') - - // sunos lets the root user unlink directories, which is... weird. - // so we have to lstat here and make sure it's not a dir. - options.lstat(p, (er, st) => { - if (er && er.code === "ENOENT") - return cb(null) - - // Windows can EPERM on stat. Life is suffering. - if (er && er.code === "EPERM" && isWindows) - fixWinEPERM(p, options, er, cb) - - if (st && st.isDirectory()) - return rmdir(p, options, er, cb) - - options.unlink(p, er => { - if (er) { - if (er.code === "ENOENT") - return cb(null) - if (er.code === "EPERM") - return (isWindows) - ? fixWinEPERM(p, options, er, cb) - : rmdir(p, options, er, cb) - if (er.code === "EISDIR") - return rmdir(p, options, er, cb) - } - return cb(er) - }) - }) -} - -const fixWinEPERM = (p, options, er, cb) => { - assert(p) - assert(options) - assert(typeof cb === 'function') - - options.chmod(p, 0o666, er2 => { - if (er2) - cb(er2.code === "ENOENT" ? null : er) - else - options.stat(p, (er3, stats) => { - if (er3) - cb(er3.code === "ENOENT" ? null : er) - else if (stats.isDirectory()) - rmdir(p, options, er, cb) - else - options.unlink(p, cb) - }) - }) -} - -const fixWinEPERMSync = (p, options, er) => { - assert(p) - assert(options) - - try { - options.chmodSync(p, 0o666) - } catch (er2) { - if (er2.code === "ENOENT") - return - else - throw er - } - - let stats - try { - stats = options.statSync(p) - } catch (er3) { - if (er3.code === "ENOENT") - return - else - throw er - } - - if (stats.isDirectory()) - rmdirSync(p, options, er) - else - options.unlinkSync(p) -} - -const rmdir = (p, options, originalEr, cb) => { - assert(p) - assert(options) - assert(typeof cb === 'function') - - // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) - // if we guessed wrong, and it's not a directory, then - // raise the original error. - options.rmdir(p, er => { - if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) - rmkids(p, options, cb) - else if (er && er.code === "ENOTDIR") - cb(originalEr) - else - cb(er) - }) -} - -const rmkids = (p, options, cb) => { - assert(p) - assert(options) - assert(typeof cb === 'function') - - options.readdir(p, (er, files) => { - if (er) - return cb(er) - let n = files.length - if (n === 0) - return options.rmdir(p, cb) - let errState - files.forEach(f => { - rimraf(path.join(p, f), options, er => { - if (errState) - return - if (er) - return cb(errState = er) - if (--n === 0) - options.rmdir(p, cb) - }) - }) - }) -} - -// this looks simpler, and is strictly *faster*, but will -// tie up the JavaScript thread and fail on excessively -// deep directory trees. -const rimrafSync = (p, options) => { - options = options || {} - defaults(options) - - assert(p, 'rimraf: missing path') - assert.equal(typeof p, 'string', 'rimraf: path should be a string') - assert(options, 'rimraf: missing options') - assert.equal(typeof options, 'object', 'rimraf: options should be object') - - let results - - if (options.disableGlob || !glob.hasMagic(p)) { - results = [p] - } else { - try { - options.lstatSync(p) - results = [p] - } catch (er) { - results = glob.sync(p, options.glob) - } - } - - if (!results.length) - return - - for (let i = 0; i < results.length; i++) { - const p = results[i] - - let st - try { - st = options.lstatSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - - // Windows can EPERM on stat. Life is suffering. - if (er.code === "EPERM" && isWindows) - fixWinEPERMSync(p, options, er) - } - - try { - // sunos lets the root user unlink directories, which is... weird. - if (st && st.isDirectory()) - rmdirSync(p, options, null) - else - options.unlinkSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - if (er.code === "EPERM") - return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) - if (er.code !== "EISDIR") - throw er - - rmdirSync(p, options, er) - } - } -} - -const rmdirSync = (p, options, originalEr) => { - assert(p) - assert(options) - - try { - options.rmdirSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - if (er.code === "ENOTDIR") - throw originalEr - if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") - rmkidsSync(p, options) - } -} - -const rmkidsSync = (p, options) => { - assert(p) - assert(options) - options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) - - // We only end up here once we got ENOTEMPTY at least once, and - // at this point, we are guaranteed to have removed all the kids. - // So, we know that it won't be ENOENT or ENOTDIR or anything else. - // try really hard to delete stuff on windows, because it has a - // PROFOUNDLY annoying habit of not closing handles promptly when - // files are deleted, resulting in spurious ENOTEMPTY errors. - const retries = isWindows ? 100 : 1 - let i = 0 - do { - let threw = true - try { - const ret = options.rmdirSync(p, options) - threw = false - return ret - } finally { - if (++i < retries && threw) - continue - } - } while (true) -} - -module.exports = rimraf -rimraf.sync = rimrafSync diff --git a/node_modules/socks-proxy-agent/dist/index.js b/node_modules/socks-proxy-agent/dist/index.js deleted file mode 100644 index 55b598b7f5ca7..0000000000000 --- a/node_modules/socks-proxy-agent/dist/index.js +++ /dev/null @@ -1,197 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SocksProxyAgent = void 0; -const socks_1 = require("socks"); -const agent_base_1 = require("agent-base"); -const debug_1 = __importDefault(require("debug")); -const dns_1 = __importDefault(require("dns")); -const tls_1 = __importDefault(require("tls")); -const debug = (0, debug_1.default)('socks-proxy-agent'); -function parseSocksProxy(opts) { - var _a; - let port = 0; - let lookup = false; - let type = 5; - const host = opts.hostname; - if (host == null) { - throw new TypeError('No "host"'); - } - if (typeof opts.port === 'number') { - port = opts.port; - } - else if (typeof opts.port === 'string') { - port = parseInt(opts.port, 10); - } - // From RFC 1928, Section 3: https://tools.ietf.org/html/rfc1928#section-3 - // "The SOCKS service is conventionally located on TCP port 1080" - if (port == null) { - port = 1080; - } - // figure out if we want socks v4 or v5, based on the "protocol" used. - // Defaults to 5. - if (opts.protocol != null) { - switch (opts.protocol.replace(':', '')) { - case 'socks4': - lookup = true; - // pass through - case 'socks4a': - type = 4; - break; - case 'socks5': - lookup = true; - // pass through - case 'socks': // no version specified, default to 5h - case 'socks5h': - type = 5; - break; - default: - throw new TypeError(`A "socks" protocol must be specified! Got: ${String(opts.protocol)}`); - } - } - if (typeof opts.type !== 'undefined') { - if (opts.type === 4 || opts.type === 5) { - type = opts.type; - } - else { - throw new TypeError(`"type" must be 4 or 5, got: ${String(opts.type)}`); - } - } - const proxy = { - host, - port, - type - }; - let userId = (_a = opts.userId) !== null && _a !== void 0 ? _a : opts.username; - let password = opts.password; - if (opts.auth != null) { - const auth = opts.auth.split(':'); - userId = auth[0]; - password = auth[1]; - } - if (userId != null) { - Object.defineProperty(proxy, 'userId', { - value: userId, - enumerable: false - }); - } - if (password != null) { - Object.defineProperty(proxy, 'password', { - value: password, - enumerable: false - }); - } - return { lookup, proxy }; -} -const normalizeProxyOptions = (input) => { - let proxyOptions; - if (typeof input === 'string') { - proxyOptions = new URL(input); - } - else { - proxyOptions = input; - } - if (proxyOptions == null) { - throw new TypeError('a SOCKS proxy server `host` and `port` must be specified!'); - } - return proxyOptions; -}; -class SocksProxyAgent extends agent_base_1.Agent { - constructor(input, options) { - var _a; - const proxyOptions = normalizeProxyOptions(input); - super(proxyOptions); - const parsedProxy = parseSocksProxy(proxyOptions); - this.shouldLookup = parsedProxy.lookup; - this.proxy = parsedProxy.proxy; - this.tlsConnectionOptions = proxyOptions.tls != null ? proxyOptions.tls : {}; - this.timeout = (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : null; - } - /** - * Initiates a SOCKS connection to the specified SOCKS proxy server, - * which in turn connects to the specified remote host and port. - * - * @api protected - */ - callback(req, opts) { - var _a; - return __awaiter(this, void 0, void 0, function* () { - const { shouldLookup, proxy, timeout } = this; - let { host, port, lookup: lookupCallback } = opts; - if (host == null) { - throw new Error('No `host` defined!'); - } - if (shouldLookup) { - // Client-side DNS resolution for "4" and "5" socks proxy versions. - host = yield new Promise((resolve, reject) => { - // Use the request's custom lookup, if one was configured: - const lookupFn = lookupCallback !== null && lookupCallback !== void 0 ? lookupCallback : dns_1.default.lookup; - lookupFn(host, {}, (err, res) => { - if (err) { - reject(err); - } - else { - resolve(res); - } - }); - }); - } - const socksOpts = { - proxy, - destination: { host, port }, - command: 'connect', - timeout: timeout !== null && timeout !== void 0 ? timeout : undefined - }; - const cleanup = (tlsSocket) => { - req.destroy(); - socket.destroy(); - if (tlsSocket) - tlsSocket.destroy(); - }; - debug('Creating socks proxy connection: %o', socksOpts); - const { socket } = yield socks_1.SocksClient.createConnection(socksOpts); - debug('Successfully created socks proxy connection'); - if (timeout !== null) { - socket.setTimeout(timeout); - socket.on('timeout', () => cleanup()); - } - if (opts.secureEndpoint) { - // The proxy is connecting to a TLS server, so upgrade - // this socket connection to a TLS connection. - debug('Upgrading socket connection to TLS'); - const servername = (_a = opts.servername) !== null && _a !== void 0 ? _a : opts.host; - const tlsSocket = tls_1.default.connect(Object.assign(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket, - servername }), this.tlsConnectionOptions)); - tlsSocket.once('error', (error) => { - debug('socket TLS error', error.message); - cleanup(tlsSocket); - }); - return tlsSocket; - } - return socket; - }); - } -} -exports.SocksProxyAgent = SocksProxyAgent; -function omit(obj, ...keys) { - const ret = {}; - let key; - for (key in obj) { - if (!keys.includes(key)) { - ret[key] = obj[key]; - } - } - return ret; -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/socks-proxy-agent/package.json b/node_modules/socks-proxy-agent/package.json deleted file mode 100644 index aa2999969c174..0000000000000 --- a/node_modules/socks-proxy-agent/package.json +++ /dev/null @@ -1,181 +0,0 @@ -{ - "name": "socks-proxy-agent", - "description": "A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS", - "homepage": "https://github.com/TooTallNate/node-socks-proxy-agent#readme", - "version": "7.0.0", - "main": "dist/index.js", - "author": { - "email": "nathan@tootallnate.net", - "name": "Nathan Rajlich", - "url": "http://n8.io/" - }, - "contributors": [ - { - "name": "Kiko Beats", - "email": "josefrancisco.verdu@gmail.com" - }, - { - "name": "Josh Glazebrook", - "email": "josh@joshglazebrook.com" - }, - { - "name": "talmobi", - "email": "talmobi@users.noreply.github.com" - }, - { - "name": "Indospace.io", - "email": "justin@indospace.io" - }, - { - "name": "Kilian von Pflugk", - "email": "github@jumoog.io" - }, - { - "name": "Kyle", - "email": "admin@hk1229.cn" - }, - { - "name": "Matheus Fernandes", - "email": "matheus.frndes@gmail.com" - }, - { - "name": "Ricky Miller", - "email": "richardkazuomiller@gmail.com" - }, - { - "name": "Shantanu Sharma", - "email": "shantanu34@outlook.com" - }, - { - "name": "Tim Perry", - "email": "pimterry@gmail.com" - }, - { - "name": "Vadim Baryshev", - "email": "vadimbaryshev@gmail.com" - }, - { - "name": "jigu", - "email": "luo1257857309@gmail.com" - }, - { - "name": "Alba Mendez", - "email": "me@jmendeth.com" - }, - { - "name": "Дмитрий Гуденков", - "email": "Dimangud@rambler.ru" - }, - { - "name": "Andrei Bitca", - "email": "63638922+andrei-bitca-dc@users.noreply.github.com" - }, - { - "name": "Andrew Casey", - "email": "amcasey@users.noreply.github.com" - }, - { - "name": "Brandon Ros", - "email": "brandonros1@gmail.com" - }, - { - "name": "Dang Duy Thanh", - "email": "thanhdd.it@gmail.com" - }, - { - "name": "Dimitar Nestorov", - "email": "8790386+dimitarnestorov@users.noreply.github.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/node-socks-proxy-agent.git" - }, - "bugs": { - "url": "https://github.com/TooTallNate/node-socks-proxy-agent/issues" - }, - "keywords": [ - "agent", - "http", - "https", - "proxy", - "socks", - "socks4", - "socks4a", - "socks5", - "socks5h" - ], - "dependencies": { - "agent-base": "^6.0.2", - "debug": "^4.3.3", - "socks": "^2.6.2" - }, - "devDependencies": { - "@commitlint/cli": "latest", - "@commitlint/config-conventional": "latest", - "@types/debug": "latest", - "@types/node": "latest", - "cacheable-lookup": "latest", - "conventional-github-releaser": "latest", - "dns2": "latest", - "finepack": "latest", - "git-authors-cli": "latest", - "mocha": "9", - "nano-staged": "latest", - "npm-check-updates": "latest", - "prettier-standard": "latest", - "raw-body": "latest", - "rimraf": "latest", - "simple-git-hooks": "latest", - "socksv5": "github:TooTallNate/socksv5#fix/dstSock-close-event", - "standard": "latest", - "standard-markdown": "latest", - "standard-version": "latest", - "ts-standard": "latest", - "typescript": "latest" - }, - "engines": { - "node": ">= 10" - }, - "files": [ - "dist" - ], - "scripts": { - "build": "tsc", - "clean": "rimraf node_modules", - "contributors": "(git-authors-cli && finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true", - "lint": "ts-standard", - "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)", - "prebuild": "rimraf dist", - "prepublishOnly": "npm run build", - "prerelease": "npm run update:check && npm run contributors", - "release": "standard-version -a", - "release:github": "conventional-github-releaser -p angular", - "release:tags": "git push --follow-tags origin HEAD:master", - "test": "mocha --reporter spec", - "update": "ncu -u", - "update:check": "ncu -- --error-level 2" - }, - "license": "MIT", - "commitlint": { - "extends": [ - "@commitlint/config-conventional" - ] - }, - "nano-staged": { - "*.js": [ - "prettier-standard" - ], - "*.md": [ - "standard-markdown" - ], - "package.json": [ - "finepack" - ] - }, - "simple-git-hooks": { - "commit-msg": "npx commitlint --edit", - "pre-commit": "npx nano-staged" - }, - "typings": "dist/index.d.ts" -} diff --git a/node_modules/wrappy/LICENSE b/node_modules/wrappy/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/wrappy/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/wrappy/package.json b/node_modules/wrappy/package.json deleted file mode 100644 index 130752046714d..0000000000000 --- a/node_modules/wrappy/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "wrappy", - "version": "1.0.2", - "description": "Callback wrapping utility", - "main": "wrappy.js", - "files": [ - "wrappy.js" - ], - "directories": { - "test": "test" - }, - "dependencies": {}, - "devDependencies": { - "tap": "^2.3.1" - }, - "scripts": { - "test": "tap --coverage test/*.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/npm/wrappy" - }, - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC", - "bugs": { - "url": "https://github.com/npm/wrappy/issues" - }, - "homepage": "https://github.com/npm/wrappy" -} diff --git a/node_modules/wrappy/wrappy.js b/node_modules/wrappy/wrappy.js deleted file mode 100644 index bb7e7d6fcf70f..0000000000000 --- a/node_modules/wrappy/wrappy.js +++ /dev/null @@ -1,33 +0,0 @@ -// Returns a wrapper function that returns a wrapped callback -// The wrapper function should do some stuff, and return a -// presumably different callback function. -// This makes sure that own properties are retained, so that -// decorations and such are not lost along the way. -module.exports = wrappy -function wrappy (fn, cb) { - if (fn && cb) return wrappy(fn)(cb) - - if (typeof fn !== 'function') - throw new TypeError('need wrapper function') - - Object.keys(fn).forEach(function (k) { - wrapper[k] = fn[k] - }) - - return wrapper - - function wrapper() { - var args = new Array(arguments.length) - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i] - } - var ret = fn.apply(this, args) - var cb = args[args.length-1] - if (typeof ret === 'function' && ret !== cb) { - Object.keys(cb).forEach(function (k) { - ret[k] = cb[k] - }) - } - return ret - } -} diff --git a/package-lock.json b/package-lock.json index 2ab9394cd58d4..d3c7778e8edef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -96,7 +96,7 @@ "@npmcli/map-workspaces": "^3.0.4", "@npmcli/package-json": "^5.0.0", "@npmcli/promise-spawn": "^7.0.0", - "@npmcli/run-script": "^7.0.1", + "@npmcli/run-script": "^7.0.2", "@sigstore/tuf": "^2.1.0", "abbrev": "^2.0.0", "archy": "~1.0.0", @@ -1299,7 +1299,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", - "inBundle": true + "dev": true }, "node_modules/@google-automations/git-file-utils": { "version": "1.2.6", @@ -2672,7 +2672,7 @@ "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-2.0.1.tgz", "integrity": "sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ==", "deprecated": "This functionality has been moved to @npmcli/fs", - "inBundle": true, + "dev": true, "dependencies": { "mkdirp": "^1.0.4", "rimraf": "^3.0.2" @@ -2741,14 +2741,14 @@ } }, "node_modules/@npmcli/run-script": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-7.0.1.tgz", - "integrity": "sha512-Od/JMrgkjZ8alyBE0IzeqZDiF1jgMez9Gkc/OYrCkHHiXNwM0wc6s7+h+xM7kYDZkS0tAoOLr9VvygyE5+2F7g==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-7.0.2.tgz", + "integrity": "sha512-Omu0rpA8WXvcGeY6DDzyRoY1i5DkCBkzyJ+m2u7PD6quzb0TvSqdIPOkTn8ZBOj7LbbcbMfZ3c5skwSu6m8y2w==", "inBundle": true, "dependencies": { "@npmcli/node-gyp": "^3.0.0", "@npmcli/promise-spawn": "^7.0.0", - "node-gyp": "^9.0.0", + "node-gyp": "^10.0.0", "read-package-json-fast": "^3.0.0", "which": "^4.0.0" }, @@ -2756,371 +2756,6 @@ "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/@npmcli/run-script/node_modules/@npmcli/fs": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz", - "integrity": "sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==", - "inBundle": true, - "dependencies": { - "@gar/promisify": "^1.1.3", - "semver": "^7.3.5" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/@npmcli/run-script/node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "inBundle": true - }, - "node_modules/@npmcli/run-script/node_modules/are-we-there-yet": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", - "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", - "inBundle": true, - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/@npmcli/run-script/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "inBundle": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@npmcli/run-script/node_modules/cacache": { - "version": "16.1.3", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.3.tgz", - "integrity": "sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==", - "inBundle": true, - "dependencies": { - "@npmcli/fs": "^2.1.0", - "@npmcli/move-file": "^2.0.0", - "chownr": "^2.0.0", - "fs-minipass": "^2.1.0", - "glob": "^8.0.1", - "infer-owner": "^1.0.4", - "lru-cache": "^7.7.1", - "minipass": "^3.1.6", - "minipass-collect": "^1.0.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "mkdirp": "^1.0.4", - "p-map": "^4.0.0", - "promise-inflight": "^1.0.1", - "rimraf": "^3.0.2", - "ssri": "^9.0.0", - "tar": "^6.1.11", - "unique-filename": "^2.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/@npmcli/run-script/node_modules/cacache/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "inBundle": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@npmcli/run-script/node_modules/cacache/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "inBundle": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@npmcli/run-script/node_modules/cacache/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "inBundle": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@npmcli/run-script/node_modules/fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "inBundle": true, - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@npmcli/run-script/node_modules/gauge": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", - "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", - "inBundle": true, - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.3", - "console-control-strings": "^1.1.0", - "has-unicode": "^2.0.1", - "signal-exit": "^3.0.7", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.5" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/@npmcli/run-script/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "inBundle": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@npmcli/run-script/node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "inBundle": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/@npmcli/run-script/node_modules/make-fetch-happen": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz", - "integrity": "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==", - "inBundle": true, - "dependencies": { - "agentkeepalive": "^4.2.1", - "cacache": "^16.1.0", - "http-cache-semantics": "^4.1.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", - "is-lambda": "^1.0.1", - "lru-cache": "^7.7.1", - "minipass": "^3.1.6", - "minipass-collect": "^1.0.2", - "minipass-fetch": "^2.0.3", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "negotiator": "^0.6.3", - "promise-retry": "^2.0.1", - "socks-proxy-agent": "^7.0.0", - "ssri": "^9.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/@npmcli/run-script/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "inBundle": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@npmcli/run-script/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "inBundle": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@npmcli/run-script/node_modules/minipass-fetch": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.2.tgz", - "integrity": "sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==", - "inBundle": true, - "dependencies": { - "minipass": "^3.1.6", - "minipass-sized": "^1.0.3", - "minizlib": "^2.1.2" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - }, - "optionalDependencies": { - "encoding": "^0.1.13" - } - }, - "node_modules/@npmcli/run-script/node_modules/node-gyp": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.1.tgz", - "integrity": "sha512-OQkWKbjQKbGkMf/xqI1jjy3oCTgMKJac58G2+bjZb3fza6gW2YrCSdMQYaoTb70crvE//Gngr4f0AgVHmqHvBQ==", - "inBundle": true, - "dependencies": { - "env-paths": "^2.2.0", - "exponential-backoff": "^3.1.1", - "glob": "^7.1.4", - "graceful-fs": "^4.2.6", - "make-fetch-happen": "^10.0.3", - "nopt": "^6.0.0", - "npmlog": "^6.0.0", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.2", - "which": "^2.0.2" - }, - "bin": { - "node-gyp": "bin/node-gyp.js" - }, - "engines": { - "node": "^12.13 || ^14.13 || >=16" - } - }, - "node_modules/@npmcli/run-script/node_modules/node-gyp/node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "inBundle": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@npmcli/run-script/node_modules/nopt": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", - "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==", - "inBundle": true, - "dependencies": { - "abbrev": "^1.0.0" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/@npmcli/run-script/node_modules/npmlog": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz", - "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==", - "inBundle": true, - "dependencies": { - "are-we-there-yet": "^3.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^4.0.3", - "set-blocking": "^2.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/@npmcli/run-script/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "inBundle": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@npmcli/run-script/node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "inBundle": true - }, - "node_modules/@npmcli/run-script/node_modules/ssri": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz", - "integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==", - "inBundle": true, - "dependencies": { - "minipass": "^3.1.1" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/@npmcli/run-script/node_modules/unique-filename": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz", - "integrity": "sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==", - "inBundle": true, - "dependencies": { - "unique-slug": "^3.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/@npmcli/run-script/node_modules/unique-slug": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-3.0.0.tgz", - "integrity": "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w==", - "inBundle": true, - "dependencies": { - "imurmurhash": "^0.1.4" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, "node_modules/@npmcli/smoke-tests": { "resolved": "smoke-tests", "link": true @@ -4199,7 +3834,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", - "inBundle": true, + "dev": true, "engines": { "node": ">= 10" } @@ -4435,7 +4070,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "inBundle": true, + "dev": true, "dependencies": { "debug": "4" }, @@ -4447,7 +4082,7 @@ "version": "4.5.0", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", - "inBundle": true, + "dev": true, "dependencies": { "humanize-ms": "^1.2.1" }, @@ -5591,7 +5226,7 @@ "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "inBundle": true + "dev": true }, "node_modules/console-control-strings": { "version": "1.1.0", @@ -7325,7 +6960,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "inBundle": true + "dev": true }, "node_modules/fsevents": { "version": "2.3.2", @@ -7982,7 +7617,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", - "inBundle": true, + "dev": true, "dependencies": { "@tootallnate/once": "2", "agent-base": "6", @@ -7996,7 +7631,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "inBundle": true, + "dev": true, "dependencies": { "agent-base": "6", "debug": "4" @@ -8018,7 +7653,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", - "inBundle": true, + "dev": true, "dependencies": { "ms": "^2.0.0" } @@ -8125,13 +7760,13 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", - "inBundle": true + "dev": true }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "inBundle": true, + "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -8141,7 +7776,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "inBundle": true + "dev": true }, "node_modules/ini": { "version": "4.1.1", @@ -12216,7 +11851,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "inBundle": true, + "dev": true, "dependencies": { "wrappy": "1" } @@ -12515,7 +12150,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "inBundle": true, + "dev": true, "engines": { "node": ">=0.10.0" } @@ -13551,7 +13186,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "inBundle": true, + "dev": true, "dependencies": { "glob": "^7.1.3" }, @@ -13566,7 +13201,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "inBundle": true, + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -13576,7 +13211,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "inBundle": true, + "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -13596,7 +13231,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "inBundle": true, + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -13854,7 +13489,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz", "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==", - "inBundle": true, + "dev": true, "dependencies": { "agent-base": "^6.0.2", "debug": "^4.3.3", @@ -17279,8 +16914,7 @@ "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "inBundle": true + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/uuid": { "version": "8.3.2", @@ -17647,7 +17281,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "inBundle": true + "dev": true }, "node_modules/write-file-atomic": { "version": "5.0.1", @@ -17918,7 +17552,7 @@ "@npmcli/node-gyp": "^3.0.0", "@npmcli/package-json": "^5.0.0", "@npmcli/query": "^3.0.1", - "@npmcli/run-script": "^7.0.1", + "@npmcli/run-script": "^7.0.2", "bin-links": "^4.0.1", "cacache": "^18.0.0", "common-ancestor-path": "^1.0.1", @@ -18030,7 +17664,7 @@ "license": "ISC", "dependencies": { "@npmcli/arborist": "^7.2.0", - "@npmcli/run-script": "^7.0.1", + "@npmcli/run-script": "^7.0.2", "ci-info": "^3.7.1", "npm-package-arg": "^11.0.1", "npmlog": "^7.0.1", @@ -18110,7 +17744,7 @@ "license": "ISC", "dependencies": { "@npmcli/arborist": "^7.2.0", - "@npmcli/run-script": "^7.0.1", + "@npmcli/run-script": "^7.0.2", "npm-package-arg": "^11.0.1", "pacote": "^17.0.4" }, @@ -18188,7 +17822,7 @@ "license": "ISC", "dependencies": { "@npmcli/git": "^5.0.3", - "@npmcli/run-script": "^7.0.1", + "@npmcli/run-script": "^7.0.2", "json-parse-even-better-errors": "^3.0.0", "proc-log": "^3.0.0", "semver": "^7.3.7" diff --git a/package.json b/package.json index 8dfb1de9f3fd8..a7950f8f5f11e 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "@npmcli/map-workspaces": "^3.0.4", "@npmcli/package-json": "^5.0.0", "@npmcli/promise-spawn": "^7.0.0", - "@npmcli/run-script": "^7.0.1", + "@npmcli/run-script": "^7.0.2", "@sigstore/tuf": "^2.1.0", "abbrev": "^2.0.0", "archy": "~1.0.0", diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index 95d9bc7416905..576108b3d26bb 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -12,7 +12,7 @@ "@npmcli/node-gyp": "^3.0.0", "@npmcli/package-json": "^5.0.0", "@npmcli/query": "^3.0.1", - "@npmcli/run-script": "^7.0.1", + "@npmcli/run-script": "^7.0.2", "bin-links": "^4.0.1", "cacache": "^18.0.0", "common-ancestor-path": "^1.0.1", diff --git a/workspaces/libnpmexec/package.json b/workspaces/libnpmexec/package.json index 5ab1484e216ab..4ad48a6facc38 100644 --- a/workspaces/libnpmexec/package.json +++ b/workspaces/libnpmexec/package.json @@ -60,7 +60,7 @@ }, "dependencies": { "@npmcli/arborist": "^7.2.0", - "@npmcli/run-script": "^7.0.1", + "@npmcli/run-script": "^7.0.2", "ci-info": "^3.7.1", "npm-package-arg": "^11.0.1", "npmlog": "^7.0.1", diff --git a/workspaces/libnpmpack/package.json b/workspaces/libnpmpack/package.json index d3ceea0882fc3..facc28fbc45db 100644 --- a/workspaces/libnpmpack/package.json +++ b/workspaces/libnpmpack/package.json @@ -37,7 +37,7 @@ "homepage": "https://npmjs.com/package/libnpmpack", "dependencies": { "@npmcli/arborist": "^7.2.0", - "@npmcli/run-script": "^7.0.1", + "@npmcli/run-script": "^7.0.2", "npm-package-arg": "^11.0.1", "pacote": "^17.0.4" }, diff --git a/workspaces/libnpmversion/package.json b/workspaces/libnpmversion/package.json index a440ee75cec7f..aee57b6125c06 100644 --- a/workspaces/libnpmversion/package.json +++ b/workspaces/libnpmversion/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@npmcli/git": "^5.0.3", - "@npmcli/run-script": "^7.0.1", + "@npmcli/run-script": "^7.0.2", "json-parse-even-better-errors": "^3.0.0", "proc-log": "^3.0.0", "semver": "^7.3.7"